forked from wevote/WebApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wdio.config.local.js
95 lines (86 loc) · 2.47 KB
/
wdio.config.local.js
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const { driver } = require('@wdio/globals');
const { readFileSync } = require('fs');
const browserStackConfig = require('./browserstack.config');
const browserCapabilities = require('../capabilities/browser.json');
let mobileCapabilities = [];
try {
const data = readFileSync('./tests/browserstack_automation/capabilities/mobile.json', { encoding: 'utf8' });
mobileCapabilities = JSON.parse(data);
} catch (error) {
// Run `npm run wdio:setup`
}
const capabilities = [...browserCapabilities, ...mobileCapabilities];
const date = new Date();
const dateForDisplay = date.toDateString();
const buildName = `${browserStackConfig.NAME}: ${dateForDisplay}`;
// https://webdriver.io/docs/configurationfile
module.exports.config = {
user: browserStackConfig.BROWSERSTACK_USER,
key: browserStackConfig.BROWSERSTACK_KEY,
injectGlobals: false,
updateJob: true,
reporters: [
[
'spec',
{
onlyFailures: true,
},
],
],
specs: [
'../specs/DiscussPage.js',
'../specs/FAQPage.js',
'../specs/PrivacyPage.js',
'../specs/ReadyPage.js',
'../specs/TermsPage.js',
'../specs/TopNavigation.js',
],
capabilities,
commonCapabilities: {
'bstack:options': {
buildName,
debug: 'true',
// geoLocation is only available under Enterprise plans
// geoLocation: 'US-CA',
// gpsLocation is only available under Paid plans
// Oakland, CA, USA
gpsLocation: '37.804363,-122.271111',
maskCommands: 'setValues, getValues, setCookies, getCookies',
video: 'true',
},
},
maxInstances: 1,
exclude: [],
logLevel: 'error',
coloredLogs: true,
baseUrl: browserStackConfig.WEB_APP_ROOT_URL,
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 1,
services: [['browserstack',{browserstackLocal: true}]],
framework: 'mocha',
mochaOpts: {
ui: 'bdd',
timeout: 100000,
},
// https://webdriver.io/docs/customcommands#examples
before: function before () {
driver.addCommand('findAndClick', async function findAndClick () {
await this.waitForExist();
await this.moveTo();
await this.click();
}, true);
},
};
module.exports.config.capabilities.forEach((capability) => {
const device = capability;
const keys = Object.keys(device);
keys.forEach((key) => {
if (key in module.exports.config.commonCapabilities) {
device[key] = {
...device[key],
...module.exports.config.commonCapabilities[key],
};
}
});
});