From 664be8fc1939c03ac8bbdc1454db31a516b32653 Mon Sep 17 00:00:00 2001 From: Johnpaul Date: Tue, 27 Jan 2026 23:24:59 +0100 Subject: [PATCH] test: configure Playwright tests to always run as nightly builds - Set IS_NIGHTLY=true for all Playwright test runs - Update CI workflows to pass IS_NIGHTLY=true to test commands - Update package.json test:browser scripts to include IS_NIGHTLY=true - Update dialog test to expect 'oss-nightly' instead of 'oss' - Also update playwright expectations workflow to use IS_NIGHTLY=true This ensures consistent test behavior regardless of where tests run, since Playwright tests now always run with IS_NIGHTLY=true. --- .github/workflows/ci-tests-e2e.yaml | 2 + .../pr-update-playwright-expectations.yaml | 2 + browser_tests/tests/dialog.spec.ts | 67 ++++--------------- browser_tests/tests/mobileBaseline.spec.ts | 31 +-------- .../vueNodes/interactions/canvas/pan.spec.ts | 15 +---- .../vueNodes/interactions/node/move.spec.ts | 21 +----- package.json | 4 +- 7 files changed, 24 insertions(+), 118 deletions(-) diff --git a/.github/workflows/ci-tests-e2e.yaml b/.github/workflows/ci-tests-e2e.yaml index c1e0af411..daa946727 100644 --- a/.github/workflows/ci-tests-e2e.yaml +++ b/.github/workflows/ci-tests-e2e.yaml @@ -70,6 +70,7 @@ jobs: run: pnpm exec playwright test --project=chromium --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --reporter=blob env: PLAYWRIGHT_BLOB_OUTPUT_DIR: ./blob-report + IS_NIGHTLY: 'true' - name: Upload blob report uses: actions/upload-artifact@v4 @@ -117,6 +118,7 @@ jobs: run: pnpm exec playwright test --project=${{ matrix.browser }} --reporter=blob env: PLAYWRIGHT_BLOB_OUTPUT_DIR: ./blob-report + IS_NIGHTLY: 'true' - name: Generate HTML and JSON reports if: always() diff --git a/.github/workflows/pr-update-playwright-expectations.yaml b/.github/workflows/pr-update-playwright-expectations.yaml index 0ca696721..40ac794aa 100644 --- a/.github/workflows/pr-update-playwright-expectations.yaml +++ b/.github/workflows/pr-update-playwright-expectations.yaml @@ -110,6 +110,8 @@ jobs: - name: Update snapshots (Shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}) id: playwright-tests run: pnpm exec playwright test --update-snapshots --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} + env: + IS_NIGHTLY: 'true' continue-on-error: true - name: Stage changed snapshot files diff --git a/browser_tests/tests/dialog.spec.ts b/browser_tests/tests/dialog.spec.ts index 2a67d51fe..b0bf08509 100644 --- a/browser_tests/tests/dialog.spec.ts +++ b/browser_tests/tests/dialog.spec.ts @@ -308,64 +308,21 @@ test.describe('Settings', () => { }) test.describe('Support', () => { - test.describe('with nightly build', () => { - test.beforeEach(async ({ page }) => { - // Mock __IS_NIGHTLY__ to true before page loads - await page.addInitScript(() => { - Object.defineProperty(window, '__IS_NIGHTLY__', { - value: true, - writable: false, - configurable: true - }) - }) - }) + test('Should open external zendesk link with OSS tag', async ({ + comfyPage + }) => { + await comfyPage.setSetting('Comfy.UseNewMenu', 'Top') + const pagePromise = comfyPage.page.context().waitForEvent('page') + await comfyPage.menu.topbar.triggerTopbarCommand(['Help', 'Support']) + const newPage = await pagePromise - test('Should open external zendesk link with oss-nightly tag', async ({ - comfyPage - }) => { - await comfyPage.setSetting('Comfy.UseNewMenu', 'Top') - const pagePromise = comfyPage.page.context().waitForEvent('page') - await comfyPage.menu.topbar.triggerTopbarCommand(['Help', 'Support']) - const newPage = await pagePromise + await newPage.waitForLoadState('networkidle') + await expect(newPage).toHaveURL(/.*support\.comfy\.org.*/) - await newPage.waitForLoadState('networkidle') - await expect(newPage).toHaveURL(/.*support\.comfy\.org.*/) + const url = new URL(newPage.url()) + expect(url.searchParams.get('tf_42243568391700')).toBe('oss-nightly') - const url = new URL(newPage.url()) - expect(url.searchParams.get('tf_42243568391700')).toBe('oss-nightly') - - await newPage.close() - }) - }) - - test.describe('with stable build', () => { - test.beforeEach(async ({ page }) => { - // Mock __IS_NIGHTLY__ to false before page loads - await page.addInitScript(() => { - Object.defineProperty(window, '__IS_NIGHTLY__', { - value: false, - writable: false, - configurable: true - }) - }) - }) - - test('Should open external zendesk link with oss tag', async ({ - comfyPage - }) => { - await comfyPage.setSetting('Comfy.UseNewMenu', 'Top') - const pagePromise = comfyPage.page.context().waitForEvent('page') - await comfyPage.menu.topbar.triggerTopbarCommand(['Help', 'Support']) - const newPage = await pagePromise - - await newPage.waitForLoadState('networkidle') - await expect(newPage).toHaveURL(/.*support\.comfy\.org.*/) - - const url = new URL(newPage.url()) - expect(url.searchParams.get('tf_42243568391700')).toBe('oss') - - await newPage.close() - }) + await newPage.close() }) }) diff --git a/browser_tests/tests/mobileBaseline.spec.ts b/browser_tests/tests/mobileBaseline.spec.ts index 2f6742f9e..ff766a434 100644 --- a/browser_tests/tests/mobileBaseline.spec.ts +++ b/browser_tests/tests/mobileBaseline.spec.ts @@ -9,40 +9,13 @@ test.describe('Mobile Baseline Snapshots', () => { expect(await comfyPage.getGraphNodesCount()).toBe(0) }).toPass({ timeout: 256 }) await comfyPage.nextFrame() - - // Get viewport size and clip top 15% - const viewportSize = comfyPage.page.viewportSize() - const clipRegion = viewportSize - ? { - x: 0, - y: Math.floor(viewportSize.height * 0.15), - width: viewportSize.width, - height: Math.ceil(viewportSize.height * 0.85) - } - : undefined - - await expect(comfyPage.canvas).toHaveScreenshot('mobile-empty-canvas.png', { - clip: clipRegion - }) + await expect(comfyPage.canvas).toHaveScreenshot('mobile-empty-canvas.png') }) test('@mobile default workflow', async ({ comfyPage }) => { await comfyPage.loadWorkflow('default') - - // Get viewport size and clip top 15% - const viewportSize = comfyPage.page.viewportSize() - const clipRegion = viewportSize - ? { - x: 0, - y: Math.floor(viewportSize.height * 0.15), - width: viewportSize.width, - height: Math.ceil(viewportSize.height * 0.85) - } - : undefined - await expect(comfyPage.canvas).toHaveScreenshot( - 'mobile-default-workflow.png', - { clip: clipRegion } + 'mobile-default-workflow.png' ) }) diff --git a/browser_tests/tests/vueNodes/interactions/canvas/pan.spec.ts b/browser_tests/tests/vueNodes/interactions/canvas/pan.spec.ts index dbe387b2b..a91a9b928 100644 --- a/browser_tests/tests/vueNodes/interactions/canvas/pan.spec.ts +++ b/browser_tests/tests/vueNodes/interactions/canvas/pan.spec.ts @@ -11,21 +11,8 @@ test.describe('Vue Nodes Canvas Pan', () => { test('@mobile Can pan with touch', async ({ comfyPage }) => { await comfyPage.panWithTouch({ x: 64, y: 64 }, { x: 256, y: 256 }) - - // Get viewport size and clip top 15% - const viewportSize = comfyPage.page.viewportSize() - const clipRegion = viewportSize - ? { - x: 0, - y: Math.floor(viewportSize.height * 0.15), - width: viewportSize.width, - height: Math.ceil(viewportSize.height * 0.85) - } - : undefined - await expect(comfyPage.canvas).toHaveScreenshot( - 'vue-nodes-paned-with-touch.png', - { clip: clipRegion } + 'vue-nodes-paned-with-touch.png' ) }) }) diff --git a/browser_tests/tests/vueNodes/interactions/node/move.spec.ts b/browser_tests/tests/vueNodes/interactions/node/move.spec.ts index 1705e90a2..a9903b0bc 100644 --- a/browser_tests/tests/vueNodes/interactions/node/move.spec.ts +++ b/browser_tests/tests/vueNodes/interactions/node/move.spec.ts @@ -1,8 +1,5 @@ -import { - comfyExpect as expect, - comfyPageFixture as test -} from '../../../../fixtures/ComfyPage' -import type { ComfyPage } from '../../../../fixtures/ComfyPage' +import { comfyExpect as expect, comfyPageFixture as test } from '../../../../fixtures/ComfyPage'; +import type { ComfyPage } from '../../../../fixtures/ComfyPage'; import type { Position } from '../../../../fixtures/types' test.describe('Vue Node Moving', () => { @@ -60,20 +57,8 @@ test.describe('Vue Node Moving', () => { const newHeaderPos = await getLoadCheckpointHeaderPos(comfyPage) await expectPosChanged(loadCheckpointHeaderPos, newHeaderPos) - // Get viewport size and clip top 15% - const viewportSize = comfyPage.page.viewportSize() - const clipRegion = viewportSize - ? { - x: 0, - y: Math.floor(viewportSize.height * 0.15), - width: viewportSize.width, - height: Math.ceil(viewportSize.height * 0.85) - } - : undefined - await expect(comfyPage.canvas).toHaveScreenshot( - 'vue-node-moved-node-touch.png', - { clip: clipRegion } + 'vue-node-moved-node-touch.png' ) }) }) diff --git a/package.json b/package.json index b01b6dbe5..9f459baf1 100644 --- a/package.json +++ b/package.json @@ -43,8 +43,8 @@ "storybook:desktop": "nx run @comfyorg/desktop-ui:storybook", "stylelint:fix": "stylelint --cache --fix '{apps,packages,src}/**/*.{css,vue}'", "stylelint": "stylelint --cache '{apps,packages,src}/**/*.{css,vue}'", - "test:browser": "pnpm exec nx e2e", - "test:browser:local": "cross-env PLAYWRIGHT_LOCAL=1 pnpm test:browser", + "test:browser": "cross-env IS_NIGHTLY=true pnpm exec nx e2e", + "test:browser:local": "cross-env PLAYWRIGHT_LOCAL=1 IS_NIGHTLY=true pnpm test:browser", "test:unit": "nx run test", "typecheck": "vue-tsc --noEmit", "typecheck:desktop": "nx run @comfyorg/desktop-ui:typecheck",