@ui5/webcomponents-tools 1.0.0-rc.8 → 1.0.2
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 +94 -0
- package/README.md +1 -1
- package/assets-meta.js +12 -1
- package/components-package/nps.js +62 -24
- package/components-package/postcss.themes.js +5 -2
- package/components-package/rollup-plugins/empty-module.js +15 -0
- package/components-package/rollup.js +155 -50
- package/components-package/wdio.js +37 -28
- package/components-package/wdio.sync.js +344 -0
- package/icons-collection/nps.js +53 -9
- package/lib/copy-and-watch/index.js +6 -4
- package/lib/copy-list/index.js +28 -0
- package/lib/create-icons/index.js +32 -14
- package/lib/create-illustrations/index.js +95 -0
- package/lib/create-new-component/index.js +16 -4
- package/lib/documentation/index.js +42 -20
- package/lib/esm-abs-to-rel/index.js +54 -0
- package/lib/generate-json-imports/i18n.js +59 -24
- package/lib/generate-json-imports/themes.js +44 -13
- package/lib/hash/config.js +10 -0
- package/lib/hash/generate.js +19 -0
- package/lib/hash/upToDate.js +31 -0
- package/lib/hbs2lit/src/litVisitor2.js +31 -6
- package/lib/hbs2lit/src/svgProcessor.js +3 -3
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +5 -5
- package/lib/hbs2ui5/index.js +21 -5
- package/lib/i18n/toJSON.js +1 -1
- package/lib/jsdoc/config.json +1 -1
- package/lib/jsdoc/plugin.js +21 -1
- package/lib/jsdoc/template/publish.js +9 -0
- package/lib/polyfill-placeholder/index.js +5 -0
- package/lib/postcss-css-to-esm/index.js +19 -16
- package/lib/postcss-css-to-json/index.js +20 -11
- package/lib/postcss-new-files/index.js +36 -0
- package/lib/replace-global-core/index.js +20 -0
- package/lib/scoping/get-all-tags.js +44 -0
- package/lib/scoping/lint-src.js +31 -0
- package/lib/scoping/scope-test-pages.js +40 -0
- package/lib/serve/index.js +46 -0
- package/{components-package → lib/serve}/serve.json +0 -0
- package/package-lock.json +48 -0
- package/package.json +54 -54
- package/bin/init-ui5-package.js +0 -3
- 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/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 -51
- package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
@@ -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: undefined, // 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.
|
@@ -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,54 @@ 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("setProperty", function(property, value) {
|
172
|
-
return browser.
|
173
|
-
|
171
|
+
await browser.addCommand("setProperty", async function(property, value) {
|
172
|
+
return browser.executeAsync((elem, property, value, done) => {
|
173
|
+
elem[property] = value;
|
174
|
+
done();
|
174
175
|
}, this, property, value);
|
175
176
|
}, true);
|
176
177
|
|
177
|
-
browser.addCommand("setAttribute", function(attribute, value) {
|
178
|
-
return browser.
|
179
|
-
|
178
|
+
await browser.addCommand("setAttribute", async function(attribute, value) {
|
179
|
+
return browser.executeAsync((elem, attribute, value, done) => {
|
180
|
+
elem.setAttribute(attribute, value);
|
181
|
+
done();
|
180
182
|
}, this, attribute, value);
|
181
183
|
}, true);
|
182
184
|
|
183
|
-
browser.addCommand("removeAttribute", function(attribute) {
|
184
|
-
return browser.
|
185
|
-
|
185
|
+
await browser.addCommand("removeAttribute", async function(attribute) {
|
186
|
+
return browser.executeAsync((elem, attribute, done) => {
|
187
|
+
elem.removeAttribute(attribute);
|
188
|
+
done();
|
186
189
|
}, this, attribute);
|
187
190
|
}, true);
|
188
191
|
|
189
|
-
browser.addCommand("hasClass", function(className) {
|
190
|
-
return browser.
|
191
|
-
|
192
|
+
await browser.addCommand("hasClass", async function(className) {
|
193
|
+
return browser.executeAsync((elem, className, done) => {
|
194
|
+
done(elem.classList.contains(className));
|
192
195
|
}, this, className);
|
193
196
|
}, true);
|
194
197
|
|
195
|
-
browser.addCommand("getStaticAreaItemClassName", function(selector) {
|
196
|
-
return browser.
|
198
|
+
await browser.addCommand("getStaticAreaItemClassName", async function(selector) {
|
199
|
+
return browser.executeAsync(async (selector, done) => {
|
197
200
|
const staticAreaItem = await document.querySelector(selector).getStaticAreaItemDomRef();
|
198
|
-
|
201
|
+
done(staticAreaItem.host.classList[0]);
|
199
202
|
}, selector);
|
200
203
|
}, false);
|
204
|
+
|
205
|
+
await browser.addLocatorStrategy('activeElement', (selector) => {
|
206
|
+
return document.querySelector(selector).shadowRoot.activeElement;
|
207
|
+
});
|
201
208
|
},
|
202
209
|
/**
|
203
210
|
* Runs before a WebdriverIO command gets executed.
|
204
211
|
* @param {String} commandName hook command name
|
205
212
|
* @param {Array} args arguments that command would receive
|
206
213
|
*/
|
207
|
-
beforeCommand: function (commandName, args) {
|
214
|
+
beforeCommand: async function (commandName, args) {
|
208
215
|
const waitFor = [
|
209
216
|
"$",
|
210
217
|
"$$",
|
@@ -227,8 +234,8 @@ exports.config = {
|
|
227
234
|
"shadow$$",
|
228
235
|
];
|
229
236
|
if (waitFor.includes(commandName)) {
|
230
|
-
browser.executeAsync(function (done) {
|
231
|
-
window.
|
237
|
+
await browser.executeAsync(function (done) {
|
238
|
+
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
232
239
|
});
|
233
240
|
}
|
234
241
|
},
|
@@ -277,12 +284,13 @@ exports.config = {
|
|
277
284
|
* @param {Number} result 0 - command success, 1 - command error
|
278
285
|
* @param {Object} error error object if any
|
279
286
|
*/
|
280
|
-
afterCommand: function (commandName, args, result, error) {
|
287
|
+
afterCommand: async function (commandName, args, result, error) {
|
281
288
|
|
282
289
|
// url -> set configuration first
|
283
290
|
if (commandName === "url" && !args[0].includes("do-not-change-configuration")) {
|
284
|
-
browser.
|
291
|
+
await browser.executeAsync(function(done) {
|
285
292
|
window["sap-ui-webcomponents-bundle"].configuration.setNoConflict(true);
|
293
|
+
done();
|
286
294
|
});
|
287
295
|
}
|
288
296
|
|
@@ -295,16 +303,17 @@ exports.config = {
|
|
295
303
|
"keys",
|
296
304
|
"pause",
|
297
305
|
"removeAttribute", // custom
|
306
|
+
"scrollIntoView",
|
298
307
|
"setAttribute", // custom
|
299
308
|
"setProperty", // custom
|
300
309
|
"setValue",
|
301
310
|
"setWindowSize",
|
302
311
|
"touchAction",
|
303
|
-
"url"
|
312
|
+
"url",
|
304
313
|
];
|
305
314
|
if (waitFor.includes(commandName)) {
|
306
|
-
browser.executeAsync(function (done) {
|
307
|
-
window.
|
315
|
+
await browser.executeAsync(function (done) {
|
316
|
+
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
308
317
|
});
|
309
318
|
}
|
310
319
|
},
|
@@ -0,0 +1,344 @@
|
|
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
|
+
}
|
package/icons-collection/nps.js
CHANGED
@@ -1,25 +1,69 @@
|
|
1
1
|
const path = require("path");
|
2
|
+
const resolve = require("resolve");
|
3
|
+
|
4
|
+
const generateHash = resolve.sync("@ui5/webcomponents-tools/lib/hash/generate.js");
|
5
|
+
const hashIsUpToDate = resolve.sync("@ui5/webcomponents-tools/lib/hash/upToDate.js");
|
6
|
+
const UP_TO_DATE = `node "${hashIsUpToDate}" dist/ hash.txt && echo "Up to date."`;
|
2
7
|
|
3
8
|
const LIB = path.join(__dirname, `../lib/`);
|
4
9
|
|
5
|
-
const
|
10
|
+
const createIconImportsCommand = (options) => {
|
11
|
+
if (!options.versions) {
|
12
|
+
return `node "${LIB}/create-icons/index.js" "${options.collectionName}"`;
|
13
|
+
}
|
14
|
+
|
15
|
+
const command = { default: "nps" };
|
16
|
+
options.versions.forEach((v) => {
|
17
|
+
command.default += ` build.icons.create${v}`;
|
18
|
+
command[`create${v}`] = `node "${LIB}/create-icons/index.js" "${options.collectionName}" "${v}"`;
|
19
|
+
});
|
20
|
+
|
21
|
+
return command;
|
22
|
+
}
|
23
|
+
|
24
|
+
const copyIconAssetsCommand = (options) => {
|
25
|
+
if (!options.versions) {
|
26
|
+
return {
|
27
|
+
default: "nps copy.json-imports copy.icon-collection",
|
28
|
+
"json-imports": `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
|
29
|
+
"icon-collection": `node "${LIB}/copy-and-watch/index.js" --silent "src/*.json" dist/generated/assets/`,
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
const command = {
|
34
|
+
default: "nps copy.json-imports ",
|
35
|
+
"json-imports": `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
|
36
|
+
};
|
37
|
+
|
38
|
+
options.versions.forEach((v) => {
|
39
|
+
command.default += ` copy.icon-collection${v}`;
|
40
|
+
command[`icon-collection${v}`] = `node "${LIB}/copy-and-watch/index.js" --silent "src/${v}/*.json" dist/generated/assets/${v}/`;
|
41
|
+
});
|
42
|
+
|
43
|
+
return command;
|
44
|
+
}
|
45
|
+
|
46
|
+
const getScripts = (options) => {
|
47
|
+
const createJSImportsCmd = createIconImportsCommand(options);
|
48
|
+
const copyAssetsCmd = copyIconAssetsCommand(options);
|
6
49
|
|
7
50
|
const scripts = {
|
8
51
|
clean: "rimraf dist",
|
9
|
-
copy:
|
10
|
-
default: "nps copy.json-imports copy.icon-collections",
|
11
|
-
"json-imports": `node "${LIB}/copy-and-watch/index.js" "src/**/*.js" dist/`,
|
12
|
-
"icon-collections": `node "${LIB}/copy-and-watch/index.js" "src/icon-collections/**/*.json" dist/generated/assets/icon-collections/`
|
13
|
-
},
|
52
|
+
copy: copyAssetsCmd,
|
14
53
|
build: {
|
15
|
-
default:
|
54
|
+
default: `${UP_TO_DATE} || nps clean copy build.i18n build.icons build.jsonImports hash`,
|
16
55
|
i18n: {
|
17
56
|
default: "nps build.i18n.defaultsjs build.i18n.json",
|
18
57
|
defaultsjs: `mkdirp dist/generated/i18n && node "${LIB}/i18n/defaults.js" src/i18n dist/generated/i18n`,
|
19
58
|
json: `mkdirp dist/generated/assets/i18n && node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
|
20
59
|
},
|
21
|
-
|
22
|
-
|
60
|
+
jsonImports: {
|
61
|
+
default: "mkdirp dist/generated/json-imports && nps build.jsonImports.i18n",
|
62
|
+
i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n dist/generated/json-imports`,
|
63
|
+
},
|
64
|
+
icons: createJSImportsCmd,
|
65
|
+
},
|
66
|
+
hash: `node "${generateHash}" dist/ hash.txt`,
|
23
67
|
};
|
24
68
|
|
25
69
|
return scripts;
|
@@ -10,7 +10,7 @@ require('colors');
|
|
10
10
|
const args = process.argv.slice(2);
|
11
11
|
const options = {};
|
12
12
|
|
13
|
-
['watch', 'clean', 'skip-initial-copy', 'safe'].forEach(key => {
|
13
|
+
['watch', 'clean', 'skip-initial-copy', 'safe', 'silent'].forEach(key => {
|
14
14
|
const index = args.indexOf(`--${key}`);
|
15
15
|
if (index >= 0) {
|
16
16
|
options[key] = true;
|
@@ -64,12 +64,12 @@ const copy = from => {
|
|
64
64
|
return;
|
65
65
|
}
|
66
66
|
fs.writeFileSync(to, fs.readFileSync(from));
|
67
|
-
console.log('[COPY]'.yellow, from, 'to'.yellow, to);
|
67
|
+
options.silent || console.log('[COPY]'.yellow, from, 'to'.yellow, to);
|
68
68
|
};
|
69
69
|
const remove = from => {
|
70
70
|
const to = findTarget(from);
|
71
71
|
fs.unlinkSync(to);
|
72
|
-
console.log('[DELETE]'.yellow, to);
|
72
|
+
options.silent || console.log('[DELETE]'.yellow, to);
|
73
73
|
};
|
74
74
|
const rimraf = dir => {
|
75
75
|
if (fs.existsSync(dir)) {
|
@@ -110,7 +110,9 @@ if (options.watch) {
|
|
110
110
|
|
111
111
|
chokidar
|
112
112
|
.watch(sources, chokidarOptions)
|
113
|
-
.on('ready', () => sources.forEach(s =>
|
113
|
+
.on('ready', () => sources.forEach(s => {
|
114
|
+
options.silent || console.log('[WATCH]'.yellow, s);
|
115
|
+
}))
|
114
116
|
.on('add', copy)
|
115
117
|
.on('addDir', copy)
|
116
118
|
.on('change', copy)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
const fs = require("fs");
|
2
|
+
const path = require("path");
|
3
|
+
const mkdirp = require("mkdirp");
|
4
|
+
|
5
|
+
const fileList = process.argv[2];
|
6
|
+
const dest = process.argv[3];
|
7
|
+
const src = "../../node_modules/@openui5/sap.ui.core/src/";
|
8
|
+
|
9
|
+
const filesToCopy = fs.readFileSync(fileList).toString();
|
10
|
+
// console.log(filesToCopy);
|
11
|
+
|
12
|
+
// Support full-line comments starting with # in the used-modules.txt file
|
13
|
+
const shouldCopy = file => file.length && !file.startsWith("#");
|
14
|
+
|
15
|
+
const trimFile = file => file.trim();
|
16
|
+
|
17
|
+
filesToCopy.split("\n").map(trimFile).filter(shouldCopy).forEach(async moduleName => {
|
18
|
+
const srcPath = path.join(src, moduleName);
|
19
|
+
const destPath = path.join(dest, moduleName);
|
20
|
+
|
21
|
+
await mkdirp(path.dirname(destPath));
|
22
|
+
fs.copyFile(srcPath, destPath, (err) => {
|
23
|
+
if (err) {
|
24
|
+
throw err;
|
25
|
+
}
|
26
|
+
console.log(`${destPath} created.`);
|
27
|
+
});
|
28
|
+
});
|