diff --git a/e2e-tests/smoketest.spec.ts b/e2e-tests/smoketest.spec.ts index 8086f2a..4e928e0 100644 --- a/e2e-tests/smoketest.spec.ts +++ b/e2e-tests/smoketest.spec.ts @@ -35,15 +35,6 @@ test.beforeEach(async ({ context }) => { await context.route(/.(css|js|svg|png|jpg|woff2|otf|webp|ttf|json)(?:\?.*)?$/, async route => route.abort()) }) -test.afterEach(async ({ page }) => { - test.setTimeout(2 * 60 * 1000) // 2 minutes - const result = await page.request.post(`http://localhost:${PORT}/api/v0/repo/gc`) - expect(result?.status()).toBe(200) - - const maybeContent = await result?.text() - expect(maybeContent).toEqual('OK') -}) - pages.forEach((pagePath) => { const url = `http://${pagePath}.ipns.localhost:${PORT}` test(`helia-http-gateway can load path '${url}'`, async ({ page }) => { diff --git a/package.json b/package.json index 4cd33de..767eb8a 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,8 @@ "lint": "aegir lint", "build": "aegir build --bundle false", "start": "node --trace-warnings dist/src/index.js", + "start:env-dr": "node -r dotenv/config --trace-warnings dist/src/index.js dotenv_config_path=./.env-delegated-routing", + "start:env-to": "node -r dotenv/config --trace-warnings dist/src/index.js dotenv_config_path=./.env-trustless-only", "start:dev": "npm run build && node dist/src/index.js", "start:dev-trace": "npm run build && node --trace-warnings dist/src/index.js", "start:dev-doctor": "npm run build && npx clinic doctor --name playwright -- node dist/src/index.js", diff --git a/playwright.config.ts b/playwright.config.ts index 6e49823..fd383bf 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -2,6 +2,14 @@ import { join } from 'node:path' import { defineConfig, devices } from '@playwright/test' import { PORT } from './src/constants.js' +/** + * Run one of the variants of `npm run start` by setting the PLAYWRIGHT_START_CMD_MOD environment variable. + * + * For example, to run `npm run start:dev-doctor`: `PLAYWRIGHT_START_CMD_MOD=:dev-doctor npm run test:e2e` + * For example, to run `npm run start:env-to`: `PLAYWRIGHT_START_CMD_MOD=:env-to npm run test:e2e` + */ +const PLAYWRIGHT_START_CMD_MOD = process.env.PLAYWRIGHT_START_CMD_MOD ?? '' + /** * See https://playwright.dev/docs/test-configuration. */ @@ -51,13 +59,12 @@ export default defineConfig({ /* Run your local dev server before starting the tests */ webServer: { - command: (process.env.DOCTOR != null) ? 'npm run start:dev-doctor' : 'npm run start:dev', + command: `npm run build && npm run start${PLAYWRIGHT_START_CMD_MOD}`, port: PORT, // Tiros does not re-use the existing server. reuseExistingServer: process.env.CI == null, env: { DEBUG: process.env.DEBUG ?? ' ', - USE_BITSWAP: 'false', // we save to the filesystem so github CI can cache the data. FILE_BLOCKSTORE_PATH: join(process.cwd(), 'test', 'fixtures', 'e2e', 'blockstore'), FILE_DATASTORE_PATH: join(process.cwd(), 'test', 'fixtures', 'e2e', 'datastore')