diff --git a/browser_tests/actionbar.spec.ts b/browser_tests/actionbar.spec.ts index 41a486019..96a2d3a72 100644 --- a/browser_tests/actionbar.spec.ts +++ b/browser_tests/actionbar.spec.ts @@ -11,10 +11,6 @@ test.describe('Actionbar', () => { await comfyPage.setSetting('Comfy.UseNewMenu', 'Top') }) - test.afterEach(async ({ comfyPage }) => { - await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled') - }) - /** * This test ensures that the autoqueue change mode can only queue one change at a time */ diff --git a/browser_tests/browserTabTitle.spec.ts b/browser_tests/browserTabTitle.spec.ts index 11b0f7aeb..b5c02812a 100644 --- a/browser_tests/browserTabTitle.spec.ts +++ b/browser_tests/browserTabTitle.spec.ts @@ -7,10 +7,6 @@ test.describe('Browser tab title', () => { await comfyPage.setSetting('Comfy.UseNewMenu', 'Top') }) - test.afterEach(async ({ comfyPage }) => { - await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled') - }) - test('Can display workflow name', async ({ comfyPage }) => { const workflowName = await comfyPage.page.evaluate(async () => { return window['app'].workflowManager.activeWorkflow.name diff --git a/browser_tests/colorPalette.spec.ts b/browser_tests/colorPalette.spec.ts index d618f0f61..21e594ee1 100644 --- a/browser_tests/colorPalette.spec.ts +++ b/browser_tests/colorPalette.spec.ts @@ -135,12 +135,6 @@ test.describe('Color Palette', () => { await comfyPage.setSetting('Comfy.CustomColorPalettes', customColorPalettes) }) - test.afterEach(async ({ comfyPage }) => { - await comfyPage.setSetting('Comfy.CustomColorPalettes', {}) - await comfyPage.setSetting('Comfy.ColorPalette', 'dark') - await comfyPage.setSetting('Comfy.Node.Opacity', 1.0) - }) - test('Can show custom color palette', async ({ comfyPage }) => { await comfyPage.setSetting('Comfy.ColorPalette', 'custom_obsidian_dark') await comfyPage.nextFrame() @@ -158,11 +152,6 @@ test.describe('Node Color Adjustments', () => { await comfyPage.loadWorkflow('every_node_color') }) - test.afterEach(async ({ comfyPage }) => { - await comfyPage.setSetting('Comfy.Node.Opacity', 1.0) - await comfyPage.setSetting('Comfy.ColorPalette', 'dark') - }) - test('should adjust opacity via node opacity setting', async ({ comfyPage }) => { diff --git a/browser_tests/dialog.spec.ts b/browser_tests/dialog.spec.ts index e0c11a183..0ff979e02 100644 --- a/browser_tests/dialog.spec.ts +++ b/browser_tests/dialog.spec.ts @@ -97,11 +97,6 @@ test.describe('Missing models warning', () => { }) test.describe('Settings', () => { - test.afterEach(async ({ comfyPage }) => { - // Restore default setting value - await comfyPage.setSetting('Comfy.Graph.ZoomSpeed', 1.1) - }) - test('@mobile Should be visible on mobile', async ({ comfyPage }) => { await comfyPage.page.keyboard.press('Control+,') const searchBox = comfyPage.page.locator('.settings-content') diff --git a/browser_tests/extensionAPI.spec.ts b/browser_tests/extensionAPI.spec.ts index 70efa5914..9dde5d06a 100644 --- a/browser_tests/extensionAPI.spec.ts +++ b/browser_tests/extensionAPI.spec.ts @@ -6,10 +6,6 @@ test.describe('Topbar commands', () => { await comfyPage.setSetting('Comfy.UseNewMenu', 'Top') }) - test.afterEach(async ({ comfyPage }) => { - await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled') - }) - test('Should allow registering topbar commands', async ({ comfyPage }) => { await comfyPage.page.evaluate(() => { window['app'].registerExtension({ diff --git a/browser_tests/fixtures/ComfyPage.ts b/browser_tests/fixtures/ComfyPage.ts index cf00722e4..16dc9bf90 100644 --- a/browser_tests/fixtures/ComfyPage.ts +++ b/browser_tests/fixtures/ComfyPage.ts @@ -155,7 +155,20 @@ export class ComfyPage { } } - async setup({ resetView = true } = {}) { + async setupSettings(settings: Record) { + const resp = await this.request.post( + `${this.url}/api/devtools/set_settings`, + { + data: settings + } + ) + + if (resp.status() !== 200) { + throw new Error(`Failed to setup settings: ${await resp.text()}`) + } + } + + async setup() { await this.goto() await this.page.evaluate(() => { localStorage.clear() @@ -176,26 +189,13 @@ export class ComfyPage { }) await this.page.waitForFunction(() => document.fonts.ready) await this.page.waitForFunction( - () => window['app'] !== undefined && window['app'].vueAppReady + () => + // window['app'] => GraphCanvas ready + // window['app'].extensionManager => GraphView ready + window['app'] && window['app'].extensionManager ) - await this.page.evaluate(() => { - window['app']['canvas'].show_info = false - }) + await this.page.waitForSelector('.p-blockui-mask', { state: 'hidden' }) await this.nextFrame() - if (resetView) { - // Reset view to force re-rendering of canvas. So that info fields like fps - // become hidden. - await this.resetView() - } - - // Hide all badges by default. - await this.setSetting('Comfy.NodeBadge.NodeIdBadgeMode', NodeBadgeMode.None) - await this.setSetting( - 'Comfy.NodeBadge.NodeSourceBadgeMode', - NodeBadgeMode.None - ) - // Hide canvas menu by default. - await this.setSetting('Comfy.Graph.CanvasMenu', false) } public assetPath(fileName: string) { @@ -722,6 +722,14 @@ export class ComfyPage { export const comfyPageFixture = base.extend<{ comfyPage: ComfyPage }>({ comfyPage: async ({ page, request }, use) => { const comfyPage = new ComfyPage(page, request) + await comfyPage.setupSettings({ + // Hide canvas menu/info by default. + 'Comfy.Graph.CanvasInfo': false, + 'Comfy.Graph.CanvasMenu': false, + // Hide all badges by default. + 'Comfy.NodeBadge.NodeIdBadgeMode': NodeBadgeMode.None, + 'Comfy.NodeBadge.NodeSourceBadgeMode': NodeBadgeMode.None + }) await comfyPage.setup() await use(comfyPage) } diff --git a/browser_tests/groupNode.spec.ts b/browser_tests/groupNode.spec.ts index c646c5111..7422a5247 100644 --- a/browser_tests/groupNode.spec.ts +++ b/browser_tests/groupNode.spec.ts @@ -3,10 +3,6 @@ import { ComfyPage, comfyPageFixture as test } from './fixtures/ComfyPage' import type { NodeReference } from './fixtures/utils/litegraphUtils' test.describe('Group Node', () => { - test.afterEach(async ({ comfyPage }) => { - await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled') - }) - test.describe('Node library sidebar', () => { const groupNodeName = 'DefautWorkflowGroupNode' const groupNodeCategory = 'group nodes>workflow' @@ -20,11 +16,6 @@ test.describe('Group Node', () => { await libraryTab.open() }) - test.afterEach(async ({ comfyPage }) => { - await comfyPage.setSetting('Comfy.NodeLibrary.Bookmarks.V2', []) - await libraryTab.close() - }) - test('Is added to node library sidebar', async ({ comfyPage }) => { expect(await libraryTab.getFolder('group nodes').count()).toBe(1) }) @@ -193,13 +184,6 @@ test.describe('Group Node', () => { await groupNode.copy() }) - test.afterEach(async ({ comfyPage }) => { - await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled') - await comfyPage.page.evaluate((groupNodeName) => { - window['LiteGraph'].unregisterNodeType(groupNodeName) - }, GROUP_NODE_TYPE) - }) - test('Copies and pastes group node within the same workflow', async ({ comfyPage }) => { diff --git a/browser_tests/interaction.spec.ts b/browser_tests/interaction.spec.ts index 901e05ed9..1b0f80595 100644 --- a/browser_tests/interaction.spec.ts +++ b/browser_tests/interaction.spec.ts @@ -493,10 +493,6 @@ test.describe('Load duplicate workflow', () => { await comfyPage.setSetting('Comfy.UseNewMenu', 'Top') }) - test.afterEach(async ({ comfyPage }) => { - await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled') - }) - test('A workflow can be loaded multiple times in a row', async ({ comfyPage }) => { diff --git a/browser_tests/menu.spec.ts b/browser_tests/menu.spec.ts index b27a871bd..719e81c09 100644 --- a/browser_tests/menu.spec.ts +++ b/browser_tests/menu.spec.ts @@ -6,14 +6,6 @@ test.describe('Menu', () => { await comfyPage.setSetting('Comfy.UseNewMenu', 'Top') }) - test.afterEach(async ({ comfyPage }) => { - const currentThemeId = await comfyPage.menu.getThemeId() - if (currentThemeId !== 'dark') { - await comfyPage.menu.toggleTheme() - } - await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled') - }) - // Skip reason: Flaky. test.skip('Toggle theme', async ({ comfyPage }) => { test.setTimeout(30000) @@ -25,8 +17,7 @@ test.describe('Menu', () => { expect(await comfyPage.menu.getThemeId()).toBe('light') // Theme id should persist after reload. - await comfyPage.page.reload() - await comfyPage.setup() + await comfyPage.reload() expect(await comfyPage.menu.getThemeId()).toBe('light') await comfyPage.menu.toggleTheme() @@ -368,8 +359,7 @@ test.describe('Menu', () => { 'KSampler' ]) await comfyPage.setSetting('Comfy.NodeLibrary.Bookmarks.V2', []) - await comfyPage.page.reload() - await comfyPage.setup() + await comfyPage.reload() expect(await comfyPage.getSetting('Comfy.NodeLibrary.Bookmarks')).toEqual( [] ) @@ -412,7 +402,7 @@ test.describe('Menu', () => { 'workflow2.json': 'default.json' }) // Avoid reset view as the button is not visible in BetaMenu UI. - await comfyPage.setup({ resetView: false }) + await comfyPage.setup() const tab = comfyPage.menu.workflowsTab await tab.open() diff --git a/browser_tests/propertiesPanel.spec.ts b/browser_tests/propertiesPanel.spec.ts index 96916c7bf..964dc6f3f 100644 --- a/browser_tests/propertiesPanel.spec.ts +++ b/browser_tests/propertiesPanel.spec.ts @@ -6,10 +6,6 @@ test.describe('Properties Panel', () => { await comfyPage.setSetting('Comfy.UseNewMenu', 'Top') }) - test.afterEach(async ({ comfyPage }) => { - await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled') - }) - // TODO: Update expectation after new menu dropdown is added. test.skip('Can change property value', async ({ comfyPage }) => { await comfyPage.rightClickEmptyLatentNode() diff --git a/browser_tests/rightClickMenu.spec.ts b/browser_tests/rightClickMenu.spec.ts index 5394ed439..40a06aa47 100644 --- a/browser_tests/rightClickMenu.spec.ts +++ b/browser_tests/rightClickMenu.spec.ts @@ -96,11 +96,6 @@ test.describe('Node Right Click Menu', () => { test.describe('Widget conversion', () => { const convertibleWidgetTypes = ['text', 'string', 'number', 'toggle'] - test.afterEach(async ({ comfyPage }) => { - // Restore default setting value - await comfyPage.setSetting('Comfy.NodeInputConversionSubmenus', true) - }) - test('Can convert widget to input', async ({ comfyPage }) => { await comfyPage.rightClickEmptyLatentNode() await expect(comfyPage.canvas).toHaveScreenshot('right-click-node.png') diff --git a/browser_tests/templates.spec.ts b/browser_tests/templates.spec.ts index 0507bba1b..ea5101a1e 100644 --- a/browser_tests/templates.spec.ts +++ b/browser_tests/templates.spec.ts @@ -6,10 +6,6 @@ test.describe('Templates', () => { await comfyPage.setSetting('Comfy.UseNewMenu', 'Top') }) - test.afterEach(async ({ comfyPage }) => { - await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled') - }) - test('Can load template workflows', async ({ comfyPage }) => { // This test will need expanding on once the templates are decided