@enact/ui-test-utils 1.0.0 → 1.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/.travis.yml CHANGED
@@ -9,5 +9,5 @@ install:
9
9
  - npm install
10
10
  script:
11
11
  - echo -e "\x1b\x5b35;1m*** Linting...\x1b\x5b0m"
12
- - npm run lint
12
+ - npm run lint -- --report-unused-disable-directives --max-warnings 0
13
13
  - echo -e "\x1b\x5b35;1m*** Linting complete...\x1b\x5b0m"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## [1.0.1] (October 12, 2022)
4
+
5
+ * Fixed the first tests in the test suite fail randomly by adding missed `await` in `utils/Page`.
6
+ * Fixed the util method `waitTransitionEnd` in `utils/Page` to correctly call `browser.waitUntil()` and to wait for the promise of `browser.execute()` to be resolved.
7
+
3
8
  ## [1.0.0] (June 8, 2022)
4
9
 
5
10
  * Updated test app to use `createRoot` API from React 18.
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@enact/ui-test-utils",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "UI Testing for the Enact framework",
5
+ "repository": "https://github.com/enactjs/ui-test-utils",
5
6
  "main": "index.js",
6
7
  "bin": {
7
8
  "start-tests": "./start-tests.js"
package/start-tests.js CHANGED
File without changes
package/utils/Page.js CHANGED
@@ -13,6 +13,10 @@ class Page {
13
13
  }
14
14
 
15
15
  async open (appPath, urlExtra = '?locale=en-US') {
16
+ await browser.execute(function () {
17
+ document.body.innerHTML = '';
18
+ });
19
+
16
20
  this._url = `/${appPath}/${urlExtra}`;
17
21
  // Can't resize browser window when connected to remote debugger!
18
22
  if (!browser._options || !browser._options.remote) {
@@ -22,7 +26,9 @@ class Page {
22
26
  await browser.url(this.url);
23
27
 
24
28
  const body = await $('body');
25
- await body.waitForExist({timeout: 1000});
29
+ await body.waitForDisplayed({timeout: 5000});
30
+
31
+ await this.delay(200);
26
32
  }
27
33
 
28
34
  serializeParams (params) {
@@ -69,7 +75,7 @@ class Page {
69
75
 
70
76
  // For testing "pointer off" by timeout.
71
77
  async hidePointerByKeycode () {
72
- browser.execute(function () {
78
+ await browser.execute(function () {
73
79
  const event = document.createEvent('Events');
74
80
  event.initEvent('keydown', true, true);
75
81
  event.keyCode = 1537;
@@ -136,7 +142,7 @@ class Page {
136
142
  await browser.waitUntil(() => target.isExisting() && target.isFocused(), {timeout, timeoutMsg, interval});
137
143
  }
138
144
 
139
- async waitTransitionEnd (delay = 3000, msg = 'timed out waiting for transitionend', callback, ignore = ['opacity', 'filter']) {
145
+ async waitTransitionEnd (timeout = 3000, timeoutMsg = 'timed out waiting for transitionend', callback, ignore = ['opacity', 'filter']) {
140
146
  await browser.execute(
141
147
  // eslint-disable-next-line no-shadow
142
148
  function (ignore) {
@@ -153,15 +159,14 @@ class Page {
153
159
  callback();
154
160
  }
155
161
  await browser.waitUntil(
156
- function () {
157
- return browser.execute(
162
+ async function () {
163
+ return await browser.execute(
158
164
  function () {
159
165
  return window.__transition;
160
166
  }
161
167
  );
162
168
  },
163
- delay,
164
- msg
169
+ {timeout, timeoutMsg}
165
170
  );
166
171
  }
167
172
  }
package/utils/runTest.js CHANGED
@@ -19,7 +19,7 @@ const runTest = ({concurrency, filter, Page, testName, ...rest}) => {
19
19
  await Page.open('?request');
20
20
 
21
21
  let testCases = await browser.execute(async function () {
22
- return await window.__TEST_DATA; // eslint-disable-line no-undef
22
+ return await window.__TEST_DATA;
23
23
  });
24
24
 
25
25
  await expect(testCases).to.be.an('object', 'Test data failed to load');