@suffolklitlab/alkiln 5.11.2-feat-output-6 → 5.11.2-fix-root-dir-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.
@@ -23,8 +23,8 @@ on:
23
23
  jobs:
24
24
 
25
25
  github-server-tests:
26
- #### Developer note: If you have both `push` and `pull_request` in the
27
- #### `on` section (above), this avoids running double tests when someone
26
+ #### Developer note: If under `on` (above) you have both `push` and
27
+ #### `pull_request`, this avoids running double tests when someone
28
28
  #### on the team makes a pull request
29
29
  # 1: Trigger job on push or dispatch from this repository
30
30
  # 2: Trigger job on pull request from a fork
@@ -71,10 +71,10 @@ jobs:
71
71
  shell: bash
72
72
 
73
73
  #### Developer note: You can probably leave this out
74
- # # Optional debugging to explore things like docker issues
75
- # - name: Docker debug tmate session
76
- # if: ${{ failure() && github.event.inputs.enable_tmate == 'true' }}
77
- # uses: mxschmitt/action-tmate@v3
74
+ # Optional debugging to explore things like docker issues
75
+ - name: Docker debug tmate session
76
+ if: ${{ github.event.inputs.enable_tmate }}
77
+ uses: mxschmitt/action-tmate@v3
78
78
 
79
79
  #### Developer note: You can probably leave this out
80
80
  - name: Run ALKiln - Env vars for our own tests from server output
@@ -93,49 +93,25 @@ jobs:
93
93
 
94
94
  - name: "Run ALKiln tests"
95
95
  if: ${{ success() }}
96
- id: alkiln
97
96
  #### Developer note: you'll need to replace `uses: ./`
98
97
  #### with the path to ALKiln’s repository name and branch name. For example,
99
98
  #### for version 5, use the branch name `v5`: `uses: suffolkLITLab/ALKiln@v5`
100
99
  uses: ./
101
- #### Developer note: You can probably leave out this `env` section
100
+ #### Developer note: You can probably leave this out
102
101
  env:
103
- # Internal: docassemble changes sometimes break @a11y tests. That is
104
- # a da problem, not ours. We will trigger these tests manually when we
105
- # want to check up on this.
106
- ALKILN_TAG_EXPRESSION: "${{ (github.event.inputs.tags && format('{0}', github.event.inputs.tags)) || '(not @a11y) and (not @error)' }}"
102
+ ALKILN_TAG_EXPRESSION: "${{ (github.event.inputs.tags && format('{0}', github.event.inputs.tags)) || 'not @a11y' }}"
107
103
  with:
108
104
  #### Developer note: Required inputs. See
109
105
  #### https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/alkiln/writing/#sandbox-inputs
110
106
  SERVER_URL: "${{ steps.github_server.outputs.SERVER_URL }}"
111
107
  DOCASSEMBLE_DEVELOPER_API_KEY: "${{ steps.github_server.outputs.DOCASSEMBLE_DEVELOPER_API_KEY }}"
112
108
  INSTALL_METHOD: "server"
113
- #### Developer note: You can probably leave the rest out
114
- #### To learn more, see https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/alkiln/writing/#optional-inputs
115
- ALKILN_TAG_EXPRESSION: "${{ env.ALKILN_TAG_EXPRESSION }}"
116
- ALKILN_VERSION: output
117
-
118
- #### Developer note: Example of making an issue when tests fail
119
- #### that includes the text of the failure output file
120
- #### See https://cli.github.com/manual/gh_issue_create for more details
121
- - shell: bash
122
- if: ${{ failure() }}
123
- env:
124
- GH_TOKEN: ${{ github.token }}
125
- PATH_TO_REPORT_FILE: "${{ steps.alkiln.outputs.PATH_TO_REPORT_FILE }}"
126
- PATH_TO_UNEXPECTED_RESULTS_FILE: "${{ steps.alkiln.outputs.PATH_TO_UNEXPECTED_RESULTS_FILE }}"
127
- PATH_TO_DEBUG_LOG_FILE: "${{ steps.alkiln.outputs.PATH_TO_DEBUG_LOG_FILE }}"
128
- run: |
129
- # Make an issue with file contents or 'no file' message as part of the body
130
-
131
- if [ -f "${{ env.PATH_TO_UNEXPECTED_RESULTS_FILE }}" ]; then
132
- UNEXPECTED_2=$(cat "${{ env.PATH_TO_UNEXPECTED_RESULTS_FILE }}")
133
- else
134
- UNEXPECTED_2="unexpected_results.txt does not exist. Something other than the interview tests may have failed."
135
- fi
136
-
137
- gh issue create --body "An ALKiln test run failed. See the action at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.
138
-
139
- ### Results:
109
+ #### Developer note: See https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/alkiln/writing/#optional-inputs
110
+ #### You can probably leave this out
111
+ # Internal: docassemble changes sometimes break @a11y tests. That is
112
+ # a da problem, not ours. We will trigger these tests manually when we
113
+ # want to check up on this.
114
+ ALKILN_TAG_EXPRESSION: $ALKILN_TAG_EXPRESSION
115
+ #### Developer note: You can probably leave this out
116
+ # ALKILN_VERSION: url
140
117
 
