diff --git a/apps/zui/package.json b/apps/zui/package.json index db0092352e..aaebf01ab2 100644 --- a/apps/zui/package.json +++ b/apps/zui/package.json @@ -85,7 +85,7 @@ "d3": "^6.7.0", "date-fns": "^2.16.1", "decompress": "^4.2.1", - "electron": "22.3.25", + "electron": "28.0.0", "electron-builder": "^23.6.0", "electron-builder-notarize": "^1.2.0", "electron-devtools-assembler": "^1.2.0", diff --git a/apps/zui/src/core/main/main-object.ts b/apps/zui/src/core/main/main-object.ts index 1387de199b..515a5135ca 100644 --- a/apps/zui/src/core/main/main-object.ts +++ b/apps/zui/src/core/main/main-object.ts @@ -29,6 +29,7 @@ import createLake from "src/js/models/lake" import {getAuthToken} from "../../js/api/core/get-zealot" import {Abortables} from "src/app/core/models/abortables" import * as zui from "src/zui" +import log from "electron-log" export class MainObject { public isQuitting = false @@ -63,7 +64,11 @@ export class MainObject { ) {} async start() { - if (this.args.lake) this.lake.start() + if (this.args.lake) { + if (!(await this.lake.start())) { + log.error("Failed to start lake process after 5 seconds") + } + } if (this.args.devtools) await installExtensions() await this.windows.init() } diff --git a/apps/zui/src/electron/run-main/before-boot.ts b/apps/zui/src/electron/run-main/before-boot.ts index 30487969c0..76b19b644e 100644 --- a/apps/zui/src/electron/run-main/before-boot.ts +++ b/apps/zui/src/electron/run-main/before-boot.ts @@ -6,16 +6,18 @@ import {MainArgs} from "./args" import {setLogLevel} from "../set-log-level" import {runMigrations} from "./run-migrations" +app.disableHardwareAcceleration() + export async function beforeBoot( args: Partial ): Promise { // Disable security warnings - process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true" + // process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = "true" // Setup app paths, this must be first appPathSetup() setLogLevel() // Disable for certain platforms - app.disableHardwareAcceleration() + // Ensure only one instance of the app is ever on (windows) const lock = app.requestSingleInstanceLock() if (args.singleInstance && !lock) { diff --git a/apps/zui/src/electron/run-main/boot.ts b/apps/zui/src/electron/run-main/boot.ts index ea33489c44..004b248c42 100644 --- a/apps/zui/src/electron/run-main/boot.ts +++ b/apps/zui/src/electron/run-main/boot.ts @@ -24,7 +24,7 @@ export async function boot(args: Partial = {}) { // 6. Protocol Handler runProtocolHandlers() // 7. Start the app - app.whenReady().then(() => main.start()) - + await app.whenReady() + await main.start() return main } diff --git a/apps/zui/src/electron/start.test.ts b/apps/zui/src/electron/start.test.ts index aad855d139..317754db42 100644 --- a/apps/zui/src/electron/start.test.ts +++ b/apps/zui/src/electron/start.test.ts @@ -14,14 +14,6 @@ jest.mock("@brimdata/zed-node") afterEach(teardown) -test("start is called in zed lake", async () => { - const appMain = (await main({ - devtools: false, - autoUpdater: false, - })) as MainObject - expect(appMain.lake.start).toHaveBeenCalledTimes(1) -}) - test("app opens a window on startup", async () => { const appMain = (await main({ devtools: false, diff --git a/apps/zui/src/js/flows/lake/buildAndAuthenticateLake.ts b/apps/zui/src/js/flows/lake/buildAndAuthenticateLake.ts index de75cb609e..023c4a70e1 100644 --- a/apps/zui/src/js/flows/lake/buildAndAuthenticateLake.ts +++ b/apps/zui/src/js/flows/lake/buildAndAuthenticateLake.ts @@ -49,14 +49,13 @@ export const buildAndAuthenticateLake = return [false, null] } - const dialogOpts = { + const dialogChoice = await showMessageBox({ type: "info", buttons: ["Continue", "Cancel"], title: "Redirect to Browser", message: "This lake requires authentication. Continue to log in with your browser?", - } - const dialogChoice = await showMessageBox(dialogOpts) + }) if (dialogChoice.response === 1) return [true, null] try { diff --git a/apps/zui/src/test/system/boot.tsx b/apps/zui/src/test/system/boot.tsx index cb8207fe8b..cb5c636219 100644 --- a/apps/zui/src/test/system/boot.tsx +++ b/apps/zui/src/test/system/boot.tsx @@ -50,6 +50,7 @@ export async function boot(name: string, args: Partial = {}) { autoUpdater: false, singleInstance: false, })) as MainObject + await waitFor(async () => fetch(`http://localhost:${lakePort}/version`), { timeout: 20_000, }) diff --git a/package.json b/package.json index 1b48d6433a..b13ae0c811 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,6 @@ "@nx/js": "16.10.0", "@nx/linter": "16.10.0", "@nx/workspace": "16.10.0", - "@nxkit/playwright": "^2.3.0", - "@playwright/test": "1.27.1", "@swc/cli": "~0.1.55", "@swc/core": "^1.2.173", "@swc/jest": "0.2.20", @@ -41,7 +39,6 @@ "jest-environment-node": "^29.4.1", "nx": "16.10.0", "open-cli": "^7.2.0", - "playwright-chromium": "1.27.1", "prettier": "^2.6.2", "serve": "^14.2.0", "ts-jest": "^29.0.5", diff --git a/packages/zed-node/src/lake.ts b/packages/zed-node/src/lake.ts index 4eb12ba93b..128efd6e41 100644 --- a/packages/zed-node/src/lake.ts +++ b/packages/zed-node/src/lake.ts @@ -38,7 +38,7 @@ export class Lake { const args = [ 'serve', '-l', - this.addr(), + ':' + this.port, '-lake', this.root, '-log.level=info', diff --git a/packages/zui-player/helpers/test-app.ts b/packages/zui-player/helpers/test-app.ts index 73510a5686..a2b7cb3bd6 100644 --- a/packages/zui-player/helpers/test-app.ts +++ b/packages/zui-player/helpers/test-app.ts @@ -186,7 +186,7 @@ export default class TestApp { if (role instanceof RegExp) { return this.mainWin.getByText(role); } else { - return this.mainWin.getByRole(role, { name }); + return this.mainWin.getByRole(role, { name, exact: true }); } } @@ -236,7 +236,7 @@ const getAppInfo = () => { }; } - return { bin: null, entry: 'apps/zui' }; + return { bin: null, entry: '../../apps/zui' }; }; function waitForTrue(check: () => boolean | Promise) { diff --git a/packages/zui-player/package.json b/packages/zui-player/package.json index c353e36ae3..a841ff77ca 100644 --- a/packages/zui-player/package.json +++ b/packages/zui-player/package.json @@ -2,7 +2,13 @@ "name": "zui-player", "private": true, "main": "./index.ts", + "scripts": { + "test": "playwright test --config playwright.config.js" + }, "dependencies": { - "fs-extra": "^11.2.0" + "@playwright/test": "next", + "fs-extra": "^11.2.0", + "playwright": "next", + "playwright-chromium": "next" } } diff --git a/packages/zui-player/project.json b/packages/zui-player/project.json index 4b36914a92..2d7ef31f22 100644 --- a/packages/zui-player/project.json +++ b/packages/zui-player/project.json @@ -13,14 +13,6 @@ "tsConfig": "packages/zui-player/tsconfig.json", "main": "packages/zui-player/index.ts" } - }, - "test": { - "executor": "@nxkit/playwright:test", - "options": { - "outputPath": "dist/packages/zui-player/test-results", - "playwrightConfig": "packages/zui-player/playwright.config.js", - "baseUrl": "https://example.com" - } } } } diff --git a/packages/zui-player/tests/export.spec.ts b/packages/zui-player/tests/export.spec.ts index efeaf37369..294f71c72b 100644 --- a/packages/zui-player/tests/export.spec.ts +++ b/packages/zui-player/tests/export.spec.ts @@ -46,7 +46,9 @@ test.describe('Export tests', () => { }); await menu.getByRole('button', { name: 'Export' }).click(); const dialog = app.mainWin.getByRole('dialog'); - await dialog.getByRole('radio', { name: `${label}` }).click(); + await dialog + .getByRole('radio', { name: `${label}`, exact: true }) + .click(); await dialog.getByRole('button').filter({ hasText: 'Export' }).click(); await app.mainWin .getByText(new RegExp('Export Completed: .*results\\.' + label)) diff --git a/packages/zui-player/tests/pool-loads.spec.ts b/packages/zui-player/tests/pool-loads.spec.ts index 68b7c9ea9d..9a7f4b9bd5 100644 --- a/packages/zui-player/tests/pool-loads.spec.ts +++ b/packages/zui-player/tests/pool-loads.spec.ts @@ -28,7 +28,7 @@ test.describe('Pool Loads', () => { await app.click('treeitem', 'prs.json'); await app.dropFile(getPath('prs.json')); await app.page - .getByLabel('Pool') + .getByLabel('Pool', { exact: true }) .nth(0) .selectOption({ label: 'prs.json' }); await app.click('button', 'Load'); diff --git a/yarn.lock b/yarn.lock index dbaa3f41c0..5c3ac6f103 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3777,15 +3777,6 @@ __metadata: languageName: node linkType: hard -"@nxkit/playwright@npm:^2.3.0": - version: 2.3.0 - resolution: "@nxkit/playwright@npm:2.3.0" - peerDependencies: - "@playwright/test": ^1.25.2 - checksum: 57fa8cc56cfb17cd1ba5bb51c433c1631a61df96d58836ac7ebab99e8cb62f3bbc2f9709170bb086475d81417951a2cb5a2d62010fb1cef768ffdc531077cd1f - languageName: node - linkType: hard - "@open-draft/until@npm:^1.0.3": version: 1.0.3 resolution: "@open-draft/until@npm:1.0.3" @@ -3815,15 +3806,14 @@ __metadata: languageName: node linkType: hard -"@playwright/test@npm:1.27.1": - version: 1.27.1 - resolution: "@playwright/test@npm:1.27.1" +"@playwright/test@npm:next": + version: 1.41.0-alpha-dec-20-2023 + resolution: "@playwright/test@npm:1.41.0-alpha-dec-20-2023" dependencies: - "@types/node": "*" - playwright-core: 1.27.1 + playwright: 1.41.0-alpha-dec-20-2023 bin: playwright: cli.js - checksum: 92f219a78c21da03c6599d92c313c914e73cc374306366130fb3bd4701555179394ec5a3000d9375ce59f5a03c00f20d1ddaae50c85583ce475e17795a622699 + checksum: 0b177a16bf503150268adb6165d8f7f58dd24f7ea8e942d94fcefcef8e4bdd60c2fd39b88c43eb726d43aaaaea0d613818924915229302820af6151b60c7b108 languageName: node linkType: hard @@ -5087,7 +5077,7 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:^16.11.26": +"@types/node@npm:*": version: 16.18.6 resolution: "@types/node@npm:16.18.6" checksum: 85b6a11c347e1edfe014eb2c520aec37117152c932b632f455d4e2a71a311fb25578602c7c25f825c6f1c3e4a912506857c1aa679717318296f5590ac0d33254 @@ -5101,6 +5091,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^18.11.18": + version: 18.19.3 + resolution: "@types/node@npm:18.19.3" + dependencies: + undici-types: ~5.26.4 + checksum: 58c4fa45a78fcec75c78182a4b266395905957633654eb0311c5f9c30ac15c179ea2287ab1af034e46c2db7bb0589ef0000ee64c1de8f568a0aad29eaadb100c + languageName: node + linkType: hard + "@types/normalize-package-data@npm:^2.4.0, @types/normalize-package-data@npm:^2.4.1": version: 2.4.1 resolution: "@types/normalize-package-data@npm:2.4.1" @@ -8899,16 +8898,16 @@ __metadata: languageName: node linkType: hard -"electron@npm:22.3.25": - version: 22.3.25 - resolution: "electron@npm:22.3.25" +"electron@npm:28.0.0": + version: 28.0.0 + resolution: "electron@npm:28.0.0" dependencies: "@electron/get": ^2.0.0 - "@types/node": ^16.11.26 + "@types/node": ^18.11.18 extract-zip: ^2.0.1 bin: electron: cli.js - checksum: be8af444bd7c9ca5504a445b660da172831150c0645b3ab46ee867ce6793ec7f77c38e5deb554caf7e4bdf2a910b500a98009a6edbeb3a2a5423a5efd8367a90 + checksum: 5e0da4f3a8b6746cc597b20453cec89a346c9b64b6d3e3dbc7ba015c1e7d1dcaf43c2fc7c3115fc57f68853724049a6b21e40a82becb49df2d8207cbf6cbc3ea languageName: node linkType: hard @@ -10211,7 +10210,7 @@ __metadata: languageName: node linkType: hard -"fsevents@npm:^2.3.2, fsevents@npm:~2.3.2": +"fsevents@npm:2.3.2, fsevents@npm:^2.3.2, fsevents@npm:~2.3.2": version: 2.3.2 resolution: "fsevents@npm:2.3.2" dependencies: @@ -10221,7 +10220,7 @@ __metadata: languageName: node linkType: hard -"fsevents@patch:fsevents@^2.3.2#~builtin, fsevents@patch:fsevents@~2.3.2#~builtin": +"fsevents@patch:fsevents@2.3.2#~builtin, fsevents@patch:fsevents@^2.3.2#~builtin, fsevents@patch:fsevents@~2.3.2#~builtin": version: 2.3.2 resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin::version=2.3.2&hash=df0bf1" dependencies: @@ -15279,23 +15278,38 @@ __metadata: languageName: node linkType: hard -"playwright-chromium@npm:1.27.1": - version: 1.27.1 - resolution: "playwright-chromium@npm:1.27.1" +"playwright-chromium@npm:next": + version: 1.41.0-alpha-dec-20-2023 + resolution: "playwright-chromium@npm:1.41.0-alpha-dec-20-2023" dependencies: - playwright-core: 1.27.1 + playwright-core: 1.41.0-alpha-dec-20-2023 bin: playwright: cli.js - checksum: 2ea86a8f7562333bf6bcb8fc7485bd9b084d067087e9a0d0aeaaa116b16cbbd3a7d6f14f509e943a962415a415ee26ef232a51317f0d4d966d0ca55f9de4bdc1 + checksum: 3482da232430d58ce3f354cb877581638eec6338be540b30515615bfbc779bfed24d98cfa5fc0989cfac3611e0e825027f139a5443646e4c519374b14c00a674 languageName: node linkType: hard -"playwright-core@npm:1.27.1": - version: 1.27.1 - resolution: "playwright-core@npm:1.27.1" +"playwright-core@npm:1.41.0-alpha-dec-20-2023": + version: 1.41.0-alpha-dec-20-2023 + resolution: "playwright-core@npm:1.41.0-alpha-dec-20-2023" + bin: + playwright-core: cli.js + checksum: 4d07324fbd42753a9c5ba0606c619b4d0c79209b9f8d6c385da62eee3c7992ac247b4ac9bc3af0dcfe8c44b5be48c2172aac54dd4fc173dfd97ff3ea2b769eaa + languageName: node + linkType: hard + +"playwright@npm:1.41.0-alpha-dec-20-2023, playwright@npm:next": + version: 1.41.0-alpha-dec-20-2023 + resolution: "playwright@npm:1.41.0-alpha-dec-20-2023" + dependencies: + fsevents: 2.3.2 + playwright-core: 1.41.0-alpha-dec-20-2023 + dependenciesMeta: + fsevents: + optional: true bin: playwright: cli.js - checksum: fd65d3eb29978e0e7a755158625e8922a66ca9d599b7c24ddf920822b261d81c51a5964ef8e0e5ed9b2b12dc64541c5949b6a898d965e107f43261964e8c29a0 + checksum: 102ab0df329a007c02b5418dd38da2e82734db156fdd46c9cc409461fe357a0b585d0ca8f29061f728862fa00929e53a8bad71135bcacd8b03dc7cb226bc2532 languageName: node linkType: hard @@ -18209,6 +18223,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~5.26.4": + version: 5.26.5 + resolution: "undici-types@npm:5.26.5" + checksum: 3192ef6f3fd5df652f2dc1cd782b49d6ff14dc98e5dced492aa8a8c65425227da5da6aafe22523c67f035a272c599bb89cfe803c1db6311e44bed3042fc25487 + languageName: node + linkType: hard + "unicode-canonical-property-names-ecmascript@npm:^2.0.0": version: 2.0.0 resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.0" @@ -19110,8 +19131,6 @@ __metadata: "@nx/js": 16.10.0 "@nx/linter": 16.10.0 "@nx/workspace": 16.10.0 - "@nxkit/playwright": ^2.3.0 - "@playwright/test": 1.27.1 "@swc/cli": ~0.1.55 "@swc/core": ^1.2.173 "@swc/helpers": ~0.4.11 @@ -19128,7 +19147,6 @@ __metadata: jest-environment-node: ^29.4.1 nx: 16.10.0 open-cli: ^7.2.0 - playwright-chromium: 1.27.1 prettier: ^2.6.2 serve: ^14.2.0 ts-jest: ^29.0.5 @@ -19142,7 +19160,10 @@ __metadata: version: 0.0.0-use.local resolution: "zui-player@workspace:packages/zui-player" dependencies: + "@playwright/test": next fs-extra: ^11.2.0 + playwright: next + playwright-chromium: next languageName: unknown linkType: soft @@ -19202,7 +19223,7 @@ __metadata: d3: ^6.7.0 date-fns: ^2.16.1 decompress: ^4.2.1 - electron: 22.3.25 + electron: 28.0.0 electron-builder: ^23.6.0 electron-builder-notarize: ^1.2.0 electron-devtools-assembler: ^1.2.0