@suffolklitlab/alkiln 4.2.1-custom-setup-timeout.1 → 4.2.1-custom-setup-timeout.2

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.
@@ -78,12 +78,12 @@ jobs:
78
78
  with:
79
79
  name: report
80
80
  path: ./**/*_report_*
81
- - name: log artifact
81
+ - name: upload debug_log artifact
82
82
  uses: actions/upload-artifact@v2
83
83
  if: ${{ always() }}
84
84
  with:
85
- name: log file
86
- path: ./log.txt
85
+ name: debug_log file
86
+ path: ./debug_log.txt
87
87
  - name: Cleanup
88
88
  if: ${{ always() }}
89
89
  run: npm run takedown
package/CHANGELOG.md CHANGED
@@ -42,6 +42,12 @@ Format:
42
42
  ### Added
43
43
  - GitHub environment variable MAX_SECONDS_FOR_SETUP to set a custom maximum time for setup and takedown for packages that take a long time to load.
44
44
 
45
+ ## [4.2.0] - 2022-04-05
46
+ ### Changed
47
+ - Pin versions of dependencies in action.yml and package.json
48
+ - Change log.txt file to debug_log.txt and upload as github artifact.
49
+ - Update cheerio version to remove vulnerabilities.
50
+
45
51
  ## [4.1.1] - 2022-04-01
46
52
  ### Added
47
53
  - Step to set vars to secret variables. That is, using environment variables while hiding the names of those variables in the report, errors, and console logs.
package/action.yml CHANGED
@@ -82,7 +82,7 @@ runs:
82
82
  },
83
83
  "dependencies": {
84
84
  "colors": "1.4.0",
85
- "@cucumber/cucumber": "^7.3.2",
85
+ "@cucumber/cucumber": "7.3.2",
86
86
  "@suffolklitlab/alkiln": "$ALKILN_VERSION"
87
87
  }
88
88
  }
@@ -356,11 +356,14 @@ da_i.wait_for_server_to_restart = async ( task_id, options ) => {
356
356
  let default_timeout = DEFAULT_MAX_REQUEST_MS;
357
357
  let timeout = options.timeout || default_timeout;
358
358
  // Other defaults
359
- let default_wait_per_loop = 5 * 1000;
360
- let default_max_loops = timeout/default_wait_per_loop;
359
+ let default_wait_between_loops = 4 * 1000;
360
+ let default_wait_for_response = 1 * 1000;
361
+ let default_max_loops = timeout/( default_wait_between_loops + default_wait_for_response );
361
362
  // Actual values
362
- let wait_ms_per_loop = options.wait_ms_per_loop || default_wait_per_loop;
363
+ let wait_between_loops = options.wait_between_loops || default_wait_between_loops;
364
+ let wait_for_response = options.wait_for_response || default_wait_for_response;
363
365
  let max_loops = options.max_loops || default_max_loops;
366
+ let total_wait = wait_between_loops + wait_for_response;
364
367
 
365
368
  // Flags for stopping the `while` loop
366
369
  let num_tries = 0;
@@ -372,7 +375,7 @@ da_i.wait_for_server_to_restart = async ( task_id, options ) => {
372
375
  while ( !done_restarting && num_tries <= max_loops ) {
373
376
  num_tries++;
374
377
  // Wait only a short time for the task to finish, not the full default timeout
375
- done_restarting = await da_i.has_task_finished( task_id, { timeout: 1 * 1000 } );
378
+ done_restarting = await da_i.has_task_finished( task_id, { timeout: wait_for_response } );
376
379
  if ( !done_restarting ) {
377
380
  if ( num_tries < max_loops ) {
378
381
  // Show a slightly different message after a number of tries to reassure
@@ -381,16 +384,17 @@ da_i.wait_for_server_to_restart = async ( task_id, options ) => {
381
384
  if ( num_tries > 3 ) { msg_start = `Still not complete`; }
382
385
 
383
386
  // When the server is busy, the task timeout causes this loop to actually
384
- // take 6 seconds to complete, not 5, but I'm not sure how to make that clear
387
+ // take 5 seconds to complete, but this only waits for 4. I'm not sure how
388
+ // to make that clear
385
389
  log.info({ pre: `${ msg_start }. Check ${ num_tries } of ${ max_loops }. `
386
- + `Will check again in ${ wait_ms_per_loop/1000 } seconds.`
390
+ + `Will check again in ${( wait_between_loops + wait_for_response )/1000 } seconds.`
387
391
  });
388
- await time.waitForTimeout( wait_ms_per_loop );
392
+ await time.waitForTimeout( wait_between_loops );
389
393
 
390
394
  } else {
391
395
  // This is our last round, let's wrap it up
392
396
  let server_msg = `ALKiln setup: It seems like the docassemble server `
393
- + `didn't finish uploading the code after ${ max_loops * (wait_ms_per_loop/1000) } `
397
+ + `didn't finish uploading the code after ${ timeout/1000 } `
394
398
  + `seconds. Some things you can try: check your server is up, try `
395
399
  + `re-running the test, and try pulling the package manually `
396
400
  + `into the playground.`;
package/lib/scope.js CHANGED
@@ -60,7 +60,7 @@ module.exports = {
60
60
  let scenario = await scope.makeSureReportPartsExist( scope );
61
61
  scenario.lines.push({ type, value });
62
62
 
63
- fs.appendFileSync('log.txt', `Report:\ntype: ${ type }, value: ${ value }`);
63
+ fs.appendFileSync('debug_log.txt', `Report:\ntype: ${ type }, value: ${ value }`);
64
64
  return scenario;
65
65
 
66
66
  }, // Ends scope.addToReport()
package/lib/steps.js CHANGED
@@ -68,7 +68,7 @@ BeforeAll(async () => {
68
68
  scope.timeout = 30 * 1000;
69
69
  scope.showif_timeout = 600;
70
70
  scope.report = new Map();
71
- fs.writeFileSync('log.txt', "");
71
+ fs.writeFileSync('debug_log.txt', "");
72
72
  });
73
73
 
74
74
  Before(async (scenario) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "4.2.1-custom-setup-timeout.1",
3
+ "version": "4.2.1-custom-setup-timeout.2",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -34,16 +34,16 @@
34
34
  },
35
35
  "homepage": "https://suffolklitlab.org/docassemble-AssemblyLine-documentation/docs/automated_integrated_testing/",
36
36
  "dependencies": {
37
- "@cucumber/cucumber": "^7.3.2",
38
- "axios": "^0.24.0",
39
- "chai": "^4.2.0",
40
- "cheerio": "^1.0.0-rc.5",
41
- "dotenv": "^8.2.0",
42
- "mocha": "^9.2.0",
43
- "puppeteer": "^13.1.3",
44
- "qs": "^6.10.2",
45
- "sanitize-filename": "^1.6.3",
46
- "uuid": "^8.3.2"
37
+ "@cucumber/cucumber": "7.3.2",
38
+ "axios": "0.24.0",
39
+ "chai": "4.2.0",
40
+ "cheerio": "1.0.0-rc.10",
41
+ "dotenv": "8.2.0",
42
+ "mocha": "9.2.0",
43
+ "puppeteer": "13.1.3",
44
+ "qs": "6.10.2",
45
+ "sanitize-filename": "1.6.3",
46
+ "uuid": "8.3.2"
47
47
  },
48
48
  "bin": {
49
49
  "alkiln-setup": "./lib/docassemble/setup.js",