diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index add49058..fd10cbbb 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -6,12 +6,12 @@ on: push: branches: - - "enh/playwright-tests" + - 'enh/playwright-tests' pull_request: branches: - - "main" + - 'main' paths: - - ".github/workflows/test_windows.yml" + - '.github/workflows/test_windows.yml' jobs: build-windows-debug: @@ -36,4 +36,3 @@ jobs: with: name: screenshot path: screenshot*.png - diff --git a/playwright.setup.ts b/playwright.setup.ts index 4c1013e4..0c74fcfa 100644 --- a/playwright.setup.ts +++ b/playwright.setup.ts @@ -1,6 +1,5 @@ -import { chromium, type FullConfig } from '@playwright/test'; +import { type FullConfig } from '@playwright/test'; import { spawn } from 'child_process'; -import { writeFileSync } from 'fs'; async function globalSetup(config: FullConfig) { console.log('globalSetup'); @@ -8,10 +7,6 @@ async function globalSetup(config: FullConfig) { return new Promise(async (resolve, reject) => { const electron = spawn('node', ['./scripts/launchdev.js']); - if (electron.pid) { - writeFileSync('.electron.pid', electron.pid?.toString()); - } - electron.on('close', () => { reject('process failed to start'); }); @@ -21,10 +16,6 @@ async function globalSetup(config: FullConfig) { resolve(); } }); - - // electron.stderr.on('data', (data) => { - // reject(`${data}`) - // }); }); } diff --git a/scripts/launchdev.js b/scripts/launchdev.js index 23b7c349..8850afbd 100644 --- a/scripts/launchdev.js +++ b/scripts/launchdev.js @@ -38,8 +38,10 @@ function setupMainPackageWatcher() { electronApp = null; } + const args = process.env.CI ? ['--remote-debugging-port=9000', '--remote-allow-origins=http://127.0.0.1:9000' ] : ['--inspect=9223'] + /** Spawn new electron process */ - electronApp = spawn(String(electronPath), ['--remote-debugging-port=9000', '--remote-allow-origins=http://127.0.0.1:9000', '.'], { + electronApp = spawn(String(electronPath), [...args, '.'], { stdio: 'inherit', }); diff --git a/src/utils.ts b/src/utils.ts index d6569c98..69925a6d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -116,8 +116,9 @@ export async function validateHardware(): Promise { const graphics = await si.graphics(); const hasNvidia = graphics.controllers.some((controller) => controller.vendor.toLowerCase().includes('nvidia')); - - return { isValid: true }; // Temporary workaround for test + if (process.env.CI) { + return { isValid: true }; // Temporary workaround for testing with Playwright + } if (!hasNvidia) { try { diff --git a/tests/integration/example.spec.ts b/tests/integration/startup.spec.ts similarity index 63% rename from tests/integration/example.spec.ts rename to tests/integration/startup.spec.ts index 620d1e68..f2bec3d9 100644 --- a/tests/integration/example.spec.ts +++ b/tests/integration/startup.spec.ts @@ -18,44 +18,35 @@ test('has title', async () => { // Expect a title "to contain" a substring. await expect(page).toHaveTitle(/ComfyUI/); - const getStartedButton = page.getByText("Get Started") + const getStartedButton = page.getByText('Get Started'); await expect(getStartedButton).toBeVisible(); await expect(getStartedButton).toBeEnabled(); - await page.screenshot({ path: 'screenshot-load.png' }); + await page.screenshot({ path: 'screenshot-load.png' }); await getStartedButton.click(); - await expect(page.getByText("Choose Installation Location")).toBeVisible(); - + await expect(page.getByText('Choose Installation Location')).toBeVisible(); + await page.screenshot({ path: 'screenshot-get-started.png' }); - let nextButton = page.getByRole('button', { name: 'Next' }) + let nextButton = page.getByRole('button', { name: 'Next' }); await expect(nextButton).toBeVisible(); await expect(nextButton).toBeEnabled(); await nextButton.click(); - await expect(page.getByText("Migrate from Existing Installation")).toBeVisible(); + await expect(page.getByText('Migrate from Existing Installation')).toBeVisible(); await page.screenshot({ path: 'screenshot-migrate.png' }); - nextButton = page.getByRole('button', { name: 'Next' }) + nextButton = page.getByRole('button', { name: 'Next' }); await nextButton.click(); - await expect(page.getByText("Desktop App Settings")).toBeVisible(); - - // const installButton = page.getByText("Install") + await expect(page.getByText('Desktop App Settings')).toBeVisible(); await page.screenshot({ path: 'screenshot-install.png' }); - - // await expect(installButton).toBeVisible(); - // await expect(installButton).toBeEnabled(); - - // await installButton.click(); - - });