From 8c3dffb7d543d1622757812689b817e7d5a4178b Mon Sep 17 00:00:00 2001 From: Miles Date: Mon, 2 Nov 2026 16:05:49 -0800 Subject: [PATCH 1/3] test: add tab-order-two-reloads e2e test tab order restores after two consecutive reloads --- .../tests/tab-order-two-reloads.spec.ts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 browser_tests/tests/tab-order-two-reloads.spec.ts diff --git a/browser_tests/tests/tab-order-two-reloads.spec.ts b/browser_tests/tests/tab-order-two-reloads.spec.ts new file mode 100644 index 00000000000..19c0c97dd27 --- /dev/null +++ b/browser_tests/tests/tab-order-two-reloads.spec.ts @@ -0,0 +1,40 @@ +import { + comfyPageFixture as test, + comfyExpect as expect +} from '@e2e/fixtures/ComfyPage' + +test.describe('Workflow tab order', { tag: ['@ui'] }, () => { + test('restores the active tab across two reloads', async ({ comfyPage }) => { + const { topbar } = comfyPage.menu + + // Save the default graph as the first tab. + await topbar.saveWorkflowAs('tab-a') + + // Open a new blank workflow and save it as the second tab. + await topbar.newWorkflowButton.click() + await topbar.getWorkflowTab('Unsaved Workflow').dblclick() + await topbar.saveWorkflowAs('tab-b') + + // Repeat for the remaining tabs, leaving tab-e active. + for (const name of ['tab-c', 'tab-d', 'tab-e']) { + await topbar.newWorkflowButton.click() + await topbar.saveWorkflowAs(name) + } + + // Close every tab to the right of tab-a. + await topbar.getWorkflowTab('tab-a').click({ button: 'right' }) + await comfyPage.contextMenu.clickMenuItem('Close Tabs to Right') + + // After the first reload, tab-e is the active tab. + await comfyPage.workflow.reloadAndWaitForApp() + await expect( + comfyPage.page.getByRole('tab', { name: 'tab-e', selected: true }) + ).toBeVisible() + + // After the second reload, tab-a is the active tab. + await comfyPage.workflow.reloadAndWaitForApp() + await expect( + comfyPage.page.getByRole('tab', { name: 'tab-a', selected: true }) + ).toBeVisible() + }) +}) From 66a2ea1466007eee07e16fd62429bce04b843dc4 Mon Sep 17 00:00:00 2001 From: Miles Date: Mon, 2 Nov 2026 16:50:00 -0800 Subject: [PATCH 2/3] test: follow QA Desk C-03 in tab-order-two-reloads spec Drag the last tab to the front, close the tabs to the right of the second tab, reorder again, and assert the full tab order and active tab after each of two reloads. Each reload gets a new client id from the socket, as on Cloud. Start from an empty workflows directory so reruns never hit the overwrite prompt. --- .../tests/tab-order-two-reloads.spec.ts | 109 +++++++++++++----- 1 file changed, 82 insertions(+), 27 deletions(-) diff --git a/browser_tests/tests/tab-order-two-reloads.spec.ts b/browser_tests/tests/tab-order-two-reloads.spec.ts index 19c0c97dd27..b04330547a6 100644 --- a/browser_tests/tests/tab-order-two-reloads.spec.ts +++ b/browser_tests/tests/tab-order-two-reloads.spec.ts @@ -1,40 +1,95 @@ +import type { WebSocketRoute } from '@playwright/test' + import { comfyPageFixture as test, comfyExpect as expect } from '@e2e/fixtures/ComfyPage' test.describe('Workflow tab order', { tag: ['@ui'] }, () => { - test('restores the active tab across two reloads', async ({ comfyPage }) => { + test.beforeEach(async ({ comfyPage }) => { + await comfyPage.workflow.setupWorkflowsDirectory({}) + }) + + test('restores the latest tab order and active tab across two reloads', async ({ + comfyPage + }) => { + test.info().annotations.push({ + type: 'qa-case', + description: + 'QA Desk 1.60 C-03 (retest of 1.59 C-09): tabs restore the latest order' + }) + const { page } = comfyPage const { topbar } = comfyPage.menu + const activeTab = (name: string) => + topbar.getWorkflowTab(name).and(topbar.getActiveTab()) + const nextClientIds: string[] = [] + await page.routeWebSocket(/\/ws(\?|$)/, (socket: WebSocketRoute) => { + const sid = nextClientIds.shift() + if (!sid) return + socket.send( + JSON.stringify({ + type: 'status', + data: { status: { exec_info: { queue_remaining: 0 } }, sid } + }) + ) + }) + const reloadWithNewClientIdLikeCloud = async (sid: string) => { + nextClientIds.push(sid) + await comfyPage.workflow.reloadAndWaitForApp() + await expect + .poll( + () => page.evaluate(() => window.app!.api.clientId), + 'Cloud hands every page load a new client id' + ) + .toBe(sid) + } - // Save the default graph as the first tab. - await topbar.saveWorkflowAs('tab-a') + await test.step('open five saved workflows', async () => { + await topbar.saveWorkflowAs('tab-a') + for (const name of ['tab-b', 'tab-c', 'tab-d', 'tab-e']) { + await topbar.newWorkflowButton.click() + await topbar.saveWorkflowAs(name) + } + await expect + .poll(() => topbar.getTabNames()) + .toEqual(['tab-a', 'tab-b', 'tab-c', 'tab-d', 'tab-e']) + await expect(activeTab('tab-e')).toBeVisible() + }) - // Open a new blank workflow and save it as the second tab. - await topbar.newWorkflowButton.click() - await topbar.getWorkflowTab('Unsaved Workflow').dblclick() - await topbar.saveWorkflowAs('tab-b') + await test.step('drag the last tab to the front', async () => { + await topbar + .getWorkflowTab('tab-e') + .dragTo(topbar.getWorkflowTab('tab-a')) + await expect + .poll(() => topbar.getTabNames()) + .toEqual(['tab-e', 'tab-a', 'tab-b', 'tab-c', 'tab-d']) + }) - // Repeat for the remaining tabs, leaving tab-e active. - for (const name of ['tab-c', 'tab-d', 'tab-e']) { - await topbar.newWorkflowButton.click() - await topbar.saveWorkflowAs(name) - } + await test.step('close the tabs to the right of the second tab', async () => { + await topbar.getWorkflowTab('tab-a').click({ button: 'right' }) + await comfyPage.contextMenu.clickMenuItem('Close Tabs to Right') + await expect.poll(() => topbar.getTabNames()).toEqual(['tab-e', 'tab-a']) + await expect(activeTab('tab-e')).toBeVisible() + }) + + await test.step('the first reload restores the same tabs', async () => { + await reloadWithNewClientIdLikeCloud('cloud-load-1') + await expect.poll(() => topbar.getTabNames()).toEqual(['tab-e', 'tab-a']) + await expect(activeTab('tab-e')).toBeVisible() + }) + + await test.step('reorder the tabs again', async () => { + await topbar + .getWorkflowTab('tab-a') + .dragTo(topbar.getWorkflowTab('tab-e')) + await expect.poll(() => topbar.getTabNames()).toEqual(['tab-a', 'tab-e']) + await expect(activeTab('tab-a')).toBeVisible() + }) - // Close every tab to the right of tab-a. - await topbar.getWorkflowTab('tab-a').click({ button: 'right' }) - await comfyPage.contextMenu.clickMenuItem('Close Tabs to Right') - - // After the first reload, tab-e is the active tab. - await comfyPage.workflow.reloadAndWaitForApp() - await expect( - comfyPage.page.getByRole('tab', { name: 'tab-e', selected: true }) - ).toBeVisible() - - // After the second reload, tab-a is the active tab. - await comfyPage.workflow.reloadAndWaitForApp() - await expect( - comfyPage.page.getByRole('tab', { name: 'tab-a', selected: true }) - ).toBeVisible() + await test.step('the second reload restores the latest order', async () => { + await reloadWithNewClientIdLikeCloud('cloud-load-2') + await expect.poll(() => topbar.getTabNames()).toEqual(['tab-a', 'tab-e']) + await expect(activeTab('tab-a')).toBeVisible() + }) }) }) From 34a37c922c869526cd0a2271328b754ec6d58459 Mon Sep 17 00:00:00 2001 From: Miles Date: Mon, 2 Nov 2026 16:55:22 -0800 Subject: [PATCH 3/3] test: clear saved workflows after the tab-order spec Empty the worker user's workflows directory after each run so later specs on the same worker do not inherit tab-a through tab-e. --- browser_tests/tests/tab-order-two-reloads.spec.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/browser_tests/tests/tab-order-two-reloads.spec.ts b/browser_tests/tests/tab-order-two-reloads.spec.ts index b04330547a6..53ed4a5436a 100644 --- a/browser_tests/tests/tab-order-two-reloads.spec.ts +++ b/browser_tests/tests/tab-order-two-reloads.spec.ts @@ -10,6 +10,10 @@ test.describe('Workflow tab order', { tag: ['@ui'] }, () => { await comfyPage.workflow.setupWorkflowsDirectory({}) }) + test.afterEach(async ({ comfyPage }) => { + await comfyPage.workflow.setupWorkflowsDirectory({}) + }) + test('restores the latest tab order and active tab across two reloads', async ({ comfyPage }) => {