@enact/ui-test-utils 3.0.0 → 4.0.1

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.1] (January 13, 2026)
4
+
5
+ * Updated Chrome driver version to 132 for screenshot tests.
6
+
7
+ ## [4.0.0] (November 14, 2025)
8
+
9
+ * Updated Chrome driver version to 132.
10
+
3
11
  ## [3.0.0] (July 30, 2025)
4
12
 
5
13
  * Migrated to ESM
@@ -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,47 +14,14 @@ export const 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 = '132.0.6834.159';
54
19
 
55
20
  console.log('Chrome Driver Version : ' + process.env.CHROME_DRIVER);
56
21
  }
57
22
 
58
23
  return Object.assign(
59
- opts,
24
+ {},
60
25
  {
61
26
  path: '/',
62
27
  //
@@ -120,12 +85,33 @@ 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
- 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':
91
+ {
92
+ args: [
93
+ '--disable-infobars',
94
+ '--disable-search-engine-choice-screen',
95
+ '--disable-notifications',
96
+ '--disable-popup-blocking',
97
+ '--disable-lcd-text',
98
+ '--force-device-scale-factor=1',
99
+ '--start-maximized',
100
+ '--disable-gpu',
101
+ '--window-size=1920,1080',
102
+ // Critical for Chrome 132 in Jenkins/Linux
103
+ '--no-sandbox',
104
+ '--disable-dev-shm-usage',
105
+ '--disable-setuid-sandbox',
106
+ // Performance optimizations for Chrome 132
107
+ '--disable-features=VizDisplayCompositor',
108
+ '--disable-features=IsolateOrigins,site-per-process',
109
+ '--js-flags=--max-old-space-size=512',
110
+ ...(visibleBrowser ? [] : ['--headless=new'])
111
+ ]
112
+ },
113
+ webSocketUrl: false, // disables BiDi, forces classic mode
114
+ 'wdio:enforceWebDriverClassic': true
129
115
  }],
130
116
  //
131
117
  // ===================
@@ -151,17 +137,25 @@ export const configure = (options) => {
151
137
  baseUrl: 'http://localhost:4567',
152
138
  //
153
139
  // Default timeout for all waitFor* commands.
154
- waitforTimeout: 10000,
140
+ waitforTimeout: 45000,
155
141
  //
156
142
  // Default timeout in milliseconds for request
157
143
  // if Selenium Grid doesn't send response
158
- connectionRetryTimeout: 90000,
144
+ connectionRetryTimeout: 240000,
159
145
  //
160
146
  // Default request retries count
161
- connectionRetryCount: 3,
147
+ connectionRetryCount: 5,
162
148
  // Ignore deprecation warnings
163
149
  deprecationWarnings: false,
164
150
  //
151
+ // Default timeouts
152
+ //
153
+ timeouts: {
154
+ script: 600000,
155
+ pageLoad: 600000,
156
+ implicit: 20000
157
+ },
158
+ //
165
159
  // Initialize the browser instance with a WebdriverIO plugin. The object should have the
166
160
  // plugin name as key and the desired plugin options as properties. Make sure you have
167
161
  // the plugin installed before running any tests. The following plugins are currently
@@ -185,9 +179,6 @@ export const configure = (options) => {
185
179
  // your test setup with almost no effort. Unlike plugins, they don't add new
186
180
  // commands. Instead, they hook themselves up into the test process.
187
181
  services: [
188
- ['selenium-standalone', {
189
- skipSeleniumInstall: offline
190
- }],
191
182
  ['static-server', {
192
183
  folders: [
193
184
  {mount: '/', path: './tests/' + base + '/dist'}
@@ -213,19 +204,42 @@ export const configure = (options) => {
213
204
  // See the full list at http://mochajs.org/
214
205
  mochaOpts: {
215
206
  ui: 'bdd',
216
- timeout: 60 * 60 * 1000
207
+ timeout: 60 * 60 * 1000,
208
+ retries: 2 // Retry failed tests up to 2 times (important for timeout recovery)
217
209
  },
218
210
  /**
219
211
  * Gets executed before test execution begins. At this point you can access to all global
220
212
  * variables like `browser`. It is the perfect place to define custom commands.
221
213
  */
222
- before: function () {
214
+ before: async function () {
223
215
  global.wdioExpect = global.expect;
216
+ // in Chrome 132, the browser window size takes into account also the address bar and tab area
217
+ await browser.setWindowSize(1920, 1167);
218
+
219
+ // Small pause to let window resize complete
220
+ await browser.pause(200);
221
+
222
+ // Verify the window is ready
223
+ await browser.waitUntil(
224
+ async () => {
225
+ try {
226
+ const state = await browser.execute(() => document.readyState);
227
+ return state === 'complete';
228
+ } catch (e) {
229
+ return false;
230
+ }
231
+ },
232
+ {
233
+ timeout: 15000,
234
+ timeoutMsg: 'Page did not reach ready state'
235
+ }
236
+ );
224
237
 
225
238
  if (options.before) {
226
- options.before();
239
+ await options.before();
227
240
  }
228
241
  }
229
- }
242
+ },
243
+ opts
230
244
  );
231
245
  };