@ui5/webcomponents-tools 0.0.0-f734ea2da → 0.0.0-f79db712b

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