testaro 5.9.3 → 5.10.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.
Files changed (3) hide show
  1. package/commands.js +1 -1
  2. package/package.json +1 -1
  3. package/run.js +17 -1
package/commands.js CHANGED
@@ -32,7 +32,7 @@ exports.commands = {
32
32
  }
33
33
  ],
34
34
  link: [
35
- 'Click a link',
35
+ 'Click a link and wait for the page to be idle or loaded',
36
36
  {
37
37
  which: [true, 'string', 'hasLength', 'substring of link text'],
38
38
  index: [false, 'number', '', 'index among matches if not 0'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "5.9.3",
3
+ "version": "5.10.0",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/run.js CHANGED
@@ -1097,13 +1097,29 @@ const doActs = async (report, actIndex, page) => {
1097
1097
  };
1098
1098
  });
1099
1099
  });
1100
+ let loadState = 'idle';
1101
+ // Wait up to 3 seconds for the resulting page to be idle.
1102
+ await page.waitForLoadState('networkidle', {timeout: 3000})
1103
+ // If the wait times out:
1104
+ .catch(async () => {
1105
+ loadState = 'loaded';
1106
+ // Wait up to 2 seconds for the page to be loaded.
1107
+ await page.waitForLoadState('domcontentloaded', {timeout: 2000})
1108
+ // If the wait times out:
1109
+ .catch(() => {
1110
+ loadState = 'incomplete';
1111
+ // Proceed but report the timeout.
1112
+ console.log('ERROR waiting for page to load after link activation');
1113
+ });
1114
+ });
1100
1115
  // If it was clicked:
1101
1116
  if (actIndex > -2) {
1102
1117
  // Report the success.
1103
1118
  act.result = {
1104
1119
  href: href || 'NONE',
1105
1120
  target: target || 'NONE',
1106
- move: 'clicked'
1121
+ move: 'clicked',
1122
+ loadState
1107
1123
  };
1108
1124
  }
1109
1125
  }