@suffolklitlab/alkiln 4.10.3-feat-debug-cache → 4.10.4-feat-debug-cache

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/CHANGELOG.md CHANGED
@@ -38,12 +38,19 @@ Format:
38
38
  ### Security
39
39
  -
40
40
  -->
41
+
41
42
  ## [Unreleased]
42
- ## Added
43
- - Contribution docs.
43
+ ### Added
44
44
  - Story table can take screenshots after each visited page.
45
45
  - Projects created in da each have a unique name. We assume for now this will not build up test packages in the server.
46
46
 
47
+ ## [4.10.4] - 2023-02-15
48
+ ### Added
49
+ - Contribution docs
50
+
51
+ ### Fixed
52
+ - #511, couldn't take screenshots of signature pages https://github.com/SuffolkLITLab/ALKiln/issues/511
53
+
47
54
  ## [4.10.3] - 2023-01-11
48
55
  ### Removed
49
56
  - Internal - ignore local test output files. Part 2 of the process out of 2.
package/lib/scope.js CHANGED
@@ -2295,6 +2295,23 @@ module.exports = {
2295
2295
  return scope;
2296
2296
  }, // Ends scope.throwPageError()
2297
2297
 
2298
+ take_a_screenshot: async ( scope,{ path }) => {
2299
+ /* Takes a jpeg screenshot. Avoids destroying signatures. */
2300
+
2301
+ let fullPage = true;
2302
+ let signature_elem = await scope.page.$(scope.signature_selector);
2303
+ if ( signature_elem !== null ) {
2304
+ fullPage = false;
2305
+ }
2306
+
2307
+ await scope.page.screenshot({
2308
+ path: path,
2309
+ type: 'jpeg',
2310
+ fullPage: fullPage,
2311
+ });
2312
+
2313
+ }, // Ends scope.take_a_screenshot()
2314
+
2298
2315
 
2299
2316
  //#####################################
2300
2317
  //#####################################
@@ -2317,11 +2334,7 @@ module.exports = {
2317
2334
  name = `screenshot_on-${ id }-${ date }`;
2318
2335
  }
2319
2336
 
2320
- await scope.page.screenshot({
2321
- path: `./${ scope.paths.scenario }/${ name }.jpg`,
2322
- type: 'jpeg',
2323
- fullPage: true
2324
- });
2337
+ await scope.take_a_screenshot( scope, { path: `./${ scope.paths.scenario }/${ name }.jpg` });
2325
2338
 
2326
2339
  await scope.afterStep( scope );
2327
2340
  }, // Ends scope.steps.screenshot()
package/lib/steps.js CHANGED
@@ -852,11 +852,8 @@ When(/I answer randomly for at most ([0-9]+) (?:page(?:s)?|screen(?:s)?)/, { tim
852
852
  let buttons = await scope.steps.set_random_page_vars( scope );
853
853
 
854
854
  // Take a screenshot of the page before continuing or ending
855
- await scope.page.screenshot({
856
- path: `${ scope.paths.random_screenshots }/random-${ Date.now() }.jpg`,
857
- type: `jpeg`,
858
- fullPage: true
859
- });
855
+ let path = `${ scope.paths.random_screenshots }/random-${ Date.now() }.jpg`;
856
+ await scope.take_a_screenshot( scope, { path: path });
860
857
 
861
858
  // Prep for the next loop to possibly stop. Signature page buttons
862
859
  // don't count as buttons in the way our field detects them
@@ -1125,27 +1122,23 @@ After(async function(scenario) {
1125
1122
  if ( !!scope.disable_error_screenshot ) {
1126
1123
  scope.addToReport(scope, {
1127
1124
  type: `row`,
1128
- value: `For security, ALKiln will not create a screenshot for this error. It's possible a secret is being used on this screen.`
1125
+ value: `For security, ALKiln will avoid creating a screenshot for this error. It's possible a secret is being used on this screen.`
1129
1126
  });
1130
1127
  } else {
1131
1128
 
1132
1129
  // Save/download a picture of the screen that's showing during the unexpected status
1133
1130
  // Save one copy in the outer-most artifact folder
1134
1131
  let scenario_filename = await scope.getSafeScenarioFilename( scope, { prefix: `error_on` });
1135
- await scope.page.screenshot({
1136
- path: `${ scope.paths.artifacts }/${ scenario_filename }.jpg`,
1137
- type: `jpeg`,
1138
- fullPage: true
1139
- });
1132
+ let path_outer = `${ scope.paths.artifacts }/${ scenario_filename }.jpg`;
1133
+ await scope.take_a_screenshot( scope, { path: path_outer });
1134
+
1140
1135
  // Save another copy in the artifact's Scenario folder
1141
1136
  let screenshot_name = `error_on`;
1142
1137
  let { id } = await scope.examinePageID( scope, 'none to match' );
1143
1138
  screenshot_name += `-${ id }`;
1144
- await scope.page.screenshot({
1145
- path: `${ scope.paths.scenario }/${ screenshot_name }.jpg`,
1146
- type: `jpeg`,
1147
- fullPage: true
1148
- });
1139
+ let path_scenario = `${ scope.paths.scenario }/${ screenshot_name }.jpg`;
1140
+ await scope.take_a_screenshot( scope, { path: path_scenario });
1141
+
1149
1142
  } // ends if scope.disable_error_screenshot
1150
1143
  } // ends if scope.page exists
1151
1144
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suffolklitlab/alkiln",
3
- "version": "4.10.3-feat-debug-cache",
3
+ "version": "4.10.4-feat-debug-cache",
4
4
  "description": "Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {