@suffolklitlab/alkiln 5.16.1-always-html-3 → 5.16.1-always-html-4

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 (3) hide show
  1. package/lib/scope.js +20 -20
  2. package/lib/steps.js +37 -37
  3. package/package.json +1 -1
package/lib/scope.js CHANGED
@@ -3116,7 +3116,7 @@ module.exports = {
3116
3116
 
3117
3117
  let err_msg = `Error occurred when ALKiln tried to go to "${ login_url }".`
3118
3118
  if ( error.name === `TimeoutError` ) {
3119
- console.log(`🖊️ 110`);
3119
+ // console.log(`🖊️ 110`);
3120
3120
  let non_reload_report_msg = `It took too long to load "${ login_url }"`;
3121
3121
  await scope.handle_page_timeout_error( scope, { non_reload_report_data: {
3122
3122
  code: `ALK0159`,
@@ -3124,7 +3124,7 @@ module.exports = {
3124
3124
  }, error });
3125
3125
  } else {
3126
3126
  // Throw any non-timeout error
3127
- console.log(`🖊️ 111`);
3127
+ // console.log(`🖊️ 111`);
3128
3128
  await scope.take_a_screenshot(scope, {path:`./_alkiln_temp/Temp-4.jpg`});
3129
3129
  reports.addToReport( scope, { type: `error`, code: `ALK0160`, value: err_msg });
3130
3130
  throw error;
@@ -3166,7 +3166,7 @@ module.exports = {
3166
3166
  scope.scenarios.get( scope.scenario_id ).api_keys.push( api_key );
3167
3167
  }
3168
3168
  }
3169
- console.log(`🖊️ 112`);
3169
+ // console.log(`🖊️ 112`);
3170
3170
  await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-4.jpg`});
3171
3171
 
3172
3172
  expect( email, email_msg ).to.not.equal( undefined );
@@ -3177,14 +3177,14 @@ module.exports = {
3177
3177
  await scope.page.type( `#password`, password );
3178
3178
  let elem = await scope.page.$( `button[type="submit"]` );
3179
3179
  await scope.guard_against_missing_tap_element(scope, { elem });
3180
- console.log(`🖊️ 113`);
3180
+ // console.log(`🖊️ 113`);
3181
3181
  await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-5.jpg`});
3182
3182
 
3183
3183
  // Submit and see what happens
3184
3184
  let winner = await scope.steps.race_sign_in_navigation( scope, { elem, login_url });
3185
- console.log(`🖊️ 113.5 ${ winner }`);
3185
+ // console.log(`🖊️ 113.5 ${ winner }`);
3186
3186
  // await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-6.jpg`});
3187
- // console.log(`🖊️ 113.6 ${ winner }`);
3187
+ console.log(`🖊️ 113.6 ${ winner }`);
3188
3188
  // Add the result to the report and possibly throw errors
3189
3189
  if ( winner[0] === `success` ) {
3190
3190
  reports.addToReport( scope, {
@@ -3197,7 +3197,7 @@ module.exports = {
3197
3197
  type: `error`, code: `ALK0209`,
3198
3198
  value: `Failed to sign into ${ login_url }. Make sure you followed the instructions at https://assemblyline.suffolklitlab.org/docs/alkiln/writing/#sign-in.`
3199
3199
  });
3200
- console.log(`🍉 ${ error_msg }`);
3200
+ // console.log(`🍉 ${ error_msg }`);
3201
3201
  throw new Error( error_msg );
3202
3202
  } else if ( winner[0] === `error` ) {
3203
3203
  let error_msg = reports.addToReport( scope, {
@@ -3206,7 +3206,7 @@ module.exports = {
3206
3206
  });
3207
3207
  throw new Error( error_msg );
3208
3208
  }
3209
- console.log(`🖊️ 114`);
3209
+ // console.log(`🖊️ 114`);
3210
3210
  await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-7.jpg`});
3211
3211
  if (error_msg) {
3212
3212
  return [ error_msg ];
@@ -3222,15 +3222,15 @@ module.exports = {
3222
3222
 
3223
3223
  // After everything, clean up incomplete promises
3224
3224
  const controller = new AbortController;
3225
- console.log(`⏳ 200`);
3225
+ // console.log(`⏳ 200`);
3226
3226
 
3227
3227
  // Redirect
3228
3228
  let redirect_promise = scope.page.waitForResponse(async ( response ) => {
3229
- console.log(`⏳ 300`);
3229
+ // console.log(`⏳ 300`);
3230
3230
  return response.status() === 302;
3231
3231
  }, { signal: controller.signal })
3232
3232
  .catch(async ( catch_info ) => {
3233
- console.log(`⏳ 201`);
3233
+ // console.log(`⏳ 201`);
3234
3234
  // await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp2-1.jpg`});
