@enact/ui-test-utils 3.0.0 → 4.0.0
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 +4 -0
- package/config/wdio.conf.js +41 -50
- package/npm-shrinkwrap.json +1166 -2362
- package/package.json +16 -17
- package/screenshot/wdio.tv.conf.js +1 -7
- package/ui/wdio.tv.conf.js +1 -7
- package/utils/Page.js +1 -5
- package/utils/runTest.js +1 -0
package/CHANGELOG.md
CHANGED
package/config/wdio.conf.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import parseArgs from 'minimist';
|
|
2
|
-
import {execSync} from 'child_process';
|
|
3
2
|
|
|
4
3
|
const args = parseArgs(process.argv);
|
|
5
4
|
|
|
6
5
|
const visibleBrowser = !!args.visible,
|
|
7
|
-
maxInstances = args.instances || 5
|
|
8
|
-
offline = args.offline;
|
|
6
|
+
maxInstances = args.instances || 5;
|
|
9
7
|
|
|
10
8
|
export const configure = (options) => {
|
|
11
9
|
const {base, services} = options;
|
|
@@ -16,41 +14,8 @@ export const configure = (options) => {
|
|
|
16
14
|
delete opts.services;
|
|
17
15
|
|
|
18
16
|
if (!process.env.CHROME_DRIVER) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} else {
|
|
22
|
-
let chromeVersionMajorNumber;
|
|
23
|
-
try {
|
|
24
|
-
if (process.platform === 'win32') {
|
|
25
|
-
// Windows
|
|
26
|
-
const chromeVersion = /\d+/.exec(execSync('wmic datafile where "name=\'C:\\\\Program Files\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe\'" get Version /value').toString());
|
|
27
|
-
chromeVersionMajorNumber = (chromeVersion && chromeVersion[0]);
|
|
28
|
-
} else if (process.platform === 'darwin') {
|
|
29
|
-
// Mac
|
|
30
|
-
const chromeVersion = /Chrome (\d+)/.exec(execSync('/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --version'));
|
|
31
|
-
chromeVersionMajorNumber = (chromeVersion && chromeVersion[1]);
|
|
32
|
-
} else {
|
|
33
|
-
const chromeVersion = /Chrome (\d+)/.exec(execSync('google-chrome -version'));
|
|
34
|
-
chromeVersionMajorNumber = (chromeVersion && chromeVersion[1]);
|
|
35
|
-
}
|
|
36
|
-
let chromeDriverVersion;
|
|
37
|
-
|
|
38
|
-
if (chromeVersionMajorNumber > 114) {
|
|
39
|
-
chromeDriverVersion = execSync('curl https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE' + (chromeVersionMajorNumber ? ('_' + chromeVersionMajorNumber) : ''));
|
|
40
|
-
} else {
|
|
41
|
-
chromeDriverVersion = execSync('curl https://chromedriver.storage.googleapis.com/LATEST_RELEASE' + (chromeVersionMajorNumber ? ('_' + chromeVersionMajorNumber) : ''));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (chromeDriverVersion.includes('Error') || !/\d+.\d+.\d+.\d+/.exec(chromeDriverVersion)) {
|
|
45
|
-
throw new Error();
|
|
46
|
-
} else {
|
|
47
|
-
process.env.CHROME_DRIVER = chromeDriverVersion;
|
|
48
|
-
}
|
|
49
|
-
} catch (error) {
|
|
50
|
-
console.log('ERROR: Cannot find Chrome driver from Chrome ' + chromeVersionMajorNumber);
|
|
51
|
-
process.env.CHROME_DRIVER = 2.44;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
17
|
+
// TODO: Update this version when chromedriver version in CI/CD is updated
|
|
18
|
+
process.env.CHROME_DRIVER = base === 'screenshot' ? '120.0.6099.109' : '132.0.6834.159';
|
|
54
19
|
|
|
55
20
|
console.log('Chrome Driver Version : ' + process.env.CHROME_DRIVER);
|
|
56
21
|
}
|
|
@@ -120,12 +85,31 @@ export const configure = (options) => {
|
|
|
120
85
|
browserName: 'chrome',
|
|
121
86
|
/* WebdriverIO v8.14 and above downloads and uses the latest Chrome version when running tests.
|
|
122
87
|
We need to specify a browser version that matches chromedriver version running in CI/CD environment to
|
|
123
|
-
ensure testing accuracy.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
88
|
+
ensure testing accuracy. */
|
|
89
|
+
browserVersion: process.env.CHROME_DRIVER,
|
|
90
|
+
'goog:chromeOptions': visibleBrowser ?
|
|
91
|
+
{
|
|
92
|
+
args: [
|
|
93
|
+
'--disable-lcd-text',
|
|
94
|
+
'--force-device-scale-factor=1',
|
|
95
|
+
'--start-maximized',
|
|
96
|
+
'--start-fullscreen',
|
|
97
|
+
'--disable-gpu',
|
|
98
|
+
'--window-size=1920,1080'
|
|
99
|
+
]
|
|
100
|
+
} : {
|
|
101
|
+
args: [
|
|
102
|
+
'--disable-lcd-text',
|
|
103
|
+
'--force-device-scale-factor=1',
|
|
104
|
+
'--start-maximized',
|
|
105
|
+
'--start-fullscreen',
|
|
106
|
+
'--headless',
|
|
107
|
+
'--disable-gpu',
|
|
108
|
+
'--window-size=1920,1080'
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
webSocketUrl: false, // disables BiDi, forces classic mode
|
|
112
|
+
'wdio:enforceWebDriverClassic': true
|
|
129
113
|
}],
|
|
130
114
|
//
|
|
131
115
|
// ===================
|
|
@@ -155,13 +139,19 @@ export const configure = (options) => {
|
|
|
155
139
|
//
|
|
156
140
|
// Default timeout in milliseconds for request
|
|
157
141
|
// if Selenium Grid doesn't send response
|
|
158
|
-
connectionRetryTimeout:
|
|
142
|
+
connectionRetryTimeout: 120000,
|
|
159
143
|
//
|
|
160
144
|
// Default request retries count
|
|
161
145
|
connectionRetryCount: 3,
|
|
162
146
|
// Ignore deprecation warnings
|
|
163
147
|
deprecationWarnings: false,
|
|
164
148
|
//
|
|
149
|
+
// Default timeouts
|
|
150
|
+
//
|
|
151
|
+
timeouts: {
|
|
152
|
+
script: 60000 // extend script timeout to 60s just in case
|
|
153
|
+
},
|
|
154
|
+
//
|
|
165
155
|
// Initialize the browser instance with a WebdriverIO plugin. The object should have the
|
|
166
156
|
// plugin name as key and the desired plugin options as properties. Make sure you have
|
|
167
157
|
// the plugin installed before running any tests. The following plugins are currently
|
|
@@ -185,9 +175,6 @@ export const configure = (options) => {
|
|
|
185
175
|
// your test setup with almost no effort. Unlike plugins, they don't add new
|
|
186
176
|
// commands. Instead, they hook themselves up into the test process.
|
|
187
177
|
services: [
|
|
188
|
-
['selenium-standalone', {
|
|
189
|
-
skipSeleniumInstall: offline
|
|
190
|
-
}],
|
|
191
178
|
['static-server', {
|
|
192
179
|
folders: [
|
|
193
180
|
{mount: '/', path: './tests/' + base + '/dist'}
|
|
@@ -219,11 +206,15 @@ export const configure = (options) => {
|
|
|
219
206
|
* Gets executed before test execution begins. At this point you can access to all global
|
|
220
207
|
* variables like `browser`. It is the perfect place to define custom commands.
|
|
221
208
|
*/
|
|
222
|
-
before: function () {
|
|
209
|
+
before: async function () {
|
|
223
210
|
global.wdioExpect = global.expect;
|
|
211
|
+
// in Chrome 132, the browser window size takes into account also the address bar and tab area
|
|
212
|
+
await browser.maximizeWindow();
|
|
213
|
+
let browserHeight = base === 'screenshot' ? 1080 : 1272;
|
|
214
|
+
await browser.setWindowSize(1920, browserHeight);
|
|
224
215
|
|
|
225
216
|
if (options.before) {
|
|
226
|
-
options.before();
|
|
217
|
+
await options.before();
|
|
227
218
|
}
|
|
228
219
|
}
|
|
229
220
|
}
|