-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp-fixtures.ts
34 lines (31 loc) · 1.09 KB
/
app-fixtures.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { test as baseTest } from "@playwright/test";
import {
collectV8CodeCoverageAsync,
CollectV8CodeCoverageOptions,
} from "tests/_shared/fixtures/v8-code-coverage";
// re-exporting the default expect as well so that on the tests we can have
// a single import for expect and test, but the test will be the extended test below
export { expect } from "@playwright/test";
// See https://playwright.dev/docs/test-fixtures and https://playwright.dev/docs/test-parameterize
interface AppFixtures {
codeCoverageAutoTestFixture: void;
}
// Export the extended test type.
// All tests that use this export 'test' type will have the automatic fixture applied to them.
export const test = baseTest.extend<AppFixtures>({
codeCoverageAutoTestFixture: [
async ({ browser, page }, use): Promise<void> => {
const options: CollectV8CodeCoverageOptions = {
browserType: browser.browserType(),
page: page,
use: use,
enableJsCoverage: true,
enableCssCoverage: true,
};
await collectV8CodeCoverageAsync(options);
},
{
auto: true,
},
],
});