-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplaywright.config.ts
More file actions
46 lines (41 loc) · 1.16 KB
/
playwright.config.ts
File metadata and controls
46 lines (41 loc) · 1.16 KB
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
import { expect, PlaywrightTestConfig } from '@playwright/test';
import { devices } from '@playwright/test';
require('dotenv').config();
const config: PlaywrightTestConfig = {
testDir: './tests',
/* Maximum time one test can run for. */
timeout: 30 * 1000,
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
* For example in `await expect(locator).toHaveText();`
*/
timeout: 50000
},
//reporter: 'html',
use: {
baseURL: process.env.URL,
extraHTTPHeaders:{
'Accept':'application/json',
'Authorization': `${process.env.TOKEN}`,
}
},
};
// Created a custom asseration for validating the API response code
expect.extend({
toBeWithinRange(received: number, firstnum: number, lastnum: number) {
const pass = received >= firstnum && received <= lastnum;
if (pass) {
return {
message: () => 'Test case is passed',
pass: true,
};
} else {
return {
message: () => `Test case is failed due to recived the status ${received}`,
pass: false,
};
}
},
});
export default config;