diff --git a/_playwright-tests/test-utils/package.json b/_playwright-tests/test-utils/package.json index ac1746761..0f156ba3f 100644 --- a/_playwright-tests/test-utils/package.json +++ b/_playwright-tests/test-utils/package.json @@ -8,7 +8,8 @@ "@types/pg": "^8.11.11" }, "peerDependencies": { - "@playwright/test": "^1.49.1" + "@playwright/test": "^1.49.1", + "@currents/playwright": "^1.7.0" }, - "_comment": "↑ @playwright/test is a peer dependency, it uses the consuming project's installation" + "_comment": "↑ @playwright/test and @currents/playwright are peer dependencies, using the consuming project's installation" } diff --git a/_playwright-tests/test-utils/src/fixtures/currents.ts b/_playwright-tests/test-utils/src/fixtures/currents.ts new file mode 100644 index 000000000..27d6550bc --- /dev/null +++ b/_playwright-tests/test-utils/src/fixtures/currents.ts @@ -0,0 +1,18 @@ +import { + CurrentsFixtures, + CurrentsWorkerFixtures, + fixtures as currentsFixtures, +} from '@currents/playwright'; +import { test as base } from '@playwright/test'; + +/** + * Currents.dev fixtures for automatic coverage collection and upload. + * + * When tests use this fixture and Currents is configured in playwright.config.ts, + * coverage data from window.__coverage__ will be automatically collected + * and uploaded to Currents.dev. + */ +export const currentsTest = base.extend({ + ...currentsFixtures.baseFixtures, + ...currentsFixtures.coverageFixtures, +}); diff --git a/_playwright-tests/test-utils/src/fixtures/index.ts b/_playwright-tests/test-utils/src/fixtures/index.ts index 27a350722..941ac96cc 100644 --- a/_playwright-tests/test-utils/src/fixtures/index.ts +++ b/_playwright-tests/test-utils/src/fixtures/index.ts @@ -2,6 +2,7 @@ export * from './blockAnalytics'; export * from './cleanup'; export * from './client'; export * from './coverage'; +export * from './currents'; export * from './db'; export * from './tokenRefresh'; export * from './test'; diff --git a/_playwright-tests/test-utils/src/fixtures/test.ts b/_playwright-tests/test-utils/src/fixtures/test.ts index b8fc69ed2..307e375c3 100644 --- a/_playwright-tests/test-utils/src/fixtures/test.ts +++ b/_playwright-tests/test-utils/src/fixtures/test.ts @@ -3,18 +3,20 @@ import { blockAnalyticsTest } from './blockAnalytics'; import { cleanupTest } from './cleanup'; import { clientTest } from './client'; import { coverageTest } from './coverage'; +import { currentsTest } from './currents'; import { databaseTest } from './db'; -import { unusedRepoUrlTest } from './unusedRepoUrl'; import { tokenRefreshTest } from './tokenRefresh'; +import { unusedRepoUrlTest } from './unusedRepoUrl'; export const test = mergeTests( + currentsTest, blockAnalyticsTest, clientTest, cleanupTest, coverageTest, databaseTest, - unusedRepoUrlTest, tokenRefreshTest, + unusedRepoUrlTest, ); export { expect } from '@playwright/test';