forked from alexneo2003/playwright-azure-reporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
playwright.config.ts
65 lines (62 loc) · 2.04 KB
/
playwright.config.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { PlaywrightTestConfig } from '@playwright/test';
import { TestCase } from '@playwright/test/reporter';
import { TestPoint } from 'azure-devops-node-api/interfaces/TestInterfaces';
import azureConfig from './azure.config.json';
import { AzureReporterOptions } from './dist/playwright-azure-reporter';
/**
* See https://playwright.dev/docs/test-configuration.
*/
const config: PlaywrightTestConfig = {
testDir: './tests',
testIgnore: ['**/config/**', '**/reporter/**'],
timeout: 30 * 1000,
expect: {
timeout: 5000,
},
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [
['list'],
[
'./src/playwright-azure-reporter.ts',
{
orgUrl: azureConfig.orgUrl,
token: azureConfig.token,
planId: azureConfig.testPlanId,
projectName: azureConfig.projectName,
environment: 'AQA',
testRunTitle: 'Playwright Test Run',
uploadAttachments: true,
logging: true,
attachmentsType: ['screenshot', 'trace', /test.*/],
publishTestResultsMode: 'testRun',
testRunConfig: {
configurationIds: [1],
owner: {
displayName: 'Alex Neo',
},
comment: 'Playwright Test Run',
},
testPointMapper: async (testCase: TestCase, testPoints: TestPoint[]) => {
switch (testCase.parent.project()?.use.browserName) {
case 'chromium':
return testPoints.filter((testPoint) => testPoint.configuration.id === '3');
case 'firefox':
return testPoints.filter((testPoint) => testPoint.configuration.id === '4');
case 'webkit':
return testPoints.filter((testPoint) => testPoint.configuration.id === '5');
default:
throw new Error('invalid test configuration!');
}
},
} as AzureReporterOptions,
],
],
use: {
screenshot: 'only-on-failure',
actionTimeout: 0,
trace: 'retain-on-failure',
},
};
export default config;