From 7fb3e0951c2d64b91ebfb1d7c401d9b423feb1ba Mon Sep 17 00:00:00 2001 From: DaevMithran Date: Thu, 25 Jul 2024 17:56:37 +0530 Subject: [PATCH] test: Add release test worflow --- .github/workflows/build.yml | 1 + playwright.config.ts | 18 ++++++++++++++++++ ...spec.ts => create-positive-release.spec.ts} | 0 ... => switch-controller-flow-release.spec.ts} | 0 4 files changed, 19 insertions(+) rename tests/e2e/did/{create-positive.spec.ts => create-positive-release.spec.ts} (100%) rename tests/e2e/did/{switch-controller-flow.spec.ts => switch-controller-flow-release.spec.ts} (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d2f71c94..7eb4c3d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,7 @@ jobs: run: npm run test env: CI: true + RELEASE: ${{ github.ref_name == 'develop' }} APPLICATION_BASE_URL: ${{ vars.APPLICATION_BASE_URL }} COOKIE_SECRET: ${{ secrets.COOKIE_SECRET }} ENABLE_AUTHENTICATION: ${{ vars.ENABLE_AUTHENTICATION }} diff --git a/playwright.config.ts b/playwright.config.ts index a25eee59..41a0d583 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -94,6 +94,24 @@ export default defineConfig({ }, dependencies: ['Setup unauthenticated user'], }, + ...(process.env.RELEASE === 'true' + ? [ + { + name: 'Release Logged In User Tests', + testMatch: /.*\.release.spec.ts/, + use: { + ...devices['Desktop Chrome'], + // Use prepared auth state. + storageState: STORAGE_STATE_AUTHENTICATED, + extraHTTPHeaders: { + // Add x-api-key token to all authenticated requests. + 'x-api-key': `${process.env.TEST_USER_API_KEY}`, + }, + }, + dependencies: ['Setup authenticated user'], + }, + ] + : []), ], // Timeout for each test in milliseconds diff --git a/tests/e2e/did/create-positive.spec.ts b/tests/e2e/did/create-positive-release.spec.ts similarity index 100% rename from tests/e2e/did/create-positive.spec.ts rename to tests/e2e/did/create-positive-release.spec.ts diff --git a/tests/e2e/did/switch-controller-flow.spec.ts b/tests/e2e/did/switch-controller-flow-release.spec.ts similarity index 100% rename from tests/e2e/did/switch-controller-flow.spec.ts rename to tests/e2e/did/switch-controller-flow-release.spec.ts