@ui5/webcomponents-tools 0.0.0-78035f8e7 → 0.0.0-7d5f73b20
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 +358 -0
- package/README.md +5 -6
- package/assets-meta.js +18 -1
- package/bin/dev.js +1 -5
- package/components-package/eslint.js +28 -0
- package/components-package/nps.js +97 -40
- package/components-package/postcss.themes.js +6 -3
- package/components-package/vite.config.js +12 -0
- package/components-package/wdio.js +80 -31
- package/components-package/wdio.sync.js +360 -0
- package/icons-collection/nps.js +50 -11
- package/lib/copy-and-watch/index.js +30 -5
- package/lib/copy-list/index.js +28 -0
- package/lib/create-icons/index.js +101 -54
- package/lib/create-illustrations/index.js +161 -0
- package/lib/create-new-component/index.js +21 -9
- package/lib/dev-server/dev-server.js +66 -0
- package/lib/dev-server/virtual-index-html-plugin.js +53 -0
- package/lib/esm-abs-to-rel/index.js +58 -0
- package/lib/generate-custom-elements-manifest/index.js +327 -0
- package/lib/generate-js-imports/illustrations.js +72 -0
- package/lib/generate-json-imports/i18n.js +74 -32
- package/lib/generate-json-imports/themes.js +65 -18
- package/lib/hbs2lit/src/compiler.js +20 -3
- package/lib/hbs2lit/src/includesReplacer.js +5 -5
- package/lib/hbs2lit/src/litVisitor2.js +77 -14
- package/lib/hbs2lit/src/svgProcessor.js +3 -3
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +5 -5
- package/lib/hbs2ui5/index.js +50 -18
- package/lib/i18n/defaults.js +59 -57
- package/lib/i18n/toJSON.js +13 -12
- package/lib/jsdoc/config.json +1 -1
- package/lib/jsdoc/configTypescript.json +29 -0
- package/lib/jsdoc/plugin.js +62 -1
- package/lib/jsdoc/preprocess.js +146 -0
- package/lib/jsdoc/template/publish.js +30 -2
- package/lib/postcss-combine-duplicated-selectors/index.js +178 -0
- package/lib/postcss-css-to-esm/index.js +39 -18
- package/lib/postcss-css-to-json/index.js +31 -11
- package/lib/postcss-new-files/index.js +36 -0
- package/lib/postcss-p/postcss-p.mjs +14 -0
- package/lib/replace-global-core/index.js +25 -0
- package/lib/scoping/get-all-tags.js +37 -0
- package/lib/scoping/lint-src.js +31 -0
- package/lib/scoping/missing-dependencies.js +65 -0
- package/lib/scoping/report-tags-usage.js +28 -0
- package/lib/scoping/scope-test-pages.js +40 -0
- package/lib/test-runner/test-runner.js +63 -0
- package/package.json +45 -52
- package/bin/init-ui5-package.js +0 -3
- package/components-package/rollup.js +0 -134
- package/components-package/serve.json +0 -3
- package/lib/documentation/index.js +0 -143
- package/lib/documentation/templates/api-component-since.js +0 -3
- package/lib/documentation/templates/api-css-variables-section.js +0 -24
- package/lib/documentation/templates/api-events-section.js +0 -35
- package/lib/documentation/templates/api-methods-section.js +0 -26
- package/lib/documentation/templates/api-properties-section.js +0 -40
- package/lib/documentation/templates/api-slots-section.js +0 -28
- package/lib/documentation/templates/template.js +0 -38
- package/lib/init-package/index.js +0 -114
- package/lib/init-package/resources/.eslintignore +0 -3
- package/lib/init-package/resources/bundle.es5.js +0 -25
- package/lib/init-package/resources/bundle.esm.js +0 -34
- package/lib/init-package/resources/config/.eslintrc.js +0 -1
- package/lib/init-package/resources/config/postcss.components/postcss.config.js +0 -1
- package/lib/init-package/resources/config/postcss.themes/postcss.config.js +0 -1
- package/lib/init-package/resources/config/rollup.config.js +0 -1
- package/lib/init-package/resources/config/wdio.conf.js +0 -1
- package/lib/init-package/resources/package-scripts.js +0 -11
- package/lib/init-package/resources/src/Assets.js +0 -5
- package/lib/init-package/resources/src/Demo.hbs +0 -1
- package/lib/init-package/resources/src/Demo.js +0 -56
- package/lib/init-package/resources/src/i18n/messagebundle.properties +0 -2
- package/lib/init-package/resources/src/i18n/messagebundle_de.properties +0 -1
- package/lib/init-package/resources/src/i18n/messagebundle_en.properties +0 -1
- package/lib/init-package/resources/src/i18n/messagebundle_es.properties +0 -1
- package/lib/init-package/resources/src/i18n/messagebundle_fr.properties +0 -1
- package/lib/init-package/resources/src/themes/Demo.css +0 -11
- package/lib/init-package/resources/src/themes/sap_belize/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_belize_hcb/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
- package/lib/init-package/resources/test/pages/index.html +0 -51
- package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
@@ -1,74 +1,131 @@
|
|
1
1
|
const path = require("path");
|
2
|
-
|
2
|
+
const fs = require("fs");
|
3
|
+
const resolve = require("resolve");
|
3
4
|
const LIB = path.join(__dirname, `../lib/`);
|
4
|
-
const
|
5
|
-
const polyfillDir = path.dirname(require.resolve("@webcomponents/webcomponentsjs"));
|
6
|
-
const polyfillPath = path.join(polyfillDir, "/**/*.*");
|
5
|
+
const preprocessJSDocScript = resolve.sync("@ui5/webcomponents-tools/lib/jsdoc/preprocess.js");
|
7
6
|
|
8
7
|
const getScripts = (options) => {
|
9
8
|
|
10
|
-
|
9
|
+
// The script creates all JS modules (dist/illustrations/{illustrationName}.js) out of the existing SVGs
|
10
|
+
const illustrationsData = options.illustrationsData || [];
|
11
|
+
illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath}`);
|
12
|
+
const createIllustrationsJSImportsScript = illustrations.join(" && ");
|
13
|
+
|
14
|
+
// The script creates the "dist/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
|
15
|
+
const illustrationDestinationPaths = illustrationsData.map(illustrations => illustrations.destinationPath);
|
16
|
+
const createIllustrationsLoadersScript = options.fioriPackage ? `node ${LIB}/generate-js-imports/illustrations.js ${illustrationDestinationPaths[0]} ${illustrationDestinationPaths[1]} dist/generated/js-imports` : "";
|
17
|
+
const tsCommand = options.typescript ? "tsc" : "";
|
18
|
+
const tsWatchCommand = options.typescript ? "tsc --watch" : "";
|
19
|
+
|
20
|
+
let viteConfig;
|
21
|
+
if (fs.existsSync("config/vite.config.js")) {
|
22
|
+
// old project setup where config file is in separate folder
|
23
|
+
viteConfig = "-c config/vite.config.js";
|
24
|
+
} else if (fs.existsSync("vite.config.js")) {
|
25
|
+
// preferred way of custom configuration in root project folder
|
26
|
+
viteConfig = "";
|
27
|
+
} else {
|
28
|
+
// no custom configuration - use default from tools project
|
29
|
+
viteConfig = `-c "${require.resolve("@ui5/webcomponents-tools/components-package/vite.config.js")}"`;
|
30
|
+
}
|
31
|
+
|
32
|
+
let eslintConfig;
|
33
|
+
if (fs.existsSync("config/.eslintrc.js")) {
|
34
|
+
// old project setup where config file is in separate folder
|
35
|
+
eslintConfig = "--config config/.eslintrc.js";
|
36
|
+
} else if (fs.existsSync(".eslintrc.js")) {
|
37
|
+
// preferred way of custom configuration in root project folder
|
38
|
+
eslintConfig = "";
|
39
|
+
} else {
|
40
|
+
// no custom configuration - use default from tools project
|
41
|
+
eslintConfig = `--config "${require.resolve("@ui5/webcomponents-tools/components-package/eslint.js")}"`;
|
42
|
+
}
|
11
43
|
|
12
44
|
const scripts = {
|
13
|
-
clean:
|
14
|
-
lint:
|
15
|
-
|
45
|
+
clean: 'rimraf jsdoc-dist && rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
|
46
|
+
lint: `eslint . ${eslintConfig}`,
|
47
|
+
lintfix: `eslint . ${eslintConfig}`,
|
48
|
+
prepare: {
|
49
|
+
default: "nps clean prepare.all typescript generateAPI",
|
50
|
+
all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copy" "nps build.illustrations"',
|
51
|
+
styleRelated: "nps build.styles build.jsonImports build.jsImports",
|
52
|
+
},
|
53
|
+
typescript: tsCommand,
|
16
54
|
build: {
|
17
|
-
default: "nps lint
|
55
|
+
default: "nps prepare lint build.bundle",
|
18
56
|
templates: `mkdirp dist/generated/templates && node "${LIB}/hbs2ui5/index.js" -d src/ -o dist/generated/templates`,
|
19
57
|
styles: {
|
20
58
|
default: "nps build.styles.themes build.styles.components",
|
21
|
-
themes: "postcss
|
22
|
-
components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/",
|
59
|
+
themes: `node "${LIB}/postcss-p/postcss-p.mjs"`,
|
60
|
+
components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/", // When updating this, also update the new files script
|
23
61
|
},
|
24
62
|
i18n: {
|
25
63
|
default: "nps build.i18n.defaultsjs build.i18n.json",
|
26
|
-
defaultsjs: `node "${LIB}/i18n/defaults.js" src/i18n
|
64
|
+
defaultsjs: `node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
|
27
65
|
json: `node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
|
28
66
|
},
|
29
67
|
jsonImports: {
|
30
68
|
default: "mkdirp dist/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
|
31
|
-
themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/json-imports`,
|
69
|
+
themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes dist/generated/json-imports`,
|
32
70
|
i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n dist/generated/json-imports`,
|
33
71
|
},
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
72
|
+
jsImports: {
|
73
|
+
default: "mkdirp dist/generated/js-imports && nps build.jsImports.illustrationsLoaders",
|
74
|
+
illustrationsLoaders: createIllustrationsLoadersScript,
|
75
|
+
},
|
76
|
+
bundle: `vite build ${viteConfig}`,
|
77
|
+
illustrations: createIllustrationsJSImportsScript,
|
40
78
|
},
|
41
79
|
copy: {
|
42
|
-
default: "nps copy.src copy.
|
43
|
-
src: `node "${LIB}/copy-and-watch/index.js" "src/**/*.js" dist/`,
|
44
|
-
|
45
|
-
"webcomponents-polyfill": `node "${LIB}/copy-and-watch/index.js" "${polyfillPath}" dist/webcomponentsjs/`,
|
80
|
+
default: "nps copy.src copy.props",
|
81
|
+
src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
|
82
|
+
props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
|
46
83
|
},
|
47
84
|
watch: {
|
48
|
-
default: 'concurrently "nps watch.templates" "nps watch.
|
85
|
+
default: 'concurrently "nps watch.templates" "nps watch.api" "nps watch.src" "nps watch.typescript" "nps watch.styles" "nps watch.i18n" "nps watch.props"',
|
86
|
+
devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
|
49
87
|
src: 'nps "copy.src --watch --safe --skip-initial-copy"',
|
50
|
-
|
51
|
-
|
88
|
+
typescript: tsWatchCommand,
|
89
|
+
props: 'nps "copy.props --watch --safe --skip-initial-copy"',
|
90
|
+
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
|
52
91
|
styles: {
|
53
92
|
default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
|
54
93
|
themes: 'nps "build.styles.themes -w"',
|
55
|
-
components:
|
94
|
+
components: {
|
95
|
+
default: 'concurrently "nps watch.styles.components.existingFiles" "nps watch.styles.components.newFiles"',
|
96
|
+
existingFiles: `nps "build.styles.components -w"`,
|
97
|
+
newFiles: `node "${LIB}/postcss-new-files/index.js" --srcFiles="src/themes/*.css"`,
|
98
|
+
},
|
56
99
|
},
|
57
|
-
templates:
|
58
|
-
|
100
|
+
templates: 'chokidar "src/**/*.hbs" -c "nps build.templates"',
|
101
|
+
api: 'chokidar "test/**/*.sample.html" -c "nps generateAPI"',
|
102
|
+
i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
|
59
103
|
},
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
104
|
+
start: "nps prepare watch.devServer",
|
105
|
+
test: `node "${LIB}/test-runner/test-runner.js"`,
|
106
|
+
"test-suite-1": `node "${LIB}/test-runner/test-runner.js" --suite suite1`,
|
107
|
+
"test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
|
108
|
+
startWithScope: "nps scope.prepare scope.watchWithBundle",
|
109
|
+
scope: {
|
110
|
+
prepare: "nps scope.lint prepare scope.testPages",
|
111
|
+
lint: `node "${LIB}/scoping/lint-src.js"`,
|
112
|
+
testPages: {
|
113
|
+
default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
|
114
|
+
clean: "rimraf test/pages/scoped",
|
115
|
+
copy: `node "${LIB}/copy-and-watch/index.js" --silent "test/pages/**/*" test/pages/scoped`,
|
116
|
+
replace: `node "${LIB}/scoping/scope-test-pages.js" test/pages/scoped demo`,
|
117
|
+
},
|
118
|
+
watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
|
119
|
+
watch: 'concurrently "nps watch.templates" "nps watch.api" "nps watch.src" "nps watch.props" "nps watch.styles"',
|
120
|
+
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
|
66
121
|
},
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
122
|
+
generateAPI: {
|
123
|
+
default: "nps generateAPI.prepare generateAPI.preprocess generateAPI.jsdoc generateAPI.cleanup generateAPI.prepareManifest",
|
124
|
+
prepare: `node "${LIB}/copy-and-watch/index.js" --silent "dist/**/*.js" jsdoc-dist/`,
|
125
|
+
prepareManifest: `node "${LIB}/generate-custom-elements-manifest/index.js" dist dist`,
|
126
|
+
preprocess: `node "${preprocessJSDocScript}" jsdoc-dist/ src`,
|
127
|
+
jsdoc: `jsdoc -c "${LIB}/jsdoc/configTypescript.json"`,
|
128
|
+
cleanup: "rimraf jsdoc-dist/"
|
72
129
|
},
|
73
130
|
};
|
74
131
|
|
@@ -1,8 +1,11 @@
|
|
1
1
|
const postcssImport = require('postcss-import');
|
2
|
-
const combineSelectors = require('postcss-combine-duplicated-selectors');
|
2
|
+
const combineSelectors = require('../lib/postcss-combine-duplicated-selectors/index.js');
|
3
3
|
const postcssCSStoJSON = require('../lib/postcss-css-to-json/index.js');
|
4
4
|
const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
|
5
5
|
const cssnano = require('cssnano');
|
6
|
+
const fs = require("fs");
|
7
|
+
|
8
|
+
const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
|
6
9
|
|
7
10
|
module.exports = {
|
8
11
|
plugins: [
|
@@ -17,7 +20,7 @@ module.exports = {
|
|
17
20
|
},
|
18
21
|
]
|
19
22
|
},),
|
20
|
-
postcssCSStoJSON({toReplace: 'src'}),
|
21
|
-
postcssCSStoESM({toReplace: 'src'}),
|
23
|
+
postcssCSStoJSON({toReplace: 'src', packageName}),
|
24
|
+
postcssCSStoESM({toReplace: 'src', packageName}),
|
22
25
|
]
|
23
26
|
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
// vite.config.js
|
2
|
+
const { defineConfig } = require('vite');
|
3
|
+
const virtualIndex = require("../lib/dev-server/virtual-index-html-plugin.js");
|
4
|
+
|
5
|
+
module.exports = defineConfig(async () => {
|
6
|
+
return {
|
7
|
+
build: {
|
8
|
+
emptyOutDir: false,
|
9
|
+
},
|
10
|
+
plugins: [await virtualIndex()],
|
11
|
+
}
|
12
|
+
});
|
@@ -50,7 +50,7 @@ exports.config = {
|
|
50
50
|
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
|
51
51
|
// grid with only 5 firefox instances available you can make sure that not more than
|
52
52
|
// 5 instances get started at a time.
|
53
|
-
maxInstances:
|
53
|
+
maxInstances: 5,
|
54
54
|
//
|
55
55
|
browserName: 'chrome',
|
56
56
|
'goog:chromeOptions': {
|
@@ -82,7 +82,7 @@ exports.config = {
|
|
82
82
|
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
83
83
|
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
84
84
|
// gets prepended directly.
|
85
|
-
baseUrl: '',
|
85
|
+
baseUrl: 'http://localhost:4567', // This is important since WDIO 7+ does not accept an empty string for baseUrl
|
86
86
|
path: '',
|
87
87
|
//
|
88
88
|
// Default timeout for all waitFor* commands.
|
@@ -99,7 +99,14 @@ exports.config = {
|
|
99
99
|
// Services take over a specific job you don't want to take care of. They enhance
|
100
100
|
// your test setup with almost no effort. Unlike plugins, they don't add new
|
101
101
|
// commands. Instead, they hook themselves up into the test process.
|
102
|
-
services: ['chromedriver'
|
102
|
+
services: ['chromedriver', 'devtools',
|
103
|
+
['static-server', {
|
104
|
+
folders: [
|
105
|
+
{ mount: '/', path: './dist' },
|
106
|
+
],
|
107
|
+
port: '4567',
|
108
|
+
}],
|
109
|
+
],
|
103
110
|
// options
|
104
111
|
chromeDriverArgs: ['--port=9515'], // default
|
105
112
|
// Framework you want to run your specs with.
|
@@ -152,9 +159,9 @@ exports.config = {
|
|
152
159
|
* @param {Array.<Object>} capabilities list of capabilities details
|
153
160
|
* @param {Array.<String>} specs List of spec file paths that are to be run
|
154
161
|
*/
|
155
|
-
before: function (capabilities, specs) {
|
156
|
-
browser.addCommand("isFocusedDeep", function () {
|
157
|
-
return browser.
|
162
|
+
before: async function (capabilities, specs) {
|
163
|
+
await browser.addCommand("isFocusedDeep", async function () {
|
164
|
+
return browser.executeAsync(function (elem, done) {
|
158
165
|
let activeElement = document.activeElement;
|
159
166
|
|
160
167
|
while (activeElement.shadowRoot) {
|
@@ -164,51 +171,80 @@ exports.config = {
|
|
164
171
|
break;
|
165
172
|
}
|
166
173
|
}
|
167
|
-
|
174
|
+
done(elem === activeElement);
|
168
175
|
}, this);
|
169
176
|
}, true);
|
170
177
|
|
171
|
-
browser.addCommand("
|
172
|
-
return browser.
|
173
|
-
|
178
|
+
await browser.addCommand("isFocusedDeepElement", async function (element) {
|
179
|
+
return browser.executeAsync(function (elem, element, done) {
|
180
|
+
let activeElement = document.activeElement;
|
181
|
+
|
182
|
+
while (activeElement.shadowRoot) {
|
183
|
+
if (activeElement.shadowRoot.activeElement) {
|
184
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
185
|
+
} else {
|
186
|
+
break;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
done(element === activeElement);
|
190
|
+
}, this, element);
|
191
|
+
}, true);
|
192
|
+
|
193
|
+
await browser.addCommand("setProperty", async function(property, value) {
|
194
|
+
return browser.executeAsync((elem, property, value, done) => {
|
195
|
+
elem[property] = value;
|
196
|
+
done();
|
174
197
|
}, this, property, value);
|
175
198
|
}, true);
|
176
199
|
|
177
|
-
browser.addCommand("setAttribute", function(attribute, value) {
|
178
|
-
return browser.
|
179
|
-
|
200
|
+
await browser.addCommand("setAttribute", async function(attribute, value) {
|
201
|
+
return browser.executeAsync((elem, attribute, value, done) => {
|
202
|
+
elem.setAttribute(attribute, value);
|
203
|
+
done();
|
180
204
|
}, this, attribute, value);
|
181
205
|
}, true);
|
182
206
|
|
183
|
-
browser.addCommand("removeAttribute", function(attribute) {
|
184
|
-
return browser.
|
185
|
-
|
207
|
+
await browser.addCommand("removeAttribute", async function(attribute) {
|
208
|
+
return browser.executeAsync((elem, attribute, done) => {
|
209
|
+
elem.removeAttribute(attribute);
|
210
|
+
done();
|
186
211
|
}, this, attribute);
|
187
212
|
}, true);
|
188
213
|
|
189
|
-
browser.addCommand("hasClass", function(className) {
|
190
|
-
return browser.
|
191
|
-
|
214
|
+
await browser.addCommand("hasClass", async function(className) {
|
215
|
+
return browser.executeAsync((elem, className, done) => {
|
216
|
+
done(elem.classList.contains(className));
|
192
217
|
}, this, className);
|
193
218
|
}, true);
|
194
219
|
|
195
|
-
browser.addCommand("
|
196
|
-
return browser.
|
220
|
+
await browser.addCommand("hasAttribute", async function(attrName) {
|
221
|
+
return browser.executeAsync((elem, attrName, done) => {
|
222
|
+
done(elem.hasAttribute(attrName));
|
223
|
+
}, this, attrName);
|
224
|
+
}, true);
|
225
|
+
|
226
|
+
await browser.addCommand("getStaticAreaItemClassName", async function(selector) {
|
227
|
+
return browser.executeAsync(async (selector, done) => {
|
197
228
|
const staticAreaItem = await document.querySelector(selector).getStaticAreaItemDomRef();
|
198
|
-
|
229
|
+
done(staticAreaItem.host.classList[0]);
|
199
230
|
}, selector);
|
200
231
|
}, false);
|
232
|
+
|
233
|
+
await browser.addLocatorStrategy('activeElement', (selector) => {
|
234
|
+
return document.querySelector(selector).shadowRoot.activeElement;
|
235
|
+
});
|
201
236
|
},
|
202
237
|
/**
|
203
238
|
* Runs before a WebdriverIO command gets executed.
|
204
239
|
* @param {String} commandName hook command name
|
205
240
|
* @param {Array} args arguments that command would receive
|
206
241
|
*/
|
207
|
-
beforeCommand: function (commandName, args) {
|
242
|
+
beforeCommand: async function (commandName, args) {
|
208
243
|
const waitFor = [
|
209
244
|
"$",
|
210
245
|
"$$",
|
211
246
|
"getAttribute",
|
247
|
+
"hasAttribute", // custom
|
212
248
|
"getCSSProperty",
|
213
249
|
"getHTML",
|
214
250
|
"getProperty",
|
@@ -223,12 +259,13 @@ exports.config = {
|
|
223
259
|
"isExisting",
|
224
260
|
"isFocused",
|
225
261
|
"isFocusedDeep", // custom
|
262
|
+
"isFocusedDeepElement", // custom
|
226
263
|
"shadow$",
|
227
264
|
"shadow$$",
|
228
265
|
];
|
229
266
|
if (waitFor.includes(commandName)) {
|
230
|
-
browser.executeAsync(function (done) {
|
231
|
-
window.
|
267
|
+
await browser.executeAsync(function (done) {
|
268
|
+
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
232
269
|
});
|
233
270
|
}
|
234
271
|
},
|
@@ -277,12 +314,13 @@ exports.config = {
|
|
277
314
|
* @param {Number} result 0 - command success, 1 - command error
|
278
315
|
* @param {Object} error error object if any
|
279
316
|
*/
|
280
|
-
afterCommand: function (commandName, args, result, error) {
|
317
|
+
afterCommand: async function (commandName, args, result, error) {
|
281
318
|
|
282
319
|
// url -> set configuration first
|
283
320
|
if (commandName === "url" && !args[0].includes("do-not-change-configuration")) {
|
284
|
-
browser.
|
321
|
+
await browser.executeAsync(function(done) {
|
285
322
|
window["sap-ui-webcomponents-bundle"].configuration.setNoConflict(true);
|
323
|
+
done();
|
286
324
|
});
|
287
325
|
}
|
288
326
|
|
@@ -292,19 +330,30 @@ exports.config = {
|
|
292
330
|
"click",
|
293
331
|
"doubleClick",
|
294
332
|
"dragAndDrop",
|
295
|
-
"keys",
|
296
333
|
"pause",
|
297
334
|
"removeAttribute", // custom
|
335
|
+
"scrollIntoView",
|
298
336
|
"setAttribute", // custom
|
299
337
|
"setProperty", // custom
|
300
338
|
"setValue",
|
301
339
|
"setWindowSize",
|
302
340
|
"touchAction",
|
303
|
-
"url"
|
341
|
+
"url",
|
304
342
|
];
|
343
|
+
|
344
|
+
const waitForWithDelay = [
|
345
|
+
"keys",
|
346
|
+
];
|
347
|
+
|
305
348
|
if (waitFor.includes(commandName)) {
|
306
|
-
browser.executeAsync(function (done) {
|
307
|
-
window.
|
349
|
+
await browser.executeAsync(function (done) {
|
350
|
+
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
351
|
+
});
|
352
|
+
} else if (waitForWithDelay.includes(commandName)) {
|
353
|
+
await browser.executeAsync(function (done) {
|
354
|
+
setTimeout(() => {
|
355
|
+
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
356
|
+
}, 10);
|
308
357
|
});
|
309
358
|
}
|
310
359
|
},
|