testaro 2.2.9 → 2.3.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/README.md CHANGED
@@ -38,8 +38,8 @@ As of this version, the counts of tests in the packages referenced above were:
38
38
  - Equal Access: 163
39
39
  - WAVE: 110
40
40
  - subtotal: 612
41
- - Testaro tests: 15
42
- - grand total: 627
41
+ - Testaro tests: 16
42
+ - grand total: 628
43
43
 
44
44
  ## Code organization
45
45
 
@@ -279,6 +279,8 @@ The data for scores can include not only test results, but also log statistics.
279
279
  - `visitTimeoutCount`: how many times an attempt to visit a URL timed out
280
280
  - `visitRejectionCount`: how many times a URL visit got an HTTP status other than 200 or 304
281
281
 
282
+ Those log statistics can provide data for a log-based test defined in a score proc.
283
+
282
284
  A good score proc takes account of duplications between test packages: two or more packages that discover the same accessibility defects. Score procs can apply discounts to reflect duplications between test packages, so that, if two or more packages discover the same defect, the defect will not be overweighted.
283
285
 
284
286
  The procedures in the `scoring` directory have produced data there that score procs can use for the calibration of discounts.
package/commands.js CHANGED
@@ -119,11 +119,11 @@ exports.commands = {
119
119
  }
120
120
  ],
121
121
  text: [
122
- 'Enter text into a text input',
122
+ 'Enter text into a text input, optionally with 1 placeholder for an all-caps literal environment variable',
123
123
  {
124
124
  which: [true, 'string', 'hasLength', 'substring of input text'],
125
125
  index: [false, 'number', '', 'index among matches if not 0'],
126
- what: [true, 'string', 'hasLength', 'text to enter']
126
+ what: [true, 'string', 'hasLength', 'text to enter, with optional __PLACEHOLDER__']
127
127
  }
128
128
  ],
129
129
  url: [
package/index.js CHANGED
@@ -1006,8 +1006,17 @@ const doActs = async (report, actIndex, page) => {
1006
1006
  ? `“${optionText}}” selected`
1007
1007
  : 'ERROR: option not found';
1008
1008
  }
1009
- // Otherwise, if it is entering text on the element, perform it.
1009
+ // Otherwise, if it is entering text on the element:
1010
1010
  else if (act.type === 'text') {
1011
+ // If the text contains a placeholder for an environment variable:
1012
+ let {what} = act;
1013
+ if (/__[A-Z]+__/.test(what)) {
1014
+ // Replace it.
1015
+ const envKey = /__([A-Z]+)__/.exec(what)[1];
1016
+ const envValue = process.env[envKey];
1017
+ what = what.replace(/__[A-Z]+__/, envValue);
1018
+ }
1019
+ // Enter the text.
1011
1020
  await whichElement.type(act.what);
1012
1021
  report.presses += act.what.length;
1013
1022
  act.result = 'entered';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "2.2.9",
3
+ "version": "2.3.0",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {