@enact/ui-test-utils 2.0.1 → 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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Change Log
2
2
 
3
+ ## [4.0.0] (November 14, 2025)
4
+
5
+ * Updated Chrome driver version to 132.
6
+
7
+ ## [3.0.0] (July 30, 2025)
8
+
9
+ * Migrated to ESM
10
+
3
11
  ## [2.0.1] (July 18, 2025)
4
12
 
5
13
  * Updated dependencies.
package/README.md CHANGED
@@ -9,29 +9,29 @@ and must be configured as a `devDependency` of the UI library.
9
9
  1. Add `@enact/ui-test-utils` as a devDependency: `npm i --save-dev @enact/ui-test-utils`
10
10
  2. Create the `tests/ui` folder structure within the UI library
11
11
  3. Add `apps` and `specs` folders to `tests/ui`
12
- 4. Add local WebDriver configuration files within `tests/ui`
12
+ 4. Add local WebDriver configuration files within `tests/ui/config`
13
13
 
14
- * `wdio.conf.js` containing `module.exports = require('@enact/ui-test-utils/ui/wdio.conf.js');`
15
- * `wdio.docker.conf.js` containing `module.exports = require('@enact/ui-test-utils/ui/wdio.docker.conf.js');`
16
- * `wdio.tv.conf.js` containing `module.exports = require('@enact/ui-test-utils/ui/wdio.tv.conf.js');`
14
+ * `wdio.conf.js` containing `import config from '@enact/ui-test-utils/ui/wdio.conf.js'; export default uiConfig;`
15
+ * `wdio.docker.conf.js` containing `import {uiDockerConfig} from '@enact/ui-test-utils/ui/wdio.docker.conf.js'; export default config;`
16
+ * `wdio.tv.conf.js` containing `import {uiTVConfig} from '@enact/ui-test-utils/ui/wdio.tv.conf.js'; export default config;`
17
17
 
18
- * and `tests/screenshot`
18
+ * and `tests/screenshot/config`
19
19
 
20
- * `wdio.conf.js` containing `module.exports = require('@enact/ui-test-utils/screenshot/wdio.conf.js');`
21
- * `wdio.docker.conf.js` containing `module.exports = require('@enact/ui-test-utils/screenshot/wdio.docker.conf.js');`
22
- * `wdio.tv.conf.js` containing `module.exports = require('@enact/ui-test-utils/screenshot/wdio.tv.conf.js');`
20
+ * `wdio.conf.js` containing `import config from '@enact/ui-test-utils/screenshot/wdio.conf.js'; export default ssConfig;`
21
+ * `wdio.docker.conf.js` containing `import {ssDockerConfig} from '@enact/ui-test-utils/screenshot/wdio.docker.conf.js'; export default config;`
22
+ * `wdio.tv.conf.js` containing `import {ssTVConfig} from '@enact/ui-test-utils/screenshot/wdio.tv.conf.js'; export default config;`
23
23
 
24
24
  5. Add npm scripts for each of the above configuration files. There are likely other scripts already
25
25
  defined so these will be added to the existing scripts.
26
26
 
27
27
  ```json
28
28
  "scripts": {
29
- "test-ui": "start-tests tests/ui/wdio.conf.js",
30
- "test-ui-docker": "start-tests tests/ui/wdio.docker.conf.js",
31
- "test-ui-tv": "start-tests tests/ui/wdio.tv.conf.js",
32
- "test-ss": "start-tests tests/screenshot/wdio.conf.js",
33
- "test-ss-docker": "start-tests tests/screenshot/wdio.docker.conf.js",
34
- "test-ss-tv": "start-tests tests/screenshot/wdio.tv.conf.js",
29
+ "test-ui": "start-tests tests/ui/config/wdio.conf.js",
30
+ "test-ui-docker": "start-tests tests/ui/config/wdio.docker.conf.js",
31
+ "test-ui-tv": "start-tests tests/ui/config/wdio.tv.conf.js",
32
+ "test-ss": "start-tests tests/screenshot/config/wdio.conf.js",
33
+ "test-ss-docker": "start-tests tests/screenshot/config/wdio.docker.conf.js",
34
+ "test-ss-tv": "start-tests tests/screenshot/config/wdio.tv.conf.js",
35
35
  }
36
36
  ```
37
37
 
@@ -1,13 +1,11 @@
1
- const parseArgs = require('minimist');
2
- const {execSync} = require('child_process');
1
+ import parseArgs from 'minimist';
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
- module.exports.configure = (options) => {
8
+ export const configure = (options) => {
11
9
  const {base, services} = options;
12
10
  const opts = Object.assign({}, options);
13
11
 
@@ -16,41 +14,8 @@ module.exports.configure = (options) => {
16
14
  delete opts.services;
17
15
 
18
16
  if (!process.env.CHROME_DRIVER) {
19
- if (process.env.TV_IP && process.argv.find(arg => arg.includes('tv.conf'))) {
20
- process.env.CHROME_DRIVER = 2.44; // Currently, TV supports 83 and lower, but keep the previous version for safety.
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
  }
@@ -83,7 +48,7 @@ module.exports.configure = (options) => {
83
48
  // the config file unless it's absolute.
84
49
  //
85
50
  specs: [
86
- '../../tests/' + base + '/specs/**/*-specs.js'
51
+ '../../../tests/' + base + '/specs/**/*-specs.js'
87
52
  ],
88
53
  // Patterns to exclude.
89
54
  exclude: [
@@ -120,12 +85,31 @@ module.exports.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
- TODO: Update this version when chromedriver version in CI/CD is updated */
125
- browserVersion: '120.0.6099.109',
126
- 'goog:chromeOptions': visibleBrowser ? {} : {
127
- args: ['--headless', '--window-size=1920,1080']
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 @@ module.exports.configure = (options) => {
155
139
  //
156
140
  // Default timeout in milliseconds for request
157
141
  // if Selenium Grid doesn't send response
158
- connectionRetryTimeout: 90000,
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 @@ module.exports.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,13 +206,15 @@ module.exports.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 () {
223
- require('expect-webdriverio');
224
-
209
+ before: async function () {
225
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);
226
215
 
227
216
  if (options.before) {
228
- options.before();
217
+ await options.before();
229
218
  }
230
219
  }
231
220
  }
package/eslint.config.js CHANGED
@@ -1,5 +1,5 @@
1
- const enactStrict = require('eslint-config-enact/strict');
2
- const globals = require('globals');
1
+ import enactStrict from 'eslint-config-enact/strict.js';
2
+ import globals from 'globals';
3
3
 
4
4
  const customGlobals = {
5
5
  'browser': true,
@@ -8,7 +8,7 @@ const customGlobals = {
8
8
  '$$': true
9
9
  };
10
10
 
11
- module.exports = [
11
+ export default [
12
12
  ...enactStrict,
13
13
  {
14
14
  languageOptions: {