Skip to content

Commit

Permalink
Re-add launchCI script, remove electron plug-in
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-byrne committed Jan 26, 2025
1 parent eb4ad22 commit 4277187
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 26 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
"reset-install": "node scripts/resetInstall.js",
"sign": "node debug/sign.js",
"start": "vite build --config vite.preload.config.ts && vite build --watch",
"test:e2e": "vite build --config vite.preload.config.ts && vite build && npx playwright test",
"test:e2e:ui": "vite build --config vite.preload.config.ts && vite build && npx playwright test --ui",
"test:e2e": "npx playwright test",
"test:unit": "vitest run",
"test:update-snapshots": "npx playwright test --update-snapshots",
"todesktop:afterPack": "./scripts/todesktop/afterPack.cjs",
Expand Down
1 change: 1 addition & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import { defineConfig } from '@playwright/test';
export default defineConfig({
testDir: './tests/integration',
/* Run local instance before starting the tests */
globalSetup: './playwright.setup',
});
21 changes: 0 additions & 21 deletions scripts/launchCI.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import electronPath from 'electron';
import { spawn } from 'node:child_process';
import { build } from 'vite';

// Starts the app using the vite dev server, for use in playwright e2e testing.
Expand All @@ -11,24 +9,6 @@ const mode = (process.env.MODE = process.env.MODE || 'development');
/** @type {import('vite').LogLevel} */
const logLevel = 'warn';

/** @returns {import('vite').PluginOption} */
function runAppAfterBuild() {
return {
name: 'reload-app-on-main-package-change-a',
writeBundle() {
// CI-specific Electron launch args
const args = ['--remote-debugging-port=9000', '--remote-allow-origins=http://127.0.0.1:9000', '.'];

/** Spawn new electron process */
// eslint-disable-next-line @typescript-eslint/no-base-to-string
const electronApp = spawn(String(electronPath), args, { stdio: 'inherit' });

/** Stops the watch script when the application has been quit */
electronApp.addListener('exit', () => process.exit());
},
};
}

/**
* Setup watcher for `main` package
* On file changed it totally re-launch electron app.
Expand All @@ -38,7 +18,6 @@ function setupMainPackageWatcher() {
mode,
logLevel,
configFile: 'vite.config.ts',
plugins: [runAppAfterBuild()],
});
}

Expand Down
9 changes: 6 additions & 3 deletions tests/integration/fixtures/ComfyPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class ComfyPage {
}

async openNodeSearchbox() {
await this.page.mouse.dblclick(128, 128, { delay: 128 });
await this.page.mouse.dblclick(128, 128, { delay: 256 });
await this.page.waitForSelector('.p-autocomplete');
}
}
Expand All @@ -84,11 +84,12 @@ export const test = base.extend<TestFixtures>({
DEV_SERVER_URL: 'http://localhost:5173',
ELECTRON_IS_DEV: '1',
DEV_TOOLS_AUTO: 'false',
SKIP_HARDWARE_VALIDATION: 'true',
},
});

console.warn('Electron App launched');
await electronApp.firstWindow();
console.warn('Window loaded');

await use(electronApp);
await electronApp.close();
Expand All @@ -99,12 +100,14 @@ export const test = base.extend<TestFixtures>({
comfyPage: async ({ electronApp }, use) => {
const window = await electronApp.firstWindow();
const comfyPage = new ComfyPage(window);
console.warn('ComfyPage created');

await window.evaluate(() => {
localStorage.clear();
sessionStorage.clear();
});
await new Promise((resolve) => setTimeout(resolve, 2000));
console.warn('Local storage cleared');
await new Promise((resolve) => setTimeout(resolve, 2048));

await use(comfyPage);
},
Expand Down

0 comments on commit 4277187

Please sign in to comment.