141
- $UNEXPECTED_2" --repo "$GITHUB_REPOSITORY" --label "testing" --title "ALKiln tests failed"
@@ -13,8 +13,8 @@ on:
13
13
  jobs:
14
14
 
15
15
  puppeteer-tests:
16
- #### Developer note: If you have both `push` and `pull_request` in the
17
- #### `on` section (above), this avoids running double tests when someone
16
+ #### Developer note: If under `on` (above) you have both `push` and
17
+ #### `pull_request`, this avoids running double tests when someone
18
18
  #### editing the repository makes a pull request
19
19
  # 1: Trigger job on push or dispatch from this repository
20
20
  # 2: Trigger job on pull request from a fork
@@ -55,13 +55,18 @@ jobs:
55
55
  # Place the root directory in this branch to access relative paths to action files
56
56
  - uses: actions/checkout@v4
57
57
 
58
+ - name: Pause between triggers
59
+ if: (github.event_name == 'pull_request' && ! github.event.pull_request.head.repo.fork)
60
+ shell: bash
61
+ run: sleep 60
62
+
58
63
  #### Developer note: you'll need to replace `uses: ./`
59
64
  #### with the path to ALKiln’s repository name and branch name. For example,
60
65
  #### for version 5, use the branch name `v5`: `uses: suffolkLITLab/ALKiln@v5`
61
66
  - uses: ./
62
67
  #### Developer note: You can probably leave this out
63
68
  env:
64
- ALKILN_TAG_EXPRESSION: "${{ (github.event.inputs.tags && format('{0}', github.event.inputs.tags)) || '(not @a11y) and (not @error)' }}"
69
+ ALKILN_TAG_EXPRESSION: "${{ (github.event.inputs.tags && format('{0}', github.event.inputs.tags)) || 'not @a11y' }}"
65
70
  with:
66
71
  #### Developer note: Required ALKiln inputs. You can read more at
67
72
  #### https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/alkiln/writing/#githubNyou-inputs
@@ -72,6 +77,6 @@ jobs:
72
77
  # Internal: docassemble changes sometimes break @a11y tests. That is
73
78
  # a da problem, not ours. We will trigger these tests manually when we
74
79
  # want to check up on this.
75
- ALKILN_TAG_EXPRESSION: "${{ env.ALKILN_TAG_EXPRESSION }}"
80
+ ALKILN_TAG_EXPRESSION: $ALKILN_TAG_EXPRESSION
76
81
  #### Developer note: You can probably leave this out
77
- ALKILN_VERSION: output
82
+ # ALKILN_VERSION: url
package/CHANGELOG.md CHANGED
@@ -45,26 +45,9 @@ Format:
45
45
 
46
46
  ## [Unreleased]
47
47
 
