Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
otociulis committed Dec 7, 2024
1 parent c1105af commit 7e5b5b0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 34 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/test_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -36,4 +36,3 @@ jobs:
with:
name: screenshot
path: screenshot*.png

11 changes: 1 addition & 10 deletions playwright.setup.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
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');

return new Promise<void>(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');
});
Expand All @@ -21,10 +16,6 @@ async function globalSetup(config: FullConfig) {
resolve();
}
});

// electron.stderr.on('data', (data) => {
// reject(`${data}`)
// });
});
}

Expand Down
4 changes: 3 additions & 1 deletion scripts/launchdev.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});

Expand Down
5 changes: 3 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ export async function validateHardware(): Promise<HardwareValidation> {
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();


});

0 comments on commit 7e5b5b0

Please sign in to comment.