diff --git a/playwright.config.ts b/playwright.config.ts index 2afb9cf2c..f33f5817f 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -50,44 +50,26 @@ export default defineConfig({ video: 'on', }, projects: [ - { name: 'setup', testMatch: /auth\.setup\.ts/, use: { trace: 'off' } }, - ...(process.env.INTEGRATION - ? [ - { - name: 'Integration', - use: { - ...devices['Desktop Chrome'], - storageState: '.auth/ADMIN_TOKEN.json', - }, - testDir: './playwright/Integration/', - dependencies: ['setup'], - }, - ] - : [ - { - name: 'UI-default-user', - use: { - ...devices['Desktop Chrome'], - storageState: '.auth/ADMIN_TOKEN.json', - }, - testDir: './playwright/UI/', - testIgnore: ['**/AdvisoriesTests.spec.ts'], - dependencies: ['setup'], + { name: 'setup', testMatch: /.*\.setup\.ts/, use: { trace: 'off' } }, + process.env.INTEGRATION + ? { + name: 'Integration', + use: { + ...devices['Desktop Chrome'], + storageState: '.auth/ADMIN_TOKEN.json', }, - { - name: 'UI-advisory-remediation-user', - use: { - ...devices['Desktop Chrome'], - storageState: '.auth/ADVISORY_REMEDIATION_TOKEN.json', - extraHTTPHeaders: process.env.ADVISORY_REMEDIATION_TOKEN - ? { Authorization: process.env.ADVISORY_REMEDIATION_TOKEN } - : {}, - }, - testDir: './playwright/UI/', - testMatch: ['**/AdvisoriesTests.spec.ts'], - // Run after all default-user UI tests to prevent auth state conflicts - dependencies: ['setup', 'UI-default-user'], + testDir: './playwright/Integration/', + dependencies: ['setup'], + } + : + { + name: 'UI', + use: { + ...devices['Desktop Chrome'], + storageState: '.auth/ADMIN_TOKEN.json', }, - ]), + testDir: './playwright/UI/', + dependencies: ['setup'], + }, ], }); diff --git a/playwright/UI/AdvisoriesTests.spec.ts b/playwright/UI/AdvisoriesTests.spec.ts index 599c76188..59eb00f01 100644 --- a/playwright/UI/AdvisoriesTests.spec.ts +++ b/playwright/UI/AdvisoriesTests.spec.ts @@ -9,6 +9,13 @@ import { import { cleanupRemediationPlan } from 'test-utils/helpers/cleaners'; test.describe('Advisories Tests', () => { + test.use({ + storageState: '.auth/ADVISORY_REMEDIATION_TOKEN.json', + extraHTTPHeaders: process.env.ADVISORY_REMEDIATION_TOKEN + ? { Authorization: process.env.ADVISORY_REMEDIATION_TOKEN } + : {}, + }); + // Disable retries for this test, systems are not deleted immediately in patch so second attempt will likely fail test.describe.configure({ retries: 0 });