refactor(tests): align action timeout settings across configurations and improve drag-and-drop test logic

This commit is contained in:
Bob Qiu committed 2026-10-02 09:02:04 +08:00
1 parent 697c351d0a
commit ebf49dbbbd
3 files changed
+30 -6

No files matched your search

+4 -1
View File
@@ -25,6 +25,9 @@ export const DEFAULT_TIMEOUT = 10_000;
export const LONG_TIMEOUT = 60_000;
// Matches playwright.config.ts's `use.actionTimeout`.
export const ACTION_TIMEOUT = 30_000;
/**
* By default, the `insomnia` fixture below launches the app straight out of
* the sibling `../insomnia` source checkout (its local `electron` binary
@@ -562,7 +565,7 @@ export const test = base.extend<Fixtures>({
// Playwright creates itself — this window comes from a manual
// electronApp.firstWindow() call, so its default action timeout (30s)
// has to be raised here explicitly to match.
win.setDefaultTimeout(DEFAULT_TIMEOUT);
win.setDefaultTimeout(ACTION_TIMEOUT);
await insomnia.evaluate(({ BrowserWindow }) => {
const mainWindow = BrowserWindow.getAllWindows().find((w) =>
+1 -1
View File
@@ -42,7 +42,7 @@ export default defineConfig({
trace: "retain-on-failure",
screenshot: "only-on-failure",
video: "retain-on-failure",
actionTimeout: 10 * 1000,
actionTimeout: 30 * 1000,
},
webServer: [
@@ -7,6 +7,7 @@ import { expect, HTTP_SERVER, test } from '../../misc/fixtures';
import { Collection } from '../../models/collection';
import { Folder } from '../../models/folder';
import { Project } from '../../models/project';
import type { TreeNode } from '../../pages/workspace.page';
const WINDOW_WIDTH = 1512;
const WINDOW_HEIGHT = 859;
@@ -60,21 +61,41 @@ test(
))!;
const populatedFolderChildrenBefore = populatedFolderNode.children.map(c => c._id);
// destinationFolder starts out empty, so its only visible interior row is
// the "folder is empty" placeholder. Expanding it first and dropping onto
// that placeholder (rather than the folder's own row) is the only way to
// land "before"/"after" boundary-indicator with a readable folderName
// badge instead of a plain whole-row "on" highlight (which renders no
// name badge at all — see WorkspacePage.getDropIndicator()).
await workspacePage.expand(destinationFolderNode);
const destinationFolderPlaceholder: TreeNode = {
_id: `empty-folder-${destinationFolder.id}`,
name: '',
type: TreeNodeType.Unknown,
children: [],
};
await workspacePage.startDrag(standaloneRequestNode);
await workspacePage.dragOver(destinationFolderNode, 0.7, 0.95);
await workspacePage.dragOver(destinationFolderPlaceholder, 0.7, 0.25);
const indicatorForStandaloneRequest = await workspacePage.getDropIndicator();
await workspacePage.releaseDrag();
await workspacePage.expand(destinationFolderNode);
const treeAfterFirstDrag = await workspacePage.getTree();
const destinationFolderAfterFirstDrag = treeAfterFirstDrag
.flatten()
.find(n => n._id === destinationFolderNode._id)!;
// destinationFolder now has standaloneRequest as a real child, so there's
// no placeholder row left to target — drop just above that child instead,
// at the same deep xFraction, to land inside the folder again.
await workspacePage.startDrag(populatedFolderNode);
await workspacePage.dragOver(destinationFolderNode, 0.7, 0.95);
// The hovered boundary's preferred nesting level only settles after the
// drag's first hover re-render, so the very first dragOver() right after
// startDrag() can still report the pre-drag (shallower) level — repeat it
// once so the indicator reflects the position actually being hovered.
await workspacePage.dragOver(standaloneRequestNode, 0.7, 0.05);
await workspacePage.dragOver(standaloneRequestNode, 0.7, 0.05);
const indicatorForPopulatedFolder = await workspacePage.getDropIndicator();
await workspacePage.releaseDrag();
await workspacePage.expand(destinationFolderNode);
const treeAfterSecondDrag = await workspacePage.getTree();
const destinationFolderAfterSecondDrag = treeAfterSecondDrag
.flatten()