48
- ### Added
49
-
50
- - New file with just failure results, including cucumber results when possible. It accumulates Scenario info as the tests run. Even if a test run stops early, there will still be some results.
51
- - New outputs from the ALKiln action - `PATH_TO_REPORT_FILE`, `PATH_TO_UNEXPECTED_RESULTS_FILE`, and `PATH_TO_DEBUG_LOG_FILE`. Authors can choose to use these as they wish. For example, they can put the contents of these files in issues they create from their workflow. Closes [#701](https://github.com/SuffolkLITLab/ALKiln/issues/701).
52
- - Added cucumber output to report.txt.
53
- - Added more explanation for the logs that appear when test runs error in a way that prevents debug_log.txt and such files from being created. We will watch for feedback about the error data itself. It may still be too confusing.
54
-
55
48
  ### Changed
56
49
 
57
- - report.txt accumulates over time instead of being created all at once at the end. Even if a test run stops early, there will still be some results.
58
-
59
- ### Fixed
60
-
61
- - Tag expression not being parsed correctly. Surrounded `ALKILN_TAG_EXPRESSION` with `"`.
62
-
63
- ### Internal
64
-
65
- - Download ALKiln's artifacts back into the running job.
66
- - Removed our own workflow's pause between triggers
67
- - Improved our use of ALKIN_TAG_EXPRESSION env var
50
+ - Use an absolute path for `runtime_config.json`
68
51
 
69
52
  ## [5.11.2] - 2024-05-17
70
53
 
@@ -3,11 +3,9 @@
3
3
  const fs = require('fs');
4
4
  const cucumber_api = require('@cucumber/cucumber/api');
5
5
 
6
- const log = require('./utils/log'); // These always log in the console
6
+ const log = require('./utils/log');
7
7
  const session_vars = require('./utils/session_vars');
8
8
 
9
- const SUMMARY_FILENAME = `cucumber-report.txt`;
10
-
11
9
  function build_config( command_args ) {
12
10
  // Turn all the paths to the sources folders into paths to the feature files
13
11
  let sources_paths = session_vars.get_sources_paths();
@@ -19,17 +17,14 @@ function build_config( command_args ) {
19
17
  const config = {
20
18
  publishQuiet: true,
21
19
  require: `./lib/index.js`,
22
- format: [`progress`, `summary:${ SUMMARY_FILENAME }`],
20
+ format: [`progress`, `summary:cucumber-report.txt`],
23
21
  paths: feature_paths,
24
22
  retry: 1,
25
23
  }
26
24
 
27
25
  // Normalize tag expressions, if there are any
28
- // Joining and splitting handles both tags surrounded with `""` or those without `""`
29
- let tags = command_args[`_`].join(` `).split(` `);
30
- // If there was no tag expression, `tags` is ['']. Remove that item.
31
- tags = tags.filter(function(entry) { return entry !== ""; })
32
- if ( tags.length > 0 ) {
26
+ let tags = command_args[`_`];
27
+ if (tags.length > 0) {
33
28
  let joined_tags = '';
34
29
  // Cucumber expects tags in boolean expressions, like (@a0 or @a1) and @random.
35
30
  // If we get a list of only tags, then "or" them all together
@@ -110,21 +105,19 @@ function build_config( command_args ) {
110
105
 
111
106
  const { success } = await cucumber_api.runCucumber({...runConfiguration, support});
112
107
  if ( success ) {
113
- log.success({ type: `run`, code: `ALK0054`, pre: `Tests succeeded!` });
108
+ log.info({ type: `run`, code: `ALK0054`, pre: `Cucumber executed correctly` });
114
109
  } else {
115
- log.error({ type: `run`, code: `ALK0055`, pre: `The test run ran into something unexpected. Look above for more details.` });
110
+ log.error({ type: `run`, code: `ALK0055`, pre: `Cucumber ran into an error` });
116
111
  }
117
- // Code is our custom code for proper completion with failed tests
118
- // TODO: Check what happens with a wrongly formatted table
119
- const exitCode = success ? 0 : `ALK1`;
112
+ const exitCode = success ? 0 : 1;
120
113
  process.exitCode = exitCode;
121
114
 
122
115
  // This is hardcoded information from `provide_config` above.
123
116
  // This code isn't used for anything other than detecting and removing color codes.
124
- let summary_file_name = SUMMARY_FILENAME;
117
+ let summary_file_name = 'cucumber-report.txt';
125
118
  fs.readFile(summary_file_name, 'utf8', (err, text) => {
126
119
  if (err) {
127
- log.error({ type: `internal run`, code: `ALK0056`, pre: `Failed to read cucumber report`, data: err });
120
+ log.error({ type: `run`, code: `ALK0056`, pre: `cucumber report`, data: err });
128
121
  return;
129
122
  }
130
123
 
@@ -134,18 +127,6 @@ function build_config( command_args ) {
134
127
 
135
128
  // Put it in the correct file in the correct folder
136
129
  let artifacts_path = session_vars.get_artifacts_path_name();
137
- try {
138
- fs.appendFileSync( `${ artifacts_path }/${ log.debug_log_file }`, `\n\n${text}`);
139
- } catch ( error ) {
140
- log.info({ type: `internal run`, code: `ALK0182`, pre: `Something probably went wrong earlier. Look above for more details, but here's more info just in case: ALKiln was unable to write to ${ artifacts_path }/${ log.debug_log_file }.`, data: error });
141
- }
142
- try {
143
- // Add to a unexpected results file when tests themselves fail
144
- if ( exitCode === `ALK1` ) {
145
- fs.appendFileSync( `${ artifacts_path }/${ log.unexpected_filename }`, `\n\n${ text }` );
146
- }
147
- } catch ( error ) {
148
- log.info({ type: `internal run`, code: `ALK0181`, pre: `Something probably went wrong earlier. Look above for more details, but here's more info just in case: ALKiln was unable to write to ${ artifacts_path }/${ log.unexpected_filename }.`, data: error });
149
- }
130
+ fs.appendFileSync( `${ artifacts_path }/${ log.debug_log_file }`, `\n\n${text}`);
150
131
  });
151
132
  })();
package/lib/scope.js CHANGED
@@ -3228,7 +3228,8 @@ module.exports = {
3228
3228
  *
3229
3229
  * @param expected {array} Arr of strs that should appear in the report.
3230
3230
  */
3231
- let scenario = scope.report.get( scope.scenario_id );
3231
+ let current_report_obj = scope.report.get( scope.scenario_id );
3232
+ let scenario = [ scope.scenario_id, current_report_obj ]; // Mimic how loop works with `Map`
3232
3233
  let report = reports.getPrintableScenario( scenario );
3233
3234
  let all_are_included = true;
3234
3235
  for ( let one_expectation of expected ) {
@@ -3247,7 +3248,8 @@ module.exports = {
3247
3248
  *
3248
3249
  * @param not_expected {array} Arr of strs that should not appear in the report.
3249
3250
  */
3250
- let scenario = scope.report.get( scope.scenario_id );
3251
+ let current_report_obj = scope.report.get( scope.scenario_id );
3252
+ let scenario = [ scope.scenario_id, current_report_obj ]; // Mimic how loop works with `Map`
3251
3253
  let report = reports.getPrintableScenario( scenario );
3252
3254
  let none_included = true;
3253
3255
  for ( let one_expectation of not_expected ) {
package/lib/steps.js CHANGED
@@ -101,11 +101,8 @@ BeforeAll(async () => {
101
101
  session_vars.save_artifacts_path_name( scope.paths.artifacts );
102
102
 
103
103
  scope.paths.report = `${ scope.paths.artifacts }/report.txt`;
104
- scope.paths.failures = `${ scope.paths.artifacts }/${ log.unexpected_filename }`;
105
104
  scope.paths.debug_log = `${ scope.paths.artifacts }/${ log.debug_log_file }`;
106
105
  fs.writeFileSync( scope.paths.debug_log, "" );
107
-
108
- reports.create( scope );
109
106
  });
110
107
 
111
108
  Before(async (scenario) => {
@@ -1205,17 +1202,17 @@ After(async function(scenario) {
1205
1202
  }
1206
1203
 
1207
1204
  if ( scope.failed_pdf_compares.length > 0) {
1208
- let msg = scope.failed_pdf_compares.reduce((str, new_msg) => `${ str }\n―――\n${ new_msg }`)
1205
+ let msg = scope.failed_pdf_compares.reduce((str, new_msg) => `${ str }\n---\n${ new_msg }`)
1209
1206
  changeable_test_status = `FAILED`;
1210
1207
  reports.addToReport(scope, {
1211
1208
  type: `error`,
1212
1209
  code: `ALK0093`,
1213
- value: `PDF comparison failed ${ scope.failed_pdf_compares.length } time(s)\n―――\n${ msg }\n―――\n`
1210
+ value: `PDF comparison failed ${ scope.failed_pdf_compares.length } time(s)\n---\n${ msg }\n---\n`
1214
1211
  });
1215
1212
  }
1216
1213
 
1217
1214
  // Record status before internal report tests can interfere with values
1218
- reports.saveFinalScenarioData( scope, { status: changeable_test_status });
1215
+ reports.setReportScenarioStatus( scope, { status: changeable_test_status });
1219
1216
 
1220
1217
  if (changeable_test_status !== `PASSED`) {
1221
1218
  log.debug({
@@ -1259,11 +1256,11 @@ After(async function(scenario) {
1259
1256
  } // ends if not passed
1260
1257
 
1261
1258
  // Add report text to Scenario folder after everything has been added to the report
1262
- let scenario_report_obj = scope.report.get( scope.scenario_id );
1259
+ let current_report_obj = scope.report.get( scope.scenario_id );
1260
+ let scenario_report_obj = [ scope.scenario_id, current_report_obj ]; // Mimic how loop works with `Map`
1263
1261
  let report = reports.getPrintableScenario( scenario_report_obj );
1264
1262
  // Save the report as in the Scenario folder
1265
1263
  fs.writeFileSync( scope.paths.scenario_report, report );
1266
- // TODO: Save any cucumber failure message for the Scenario here (instead of waiting till run_cucumber.js)
1267
1264
 
1268
1265
  // ---------------- Check internal test results ----------------
1269
1266
 
@@ -1276,7 +1273,7 @@ After(async function(scenario) {
1276
1273
  // Reset report values no matter what so they don't mess up future scenarios
1277
1274
  scope.expected_in_report = null;
1278
1275
  }
1279
-
1276
+
1280
1277
  if (scope.expected_not_in_report && scope.expected_not_in_report.length > 0) {
1281
1278
  let all_prohibited_strings_were_absent = await scope.reportDoesNotInclude(
1282
1279
  scope,
@@ -1357,7 +1354,7 @@ After(async function(scenario) {
1357
1354
  // Catch a possible reload error.
1358
1355
  try {
1359
1356
  // puppeteer will ensure proper timeout.
1360
- await scope.page.goto(`${ session_vars.get_da_server_url() }/user/sign-out`, {waitUntil: `domcontentloaded`});
1357
+ await scope.page.goto(`${ session_vars.get_da_server_url() }/user/sign-out`, {waitUntil: `domcontentloaded`});
1361
1358
 
1362
1359
  } catch ( error ) {
1363
1360
  signout_succeeded = false;
@@ -1408,14 +1405,17 @@ After(async function(scenario) {
1408
1405
  AfterAll(async function() {
1409
1406
  // Stop collecting server response statuses
1410
1407
  scope.stop_tracking_server_status = true;
1411
-
1408
+
1412
1409
  let report = reports.getPrintableReport( scope );
1413
1410
  // Log the report. Can't get this.attach() or this.log() to work in `After()` or here.
1414
1411
  // May need newest version of cucumberjs
1415
1412
  console.log( `\n\n${ report }` );
1416
1413
 
1414
+ // Save/download the report as an artifact
1415
+ fs.writeFileSync( scope.paths.report, report );
1416
+
1417
1417
  // If there is a browser open, then close it
1418
1418
  if (scope.browser) {
1419
1419
  await scope.browser.close();
1420
1420
  }
1421
- });
1421
+ });
package/lib/utils/log.js CHANGED
@@ -2,7 +2,6 @@ const fs = require('fs');
2
2
  const session_vars = require( './session_vars' );
3
3
 
4
4
  // ? 🌈 💡 🔎 🤕 🐞
5
- // Alternatives: 🩹 ❤️‍🩹 🚑
6
5
  // TODO: return full message so it can be passed to manually
7
6
  // thrown errors if needed.
8
7
 
@@ -92,5 +91,4 @@ log.add_to_debug_log = function(value) {
92
91
  fs.appendFileSync(log.debug_log_file, value);
93
92
  };
94
93
 
95
- log.debug_log_file = `debug_log.txt`;
96
- log.unexpected_filename = `unexpected_results.txt`;
94
+ log.debug_log_file = 'debug_log.txt'
@@ -7,13 +7,6 @@ const files = require(`./files` );
7
7
 
8
8
  module.exports = reports = {};
9
9
 
10
- reports.title = `Assembly Line Kiln Automated Testing Report - ${ (new Date()).toUTCString() }\n`;
11
- reports.failures = [ `\n\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n🤕 Failed scenarios\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n` ];
12
- reports.successes = [ `\n\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n🌈 Passed scenarios\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n` ];
13
- // reports.warnings = [ `\n\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n🔎 Scenarios to check\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n` ];
14
- // reports.undefineds = [ `\n\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n[langs icon] Scenarios with typos\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n` ];
15
- reports.others = [ `\n\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n🔎 Other scenarios that did not pass\n≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡\n` ];
16
-
17
10
  reports.addReportHeading = function (scope, { scenario }) {
18
11
  /** Return printable heading based on Scenario name and tags.
19
12
  * Allow characters from other languages.
@@ -26,14 +19,14 @@ reports.addReportHeading = function (scope, { scenario }) {
26
19
  tag_names.push( tag.name );
27
20
  }
28
21
 
29
- let heading = `\n―――――――――――――――\n`
22
+ let heading = `\n---------------\n`
30
23
  + `Scenario: ${ scenario.pickle.name }`;
31
24
 
32
25
  if ( tag_names.length > 0 ) {
33
26
  heading += `\nTags: ${ tag_names.join(' ') }`;
34
27
  }
35
28
 
36
- heading += `\n―――――――――――――――`;
29
+ heading += `\n---------------`;
37
30
 
38
31
  reports.addToReport( scope, {
39
32
  code: `ALK0176`,
@@ -78,30 +71,21 @@ reports.addToReport = function( scope, { type, code, value }) {
78
71
  }
79
72
 
80
73
  // Report stuff
81
- let scenario = reports.makeSureScenarioExists( scope );
74
+ let scenario = makeSureReportPartsExist( scope );
82
75
  scenario.lines.push({ type, code, value });
83
76
 
84
77
  return scenario;
85
78
  }; // Ends reports.addToReport()
86
79
 
87
- reports.create = function( scope ) {
88
- reports.makeSureReportExists( scope );
89
- }
90
-
91
- reports.makeSureReportExists = function( scope ) {
80
+ let makeSureReportPartsExist = function( scope ) {
92
81
  /** If a part of the report needs to exist right now, but doesn't exist,
93
82
  * create it. */
94
83
  if ( !scope.report ) { scope.report = new Map(); }
95
- return this;
96
- }; // Ends reports.makeSureReportExists()
97
-
98
- reports.makeSureScenarioExists = function ( scope ) {
99
- reports.makeSureReportExists( scope );
100
84
  if ( !scope.scenario_id ) {
101
85
  scope.scenario_id = `_report_${ Date.now() }`;
102
86
  }
103
87
  if ( !scope.report.get( scope.scenario_id )) {
104
- scope.report.set( scope.scenario_id, {} );
88
+ scope.report.set( scope.scenario_id, {} )
105
89
  scope.report.get( scope.scenario_id ).status = `in progress`;
106
90
  }
107
91
 
@@ -109,36 +93,11 @@ reports.makeSureScenarioExists = function ( scope ) {
109
93
  if ( !scenario.lines ) { scenario.lines = []; }
110
94
 
111
95
  return scenario;
112
- }; // Ends reports.makeSureScenarioExists()
113
-
114
- reports.saveFinalScenarioData = function( scope, { status=`in progress` }) {
115
- this.setReportScenarioStatus( scope, { status });
116
- let scenario = scope.report.get( scope.scenario_id );
117
- let report = this.getPrintableScenario( scenario );
118
- if ( scenario.status === `FAILED` ) { this.failures.push( report ); }
119
- else if ( scenario.status === `PASSED` ) { this.successes.push( report ); }
120
- // else if ( scenario.status === `WARNING` ) { passed_reports += report; this.warnings.push( report ); }
121
- // else if ( scenario.status === `UNDEFINED` ) { passed_reports += report; this.undefineds.push( report ); }
122
- else { this.others.push( report ); }
123
-
124
- // Save to failures.txt (worry about optimization later)
125
- if ( this.failures.length > 1 || this.others.length > 1 ) {
126
- fs.writeFileSync(
127
- scope.paths.failures,
128
- this.title + this.getPrintableUnexpected( scope )
129
- );
130
- }
131
- // Save to reports.txt (worry about optimization later)
132
- fs.writeFileSync( scope.paths.report, this.getPrintableReport( scope ) );
133
-
134
- return scenario;
135
- }; // Ends reports.saveFinalScenarioData()
136
-
96
+ }; // Ends makeSureReportPartsExist()
137
97
 
138
98
  reports.setReportScenarioStatus = function( scope, { status=`PASSED` }) {
139
99
  /** Add final status of scenario to scenario report object - passed, failed, etc. */
140
100
  scope.report.get( scope.scenario_id ).status = status;
141
- return scope.report.get( scope.scenario_id );
142
101
  }; // Ends reports.setReportScenarioStatus()
143
102
 
144
103
  reports.convertToOriginalStoryTableRow = function( scope, { row_data }) {
@@ -165,38 +124,34 @@ let trimJSON = function( str=`` ) {
165
124
  }; // Ends trimJSON()
166
125
 
167
126
  reports.getPrintableReport = function( scope ) {
168
- /** Return a string generated from test report data.
169
- *
170
- * First list failed scenarios, then non-passed scenarios, then passed scenarios. */
171
- let report = this.getTitle( scope );
172
-
173
- if ( this.failures.length > 1 ) { report += this.failures.join( `` ); }
174
- if ( this.successes.length > 1 ) { report += this.successes.join( `` ); }
175
- // if ( this.warnings.length > 1 ) {}
176
- // if ( this.undefineds.length > 1 ) {}
177
- if ( this.others.length > 1 ) { report += this.others.join( `` ); }
127
+ /** Return a string generated from test report data. */
128
+ let report = `Assembly Line Kiln Automated Testing Report - ${ (new Date()).toUTCString() }\n`;
129
+
130
+ // First list failed scenarios, then non-passed scenarios, then passed scenarios
131
+ let failed_reports = ``;
132
+ let passed_reports = ``;
133
+ let other_reports = ``;
134
+ for ( let scenario of scope.report ) {
135
+
136
+ let report = reports.getPrintableScenario( scenario );
137
+ let [ scenario_id, data ] = scenario;
138
+ if ( data.status === `FAILED` ) { failed_reports += report; }
139
+ else if ( data.status === `PASSED` ) { passed_reports += report; }
140
+ else { other_reports += report; }
141
+ }; // ends for every scenario
142
+
143
+ if ( failed_reports !== `` ) { report += `\n\n===============================\n===============================\n🤕 Failed scenarios:\n${ failed_reports }`; }
144
+ if ( other_reports !== `` ) { report += `\n\n===============================\n===============================\n🔎 Scenarios that did not pass:\n${ other_reports }`; }
145
+ if ( passed_reports !== `` ) { report += `\n\n===============================\n===============================\n🌈 Passed scenarios:\n${ passed_reports }`; }
178
146
 
179
147
  return report;
180
148
  }; // Ends reports.getPrintableReport()
181
149
 
182
- reports.getTitle = function( scope ) { return this.title; }
183
-
184
- reports.getPrintableUnexpected = function( scope ) {
185
- // Note about `> 1`: The first line of the report section always exists
186
- let output = ``;
187
- if ( this.failures.length > 1 ) {
188
- output += this.failures.join(``);
189
- }
190
- if ( this.others.length > 1 ) {
191
- output += this.others.join(``);
192
- }
193
- return output;
194
- }; // Ends reports.getPrintableUnexpected()
195
-
196
150
  reports.getPrintableScenario = function( scenario ) {
197
151
  /** Return a string generated from scenario list of report items. */
152
+ let [ scenario_id, data ] = scenario;
198
153
  let report = ``;
199
- for ( let line of scenario.lines ) {
154
+ for ( let line of data.lines ) {
200
155
  let { type, code, value } = line;
201
156
  report += `${ getLineText({ type, code, value }) }\n`;
202
157
  }
@@ -107,7 +107,7 @@ session_vars.get_languages = function () {
107
107
  }; // Ends session_vars.get_languages()
108
108
 
109
109
 
110
- const runtime_config_path = `runtime_config.json`;
110
+ const runtime_config_path = path.join(process.cwd(), `runtime_config.json`);
111
111
  const project_name_key = `da_project_name`;
112
112
  session_vars.save_project_name = function ( project_name ) {
113
113
  /* Saves the name of the project to a json obj so deletion can use it later.
package/package.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "5.11.2-feat-output-6",
3
+ "version": "5.11.2-fix-root-dir-1",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
7
7
  "test": "npm run unit && npm run codes && npm run cucumber",
8
8
  "cucumber": "./lib/run_cucumber.js",
9
9
  "local": "npm run setup && npm run cucumber; npm run takedown",
10
- "pass": "npm run cucumber 'not @error'",
11
- "fail": "npm run cucumber '@error'",
12
10
  "setup": "./lib/docassemble/setup.js",
13
11
  "takedown": "./lib/docassemble/takedown.js",
14
12
  "server_install": "./lib/docassemble/server_install.js",