diff --git a/e2e-tests/desktop/global-setup.js b/e2e-tests/desktop/global-setup.js new file mode 100644 index 000000000..35ed0c5e6 --- /dev/null +++ b/e2e-tests/desktop/global-setup.js @@ -0,0 +1,18 @@ +/** + * Copyright IBM Corp. 2021, 2026 + * SPDX-License-Identifier: BUSL-1.1 + */ + +import * as boundaryCli from '../helpers/boundary-cli.js'; +import baseGlobalSetup from '../global-setup.js'; + +export default async function globalSetup() { + await baseGlobalSetup(); + + // when running locally, there's a chance that the cache could be running an + // older version. + // stop the cache if it's running, and the desktop client will automatically + // start the cache after logging in . + await boundaryCli.checkBoundaryCli(); + await boundaryCli.stopCache(); +} diff --git a/e2e-tests/desktop/playwright.config.js b/e2e-tests/desktop/playwright.config.js index 0bedf226d..37415979f 100644 --- a/e2e-tests/desktop/playwright.config.js +++ b/e2e-tests/desktop/playwright.config.js @@ -6,7 +6,7 @@ import { defineConfig } from '@playwright/test'; /** @type {import('@playwright/test').PlaywrightTestConfig} */ export default defineConfig({ - globalSetup: '../global-setup', + globalSetup: './global-setup', outputDir: './artifacts', workers: 1, // Tests need to be run in serial, otherwise there may be conflicts when using the CLI use: { diff --git a/e2e-tests/global-setup.js b/e2e-tests/global-setup.js index e18d195bd..4bce50f92 100644 --- a/e2e-tests/global-setup.js +++ b/e2e-tests/global-setup.js @@ -4,6 +4,7 @@ */ import { chromium, test as baseTest, mergeTests } from '@playwright/test'; + import { checkEnv } from './helpers/general.js'; import { boundaryApiClientTest } from './helpers/boundary-api-client.js'; import { LoginPage } from './admin/pages/login.js'; diff --git a/e2e-tests/helpers/boundary-cli.js b/e2e-tests/helpers/boundary-cli.js index f10d81b69..6eb1e5935 100644 --- a/e2e-tests/helpers/boundary-cli.js +++ b/e2e-tests/helpers/boundary-cli.js @@ -9,6 +9,7 @@ export * from './boundary-cli/accounts.js'; export * from './boundary-cli/aliases.js'; export * from './boundary-cli/auth-methods.js'; export * from './boundary-cli/authenticate.js'; +export * from './boundary-cli/cache.js'; export * from './boundary-cli/connect.js'; export * from './boundary-cli/credential-stores.js'; export * from './boundary-cli/credentials.js'; diff --git a/e2e-tests/helpers/boundary-cli/cache.js b/e2e-tests/helpers/boundary-cli/cache.js new file mode 100644 index 000000000..c5c08a609 --- /dev/null +++ b/e2e-tests/helpers/boundary-cli/cache.js @@ -0,0 +1,17 @@ +/** + * Copyright IBM Corp. 2021, 2026 + * SPDX-License-Identifier: BUSL-1.1 + */ + +import { execSync } from 'node:child_process'; + +/** + * Stops the boundary cache used by the desktop client + */ +export async function stopCache() { + try { + execSync('boundary cache stop'); + } catch (e) { + console.log(`${e.stderr}`); + } +} diff --git a/e2e-tests/package.json b/e2e-tests/package.json index 8895f4de2..c0e97d517 100644 --- a/e2e-tests/package.json +++ b/e2e-tests/package.json @@ -25,6 +25,7 @@ "admin:dev:firefox": "pnpm run admin --project=firefox --headed", "admin:dev:safari": "pnpm run admin --project=webkit --headed", "desktop": "pnpm run --filter desktop build && pnpm run desktop:dev", + "desktop:local": "SETUP_CLI=true pnpm run desktop", "desktop:dev": "pnpm playwright test --config desktop/playwright.config.js --reporter=html" }, "devDependencies": {