3235
3235
  log.debug({ code: `ALK0204`, context: `nav`, },
3236
3236
  `302 sign-in wait catch error:`, catch_info.name, catch_info,
@@ -3239,12 +3239,12 @@ module.exports = {
3239
3239
 
3240
3240
  // Invalid credentials, no navigation, no sign in
3241
3241
  let wrong_sign_in_promise = scope.page.waitForResponse(async ( response ) => {
3242
- console.log(`⏳ 301`);
3242
+ // console.log(`⏳ 301`);
3243
3243
  return response.status() >= 200 && response.status() < 300 && response.url().includes(`/sign-in`);
3244
3244
  }, { signal: controller.signal })
3245
3245
  .catch(async ( catch_info ) => {
3246
3246
  // errors?
3247
- console.log(`⏳ 202`);
3247
+ // console.log(`⏳ 202`);
3248
3248
  // await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp2-2.jpg`});
3249
3249
  log.debug({ code: `ALK0205`, context: `nav`, },
3250
3250
  `200s sign-in wait catch error:`, catch_info.name, catch_info,
@@ -3253,11 +3253,11 @@ module.exports = {
3253
3253
 
3254
3254
  // System error
3255
3255
  let error_promise = scope.page.waitForResponse(async ( response ) => {
3256
- console.log(`⏳ 302`);
3256
+ // console.log(`⏳ 302`);
3257
3257
  return response.status() >= 500 && response.status() < 600;
3258
3258
  }, { signal: controller.signal })
3259
3259
  .catch(async ( catch_info ) => {
3260
- console.log(`⏳ 203`);
3260
+ // console.log(`⏳ 203`);
3261
3261
  await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp2-3.jpg`});
3262
3262
  log.debug({ code: `ALK0206`, context: `nav`, },
3263
3263
  `500s sign-in wait catch error:`, catch_info.name, catch_info,
@@ -3269,29 +3269,29 @@ module.exports = {
3269
3269
  let click_promise = elem.click(); // MUST complete
3270
3270
  let nav_promise = scope.nav_race(scope, {}).result;
3271
3271
  let pic_promise = true; // scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp2-10.jpg`});
3272
- console.log(`⏳ 204`);
3272
+ // console.log(`⏳ 204`);
3273
3273
  const winner = await Promise.race([
3274
3274
  Promise.all([ `success`, click_promise, pic_promise, redirect_promise ]),
3275
3275
  Promise.all([ `failure`, click_promise, pic_promise, wrong_sign_in_promise ]),
3276
3276
  Promise.all([ `error`, click_promise, pic_promise, error_promise ]),
3277
3277
  ]).catch(async ( error ) => {
3278
- console.log(`⏳ 205`);
3278
+ // console.log(`⏳ 205`);
3279
3279
  // await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp2-4.jpg`});
3280
3280
  let error_msg = reports.addToReport( scope, {
3281
3281
  type: `error`, code: `ALK0207`,
3282
3282
  value: `Unknown error waiting for results during sign in at ${ login_url }.`
3283
3283
  });
3284
- console.log(`⏳ 205.1`, error);
3284
+ // console.log(`⏳ 205.1`, error);
3285
3285
  throw error;
3286
3286
  });
3287
3287
 
3288
- console.log(`⏳ 206`);
3288
+ // console.log(`⏳ 206`);
3289
3289
  // // await waitForTimeout(500);
3290
3290
  // await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp2-5.jpg`});
3291
3291
 
3292
3292
  // Clean up unresolved promises
3293
3293
  controller.abort();
3294
- console.log(`⏳ 207`);
3294
+ // console.log(`⏳ 207`);
3295
3295
  await nav_promise;
3296
3296
  await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp3-1.jpg`});
3297
3297
 
package/lib/steps.js CHANGED
@@ -116,7 +116,7 @@ BeforeAll(async function() {
116
116
 
117
117
  Before( beforeScenario );
118
118
  async function beforeScenario( scenario ) {
119
- console.log('👁️ 111 start beforeScenario');
119
+ // console.log('👁️ 111 start beforeScenario');
120
120
  // Start the running "progress bar" for the Scenario
121
121
  log.stdout({}, `\nScenario: ${ scenario.pickle.name }: `);
122
122
 
@@ -126,20 +126,20 @@ async function beforeScenario( scenario ) {
126
126
  // Will only run in the Playground outside of a sandbox. TODO: There's a
127
127
  // better way to do this, though it's more complicated. See comments in
128
128
  // https://github.com/SuffolkLITLab/ALKiln/issues/661
129
- console.log('👁️ 112 no browser, await new local browser');
129
+ // console.log('👁️ 112 no browser, await new local browser');
130
130
  scope.browser = await scope.driver.launch({ args: ['--no-sandbox'] });
131
131
  } else {
132
- console.log('👁️ 113 no browser, await new remote browser');
132
+ // console.log('👁️ 113 no browser, await new remote browser');
133
133
  scope.browser = await scope.driver.launch({ headless: !session_vars.get_debug(), devtools: session_vars.get_debug() });
134
134
  }
135
135
  }
136
- console.log('👁️ 114 we have ensured browser exists, awaiting pages');
136
+ // console.log('👁️ 114 we have ensured browser exists, awaiting pages');
137
137
  // Clean up all previously existing pages
138
138
  for (const page of await scope.browser.pages()) {
139
- console.log('👁️ 115 awaiting closing page');
139
+ // console.log('👁️ 115 awaiting closing page');
140
140
  await page.close();
141
141
  }
142
- console.log('👁️ 116 awaiting opening a new page');
142
+ // console.log('👁️ 116 awaiting opening a new page');
143
143
  // Make a new page
144
144
  scope.page = await scope.browser.newPage()
145
145
 
@@ -153,10 +153,10 @@ async function beforeScenario( scenario ) {
153
153
  scope.server_reload_promise = null;
154
154
 
155
155
  reports.addReportHeading(scope, {scenario});
156
- console.log('👁️ 117 awaiting getting safe scenario name');
156
+ // console.log('👁️ 117 awaiting getting safe scenario name');
157
157
  // Make folder for this Scenario in the all-tests artifacts folder
158
158
  scope.base_filename = await scope.getSafeScenarioBaseFilename(scope, {scenario});
159
- console.log('👁️ 118 got safe scenario name');
159
+ // console.log('👁️ 118 got safe scenario name');
160
160
  // Add a date for uniqueness in case dev has accidentally copied a Scenario description
161
161
  let date = Date.now();
162
162
  scope.paths.scenario = `${ scope.paths.artifacts }/${ scope.base_filename }-${ date }`;
@@ -316,7 +316,7 @@ Given(
316
316
  // Couldn't test the timeout for tapping the button because there's not
317
317
  // enough of a pause between initial navigation and pressing button.
318
318
  foo = scope.page
319
- console.log(`⭐️ ${ JSON.stringify(scope.page, null, 2) }`)
319
+ // console.log(`⭐️ ${ JSON.stringify(scope.page, null, 2) }`)
320
320
  let result = await scope.steps.sign_in( scope, {
321
321
  email_secret_name: email,
322
322
  password_secret_name: password,
@@ -324,7 +324,7 @@ Given(
324
324
  });
325
325
 
326
326
 
327
- console.log(`🖊️ 115`);
327
+ // console.log(`🖊️ 115`);
328
328
  // await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-8.jpg`});
329
329
 
330
330
  // if ( !result.ok && result.errors.length > 0 ) {
@@ -1344,7 +1344,7 @@ Then(/I fail to delete (\d) detected interview(?:s)? and get no error __internal
1344
1344
  AfterStep(async function({ result }) {
1345
1345
  // TODO: Abstract this
1346
1346
  // await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-13.jpg`});
1347
- console.log(`🛑 100`);
1347
+ // console.log(`🛑 100`);
1348
1348
  if ( result.status === `PASSED` ) { log.stdout({ records_only: true }, `.`); }
1349
1349
  else if ( result.status === `FAILED` ) { log.stdout({ records_only: true }, `F`); }
1350
1350
  else if ( result.status === `UNDEFINED` ) { log.stdout({ records_only: true }, `U`); }
@@ -1352,12 +1352,12 @@ AfterStep(async function({ result }) {
1352
1352
  else if ( result.status === `PENDING` ) { log.stdout({ records_only: true }, `P`); }
1353
1353
 
1354
1354
  reports.outdent();
1355
- console.log(`🛑 101`);
1355
+ // console.log(`🛑 101`);
1356
1356
  });
1357
1357
 
1358
1358
  After(afterScenario);
1359
1359
  async function afterScenario(scenario) {
1360
- console.log(`👀 1 ${ foo == scope.page } ${ JSON.stringify(scope.page, null, 2) }`);
1360
+ // console.log(`👀 1 ${ foo == scope.page } ${ JSON.stringify(scope.page, null, 2) }`);
1361
1361
  await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-30.jpg`});
1362
1362
  // Log errors
1363
1363
  if ( scenario.result.message ) {
@@ -1377,7 +1377,7 @@ async function afterScenario(scenario) {
1377
1377
  value: `Accessibility standards tests failed. See information above.`
1378
1378
  });
1379
1379
  }
1380
- console.log(`👀 2`);
1380
+ // console.log(`👀 2`);
1381
1381
  await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-9.jpg`});
1382
1382
 
1383
1383
  if ( scope.failed_pdf_compares.length > 0) {
@@ -1400,7 +1400,7 @@ async function afterScenario(scenario) {
1400
1400
  );
1401
1401
 
1402
1402
  if ( scope.page ) {
1403
- console.log(`👀 3`);
1403
+ // console.log(`👀 3`);
1404
1404
  await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-10.jpg`});
1405
1405
 
1406
1406
  if ( !!scope.disable_error_screenshot ) {
@@ -1413,7 +1413,7 @@ async function afterScenario(scenario) {
1413
1413
  value: `For security, ALKiln will avoid creating a picture of the page for this error. It's possible a secret is being used on this screen. ALKiln will save the HTML, which omits the values in the fields.`
1414
1414
  });
1415
1415
  }
1416
- console.log(`👀 4 ${ foo == scope.page } ${ JSON.stringify(scope.page, null, 2) }`);
1416
+ // console.log(`👀 4 ${ foo == scope.page } ${ JSON.stringify(scope.page, null, 2) }`);
1417
1417
  await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-11.jpg`});
1418
1418
 
1419
1419
  // Save/download a picture of the screen that's showing during the unexpected status
@@ -1425,7 +1425,7 @@ async function afterScenario(scenario) {
1425
1425
  disable_pic: scope.disable_error_screenshot,
1426
1426
  disable_html: false,
1427
1427
  });
1428
- console.log(`👀 5 ${ foo == scope.page } ${ JSON.stringify(scope.page, null, 2) }`);
1428
+ // console.log(`👀 5 ${ foo == scope.page } ${ JSON.stringify(scope.page, null, 2) }`);
1429
1429
  await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-12.jpg`});
1430
1430
 
1431
1431
  // Save another copy in the artifact's Scenario folder
@@ -1439,7 +1439,7 @@ async function afterScenario(scenario) {
1439
1439
  disable_pic: scope.disable_error_screenshot,
1440
1440
  disable_html: false,
1441
1441
  });
1442
- console.log(`👀 6`);
1442
+ // console.log(`👀 6`);
1443
1443
 
1444
1444
  } // ends if scope.page exists
1445
1445
 
@@ -1447,31 +1447,31 @@ async function afterScenario(scenario) {
1447
1447
  if (changeable_test_status === `FAILED`) {
1448
1448
  reports.addToReport(scope, { type: `outcome failure info`, code: `ALK0096`, value: `**-- Scenario Failed --**` });
1449
1449
  }
1450
- console.log(`👀 7`);
1450
+ // console.log(`👀 7`);
1451
1451
 
1452
1452
  } // ends if not passed
1453
- console.log(`👀 8`);
1453
+ // console.log(`👀 8`);
1454
1454
 
1455
1455
  // Add report text to Scenario folder after everything has been added to the report
1456
1456
  let scenario_report_obj = scope.report.get( scope.scenario_id );
1457
- console.log(`👀 8.01`);
1457
+ // console.log(`👀 8.01`);
1458
1458
  let report = reports.getPrintableScenario( scenario_report_obj );
1459
1459
  // Save the report as in the Scenario folder
1460
- console.log(`👀 8.02`);
1460
+ // console.log(`👀 8.02`);
1461
1461
  fs.writeFileSync( scope.paths.scenario_report, report );
1462
- console.log(`👀 8.03`);
1462
+ // console.log(`👀 8.03`);
1463
1463
  // TODO: Save any cucumber failure message for the Scenario here (instead of waiting till run_cucumber.js)
1464
1464
 
1465
1465
  // ---------------- Check internal test results ----------------
1466
1466
 
1467
1467
  if ( scope.expected_in_report && scope.expected_in_report.length > 0) {
1468
- console.log(`👀 8.04`);
1468
+ // console.log(`👀 8.04`);
1469
1469
  let data = await scope.reportIncludesAllExpected(
1470
1470
  scope,
1471
1471
  { expected: scope.expected_in_report }
1472
1472
  );
1473
1473
  let report_includes_all_expected_strings = data.all_included;
1474
- console.log(`👀 8.05`);
1474
+ // console.log(`👀 8.05`);
1475
1475
  if ( !report_includes_all_expected_strings ) {
1476
1476
  changeable_test_status = `FAILED`;
1477
1477
  let msg = `These strings are missing from the report:
@@ -1484,22 +1484,22 @@ async function afterScenario(scenario) {
1484
1484
  scope.expected_in_report = null;
1485
1485
 
1486
1486
  }
1487
- console.log(`👀 8.06`);
1487
+ // console.log(`👀 8.06`);
1488
1488
 
1489
1489
  if (scope.expected_not_in_report && scope.expected_not_in_report.length > 0) {
1490
- console.log(`👀 8.07`);
1490
+ // console.log(`👀 8.07`);
1491
1491
  let all_prohibited_strings_were_absent = await scope.reportDoesNotInclude(
1492
1492
  scope,
1493
1493
  { not_expected: scope.expected_not_in_report }
1494
1494
  );
1495
- console.log(`👀 8.08`);
1495
+ // console.log(`👀 8.08`);
1496
1496
  if ( !all_prohibited_strings_were_absent ) { changeable_test_status = `FAILED`;}
1497
- console.log(`👀 8.09`);
1497
+ // console.log(`👀 8.09`);
1498
1498
  // Reset report values no matter what so they don't mess up future scenarios
1499
1499
  scope.expected_not_in_report = null;
1500
- console.log(`👀 8.091`);
1500
+ // console.log(`👀 8.091`);
1501
1501
  }
1502
- console.log(`👀 9`);
1502
+ // console.log(`👀 9`);
1503
1503
 
1504
1504
  // ---------------- Ends internal results check ----------------
1505
1505
 
@@ -1537,7 +1537,7 @@ async function afterScenario(scenario) {
1537
1537
  );
1538
1538
  }
1539
1539
  }
1540
- console.log(`👀 10`);
1540
+ // console.log(`👀 10`);
1541
1541
  scope.expected_status = null; // reset for next Scenario
1542
1542
 
1543
1543
  let need_to_force_failed_status = false;
@@ -1578,15 +1578,15 @@ async function afterScenario(scenario) {
1578
1578
  let signout_error_msg = ``;
1579
1579
  // If there is a page open, then sign out and close it
1580
1580
  if ( scope.page ) {
1581
- console.log(`👀 11`);
1581
+ // console.log(`👀 11`);
1582
1582
  // Catch a possible reload error.
1583
1583
  try {
1584
1584
  // puppeteer will ensure proper timeout.
1585
- console.log(`👀 12`);
1585
+ // console.log(`👀 12`);
1586
1586
  await scope.page.goto(`${ session_vars.get_da_server_url() }/user/sign-out`, {waitUntil: `domcontentloaded`});
1587
1587
 
1588
1588
  } catch ( error ) {
1589
- console.log(`👀 13`);
1589
+ // console.log(`👀 13`);
1590
1590
  signout_succeeded = false;
1591
1591
 
1592
1592
  if ( error.name === `TimeoutError` ) {
@@ -1613,7 +1613,7 @@ async function afterScenario(scenario) {
1613
1613
  } // ends try/catch
1614
1614
 
1615
1615
  } // ends if scope.page
1616
- console.log(`👀 14`);
1616
+ // console.log(`👀 14`);
1617
1617
 
1618
1618
  // Now that we're no longer on the interview page, one way or
1619
1619
  // another, try to delete the interviews created during the test
@@ -1670,7 +1670,7 @@ async function afterScenario(scenario) {
1670
1670
  internal_errors
1671
1671
  );
1672
1672
  }
1673
- console.log(`👀 15`);
1673
+ // console.log(`👀 15`);
1674
1674
 
1675
1675
  // Find the race condition.
1676
1676
  log.debug({ code: `ALK0100`, context: `scenario`, },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "5.16.1-always-html-3",
3
+ "version": "5.16.1-always-html-4",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {