@ui5/webcomponents-tools 1.24.0 → 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +271 -0
- package/components-package/nps.js +4 -11
- package/components-package/wdio.js +404 -405
- package/icons-collection/nps.js +2 -2
- package/lib/create-new-component/index.js +4 -11
- package/lib/generate-json-imports/i18n.js +3 -35
- package/lib/generate-json-imports/themes.js +2 -29
- package/lib/i18n/defaults.js +1 -1
- package/package.json +2 -3
- package/components-package/wdio.sync.js +0 -368
- package/lib/create-new-component/jsFileContentTemplate.js +0 -73
- package/lib/generate-custom-elements-manifest/index.js +0 -271
- package/lib/jsdoc/config.json +0 -29
- package/lib/jsdoc/configTypescript.json +0 -29
- package/lib/jsdoc/plugin.js +0 -2468
- package/lib/jsdoc/preprocess.js +0 -146
- package/lib/jsdoc/template/publish.js +0 -4120
@@ -1,405 +1,404 @@
|
|
1
|
-
const dns = require("node:dns");
|
2
|
-
|
3
|
-
exports.config = {
|
4
|
-
//
|
5
|
-
// ====================
|
6
|
-
// Runner Configuration
|
7
|
-
// ====================
|
8
|
-
//
|
9
|
-
// WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or
|
10
|
-
// on a remote machine).
|
11
|
-
runner: 'local',
|
12
|
-
|
13
|
-
//
|
14
|
-
// ==================
|
15
|
-
// Specify Test Files
|
16
|
-
// ==================
|
17
|
-
// Define which test specs should run. The pattern is relative to the directory
|
18
|
-
// from which `wdio` was called. Notice that, if you are calling `wdio` from an
|
19
|
-
// NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
|
20
|
-
// directory is where your package.json resides, so `wdio` will be called from there.
|
21
|
-
//
|
22
|
-
specs: [
|
23
|
-
'./test/specs/**/*.js'
|
24
|
-
],
|
25
|
-
// Patterns to exclude.
|
26
|
-
exclude: [
|
27
|
-
// 'path/to/excluded/files'
|
28
|
-
],
|
29
|
-
//
|
30
|
-
// ============
|
31
|
-
// Capabilities
|
32
|
-
// ============
|
33
|
-
// Define your capabilities here. WebdriverIO can run multiple capabilities at the same
|
34
|
-
// time. Depending on the number of capabilities, WebdriverIO launches several test
|
35
|
-
// sessions. Within your capabilities you can overwrite the spec and exclude options in
|
36
|
-
// order to group specific specs to a specific capability.
|
37
|
-
//
|
38
|
-
// First, you can define how many instances should be started at the same time. Let's
|
39
|
-
// say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
|
40
|
-
// set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
|
41
|
-
// files and you set maxInstances to 10, all spec files will get tested at the same time
|
42
|
-
// and 30 processes will get spawned. The property handles how many capabilities
|
43
|
-
// from the same test should run tests.
|
44
|
-
//
|
45
|
-
maxInstances: 10,
|
46
|
-
//
|
47
|
-
// If you have trouble getting all important capabilities together, check out the
|
48
|
-
// Sauce Labs platform configurator - a great tool to configure your capabilities:
|
49
|
-
// https://docs.saucelabs.com/reference/platforms-configurator
|
50
|
-
//
|
51
|
-
capabilities: [{
|
52
|
-
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
|
53
|
-
// grid with only 5 firefox instances available you can make sure that not more than
|
54
|
-
// 5 instances get started at a time.
|
55
|
-
maxInstances: 5,
|
56
|
-
//
|
57
|
-
browserName: 'chrome',
|
58
|
-
'goog:chromeOptions': {
|
59
|
-
// to run chrome headless the following flags are required
|
60
|
-
// (see https://developers.google.com/web/updates/2017/04/headless-chrome)
|
61
|
-
args: [
|
62
|
-
'--headless',
|
63
|
-
'--start-maximized',
|
64
|
-
'--no-sandbox',
|
65
|
-
'--disable-gpu',
|
66
|
-
'--disable-infobars',
|
67
|
-
'--disable-extensions',
|
68
|
-
'--disable-dev-shm-usage',
|
69
|
-
],
|
70
|
-
// args: ['--disable-gpu'],
|
71
|
-
}
|
72
|
-
}],
|
73
|
-
//
|
74
|
-
// port to find chromedriver
|
75
|
-
port: 9515, // default
|
76
|
-
// ===================
|
77
|
-
// Test Configurations
|
78
|
-
// ===================
|
79
|
-
// Define all options that are relevant for the WebdriverIO instance here
|
80
|
-
//
|
81
|
-
// Level of logging verbosity: trace | debug | info | warn | error
|
82
|
-
logLevel: 'error',
|
83
|
-
//
|
84
|
-
// Warns when a deprecated command is used
|
85
|
-
deprecationWarnings: true,
|
86
|
-
//
|
87
|
-
// If you only want to run your tests until a specific amount of tests have failed use
|
88
|
-
// bail (default is 0 - don't bail, run all tests).
|
89
|
-
bail: 0,
|
90
|
-
//
|
91
|
-
// Set a base URL in order to shorten url command calls. If your `url` parameter starts
|
92
|
-
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
93
|
-
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
94
|
-
// gets prepended directly.
|
95
|
-
baseUrl: 'http://localhost:4567', // This is important since WDIO 7+ does not accept an empty string for baseUrl
|
96
|
-
path: '',
|
97
|
-
//
|
98
|
-
// Default timeout for all waitFor* commands.
|
99
|
-
waitforTimeout: 10000,
|
100
|
-
//
|
101
|
-
// Default timeout in milliseconds for request
|
102
|
-
// if Selenium Grid doesn't send response
|
103
|
-
connectionRetryTimeout: 90000,
|
104
|
-
//
|
105
|
-
// Default request retries count
|
106
|
-
connectionRetryCount: 3,
|
107
|
-
//
|
108
|
-
// Test runner services
|
109
|
-
// Services take over a specific job you don't want to take care of. They enhance
|
110
|
-
// your test setup with almost no effort. Unlike plugins, they don't add new
|
111
|
-
// commands. Instead, they hook themselves up into the test process.
|
112
|
-
services: ['chromedriver', ['static-server', {
|
113
|
-
folders: [
|
114
|
-
{ mount: '/', path: './dist' },
|
115
|
-
],
|
116
|
-
port: '4567',
|
117
|
-
}],
|
118
|
-
],
|
119
|
-
// options
|
120
|
-
chromeDriverArgs: ['--port=9515'], // default
|
121
|
-
// Framework you want to run your specs with.
|
122
|
-
// The following are supported: Mocha, Jasmine, and Cucumber
|
123
|
-
// see also: https://webdriver.io/docs/frameworks.html
|
124
|
-
//
|
125
|
-
// Make sure you have the wdio adapter package for the specific framework installed
|
126
|
-
// before running any tests.
|
127
|
-
framework: 'mocha',
|
128
|
-
//
|
129
|
-
// Test reporter for stdout.
|
130
|
-
// The only one supported by default is 'dot'
|
131
|
-
// see also: https://webdriver.io/docs/dot-reporter.html
|
132
|
-
reporters: ['dot', 'spec'],
|
133
|
-
|
134
|
-
//
|
135
|
-
// Options to be passed to Mocha.
|
136
|
-
// See the full list at http://mochajs.org/
|
137
|
-
mochaOpts: {
|
138
|
-
ui: 'bdd',
|
139
|
-
timeout: 60000
|
140
|
-
},
|
141
|
-
//
|
142
|
-
// =====
|
143
|
-
// Hooks
|
144
|
-
// =====
|
145
|
-
// WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
|
146
|
-
// it and to build services around it. You can either apply a single function or an array of
|
147
|
-
// methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
|
148
|
-
// resolved to continue.
|
149
|
-
/**
|
150
|
-
* Gets executed once before all workers get launched.
|
151
|
-
* @param {Object} config wdio configuration object
|
152
|
-
* @param {Array.<Object>} capabilities list of capabilities details
|
153
|
-
*/
|
154
|
-
// onPrepare: function (config, capabilities) {
|
155
|
-
// },
|
156
|
-
/**
|
157
|
-
* Gets executed just before initialising the webdriver session and test framework. It allows you
|
158
|
-
* to manipulate configurations depending on the capability or spec.
|
159
|
-
* @param {Object} config wdio configuration object
|
160
|
-
* @param {Array.<Object>} capabilities list of capabilities details
|
161
|
-
* @param {Array.<String>} specs List of spec file paths that are to be run
|
162
|
-
*/
|
163
|
-
// beforeSession: function (config, capabilities, specs) {
|
164
|
-
// },
|
165
|
-
beforeSession: () => {
|
166
|
-
dns.setDefaultResultOrder('ipv4first');
|
167
|
-
},
|
168
|
-
/**
|
169
|
-
* Gets executed before test execution begins. At this point you can access to all global
|
170
|
-
* variables like `browser`. It is the perfect place to define custom commands.
|
171
|
-
* @param {Array.<Object>} capabilities list of capabilities details
|
172
|
-
* @param {Array.<String>} specs List of spec file paths that are to be run
|
173
|
-
*/
|
174
|
-
before: async function (capabilities, specs) {
|
175
|
-
await browser.addCommand("isFocusedDeep", async function () {
|
176
|
-
return browser.executeAsync(function (elem, done) {
|
177
|
-
let activeElement = document.activeElement;
|
178
|
-
|
179
|
-
while (activeElement.shadowRoot) {
|
180
|
-
if (activeElement.shadowRoot.activeElement) {
|
181
|
-
activeElement = activeElement.shadowRoot.activeElement;
|
182
|
-
} else {
|
183
|
-
break;
|
184
|
-
}
|
185
|
-
}
|
186
|
-
done(elem === activeElement);
|
187
|
-
}, this);
|
188
|
-
}, true);
|
189
|
-
|
190
|
-
await browser.addCommand("isFocusedDeepElement", async function (element) {
|
191
|
-
return browser.executeAsync(function (elem, element, done) {
|
192
|
-
let activeElement = document.activeElement;
|
193
|
-
|
194
|
-
while (activeElement.shadowRoot) {
|
195
|
-
if (activeElement.shadowRoot.activeElement) {
|
196
|
-
activeElement = activeElement.shadowRoot.activeElement;
|
197
|
-
} else {
|
198
|
-
break;
|
199
|
-
}
|
200
|
-
}
|
201
|
-
done(element === activeElement);
|
202
|
-
}, this, element);
|
203
|
-
}, true);
|
204
|
-
|
205
|
-
await browser.addCommand("setProperty", async function(property, value) {
|
206
|
-
return browser.executeAsync((elem, property, value, done) => {
|
207
|
-
elem[property] = value;
|
208
|
-
done();
|
209
|
-
}, this, property, value);
|
210
|
-
}, true);
|
211
|
-
|
212
|
-
await browser.addCommand("setAttribute", async function(attribute, value) {
|
213
|
-
return browser.executeAsync((elem, attribute, value, done) => {
|
214
|
-
elem.setAttribute(attribute, value);
|
215
|
-
done();
|
216
|
-
}, this, attribute, value);
|
217
|
-
}, true);
|
218
|
-
|
219
|
-
await browser.addCommand("removeAttribute", async function(attribute) {
|
220
|
-
return browser.executeAsync((elem, attribute, done) => {
|
221
|
-
elem.removeAttribute(attribute);
|
222
|
-
done();
|
223
|
-
}, this, attribute);
|
224
|
-
}, true);
|
225
|
-
|
226
|
-
await browser.addCommand("hasClass", async function(className) {
|
227
|
-
return browser.executeAsync((elem, className, done) => {
|
228
|
-
done(elem.classList.contains(className));
|
229
|
-
}, this, className);
|
230
|
-
}, true);
|
231
|
-
|
232
|
-
await browser.addCommand("hasAttribute", async function(attrName) {
|
233
|
-
return browser.executeAsync((elem, attrName, done) => {
|
234
|
-
done(elem.hasAttribute(attrName));
|
235
|
-
}, this, attrName);
|
236
|
-
}, true);
|
237
|
-
|
238
|
-
await browser.addCommand("
|
239
|
-
return browser.executeAsync(
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
*
|
251
|
-
* @param {
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
"
|
257
|
-
"
|
258
|
-
"
|
259
|
-
"
|
260
|
-
"getCSSProperty",
|
261
|
-
"getHTML",
|
262
|
-
"getProperty",
|
263
|
-
"getSize",
|
264
|
-
"
|
265
|
-
"
|
266
|
-
"
|
267
|
-
"
|
268
|
-
"
|
269
|
-
"
|
270
|
-
"
|
271
|
-
"
|
272
|
-
"
|
273
|
-
"
|
274
|
-
"
|
275
|
-
"shadow
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
*
|
287
|
-
|
288
|
-
|
289
|
-
//
|
290
|
-
|
291
|
-
|
292
|
-
*
|
293
|
-
|
294
|
-
|
295
|
-
//
|
296
|
-
|
297
|
-
|
298
|
-
*
|
299
|
-
|
300
|
-
|
301
|
-
//
|
302
|
-
|
303
|
-
|
304
|
-
*
|
305
|
-
|
306
|
-
|
307
|
-
//
|
308
|
-
|
309
|
-
|
310
|
-
*
|
311
|
-
|
312
|
-
|
313
|
-
//
|
314
|
-
|
315
|
-
|
316
|
-
*
|
317
|
-
|
318
|
-
|
319
|
-
//
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
*
|
324
|
-
* @param {
|
325
|
-
* @param {
|
326
|
-
* @param {
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
"
|
341
|
-
"
|
342
|
-
"
|
343
|
-
"
|
344
|
-
"
|
345
|
-
"
|
346
|
-
"
|
347
|
-
"
|
348
|
-
"
|
349
|
-
"
|
350
|
-
"
|
351
|
-
"
|
352
|
-
"
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
*
|
374
|
-
*
|
375
|
-
* @param {
|
376
|
-
* @param {Array.<
|
377
|
-
|
378
|
-
|
379
|
-
//
|
380
|
-
|
381
|
-
|
382
|
-
*
|
383
|
-
* @param {Object}
|
384
|
-
* @param {Array.<
|
385
|
-
|
386
|
-
|
387
|
-
//
|
388
|
-
|
389
|
-
|
390
|
-
*
|
391
|
-
* @param {Object}
|
392
|
-
* @param {Object}
|
393
|
-
* @param {
|
394
|
-
|
395
|
-
|
396
|
-
//
|
397
|
-
|
398
|
-
|
399
|
-
*
|
400
|
-
* @param {String}
|
401
|
-
|
402
|
-
|
403
|
-
//
|
404
|
-
|
405
|
-
}
|
1
|
+
const dns = require("node:dns");
|
2
|
+
|
3
|
+
exports.config = {
|
4
|
+
//
|
5
|
+
// ====================
|
6
|
+
// Runner Configuration
|
7
|
+
// ====================
|
8
|
+
//
|
9
|
+
// WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or
|
10
|
+
// on a remote machine).
|
11
|
+
runner: 'local',
|
12
|
+
|
13
|
+
//
|
14
|
+
// ==================
|
15
|
+
// Specify Test Files
|
16
|
+
// ==================
|
17
|
+
// Define which test specs should run. The pattern is relative to the directory
|
18
|
+
// from which `wdio` was called. Notice that, if you are calling `wdio` from an
|
19
|
+
// NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
|
20
|
+
// directory is where your package.json resides, so `wdio` will be called from there.
|
21
|
+
//
|
22
|
+
specs: [
|
23
|
+
'./test/specs/**/*.js'
|
24
|
+
],
|
25
|
+
// Patterns to exclude.
|
26
|
+
exclude: [
|
27
|
+
// 'path/to/excluded/files'
|
28
|
+
],
|
29
|
+
//
|
30
|
+
// ============
|
31
|
+
// Capabilities
|
32
|
+
// ============
|
33
|
+
// Define your capabilities here. WebdriverIO can run multiple capabilities at the same
|
34
|
+
// time. Depending on the number of capabilities, WebdriverIO launches several test
|
35
|
+
// sessions. Within your capabilities you can overwrite the spec and exclude options in
|
36
|
+
// order to group specific specs to a specific capability.
|
37
|
+
//
|
38
|
+
// First, you can define how many instances should be started at the same time. Let's
|
39
|
+
// say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
|
40
|
+
// set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
|
41
|
+
// files and you set maxInstances to 10, all spec files will get tested at the same time
|
42
|
+
// and 30 processes will get spawned. The property handles how many capabilities
|
43
|
+
// from the same test should run tests.
|
44
|
+
//
|
45
|
+
maxInstances: 10,
|
46
|
+
//
|
47
|
+
// If you have trouble getting all important capabilities together, check out the
|
48
|
+
// Sauce Labs platform configurator - a great tool to configure your capabilities:
|
49
|
+
// https://docs.saucelabs.com/reference/platforms-configurator
|
50
|
+
//
|
51
|
+
capabilities: [{
|
52
|
+
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
|
53
|
+
// grid with only 5 firefox instances available you can make sure that not more than
|
54
|
+
// 5 instances get started at a time.
|
55
|
+
maxInstances: 5,
|
56
|
+
//
|
57
|
+
browserName: 'chrome',
|
58
|
+
'goog:chromeOptions': {
|
59
|
+
// to run chrome headless the following flags are required
|
60
|
+
// (see https://developers.google.com/web/updates/2017/04/headless-chrome)
|
61
|
+
args: [
|
62
|
+
'--headless',
|
63
|
+
'--start-maximized',
|
64
|
+
'--no-sandbox',
|
65
|
+
'--disable-gpu',
|
66
|
+
'--disable-infobars',
|
67
|
+
'--disable-extensions',
|
68
|
+
'--disable-dev-shm-usage',
|
69
|
+
],
|
70
|
+
// args: ['--disable-gpu'],
|
71
|
+
}
|
72
|
+
}],
|
73
|
+
//
|
74
|
+
// port to find chromedriver
|
75
|
+
port: 9515, // default
|
76
|
+
// ===================
|
77
|
+
// Test Configurations
|
78
|
+
// ===================
|
79
|
+
// Define all options that are relevant for the WebdriverIO instance here
|
80
|
+
//
|
81
|
+
// Level of logging verbosity: trace | debug | info | warn | error
|
82
|
+
logLevel: 'error',
|
83
|
+
//
|
84
|
+
// Warns when a deprecated command is used
|
85
|
+
deprecationWarnings: true,
|
86
|
+
//
|
87
|
+
// If you only want to run your tests until a specific amount of tests have failed use
|
88
|
+
// bail (default is 0 - don't bail, run all tests).
|
89
|
+
bail: 0,
|
90
|
+
//
|
91
|
+
// Set a base URL in order to shorten url command calls. If your `url` parameter starts
|
92
|
+
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
93
|
+
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
94
|
+
// gets prepended directly.
|
95
|
+
baseUrl: 'http://localhost:4567', // This is important since WDIO 7+ does not accept an empty string for baseUrl
|
96
|
+
path: '',
|
97
|
+
//
|
98
|
+
// Default timeout for all waitFor* commands.
|
99
|
+
waitforTimeout: 10000,
|
100
|
+
//
|
101
|
+
// Default timeout in milliseconds for request
|
102
|
+
// if Selenium Grid doesn't send response
|
103
|
+
connectionRetryTimeout: 90000,
|
104
|
+
//
|
105
|
+
// Default request retries count
|
106
|
+
connectionRetryCount: 3,
|
107
|
+
//
|
108
|
+
// Test runner services
|
109
|
+
// Services take over a specific job you don't want to take care of. They enhance
|
110
|
+
// your test setup with almost no effort. Unlike plugins, they don't add new
|
111
|
+
// commands. Instead, they hook themselves up into the test process.
|
112
|
+
services: ['chromedriver', ['static-server', {
|
113
|
+
folders: [
|
114
|
+
{ mount: '/', path: './dist' },
|
115
|
+
],
|
116
|
+
port: '4567',
|
117
|
+
}],
|
118
|
+
],
|
119
|
+
// options
|
120
|
+
chromeDriverArgs: ['--port=9515'], // default
|
121
|
+
// Framework you want to run your specs with.
|
122
|
+
// The following are supported: Mocha, Jasmine, and Cucumber
|
123
|
+
// see also: https://webdriver.io/docs/frameworks.html
|
124
|
+
//
|
125
|
+
// Make sure you have the wdio adapter package for the specific framework installed
|
126
|
+
// before running any tests.
|
127
|
+
framework: 'mocha',
|
128
|
+
//
|
129
|
+
// Test reporter for stdout.
|
130
|
+
// The only one supported by default is 'dot'
|
131
|
+
// see also: https://webdriver.io/docs/dot-reporter.html
|
132
|
+
reporters: ['dot', 'spec'],
|
133
|
+
|
134
|
+
//
|
135
|
+
// Options to be passed to Mocha.
|
136
|
+
// See the full list at http://mochajs.org/
|
137
|
+
mochaOpts: {
|
138
|
+
ui: 'bdd',
|
139
|
+
timeout: 60000
|
140
|
+
},
|
141
|
+
//
|
142
|
+
// =====
|
143
|
+
// Hooks
|
144
|
+
// =====
|
145
|
+
// WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
|
146
|
+
// it and to build services around it. You can either apply a single function or an array of
|
147
|
+
// methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
|
148
|
+
// resolved to continue.
|
149
|
+
/**
|
150
|
+
* Gets executed once before all workers get launched.
|
151
|
+
* @param {Object} config wdio configuration object
|
152
|
+
* @param {Array.<Object>} capabilities list of capabilities details
|
153
|
+
*/
|
154
|
+
// onPrepare: function (config, capabilities) {
|
155
|
+
// },
|
156
|
+
/**
|
157
|
+
* Gets executed just before initialising the webdriver session and test framework. It allows you
|
158
|
+
* to manipulate configurations depending on the capability or spec.
|
159
|
+
* @param {Object} config wdio configuration object
|
160
|
+
* @param {Array.<Object>} capabilities list of capabilities details
|
161
|
+
* @param {Array.<String>} specs List of spec file paths that are to be run
|
162
|
+
*/
|
163
|
+
// beforeSession: function (config, capabilities, specs) {
|
164
|
+
// },
|
165
|
+
beforeSession: () => {
|
166
|
+
dns.setDefaultResultOrder('ipv4first');
|
167
|
+
},
|
168
|
+
/**
|
169
|
+
* Gets executed before test execution begins. At this point you can access to all global
|
170
|
+
* variables like `browser`. It is the perfect place to define custom commands.
|
171
|
+
* @param {Array.<Object>} capabilities list of capabilities details
|
172
|
+
* @param {Array.<String>} specs List of spec file paths that are to be run
|
173
|
+
*/
|
174
|
+
before: async function (capabilities, specs) {
|
175
|
+
await browser.addCommand("isFocusedDeep", async function () {
|
176
|
+
return browser.executeAsync(function (elem, done) {
|
177
|
+
let activeElement = document.activeElement;
|
178
|
+
|
179
|
+
while (activeElement.shadowRoot) {
|
180
|
+
if (activeElement.shadowRoot.activeElement) {
|
181
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
182
|
+
} else {
|
183
|
+
break;
|
184
|
+
}
|
185
|
+
}
|
186
|
+
done(elem === activeElement);
|
187
|
+
}, this);
|
188
|
+
}, true);
|
189
|
+
|
190
|
+
await browser.addCommand("isFocusedDeepElement", async function (element) {
|
191
|
+
return browser.executeAsync(function (elem, element, done) {
|
192
|
+
let activeElement = document.activeElement;
|
193
|
+
|
194
|
+
while (activeElement.shadowRoot) {
|
195
|
+
if (activeElement.shadowRoot.activeElement) {
|
196
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
197
|
+
} else {
|
198
|
+
break;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
done(element === activeElement);
|
202
|
+
}, this, element);
|
203
|
+
}, true);
|
204
|
+
|
205
|
+
await browser.addCommand("setProperty", async function(property, value) {
|
206
|
+
return browser.executeAsync((elem, property, value, done) => {
|
207
|
+
elem[property] = value;
|
208
|
+
done();
|
209
|
+
}, this, property, value);
|
210
|
+
}, true);
|
211
|
+
|
212
|
+
await browser.addCommand("setAttribute", async function(attribute, value) {
|
213
|
+
return browser.executeAsync((elem, attribute, value, done) => {
|
214
|
+
elem.setAttribute(attribute, value);
|
215
|
+
done();
|
216
|
+
}, this, attribute, value);
|
217
|
+
}, true);
|
218
|
+
|
219
|
+
await browser.addCommand("removeAttribute", async function(attribute) {
|
220
|
+
return browser.executeAsync((elem, attribute, done) => {
|
221
|
+
elem.removeAttribute(attribute);
|
222
|
+
done();
|
223
|
+
}, this, attribute);
|
224
|
+
}, true);
|
225
|
+
|
226
|
+
await browser.addCommand("hasClass", async function(className) {
|
227
|
+
return browser.executeAsync((elem, className, done) => {
|
228
|
+
done(elem.classList.contains(className));
|
229
|
+
}, this, className);
|
230
|
+
}, true);
|
231
|
+
|
232
|
+
await browser.addCommand("hasAttribute", async function(attrName) {
|
233
|
+
return browser.executeAsync((elem, attrName, done) => {
|
234
|
+
done(elem.hasAttribute(attrName));
|
235
|
+
}, this, attrName);
|
236
|
+
}, true);
|
237
|
+
|
238
|
+
await browser.addCommand("matches", async function(selector) {
|
239
|
+
return browser.executeAsync((elem, selector, done) => {
|
240
|
+
done(elem.matches(selector));
|
241
|
+
}, this, selector);
|
242
|
+
}, true);
|
243
|
+
|
244
|
+
await browser.addLocatorStrategy('activeElement', (selector) => {
|
245
|
+
return document.querySelector(selector).shadowRoot.activeElement;
|
246
|
+
});
|
247
|
+
},
|
248
|
+
/**
|
249
|
+
* Runs before a WebdriverIO command gets executed.
|
250
|
+
* @param {String} commandName hook command name
|
251
|
+
* @param {Array} args arguments that command would receive
|
252
|
+
*/
|
253
|
+
beforeCommand: async function (commandName, args) {
|
254
|
+
const waitFor = [
|
255
|
+
"$",
|
256
|
+
"$$",
|
257
|
+
"getAttribute",
|
258
|
+
"hasAttribute", // custom
|
259
|
+
"matches", // custom
|
260
|
+
"getCSSProperty",
|
261
|
+
"getHTML",
|
262
|
+
"getProperty",
|
263
|
+
"getSize",
|
264
|
+
"getText",
|
265
|
+
"getValue",
|
266
|
+
"hasClass", // custom
|
267
|
+
"isDisplayed",
|
268
|
+
"isDisplayedInViewport",
|
269
|
+
"isEnabled",
|
270
|
+
"isExisting",
|
271
|
+
"isFocused",
|
272
|
+
"isFocusedDeep", // custom
|
273
|
+
"isFocusedDeepElement", // custom
|
274
|
+
"shadow$",
|
275
|
+
"shadow$$"
|
276
|
+
];
|
277
|
+
if (waitFor.includes(commandName)) {
|
278
|
+
await browser.executeAsync(function (done) {
|
279
|
+
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
280
|
+
});
|
281
|
+
}
|
282
|
+
},
|
283
|
+
|
284
|
+
/**
|
285
|
+
* Hook that gets executed before the suite starts
|
286
|
+
* @param {Object} suite suite details
|
287
|
+
*/
|
288
|
+
// beforeSuite: function (suite) {
|
289
|
+
// },
|
290
|
+
/**
|
291
|
+
* Function to be executed before a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
|
292
|
+
* @param {Object} test test details
|
293
|
+
*/
|
294
|
+
// beforeTest: function (test) {
|
295
|
+
// },
|
296
|
+
/**
|
297
|
+
* Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
|
298
|
+
* beforeEach in Mocha)
|
299
|
+
*/
|
300
|
+
// beforeHook: function () {
|
301
|
+
// },
|
302
|
+
/**
|
303
|
+
* Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
|
304
|
+
* afterEach in Mocha)
|
305
|
+
*/
|
306
|
+
// afterHook: function () {
|
307
|
+
// },
|
308
|
+
/**
|
309
|
+
* Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
|
310
|
+
* @param {Object} test test details
|
311
|
+
*/
|
312
|
+
// afterTest: function (test) {
|
313
|
+
// },
|
314
|
+
/**
|
315
|
+
* Hook that gets executed after the suite has ended
|
316
|
+
* @param {Object} suite suite details
|
317
|
+
*/
|
318
|
+
// afterSuite: function (suite) {
|
319
|
+
// },
|
320
|
+
|
321
|
+
/**
|
322
|
+
* Runs after a WebdriverIO command gets executed
|
323
|
+
* @param {String} commandName hook command name
|
324
|
+
* @param {Array} args arguments that command would receive
|
325
|
+
* @param {Number} result 0 - command success, 1 - command error
|
326
|
+
* @param {Object} error error object if any
|
327
|
+
*/
|
328
|
+
afterCommand: async function (commandName, args, result, error) {
|
329
|
+
|
330
|
+
// url -> set configuration first
|
331
|
+
if (commandName === "url" && !args[0].includes("do-not-change-configuration")) {
|
332
|
+
await browser.executeAsync(function(done) {
|
333
|
+
window["sap-ui-webcomponents-bundle"].configuration.setNoConflict(true);
|
334
|
+
done();
|
335
|
+
});
|
336
|
+
}
|
337
|
+
|
338
|
+
const waitFor = [
|
339
|
+
"addValue",
|
340
|
+
"clearValue",
|
341
|
+
"click",
|
342
|
+
"doubleClick",
|
343
|
+
"dragAndDrop",
|
344
|
+
"pause",
|
345
|
+
"removeAttribute", // custom
|
346
|
+
"scrollIntoView",
|
347
|
+
"setAttribute", // custom
|
348
|
+
"setProperty", // custom
|
349
|
+
"setValue",
|
350
|
+
"setWindowSize",
|
351
|
+
"touchAction",
|
352
|
+
"url",
|
353
|
+
];
|
354
|
+
|
355
|
+
const waitForWithDelay = [
|
356
|
+
"keys",
|
357
|
+
];
|
358
|
+
|
359
|
+
if (waitFor.includes(commandName)) {
|
360
|
+
await browser.executeAsync(function (done) {
|
361
|
+
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
362
|
+
});
|
363
|
+
} else if (waitForWithDelay.includes(commandName)) {
|
364
|
+
await browser.executeAsync(function (done) {
|
365
|
+
setTimeout(() => {
|
366
|
+
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
367
|
+
}, 10);
|
368
|
+
});
|
369
|
+
}
|
370
|
+
},
|
371
|
+
/**
|
372
|
+
* Gets executed after all tests are done. You still have access to all global variables from
|
373
|
+
* the test.
|
374
|
+
* @param {Number} result 0 - test pass, 1 - test fail
|
375
|
+
* @param {Array.<Object>} capabilities list of capabilities details
|
376
|
+
* @param {Array.<String>} specs List of spec file paths that ran
|
377
|
+
*/
|
378
|
+
// after: function (result, capabilities, specs) {
|
379
|
+
// },
|
380
|
+
/**
|
381
|
+
* Gets executed right after terminating the webdriver session.
|
382
|
+
* @param {Object} config wdio configuration object
|
383
|
+
* @param {Array.<Object>} capabilities list of capabilities details
|
384
|
+
* @param {Array.<String>} specs List of spec file paths that ran
|
385
|
+
*/
|
386
|
+
// afterSession: function (config, capabilities, specs) {
|
387
|
+
// },
|
388
|
+
/**
|
389
|
+
* Gets executed after all workers got shut down and the process is about to exit.
|
390
|
+
* @param {Object} exitCode 0 - success, 1 - fail
|
391
|
+
* @param {Object} config wdio configuration object
|
392
|
+
* @param {Array.<Object>} capabilities list of capabilities details
|
393
|
+
* @param {<Object>} results object containing test results
|
394
|
+
*/
|
395
|
+
// onComplete: function(exitCode, config, capabilities, results) {
|
396
|
+
// },
|
397
|
+
/**
|
398
|
+
* Gets executed when a refresh happens.
|
399
|
+
* @param {String} oldSessionId session ID of the old session
|
400
|
+
* @param {String} newSessionId session ID of the new session
|
401
|
+
*/
|
402
|
+
//onReload: function(oldSessionId, newSessionId) {
|
403
|
+
//}
|
404
|
+
}
|