@suffolklitlab/alkiln 5.8.1-feat2columns2 → 5.8.1-feat2columns3

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.
@@ -88,5 +88,5 @@ jobs:
88
88
  #### Developer note: Useful for temporarily shortening ALKiln tests
89
89
  #### to debug the docker install step
90
90
  # ALKILN_TAG_EXPRESSION: @a_tag_expression
91
- ALKILN_VERSION: 5.8.1-feat2columns2
91
+ ALKILN_VERSION: 5.8.1-feat2columns3
92
92
 
@@ -55,4 +55,4 @@ jobs:
55
55
  #### to debug the docker install step
56
56
  # ALKILN_TAG_EXPRESSION: @a_tag_expression
57
57
  #### Developer note: you probalby don't need this
58
- ALKILN_VERSION: 5.8.1-feat2columns2
58
+ ALKILN_VERSION: 5.8.1-feat2columns3
package/CHANGELOG.md CHANGED
@@ -45,6 +45,10 @@ Format:
45
45
 
46
46
  <!-- ## [Unreleased] -->
47
47
 
48
+ ### Added
49
+
50
+ - 2-column Story Tables that work without the trigger variable. Now column 1, "var", should only contain the actual variable name with no proxies (x, i, j, etc). For example, instead of `x[i].name.first` the var column should now contain `users[0].name.first`. Column 2 is the same as it was before - the answer for the field. See [#582](https://github.com/SuffolkLITLab/ALKiln/issues/582).
51
+
48
52
  ## [5.8.1] - 2023-12-28
49
53
 
50
54
  ### Fixed
package/lib/scope.js CHANGED
@@ -721,51 +721,6 @@ module.exports = {
721
721
  return result;
722
722
  }, // Ends scope.getLoadData()
723
723
 
724
- // three_column_table_warning: async function ( scope, { var_data=null, raw_var_data=null }) {
725
-
726
- // },
727
-
728
- // normalize_table_base: async function ( scope, { var_data=null, raw_var_data=null }) {
729
- // /* Return data derived from cucumber variable-setting data, from either an object format
730
- // * (var_data) or an array format (raw_var_data). `var_data` only is used when calling
731
- // * normalizeTable internally.
732
- // *
733
- // * Takes care of the shared funcitonality that needs to happen to all tables.
734
- // */
735
-
736
- // if (!var_data && ! raw_var_data) {
737
- // let no_data_msg = `ALKiln Internal error: normalizeTable called w/o var_data or raw_var_data:` +
738
- // ` open an issue at https://github.com/SuffolkLITLab/ALKiln/issues/new if you see this!`;
739
- // reports.addToReport( scope, { type: `error`, value: no_data_msg });
740
- // throw Error(no_data_msg);
741
- // }
742
-
743
- // // Always use the raw var data if present; it has the full first row
744
- // if (raw_var_data) {
745
- // var_data = raw_var_data.hashes();
746
- // if (!('var' in var_data[0]) || !('value' in var_data[0])) {
747
- // let raw_array = raw_var_data.raw();
748
- // var_data = [];
749
- // for (let row_raw of raw_array) {
750
- // if (row_raw.length < 2) {
751
- // let bad_table_msg = `Your Story Table has less than 2 columns.`
752
- // + ` Take another look at Story Table documentation at`
753
- // + ` https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/alkiln/#story-tables.`
754
- // reports.addToReport( scope, { type: `error`, value: bad_table_msg})
755
- // throw Error(bad_table_msg);
756
- // } else if (row_raw.length == 2) {
757
- // var_data.push({var: row_raw[0], value: row_raw[1]});
758
- // } else {
759
- // var_data.push({var: row_raw[0], value: row_raw[1], trigger: row_raw[2]});
760
- // }
761
- // }
762
- // }
763
- // }
764
-
765
-
766
-
767
- // },
768
-
769
724
  normalizeTable: async function ( scope, { var_data=null, raw_var_data=null }) {
770
725
  /* Return data derived from cucumber variable-setting data, from either an object format
771
726
  * (var_data) or an array format (raw_var_data). `var_data` only is used when calling
@@ -1482,9 +1437,12 @@ module.exports = {
1482
1437
 
1483
1438
  let multiple_matches_msg = `Do you have a duplicate story table row? `
1484
1439
  + `Multiple story table rows match this field's variable name. `
1485
- + `The test will use the last row that matched. See `
1486
- + `https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/alkiln/#trigger.`
1487
- + `\nThe matching rows:\n${ rows_as_story_table.join(`\n`) }`
1440
+ + `The test will use the last row that matched.`
1441
+
1442
+ if ( trigger_might_be_needed ) {
1443
+ multiple_matches_msg += ` See https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/alkiln/#trigger.`
1444
+ }
1445
+ multiple_matches_msg += `\nThe matching rows:\n${ rows_as_story_table.join(`\n`) }`
1488
1446
  + `\nThis field's data:\n${ JSON.stringify( field )}`;
1489
1447
  reports.addToReport(scope, { type: `warning`, value: multiple_matches_msg });
1490
1448
  }
@@ -2148,24 +2106,21 @@ module.exports = {
2148
2106
 
2149
2107
  // If all table rows must be used and any table row was not, error
2150
2108
  if ( ensure_all_vars_used ) {
2151
- let num_unused_rows = 0;
2152
2109
  for ( let row of var_data ) {
2153
2110
  if ( row.times_used === 0 ) {
2154
- num_unused_rows += 1;
2111
+ let values_used_status = 'The page is missing a value';
2155
2112
  let source_row = row;
2156
2113
  // TODO: Make the row object flatter so we don't need to dig in this way
2157
2114
  if ( row.source ) { source_row = row.source; }
2158
2115
  let original_row = source_row.original;
2159
- let msg = `Did not find a field on this page for the variable "${ original_row.var }" that could be set to "${ original_row.value }"`;
2160
- reports.addToReport(scope, { type: `warning`, value: msg });
2116
+ let { id } = await scope.examinePageID( scope, 'none to match' );
2117
+ let msg = `In a linear Step all the values you give MUST be filled in, but ALKiln was unable `
2118
+ + `to find a field on the page "${id}" for the variable "${ original_row.var }" that `
2119
+ + `could be set to "${ original_row.value }". See this Scenario's HTML file for details.`;
2120
+ reports.addToReport(scope, { type: `error`, value: msg });
2121
+ expect( values_used_status, msg ).to.equal( '' );
2161
2122
  }
2162
2123
  }
2163
- if ( num_unused_rows > 0 ) {
2164
- let { id } = await scope.examinePageID( scope, 'none to match' );
2165
- let msg = `Error on page "${id}". See screenshot and see text above for more details.`;
2166
- reports.addToReport(scope, { type: `error`, value: msg });
2167
- expect( num_unused_rows, msg ).to.equal( 0 );
2168
- }
2169
2124
  }
2170
2125
 
2171
2126
  // If didn't already press a continue button, press one now.
package/lib/steps.js CHANGED
@@ -297,7 +297,9 @@ Given(/the max(?:imum)? sec(?:ond)?s for each step (?:in this scenario )?is (\d+
297
297
  // Story
298
298
  //#####################################
299
299
  //#####################################
300
-
300
+ // TODO: Consider more permissive sentences:
301
+ // with(?: this data| these answers)?:?
302
+ // with(?:.*):?
301
303
  When(/^(?:the user gets)?(?:I get)? to ?(?:the)?(?: ?question)?(?: id)? "([^"]+)" with this data:?/, {timeout: -1}, async (target_id, raw_var_data) => {
302
304
  /* NO CUCUMBER TIMEOUT. Must handle timeout ourselves:
303
305
  * https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/timeouts.md#disable-timeouts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "5.8.1-feat2columns2",
3
+ "version": "5.8.1-feat2columns3",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {