@ui5/webcomponents-tools 0.0.0-de4752078 → 0.0.0-deac3098a
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 +111 -0
- package/README.md +1 -1
- package/assets-meta.js +7 -1
- package/components-package/nps.js +11 -5
- package/components-package/postcss.themes.js +5 -2
- package/components-package/rollup-plugins/empty-module.js +15 -0
- package/components-package/rollup.js +52 -8
- package/components-package/wdio.js +50 -25
- package/components-package/wdio.sync.js +360 -0
- package/icons-collection/nps.js +42 -8
- package/lib/copy-list/index.js +28 -0
- package/lib/create-icons/index.js +20 -6
- package/lib/create-illustrations/index.js +150 -0
- package/lib/create-new-component/index.js +12 -4
- package/lib/documentation/templates/api-properties-section.js +3 -1
- package/lib/documentation/templates/template.js +2 -1
- package/lib/esm-abs-to-rel/index.js +54 -0
- package/lib/hbs2lit/src/compiler.js +10 -1
- package/lib/hbs2lit/src/litVisitor2.js +31 -6
- package/lib/hbs2lit/src/svgProcessor.js +3 -3
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +4 -11
- package/lib/jsdoc/plugin.js +9 -0
- package/lib/jsdoc/template/publish.js +13 -2
- package/lib/postcss-css-to-esm/index.js +4 -4
- package/lib/postcss-css-to-json/index.js +7 -2
- package/lib/postcss-p/postcss-p.mjs +11 -0
- package/lib/replace-global-core/index.js +20 -0
- package/lib/scoping/lint-src.js +1 -1
- package/lib/scoping/missing-dependencies.js +65 -0
- package/lib/scoping/report-tags-usage.js +28 -0
- package/lib/serve/index.js +1 -1
- package/package.json +25 -28
- package/bin/init-ui5-package.js +0 -3
- package/lib/init-package/index.js +0 -123
- 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 -31
- 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/MyFirstComponent.hbs +0 -1
- package/lib/init-package/resources/src/MyFirstComponent.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/MyFirstComponent.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/src/themes/sap_fiori_3_hcb/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_fiori_3_hcw/parameters-bundle.css +0 -3
- package/lib/init-package/resources/test/pages/index.html +0 -56
- package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,117 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [1.2.3](https://github.com/SAP/ui5-webcomponents/compare/v1.2.2...v1.2.3) (2022-03-23)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
## [1.2.2](https://github.com/SAP/ui5-webcomponents/compare/v1.2.1...v1.2.2) (2022-03-22)
|
15
|
+
|
16
|
+
|
17
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
## [1.2.1](https://github.com/SAP/ui5-webcomponents/compare/v1.2.0...v1.2.1) (2022-03-02)
|
24
|
+
|
25
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
# [1.2.0](https://github.com/SAP/ui5-webcomponents/compare/v1.1.2...v1.2.0) (2022-02-28)
|
32
|
+
|
33
|
+
|
34
|
+
### Bug Fixes
|
35
|
+
|
36
|
+
* correct scoping issues with several components ([#4820](https://github.com/SAP/ui5-webcomponents/issues/4820)) ([621dc20](https://github.com/SAP/ui5-webcomponents/commit/621dc20))
|
37
|
+
* display methods in child components API ([#4792](https://github.com/SAP/ui5-webcomponents/issues/4792)) ([1929d08](https://github.com/SAP/ui5-webcomponents/commit/1929d08))
|
38
|
+
|
39
|
+
|
40
|
+
### Features
|
41
|
+
|
42
|
+
* **jsdoc:** remove attr name for Object props ([#4680](https://github.com/SAP/ui5-webcomponents/issues/4680)) ([1741bd6](https://github.com/SAP/ui5-webcomponents/commit/1741bd6)), closes [#4674](https://github.com/SAP/ui5-webcomponents/issues/4674)
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
## [1.1.2](https://github.com/SAP/ui5-webcomponents/compare/v1.1.1...v1.1.2) (2022-01-26)
|
49
|
+
|
50
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
## [1.1.1](https://github.com/SAP/ui5-webcomponents/compare/v1.1.0...v1.1.1) (2022-01-24)
|
57
|
+
|
58
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
# [1.1.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.2...v1.1.0) (2022-01-21)
|
65
|
+
|
66
|
+
|
67
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
## [1.0.2](https://github.com/SAP/ui5-webcomponents/compare/v1.0.1...v1.0.2) (2021-11-29)
|
74
|
+
|
75
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
## [1.0.1](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0...v1.0.1) (2021-11-10)
|
82
|
+
|
83
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
# [1.0.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.16...v1.0.0) (2021-11-10)
|
90
|
+
|
91
|
+
|
92
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
93
|
+
|
94
|
+
|
95
|
+
# [1.0.0-rc.16](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.15...v1.0.0-rc.16) (2021-11-09)
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
### Features
|
100
|
+
|
101
|
+
* **tools:** create an npm init script ([#4090](https://github.com/SAP/ui5-webcomponents/issues/4090)) ([5608e04](https://github.com/SAP/ui5-webcomponents/commit/5608e04))
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
# [1.0.0-rc.15](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.14...v1.0.0-rc.15) (2021-07-23)
|
106
|
+
|
107
|
+
|
108
|
+
### Bug Fixes
|
109
|
+
|
110
|
+
* **tools:** fix build error on MacOS 11 from rollup-plugin-terser ([#3347](https://github.com/SAP/ui5-webcomponents/issues/3347)) ([59892c4](https://github.com/SAP/ui5-webcomponents/commit/59892c4)), closes [#2515](https://github.com/SAP/ui5-webcomponents/issues/2515)
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
6
117
|
# [1.0.0-rc.14](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.13...v1.0.0-rc.14) (2021-04-01)
|
7
118
|
|
8
119
|
|
package/README.md
CHANGED
@@ -17,7 +17,7 @@ used by other UI5 Web Components packages, such as `main` and `fiori`.
|
|
17
17
|
We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/SUPPORT.md#-content) on how to report an issue, or chat with us in the `#webcomponents` channel of the [OpenUI5 Community Slack](https://join-ui5-slack.herokuapp.com/).
|
18
18
|
|
19
19
|
## Contribute
|
20
|
-
Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/
|
20
|
+
Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/docs/6-contributing/02-conventions-and-guidelines.md).
|
21
21
|
|
22
22
|
## License
|
23
23
|
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
|
package/assets-meta.js
CHANGED
@@ -8,7 +8,12 @@ const assetsMeta = {
|
|
8
8
|
"sap_belize_hcb",
|
9
9
|
"sap_belize_hcw",
|
10
10
|
"sap_fiori_3_hcb",
|
11
|
-
"sap_fiori_3_hcw"
|
11
|
+
"sap_fiori_3_hcw",
|
12
|
+
"sap_horizon",
|
13
|
+
"sap_horizon_dark",
|
14
|
+
"sap_horizon_hcb",
|
15
|
+
"sap_horizon_hcw",
|
16
|
+
"sap_horizon_exp"
|
12
17
|
]
|
13
18
|
},
|
14
19
|
"languages": {
|
@@ -131,6 +136,7 @@ const assetsMeta = {
|
|
131
136
|
"sk",
|
132
137
|
"sl",
|
133
138
|
"sr",
|
139
|
+
"sr_Latn",
|
134
140
|
"sv",
|
135
141
|
"th",
|
136
142
|
"tr",
|
@@ -10,21 +10,26 @@ const getScripts = (options) => {
|
|
10
10
|
|
11
11
|
const port = options.port || 8080; // preferred port
|
12
12
|
const portStep = options.portStep || 1; // step to check for available ports, if preferred port is already used
|
13
|
+
let illustrations = options.illustrationsData || [];
|
14
|
+
|
15
|
+
illustrations = illustrations.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath}`);
|
16
|
+
|
17
|
+
let illustrationsScript = illustrations.join(" && ");
|
13
18
|
|
14
19
|
const scripts = {
|
15
20
|
clean: "rimraf dist && rimraf .port",
|
16
21
|
lint: "eslint . --config config/.eslintrc.js",
|
17
22
|
lintfix: "eslint . --config config/.eslintrc.js --fix",
|
18
23
|
prepare: {
|
19
|
-
default: "nps clean build.templates build.styles build.i18n build.jsonImports copy build.samples",
|
20
|
-
es5: "nps clean build.templates build.styles build.i18n build.jsonImports copy.es5 build.samples"
|
24
|
+
default: "nps clean build.templates build.styles build.i18n build.jsonImports copy build.samples build.illustrations",
|
25
|
+
es5: "nps clean build.templates build.styles build.i18n build.jsonImports copy.es5 build.samples build.illustrations"
|
21
26
|
},
|
22
27
|
build: {
|
23
28
|
default: "nps lint prepare.es5 build.bundle",
|
24
29
|
templates: `mkdirp dist/generated/templates && node "${LIB}/hbs2ui5/index.js" -d src/ -o dist/generated/templates`,
|
25
30
|
styles: {
|
26
31
|
default: "nps build.styles.themes build.styles.components",
|
27
|
-
themes: "postcss
|
32
|
+
themes: `node "${LIB}/postcss-p/postcss-p.mjs"`,
|
28
33
|
components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/", // When updating this, also update the new files script
|
29
34
|
},
|
30
35
|
i18n: {
|
@@ -42,7 +47,8 @@ const getScripts = (options) => {
|
|
42
47
|
default: "nps build.samples.api build.samples.docs",
|
43
48
|
api: `jsdoc -c "${LIB}/jsdoc/config.json"`,
|
44
49
|
docs: `node "${LIB}/documentation/index.js" dist/api.json`,
|
45
|
-
}
|
50
|
+
},
|
51
|
+
illustrations: illustrationsScript
|
46
52
|
},
|
47
53
|
copy: {
|
48
54
|
default: "nps copy.src copy.props copy.test copy.webcomponents-polyfill-placeholder",
|
@@ -51,7 +57,7 @@ const getScripts = (options) => {
|
|
51
57
|
props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
|
52
58
|
test: `node "${LIB}/copy-and-watch/index.js" --silent "test/**/*.*" dist/test-resources`,
|
53
59
|
"webcomponents-polyfill": `node "${LIB}/copy-and-watch/index.js" --silent "${polyfillPath}" dist/webcomponentsjs/`,
|
54
|
-
"webcomponents-polyfill-placeholder": `node ${LIB}/polyfill-placeholder/index.js`
|
60
|
+
"webcomponents-polyfill-placeholder": `node "${LIB}/polyfill-placeholder/index.js"`
|
55
61
|
},
|
56
62
|
watch: {
|
57
63
|
default: 'concurrently "nps watch.templates" "nps watch.samples" "nps watch.test" "nps watch.src" "nps watch.bundle" "nps watch.styles" "nps watch.i18n"',
|
@@ -3,6 +3,9 @@ const combineSelectors = require('postcss-combine-duplicated-selectors');
|
|
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,15 @@
|
|
1
|
+
const slash = require("slash");
|
2
|
+
|
3
|
+
function emptyModulePlugin({ emptyModules }) {
|
4
|
+
return {
|
5
|
+
name: "ui5-dev-empty-module-plugin",
|
6
|
+
load(id) {
|
7
|
+
if (emptyModules.some(mod => slash(id).includes(mod))) {
|
8
|
+
return `export default ""`;
|
9
|
+
}
|
10
|
+
return null;
|
11
|
+
},
|
12
|
+
};
|
13
|
+
}
|
14
|
+
|
15
|
+
module.exports = emptyModulePlugin;
|
@@ -6,15 +6,22 @@ const { nodeResolve } = require("@rollup/plugin-node-resolve");
|
|
6
6
|
const url = require("@rollup/plugin-url");
|
7
7
|
const { terser } = require("rollup-plugin-terser");
|
8
8
|
const json = require("@rollup/plugin-json");
|
9
|
-
const
|
10
|
-
const
|
9
|
+
const replace = require("@rollup/plugin-replace");
|
10
|
+
const commonjs = require("@rollup/plugin-commonjs");
|
11
|
+
const colors = require("cli-color");
|
11
12
|
const filesize = require("rollup-plugin-filesize");
|
12
13
|
const livereload = require("rollup-plugin-livereload");
|
14
|
+
const emptyModulePlugin = require("./rollup-plugins/empty-module.js");
|
13
15
|
|
14
16
|
const packageFile = JSON.parse(fs.readFileSync("./package.json"));
|
15
17
|
const packageName = packageFile.name;
|
16
18
|
const DEPLOY_PUBLIC_PATH = process.env.DEPLOY_PUBLIC_PATH || "";
|
17
19
|
|
20
|
+
const warningsToSkip = [{
|
21
|
+
warningCode: "THIS_IS_UNDEFINED",
|
22
|
+
filePath: /.+zxing.+/,
|
23
|
+
}];
|
24
|
+
|
18
25
|
function ui5DevImportCheckerPlugin() {
|
19
26
|
return {
|
20
27
|
name: "ui5-dev-import-checker-plugin",
|
@@ -27,6 +34,23 @@ function ui5DevImportCheckerPlugin() {
|
|
27
34
|
};
|
28
35
|
}
|
29
36
|
|
37
|
+
function onwarn(warning, warn) {
|
38
|
+
// Skip warning for known false positives that will otherwise polute the log
|
39
|
+
let skip = warningsToSkip.find(warningToSkip => {
|
40
|
+
let loc, file;
|
41
|
+
return warning.code === warningToSkip.warningCode
|
42
|
+
&& (loc = warning.loc)
|
43
|
+
&& (file = loc.file)
|
44
|
+
&& file.match(warningToSkip.filePath);
|
45
|
+
});
|
46
|
+
if (skip) {
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
|
50
|
+
// warn everything else
|
51
|
+
warn( warning );
|
52
|
+
}
|
53
|
+
|
30
54
|
const reportedForPackages = new Set(); // sometimes writeBundle is called more than once per bundle -> suppress extra messages
|
31
55
|
function ui5DevReadyMessagePlugin() {
|
32
56
|
return {
|
@@ -50,6 +74,25 @@ function ui5DevReadyMessagePlugin() {
|
|
50
74
|
|
51
75
|
const getPlugins = ({ transpile }) => {
|
52
76
|
const plugins = [];
|
77
|
+
|
78
|
+
if (process.env.DEV) {
|
79
|
+
plugins.push(replace({
|
80
|
+
values: {
|
81
|
+
'const DEV_MODE = false': 'const DEV_MODE = true',
|
82
|
+
},
|
83
|
+
preventAssignment: false,
|
84
|
+
}));
|
85
|
+
}
|
86
|
+
|
87
|
+
if (process.env.DEV && !process.env.ENABLE_CLDR) {
|
88
|
+
// Empty the CLDR assets file for better performance during development
|
89
|
+
plugins.push(emptyModulePlugin({
|
90
|
+
emptyModules: [
|
91
|
+
"localization/dist/Assets.js",
|
92
|
+
],
|
93
|
+
}));
|
94
|
+
}
|
95
|
+
|
53
96
|
if (!process.env.DEV) {
|
54
97
|
plugins.push(filesize(
|
55
98
|
{
|
@@ -95,10 +138,11 @@ const getPlugins = ({ transpile }) => {
|
|
95
138
|
}
|
96
139
|
|
97
140
|
if (transpile) {
|
141
|
+
plugins.push(commonjs());
|
98
142
|
plugins.push(babel({
|
99
143
|
presets: ["@babel/preset-env"],
|
100
144
|
exclude: /node_modules\/(?!(lit-html|@ui5\/webcomponents))/, // exclude all node_modules/ except lit-html and all starting with @ui5/webcomponents
|
101
|
-
sourcemap:
|
145
|
+
sourcemap: false,
|
102
146
|
babelHelpers: "bundled",
|
103
147
|
}));
|
104
148
|
}
|
@@ -106,11 +150,9 @@ const getPlugins = ({ transpile }) => {
|
|
106
150
|
plugins.push(nodeResolve());
|
107
151
|
|
108
152
|
if (!process.env.DEV) {
|
109
|
-
plugins.push(terser(
|
110
|
-
|
111
|
-
|
112
|
-
if (process.env.DEV) {
|
113
|
-
plugins.push(notify());
|
153
|
+
plugins.push(terser({
|
154
|
+
numWorkers: 1,
|
155
|
+
}));
|
114
156
|
}
|
115
157
|
|
116
158
|
const es6DevMain = process.env.DEV && !transpile && packageName === "@ui5/webcomponents";
|
@@ -149,6 +191,7 @@ const getES6Config = (input = "bundle.esm.js") => {
|
|
149
191
|
clearScreen: false,
|
150
192
|
},
|
151
193
|
plugins: getPlugins({ transpile: false }),
|
194
|
+
onwarn: onwarn,
|
152
195
|
}];
|
153
196
|
};
|
154
197
|
|
@@ -173,6 +216,7 @@ const getES5Config = (input = "bundle.es5.js") => {
|
|
173
216
|
clearScreen: false,
|
174
217
|
},
|
175
218
|
plugins: getPlugins({ transpile: true }),
|
219
|
+
onwarn: onwarn,
|
176
220
|
}];
|
177
221
|
};
|
178
222
|
|
@@ -152,9 +152,9 @@ exports.config = {
|
|
152
152
|
* @param {Array.<Object>} capabilities list of capabilities details
|
153
153
|
* @param {Array.<String>} specs List of spec file paths that are to be run
|
154
154
|
*/
|
155
|
-
before: function (capabilities, specs) {
|
156
|
-
browser.addCommand("isFocusedDeep", function () {
|
157
|
-
return browser.
|
155
|
+
before: async function (capabilities, specs) {
|
156
|
+
await browser.addCommand("isFocusedDeep", async function () {
|
157
|
+
return browser.executeAsync(function (elem, done) {
|
158
158
|
let activeElement = document.activeElement;
|
159
159
|
|
160
160
|
while (activeElement.shadowRoot) {
|
@@ -164,47 +164,69 @@ exports.config = {
|
|
164
164
|
break;
|
165
165
|
}
|
166
166
|
}
|
167
|
-
|
167
|
+
done(elem === activeElement);
|
168
168
|
}, this);
|
169
169
|
}, true);
|
170
170
|
|
171
|
-
browser.addCommand("
|
172
|
-
return browser.
|
173
|
-
|
171
|
+
await browser.addCommand("isFocusedDeepElement", async function (element) {
|
172
|
+
return browser.executeAsync(function (elem, element, done) {
|
173
|
+
let activeElement = document.activeElement;
|
174
|
+
|
175
|
+
while (activeElement.shadowRoot) {
|
176
|
+
if (activeElement.shadowRoot.activeElement) {
|
177
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
178
|
+
} else {
|
179
|
+
break;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
done(element === activeElement);
|
183
|
+
}, this, element);
|
184
|
+
}, true);
|
185
|
+
|
186
|
+
await browser.addCommand("setProperty", async function(property, value) {
|
187
|
+
return browser.executeAsync((elem, property, value, done) => {
|
188
|
+
elem[property] = value;
|
189
|
+
done();
|
174
190
|
}, this, property, value);
|
175
191
|
}, true);
|
176
192
|
|
177
|
-
browser.addCommand("setAttribute", function(attribute, value) {
|
178
|
-
return browser.
|
179
|
-
|
193
|
+
await browser.addCommand("setAttribute", async function(attribute, value) {
|
194
|
+
return browser.executeAsync((elem, attribute, value, done) => {
|
195
|
+
elem.setAttribute(attribute, value);
|
196
|
+
done();
|
180
197
|
}, this, attribute, value);
|
181
198
|
}, true);
|
182
199
|
|
183
|
-
browser.addCommand("removeAttribute", function(attribute) {
|
184
|
-
return browser.
|
185
|
-
|
200
|
+
await browser.addCommand("removeAttribute", async function(attribute) {
|
201
|
+
return browser.executeAsync((elem, attribute, done) => {
|
202
|
+
elem.removeAttribute(attribute);
|
203
|
+
done();
|
186
204
|
}, this, attribute);
|
187
205
|
}, true);
|
188
206
|
|
189
|
-
browser.addCommand("hasClass", function(className) {
|
190
|
-
return browser.
|
191
|
-
|
207
|
+
await browser.addCommand("hasClass", async function(className) {
|
208
|
+
return browser.executeAsync((elem, className, done) => {
|
209
|
+
done(elem.classList.contains(className));
|
192
210
|
}, this, className);
|
193
211
|
}, true);
|
194
212
|
|
195
|
-
browser.addCommand("getStaticAreaItemClassName", function(selector) {
|
196
|
-
return browser.
|
213
|
+
await browser.addCommand("getStaticAreaItemClassName", async function(selector) {
|
214
|
+
return browser.executeAsync(async (selector, done) => {
|
197
215
|
const staticAreaItem = await document.querySelector(selector).getStaticAreaItemDomRef();
|
198
|
-
|
216
|
+
done(staticAreaItem.host.classList[0]);
|
199
217
|
}, selector);
|
200
218
|
}, false);
|
219
|
+
|
220
|
+
await browser.addLocatorStrategy('activeElement', (selector) => {
|
221
|
+
return document.querySelector(selector).shadowRoot.activeElement;
|
222
|
+
});
|
201
223
|
},
|
202
224
|
/**
|
203
225
|
* Runs before a WebdriverIO command gets executed.
|
204
226
|
* @param {String} commandName hook command name
|
205
227
|
* @param {Array} args arguments that command would receive
|
206
228
|
*/
|
207
|
-
beforeCommand: function (commandName, args) {
|
229
|
+
beforeCommand: async function (commandName, args) {
|
208
230
|
const waitFor = [
|
209
231
|
"$",
|
210
232
|
"$$",
|
@@ -223,11 +245,12 @@ exports.config = {
|
|
223
245
|
"isExisting",
|
224
246
|
"isFocused",
|
225
247
|
"isFocusedDeep", // custom
|
248
|
+
"isFocusedDeepElement", // custom
|
226
249
|
"shadow$",
|
227
250
|
"shadow$$",
|
228
251
|
];
|
229
252
|
if (waitFor.includes(commandName)) {
|
230
|
-
browser.executeAsync(function (done) {
|
253
|
+
await browser.executeAsync(function (done) {
|
231
254
|
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
232
255
|
});
|
233
256
|
}
|
@@ -277,12 +300,13 @@ exports.config = {
|
|
277
300
|
* @param {Number} result 0 - command success, 1 - command error
|
278
301
|
* @param {Object} error error object if any
|
279
302
|
*/
|
280
|
-
afterCommand: function (commandName, args, result, error) {
|
303
|
+
afterCommand: async function (commandName, args, result, error) {
|
281
304
|
|
282
305
|
// url -> set configuration first
|
283
306
|
if (commandName === "url" && !args[0].includes("do-not-change-configuration")) {
|
284
|
-
browser.
|
307
|
+
await browser.executeAsync(function(done) {
|
285
308
|
window["sap-ui-webcomponents-bundle"].configuration.setNoConflict(true);
|
309
|
+
done();
|
286
310
|
});
|
287
311
|
}
|
288
312
|
|
@@ -295,15 +319,16 @@ exports.config = {
|
|
295
319
|
"keys",
|
296
320
|
"pause",
|
297
321
|
"removeAttribute", // custom
|
322
|
+
"scrollIntoView",
|
298
323
|
"setAttribute", // custom
|
299
324
|
"setProperty", // custom
|
300
325
|
"setValue",
|
301
326
|
"setWindowSize",
|
302
327
|
"touchAction",
|
303
|
-
"url"
|
328
|
+
"url",
|
304
329
|
];
|
305
330
|
if (waitFor.includes(commandName)) {
|
306
|
-
browser.executeAsync(function (done) {
|
331
|
+
await browser.executeAsync(function (done) {
|
307
332
|
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
308
333
|
});
|
309
334
|
}
|