testaro 35.0.3 → 35.0.5

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 (2) hide show
  1. package/package.json +1 -1
  2. package/testaro/focVis.js +23 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "35.0.3",
3
+ "version": "35.0.5",
4
4
  "description": "Run 1000 web accessibility tests from 10 tools and get a standardized report",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/testaro/focVis.js CHANGED
@@ -40,25 +40,30 @@ exports.reporter = async (page, withItems) => {
40
40
  // For each locator:
41
41
  for (const loc of all.allLocs) {
42
42
  // Get how its element violates the rule, if it does.
43
- const isBad = await loc.evaluate(el => {
44
- const isAbove = el.offsetTop + el.offsetHeight <= 0;
45
- const isLeft = el.offsetLeft + el.offsetWidth <= 0;
46
- return [isAbove, isLeft];
47
- });
48
- // If it does:
49
- if (isBad[0] || isBad[1]) {
50
- // Add the locator to the array of violators.
51
- let param;
52
- if (isBad[0] && isBad[1]) {
53
- param = 'above and to the left of';
43
+ try {
44
+ const isBad = await loc.evaluate(el => {
45
+ const isAbove = el.offsetTop + el.offsetHeight <= 0;
46
+ const isLeft = el.offsetLeft + el.offsetWidth <= 0;
47
+ return [isAbove, isLeft];
48
+ }, {timeout: 500});
49
+ // If it does:
50
+ if (isBad[0] || isBad[1]) {
51
+ // Add the locator to the array of violators.
52
+ let param;
53
+ if (isBad[0] && isBad[1]) {
54
+ param = 'above and to the left of';
55
+ }
56
+ else if (isBad[0]) {
57
+ param = 'above';
58
+ }
59
+ else {
60
+ param = 'to the left of';
61
+ }
62
+ all.locs.push([loc, param]);
54
63
  }
55
- else if (isBad[0]) {
56
- param = 'above';
57
- }
58
- else {
59
- param = 'to the left of';
60
- }
61
- all.locs.push([loc, param]);
64
+ }
65
+ catch(error) {
66
+ console.log(`ERROR analyzing locator for focVis (${error.message})`);
62
67
  }
63
68
  }
64
69
  // Populate and return the result.