-
Notifications
You must be signed in to change notification settings - Fork 0
/
wdio.conf.ts
78 lines (67 loc) · 2.25 KB
/
wdio.conf.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
66
67
68
69
70
71
72
73
74
75
76
77
78
const isInDocker = !!process.env.IN_DOCKER,
isTeamCity = !!process.env.TEAMCITY_VERSION;
export const config: WebdriverIO.Config = {
// Use devtools to control Chrome when we're running tests locally
// Avoids issues with having the wrong ChromeDriver installed via selenium-standalone when Chrome updates every 6 weeks.
// We need to use webdriver protocol in Docker because we use the selenium grid.
automationProtocol: isInDocker ? "webdriver" : "devtools",
maxInstances: isInDocker ? 10 : 2,
path: "/wd/hub",
specs: ["./features/**/*.feature"],
capabilities: [
{
browserName: "chrome",
"goog:chromeOptions": {
args: ["--window-size=1366,768"].concat(isInDocker ? "--headless" : []),
},
},
],
logLevel: "error",
baseUrl: "http://localhost:5000/",
reporters: isTeamCity
? [
"spec",
"teamcity",
[
"allure",
{
useCucumberStepReporter: true,
// Turn on screenshot reporting for error shots
disableWebdriverScreenshotsReporting: false,
},
],
]
: ["spec"],
// Use BDD with Cucumber
framework: "cucumber",
cucumberOpts: {
require: [
"./steps/**/*.ts",
"./node_modules/@nice-digital/wdio-cucumber-steps/lib/index.js",
],
tagExpression: "not @pending", // See https://docs.cucumber.io/tag-expressions/
// Need quite a long timeout here because some of the Axe a11y tests take a while for longer pages (like A to Z)
timeout: 60000,
},
afterStep: async function (_test, _scenario, { error }) {
// Take screenshots on error, these end up in the Allure reports
if (error) await browser.takeScreenshot();
},
afterScenario: async function (_world, _result, _context) {
// Clear session storage after each test because Gatsby stores scroll
// positions of each page, which causes issues running multiple tests
// on the same page in the same browser instance when scrolling to links
// await browser.execute("sessionStorage.clear()");
//TODO window.sessionStorage required for wdio8 upgrade
await browser.execute("window.sessionStorage.clear()");
},
autoCompileOpts: {
autoCompile: true,
// see https://github.com/TypeStrong/ts-node#cli-and-programmatic-options
// for all available options
tsNodeOpts: {
transpileOnly: true,
project: "tsconfig.json",
},
},
};