diff --git a/e2e/utils/TestUtils.ts b/e2e/utils/TestUtils.ts index d76126af0bb..0404465425a 100644 --- a/e2e/utils/TestUtils.ts +++ b/e2e/utils/TestUtils.ts @@ -355,8 +355,9 @@ export async function startRancherDesktop(testInfo: TestInfo, options: startRanc currentTest = { file: testInfo.file, options, startTime: Date.now(), }; + const packageMeta = require('../../package.json'); const args = [ - path.join(__dirname, '../../'), + path.join(__dirname, '../..', packageMeta.main), '--disable-gpu', '--whitelisted-ips=', // See pkg/rancher-desktop/utils/commandLine.ts before changing the next item as the final option. diff --git a/package.json b/package.json index 08994326018..6de506769a2 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "@nuxtjs/router-extras": "1.1.1", "@nuxtjs/style-resources": "1.2.2", "@octokit/rest": "20.1.1", - "@playwright/test": "1.43.1", + "@playwright/test": "1.44.1", "@types/cross-spawn": "6.0.6", "@types/dompurify": "3.0.5", "@types/ejs": "3.1.5", diff --git a/pkg/rancher-desktop/utils/paths.ts b/pkg/rancher-desktop/utils/paths.ts index dd3c0c50e7e..988611256be 100644 --- a/pkg/rancher-desktop/utils/paths.ts +++ b/pkg/rancher-desktop/utils/paths.ts @@ -108,10 +108,10 @@ export function getRdctlPath(): string | null { let basePath: string; // If we are running as a script (i.e. yarn postinstall), electron.app is undefined - if (electron.app === undefined) { - basePath = process.cwd(); + if (electron.app?.isPackaged) { + basePath = process.resourcesPath; } else { - basePath = electron.app.isPackaged ? process.resourcesPath : electron.app.getAppPath(); + basePath = process.cwd(); } const osSpecificName = os.platform().startsWith('win') ? `rdctl.exe` : 'rdctl'; const rdctlPath = path.join(basePath, 'resources', os.platform(), 'bin', osSpecificName); @@ -140,9 +140,7 @@ function getPaths(): Paths { if (!pathsData) { const processType = process.type; - if (!errorMsg) { - errorMsg = `Internal error: attempting to load the paths module from a ${ processType } process.`; - } + errorMsg ||= `Internal error: attempting to load the paths module from a ${ processType } process. (rdctl: ${ rdctlPath })`; if (processType === 'renderer') { alert(errorMsg); } diff --git a/pkg/rancher-desktop/utils/protocols.ts b/pkg/rancher-desktop/utils/protocols.ts index 611b2d4687d..cf0d6dd048b 100644 --- a/pkg/rancher-desktop/utils/protocols.ts +++ b/pkg/rancher-desktop/utils/protocols.ts @@ -20,8 +20,13 @@ function redirectedUrl(relPath: string) { if (isDevBuild) { return `http://localhost:8888${ relPath }`; } + if (app.isPackaged) { + return path.join(app.getAppPath(), 'dist', 'app', relPath); + } - return path.join(app.getAppPath(), 'dist', 'app', relPath); + // Unpackaged non-dev build; this normally means E2E tests, where + // `app.getAppPath()` is `.../dist/app. + return path.join(process.cwd(), 'dist', 'app', relPath); } // Latch that is set when the app:// protocol handler has been registered. diff --git a/yarn.lock b/yarn.lock index d389108161a..b06ab644541 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2396,12 +2396,12 @@ resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== -"@playwright/test@1.43.1": - version "1.43.1" - resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.43.1.tgz#16728a59eb8ce0f60472f98d8886d6cab0fa3e42" - integrity sha512-HgtQzFgNEEo4TE22K/X7sYTYNqEMMTZmFS8kTq6m8hXj+m1D8TgwgIbumHddJa9h4yl4GkKb8/bgAl2+g7eDgA== +"@playwright/test@1.44.1": + version "1.44.1" + resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.44.1.tgz#cc874ec31342479ad99838040e99b5f604299bcb" + integrity sha512-1hZ4TNvD5z9VuhNJ/walIjvMVvYkZKf71axoF/uiAqpntQJXpG64dlXhoDXE3OczPuTuvjf/M5KWFg5VAVUS3Q== dependencies: - playwright "1.43.1" + playwright "1.44.1" "@polka/url@^1.0.0-next.20": version "1.0.0-next.21" @@ -10499,17 +10499,17 @@ pkg-dir@^4.1.0, pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" -playwright-core@1.43.1: - version "1.43.1" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.43.1.tgz#0eafef9994c69c02a1a3825a4343e56c99c03b02" - integrity sha512-EI36Mto2Vrx6VF7rm708qSnesVQKbxEWvPrfA1IPY6HgczBplDx7ENtx+K2n4kJ41sLLkuGfmb0ZLSSXlDhqPg== +playwright-core@1.44.1: + version "1.44.1" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.44.1.tgz#53ec975503b763af6fc1a7aa995f34bc09ff447c" + integrity sha512-wh0JWtYTrhv1+OSsLPgFzGzt67Y7BE/ZS3jEqgGBlp2ppp1ZDj8c+9IARNW4dwf1poq5MgHreEM2KV/GuR4cFA== -playwright@1.43.1: - version "1.43.1" - resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.43.1.tgz#8ad08984ac66c9ef3d0db035be54dd7ec9f1c7d9" - integrity sha512-V7SoH0ai2kNt1Md9E3Gwas5B9m8KR2GVvwZnAI6Pg0m3sh7UvgiYhRrhsziCmqMJNouPckiOhk8T+9bSAK0VIA== +playwright@1.44.1: + version "1.44.1" + resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.44.1.tgz#5634369d777111c1eea9180430b7a184028e7892" + integrity sha512-qr/0UJ5CFAtloI3avF95Y0L1xQo6r3LQArLIg/z/PoGJ6xa+EwzrwO5lpNr/09STxdHuUoP2mvuELJS+hLdtgg== dependencies: - playwright-core "1.43.1" + playwright-core "1.44.1" optionalDependencies: fsevents "2.3.2"