forked from cerner/terra-application
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wdio.conf.js
43 lines (37 loc) · 1.37 KB
/
wdio.conf.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
// eslint-disable-next-line import/no-extraneous-dependencies
const { config } = require('@cerner/terra-functional-testing');
const defaultBefore = config.before;
config.before = () => {
if (defaultBefore) {
defaultBefore();
}
global.browser.addCommand('disableCSSAnimations', () => {
global.browser.execute(`
if (!document.getElementById('wdio-animation-override')) {
var animationOverride = document.createElement('style');
animationOverride.id = 'wdio-animation-override';
animationOverride.appendChild(document.createTextNode('body * { animation: none !important; }'));
document.head.appendChild(animationOverride);
}
`);
});
global.browser.addCommand('enableCSSAnimations', () => {
global.browser.execute(`
var animationOverride = document.getElementById('wdio-animation-override');
if (animationOverride) {
animationOverride.parentNode.removeChild(animationOverride);
}
`);
});
global.browser.addCommand('clickWithTestId', (testId) => {
const selector = global.browser.$(`[data-testid="${testId}"]`);
selector.waitForDisplayed();
selector.click();
});
global.browser.addCommand('clickWithAttribute', (key, value) => {
const selector = global.browser.$(`[${key}=${value}]`);
selector.waitForDisplayed();
selector.click();
});
};
exports.config = config;