@suffolklitlab/alkiln 5.16.1-always-html-5 → 5.16.1-always-html-6
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 +6 -5
- package/lib/scope.js +11 -57
- package/lib/steps.js +42 -78
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -47,19 +47,20 @@ Format:
|
|
|
47
47
|
|
|
48
48
|
### Changed
|
|
49
49
|
|
|
50
|
-
- On pages with sensitive answers, store the HTML of the page. The HTML excludes field values, so those sensitive answers will not be in the saved file. Still avoid taking a pic of the screen, which would reveal sensitive answers. NEVER USE REAL USERS' ANSWERS IN ALKILN TESTS. This HTML can still reveal information about a user's answers. For example, some answers will reveal new questions. That will change the code of the revealed fields and that code will be in the HTML.
|
|
51
|
-
|
|
50
|
+
- On pages with sensitive answers, store the HTML of the page. The HTML excludes field values, so those sensitive answers will not be in the saved file. Still avoid taking a pic of the screen, which would reveal sensitive answers. ‼️ NEVER USE REAL USERS' ANSWERS IN ALKILN TESTS. This HTML can still reveal information about a user's answers. For example, some answers will reveal new questions. That will change the code of the revealed fields and that code will be in the HTML. See #1099
|
|
52
51
|
- GitHub action release: Restored our GitHub action's default for ALKiln version to the latest version 5 again. Released first on GitHub actions. NPM release will come in time, but npm has no impact on GitHub action releases.
|
|
53
52
|
|
|
54
53
|
### Fixed
|
|
55
54
|
|
|
56
|
-
-
|
|
55
|
+
- Updated docassemble cli version.
|
|
56
|
+
- Better detect navigation when email and password fail to sign in to a docassemble server account.
|
|
57
57
|
|
|
58
58
|
### Internal
|
|
59
59
|
|
|
60
|
-
- Break out the function in `Before()` to attempt better error tracing. Goal: try to repeat this for other functions in that file.
|
|
61
|
-
|
|
60
|
+
- Break out the function in `Before()` and `After()` to attempt better error tracing. Goal: try to repeat this for other functions in that file.
|
|
62
61
|
- Updated both of our actions' dependencies (the checkout, setup-node, setup-python, upload-artifacts, download-artifacts actions). Closes [#1095](https://github.com/suffolkLITLab/aLKiln/issues/1095). Once again, action related.
|
|
62
|
+
- When our report phrases are missing, list all missing phrases at one time in our custom message. The cucumber message will stay the same.
|
|
63
|
+
- Silence errors from screenshots & HTML downloads when trying to provide more information about failing tests. Those records are nice to have, but not absolutely necessary, and if a server is busy puppeteer will rightly have lost execution context, preventing interactions with the page and we don't need a noisy error about it. Log any problems.
|
|
63
64
|
|
|
64
65
|
## [5.16.1] - 2026-06-01
|
|
65
66
|
|
package/lib/scope.js
CHANGED
|
@@ -3090,7 +3090,6 @@ module.exports = {
|
|
|
3090
3090
|
/** Allow the developer to log a user into their server using GitHub
|
|
3091
3091
|
* secrets to authenticate.
|
|
3092
3092
|
*/
|
|
3093
|
-
await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-1.jpg`});
|
|
3094
3093
|
// Don't take a picture of a failed login in case one of the inputs is correct
|
|
3095
3094
|
scope.disable_error_screenshot = true;
|
|
3096
3095
|
|
|
@@ -3102,7 +3101,6 @@ module.exports = {
|
|
|
3102
3101
|
|
|
3103
3102
|
// Go to the sign in page
|
|
3104
3103
|
let login_url = `${ session_vars.get_da_server_url() }/user/sign-in`;
|
|
3105
|
-
await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-2.jpg`});
|
|
3106
3104
|
|
|
3107
3105
|
// TODO: implement and use scope.handle_possible_timeout()
|
|
3108
3106
|
try {
|
|
@@ -3110,13 +3108,10 @@ module.exports = {
|
|
|
3110
3108
|
await scope.page.goto( login_url, { waitUntil: `domcontentloaded`, timeout: scope.timeout });
|
|
3111
3109
|
await scope.page.waitForSelector( `.dabody` );
|
|
3112
3110
|
|
|
3113
|
-
await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-3.jpg`});
|
|
3114
|
-
|
|
3115
3111
|
} catch ( error ) {
|
|
3116
3112
|
|
|
3117
3113
|
let err_msg = `Error occurred when ALKiln tried to go to "${ login_url }".`
|
|
3118
3114
|
if ( error.name === `TimeoutError` ) {
|
|
3119
|
-
// console.log(`🖊️ 110`);
|
|
3120
3115
|
let non_reload_report_msg = `It took too long to load "${ login_url }"`;
|
|
3121
3116
|
await scope.handle_page_timeout_error( scope, { non_reload_report_data: {
|
|
3122
3117
|
code: `ALK0159`,
|
|
@@ -3124,8 +3119,6 @@ module.exports = {
|
|
|
3124
3119
|
}, error });
|
|
3125
3120
|
} else {
|
|
3126
3121
|
// Throw any non-timeout error
|
|
3127
|
-
// console.log(`🖊️ 111`);
|
|
3128
|
-
await scope.take_a_screenshot(scope, {path:`./_alkiln_temp/Temp-4.jpg`});
|
|
3129
3122
|
reports.addToReport( scope, { type: `error`, code: `ALK0160`, value: err_msg });
|
|
3130
3123
|
throw error;
|
|
3131
3124
|
} // ends if error is timeout error
|
|
@@ -3166,8 +3159,6 @@ module.exports = {
|
|
|
3166
3159
|
scope.scenarios.get( scope.scenario_id ).api_keys.push( api_key );
|
|
3167
3160
|
}
|
|
3168
3161
|
}
|
|
3169
|
-
// console.log(`🖊️ 112`);
|
|
3170
|
-
await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-4.jpg`});
|
|
3171
3162
|
|
|
3172
3163
|
expect( email, email_msg ).to.not.equal( undefined );
|
|
3173
3164
|
expect( password, password_msg ).to.not.equal( undefined );
|
|
@@ -3177,14 +3168,9 @@ module.exports = {
|
|
|
3177
3168
|
await scope.page.type( `#password`, password );
|
|
3178
3169
|
let elem = await scope.page.$( `button[type="submit"]` );
|
|
3179
3170
|
await scope.guard_against_missing_tap_element(scope, { elem });
|
|
3180
|
-
// console.log(`🖊️ 113`);
|
|
3181
|
-
await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-5.jpg`});
|
|
3182
3171
|
|
|
3183
3172
|
// Submit and see what happens
|
|
3184
3173
|
let winner = await scope.steps.race_sign_in_navigation( scope, { elem, login_url });
|
|
3185
|
-
// console.log(`🖊️ 113.5 ${ winner }`);
|
|
3186
|
-
// await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-6.jpg`});
|
|
3187
|
-
// console.log(`🖊️ 113.6 ${ winner }`);
|
|
3188
3174
|
// Add the result to the report and possibly throw errors
|
|
3189
3175
|
if ( winner[0] === `success` ) {
|
|
3190
3176
|
reports.addToReport( scope, {
|
|
@@ -3197,7 +3183,6 @@ module.exports = {
|
|
|
3197
3183
|
type: `error`, code: `ALK0209`,
|
|
3198
3184
|
value: `Failed to sign into ${ login_url }. Make sure you followed the instructions at https://assemblyline.suffolklitlab.org/docs/alkiln/writing/#sign-in.`
|
|
3199
3185
|
});
|
|
3200
|
-
// console.log(`🍉 ${ error_msg }`);
|
|
3201
3186
|
throw new Error( error_msg );
|
|
3202
3187
|
} else if ( winner[0] === `error` ) {
|
|
3203
3188
|
let error_msg = reports.addToReport( scope, {
|
|
@@ -3206,94 +3191,63 @@ module.exports = {
|
|
|
3206
3191
|
});
|
|
3207
3192
|
throw new Error( error_msg );
|
|
3208
3193
|
}
|
|
3209
|
-
// console.log(`🖊️ 114`);
|
|
3210
|
-
// await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-7.jpg`});
|
|
3211
|
-
// if ( error_msg ) { // undefined sometimes now
|
|
3212
|
-
// return [ error_msg ];
|
|
3213
|
-
// } else {
|
|
3214
|
-
// return [];
|
|
3215
|
-
// }
|
|
3216
3194
|
}, // Ends scope.steps.sign_in()
|
|
3217
3195
|
|
|
3218
3196
|
race_sign_in_navigation: async function ( scope, { elem, login_url='unknown' }) {
|
|
3219
3197
|
/** Wait for sign in navigation success or failure, or system error. */
|
|
3220
3198
|
|
|
3221
|
-
await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp2-0.jpg`});
|
|
3222
|
-
|
|
3223
3199
|
// After everything, clean up incomplete promises
|
|
3224
3200
|
const controller = new AbortController;
|
|
3225
|
-
// console.log(`⏳ 200`);
|
|
3226
3201
|
|
|
3227
3202
|
// Redirect
|
|
3228
|
-
let redirect_promise = scope.page.waitForResponse(
|
|
3229
|
-
// console.log(`⏳ 300`);
|
|
3203
|
+
let redirect_promise = scope.page.waitForResponse(function ( response ) {
|
|
3230
3204
|
return response.status() === 302;
|
|
3231
3205
|
}, { signal: controller.signal })
|
|
3232
|
-
.catch(
|
|
3233
|
-
// console.log(`⏳ 201`);
|
|
3234
|
-
// await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp2-1.jpg`});
|
|
3206
|
+
.catch(( catch_info ) => {
|
|
3235
3207
|
log.debug({ code: `ALK0204`, context: `nav`, },
|
|
3236
3208
|
`302 sign-in wait catch error:`, catch_info.name, catch_info,
|
|
3237
3209
|
);
|
|
3238
3210
|
});
|
|
3239
3211
|
|
|
3240
3212
|
// Invalid credentials, no navigation, no sign in
|
|
3241
|
-
let wrong_sign_in_promise = scope.page.waitForResponse(
|
|
3242
|
-
// console.log(`⏳ 301`);
|
|
3213
|
+
let wrong_sign_in_promise = scope.page.waitForResponse(function ( response ) {
|
|
3243
3214
|
return response.status() >= 200 && response.status() < 300 && response.url().includes(`/sign-in`);
|
|
3244
3215
|
}, { signal: controller.signal })
|
|
3245
|
-
.catch(
|
|
3246
|
-
// errors?
|
|
3247
|
-
// console.log(`⏳ 202`);
|
|
3248
|
-
// await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp2-2.jpg`});
|
|
3216
|
+
.catch(( catch_info ) => {
|
|
3249
3217
|
log.debug({ code: `ALK0205`, context: `nav`, },
|
|
3250
3218
|
`200s sign-in wait catch error:`, catch_info.name, catch_info,
|
|
3251
3219
|
);
|
|
3252
3220
|
});
|
|
3253
3221
|
|
|
3254
3222
|
// System error
|
|
3255
|
-
let error_promise = scope.page.waitForResponse(
|
|
3256
|
-
// console.log(`⏳ 302`);
|
|
3223
|
+
let error_promise = scope.page.waitForResponse(function ( response ) {
|
|
3257
3224
|
return response.status() >= 500 && response.status() < 600;
|
|
3258
3225
|
}, { signal: controller.signal })
|
|
3259
|
-
.catch(
|
|
3260
|
-
// console.log(`⏳ 203`);
|
|
3261
|
-
await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp2-3.jpg`});
|
|
3226
|
+
.catch(( catch_info ) => {
|
|
3262
3227
|
log.debug({ code: `ALK0206`, context: `nav`, },
|
|
3263
3228
|
`500s sign-in wait catch error:`, catch_info.name, catch_info,
|
|
3264
3229
|
);
|
|
3265
3230
|
});
|
|
3266
3231
|
|
|
3267
|
-
// Duh, the other catches were triggered because those promises were aborted
|
|
3268
|
-
|
|
3269
3232
|
let click_promise = elem.click(); // MUST complete
|
|
3270
3233
|
let nav_promise = scope.nav_race(scope, {}).result;
|
|
3271
|
-
let pic_promise = true; // scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp2-10.jpg`});
|
|
3272
|
-
// console.log(`⏳ 204`);
|
|
3273
3234
|
const winner = await Promise.race([
|
|
3274
|
-
Promise.all([ `success`, click_promise,
|
|
3275
|
-
Promise.all([ `failure`, click_promise,
|
|
3276
|
-
Promise.all([ `error`, click_promise,
|
|
3235
|
+
Promise.all([ `success`, click_promise, redirect_promise ]),
|
|
3236
|
+
Promise.all([ `failure`, click_promise, wrong_sign_in_promise ]),
|
|
3237
|
+
Promise.all([ `error`, click_promise, error_promise ]),
|
|
3277
3238
|
]).catch(async ( error ) => {
|
|
3278
|
-
// console.log(`⏳ 205`);
|
|
3279
|
-
// await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp2-4.jpg`});
|
|
3280
3239
|
let error_msg = reports.addToReport( scope, {
|
|
3281
3240
|
type: `error`, code: `ALK0207`,
|
|
3282
3241
|
value: `Unknown error waiting for results during sign in at ${ login_url }.`
|
|
3283
3242
|
});
|
|
3284
|
-
// console.log(`⏳ 205.1`, error);
|
|
3285
3243
|
throw error;
|
|
3286
3244
|
});
|
|
3287
3245
|
|
|
3288
|
-
// console.log(`⏳ 206`);
|
|
3289
|
-
// // await waitForTimeout(500);
|
|
3290
|
-
// await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp2-5.jpg`});
|
|
3291
|
-
|
|
3292
3246
|
// Clean up unresolved promises
|
|
3293
3247
|
controller.abort();
|
|
3294
|
-
//
|
|
3248
|
+
// Wait to finish navigating
|
|
3249
|
+
// TODO: Test the winner 'error' under this circumstance
|
|
3295
3250
|
await nav_promise;
|
|
3296
|
-
await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp3-1.jpg`});
|
|
3297
3251
|
|
|
3298
3252
|
log.debug({ code: `ALK0208`, context: `nav` },
|
|
3299
3253
|
`Sign-in winner:`, winner
|
package/lib/steps.js
CHANGED
|
@@ -116,7 +116,6 @@ BeforeAll(async function() {
|
|
|
116
116
|
|
|
117
117
|
Before( beforeScenario );
|
|
118
118
|
async function beforeScenario( scenario ) {
|
|
119
|
-
// console.log('👁️ 111 start beforeScenario');
|
|
120
119
|
// Start the running "progress bar" for the Scenario
|
|
121
120
|
log.stdout({}, `\nScenario: ${ scenario.pickle.name }: `);
|
|
122
121
|
|
|
@@ -126,20 +125,15 @@ async function beforeScenario( scenario ) {
|
|
|
126
125
|
// Will only run in the Playground outside of a sandbox. TODO: There's a
|
|
127
126
|
// better way to do this, though it's more complicated. See comments in
|
|
128
127
|
// https://github.com/SuffolkLITLab/ALKiln/issues/661
|
|
129
|
-
// console.log('👁️ 112 no browser, await new local browser');
|
|
130
128
|
scope.browser = await scope.driver.launch({ args: ['--no-sandbox'] });
|
|
131
129
|
} else {
|
|
132
|
-
// console.log('👁️ 113 no browser, await new remote browser');
|
|
133
130
|
scope.browser = await scope.driver.launch({ headless: !session_vars.get_debug(), devtools: session_vars.get_debug() });
|
|
134
131
|
}
|
|
135
132
|
}
|
|
136
|
-
// console.log('👁️ 114 we have ensured browser exists, awaiting pages');
|
|
137
133
|
// Clean up all previously existing pages
|
|
138
134
|
for (const page of await scope.browser.pages()) {
|
|
139
|
-
// console.log('👁️ 115 awaiting closing page');
|
|
140
135
|
await page.close();
|
|
141
136
|
}
|
|
142
|
-
// console.log('👁️ 116 awaiting opening a new page');
|
|
143
137
|
// Make a new page
|
|
144
138
|
scope.page = await scope.browser.newPage()
|
|
145
139
|
|
|
@@ -153,10 +147,8 @@ async function beforeScenario( scenario ) {
|
|
|
153
147
|
scope.server_reload_promise = null;
|
|
154
148
|
|
|
155
149
|
reports.addReportHeading(scope, {scenario});
|
|
156
|
-
// console.log('👁️ 117 awaiting getting safe scenario name');
|
|
157
150
|
// Make folder for this Scenario in the all-tests artifacts folder
|
|
158
151
|
scope.base_filename = await scope.getSafeScenarioBaseFilename(scope, {scenario});
|
|
159
|
-
// console.log('👁️ 118 got safe scenario name');
|
|
160
152
|
// Add a date for uniqueness in case dev has accidentally copied a Scenario description
|
|
161
153
|
let date = Date.now();
|
|
162
154
|
scope.paths.scenario = `${ scope.paths.artifacts }/${ scope.base_filename }-${ date }`;
|
|
@@ -297,10 +289,8 @@ Given(/I go to "([^"]+)"/i, {timeout: -1}, async ( url ) => {
|
|
|
297
289
|
return result;
|
|
298
290
|
});
|
|
299
291
|
|
|
300
|
-
foo = null
|
|
301
292
|
Given(
|
|
302
293
|
/I (?:sign|log) ?(?:in)?(?:on)?(?:to the server)? with(?: the email)? "([^"]+)",?(?: and)?(?: the password)? "([^"]+)"(?: SECRETs)?(?:,?(?: and)?(?: the API key)? "([^"]+)")?/i,
|
|
303
|
-
{ timeout: -1 },
|
|
304
294
|
async ( email, password, api_key ) => {
|
|
305
295
|
/** Uses the names of environment variables (most often GitHub SECRETs) to
|
|
306
296
|
* log into an account on the user's server. Must be secure.
|
|
@@ -315,21 +305,11 @@ Given(
|
|
|
315
305
|
// `page` timeout will deal with custom timeout
|
|
316
306
|
// Couldn't test the timeout for tapping the button because there's not
|
|
317
307
|
// enough of a pause between initial navigation and pressing button.
|
|
318
|
-
foo = scope.page
|
|
319
|
-
// console.log(`⭐️ ${ JSON.stringify(scope.page, null, 2) }`)
|
|
320
308
|
await scope.steps.sign_in( scope, {
|
|
321
309
|
email_secret_name: email,
|
|
322
310
|
password_secret_name: password,
|
|
323
311
|
api_key_secret_name: api_key
|
|
324
312
|
});
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
// console.log(`🖊️ 115`);
|
|
328
|
-
// await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-8.jpg`});
|
|
329
|
-
|
|
330
|
-
// if ( !result.ok && result.errors.length > 0 ) {
|
|
331
|
-
// throw result.errors[ result.errors.length - 1 ];
|
|
332
|
-
// }
|
|
333
313
|
});
|
|
334
314
|
|
|
335
315
|
// I am using a mobile/pc
|
|
@@ -1343,8 +1323,6 @@ Then(/I fail to delete (\d) detected interview(?:s)? and get no error __internal
|
|
|
1343
1323
|
|
|
1344
1324
|
AfterStep(async function({ result }) {
|
|
1345
1325
|
// TODO: Abstract this
|
|
1346
|
-
// await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-13.jpg`});
|
|
1347
|
-
// console.log(`🛑 100`);
|
|
1348
1326
|
if ( result.status === `PASSED` ) { log.stdout({ records_only: true }, `.`); }
|
|
1349
1327
|
else if ( result.status === `FAILED` ) { log.stdout({ records_only: true }, `F`); }
|
|
1350
1328
|
else if ( result.status === `UNDEFINED` ) { log.stdout({ records_only: true }, `U`); }
|
|
@@ -1352,13 +1330,10 @@ AfterStep(async function({ result }) {
|
|
|
1352
1330
|
else if ( result.status === `PENDING` ) { log.stdout({ records_only: true }, `P`); }
|
|
1353
1331
|
|
|
1354
1332
|
reports.outdent();
|
|
1355
|
-
// console.log(`🛑 101`);
|
|
1356
1333
|
});
|
|
1357
1334
|
|
|
1358
1335
|
After(afterScenario);
|
|
1359
1336
|
async function afterScenario(scenario) {
|
|
1360
|
-
// console.log(`👀 1 ${ foo == scope.page } ${ JSON.stringify(scope.page, null, 2) }`);
|
|
1361
|
-
await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-30.jpg`});
|
|
1362
1337
|
// Log errors
|
|
1363
1338
|
if ( scenario.result.message ) {
|
|
1364
1339
|
log.debug({ code: `ALK0091`, context: `scenario`, },
|
|
@@ -1377,8 +1352,6 @@ async function afterScenario(scenario) {
|
|
|
1377
1352
|
value: `Accessibility standards tests failed. See information above.`
|
|
1378
1353
|
});
|
|
1379
1354
|
}
|
|
1380
|
-
// console.log(`👀 2`);
|
|
1381
|
-
await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-9.jpg`});
|
|
1382
1355
|
|
|
1383
1356
|
if ( scope.failed_pdf_compares.length > 0) {
|
|
1384
1357
|
let msg = scope.failed_pdf_compares.reduce((str, new_msg) => `${ str }\n―――\n${ new_msg }`)
|
|
@@ -1400,46 +1373,54 @@ async function afterScenario(scenario) {
|
|
|
1400
1373
|
);
|
|
1401
1374
|
|
|
1402
1375
|
if ( scope.page ) {
|
|
1403
|
-
// console.log(`👀 3`);
|
|
1404
|
-
await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-10.jpg`});
|
|
1405
1376
|
|
|
1406
1377
|
if ( !!scope.disable_error_screenshot ) {
|
|
1407
1378
|
reports.addToReport(scope, {
|
|
1408
1379
|
type: `row info`,
|
|
1409
1380
|
code: `ALK0095`,
|
|
1410
1381
|
// Discuss: Might people use secret variables to prevent any
|
|
1411
|
-
// information about a screen from getting out? For example, they
|
|
1412
|
-
// proprietary info in the HTML itself.
|
|
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
|
|
1382
|
+
// information about a screen from getting out? For example, they may
|
|
1383
|
+
// have proprietary info in the HTML itself.
|
|
1384
|
+
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 as a file. The HTML omits the values in the fields.`
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
// Could have an error if page can't load or something similar
|
|
1389
|
+
try {
|
|
1390
|
+
// Save/download a picture of the screen that's showing during the unexpected status
|
|
1391
|
+
// Save one copy in the outer-most artifact folder
|
|
1392
|
+
let scenario_filename = await scope.getSafeScenarioFilename( scope, { prefix: `error_on` });
|
|
1393
|
+
let path_outer = `${ scope.paths.artifacts }/${ scenario_filename }.jpg`;
|
|
1394
|
+
await scope.take_a_screenshot( scope, {
|
|
1395
|
+
path: path_outer,
|
|
1396
|
+
disable_pic: scope.disable_error_screenshot,
|
|
1397
|
+
disable_html: false,
|
|
1398
|
+
});
|
|
1399
|
+
|
|
1400
|
+
// Save another copy in the artifact's Scenario folder
|
|
1401
|
+
let screenshot_name = `error_on`;
|
|
1402
|
+
let { id } = await scope.examinePageID( scope, 'none to match' );
|
|
1403
|
+
let short_id = `${ id }`.substring(0, 20);
|
|
1404
|
+
screenshot_name += `-${ short_id }`;
|
|
1405
|
+
let path_scenario = `${ scope.paths.scenario }/${ screenshot_name }.jpg`;
|
|
1406
|
+
await scope.take_a_screenshot( scope, {
|
|
1407
|
+
path: path_scenario,
|
|
1408
|
+
disable_pic: scope.disable_error_screenshot,
|
|
1409
|
+
disable_html: false,
|
|
1414
1410
|
});
|
|
1411
|
+
|
|
1412
|
+
} catch ( page_error ) {
|
|
1413
|
+
// Fail silently. Our inability to take a pic shouldn't cause confusion
|
|
1414
|
+
// about why a test failed
|
|
1415
|
+
if ( page_error.message.lower().includes(`execution context`) ) {
|
|
1416
|
+
reports.addToReport(scope, {
|
|
1417
|
+
type: `row warning`,
|
|
1418
|
+
code: `ALK0281`,
|
|
1419
|
+
value: `ALKiln is unable to get any record of this page whatsoever, even the page HTML. Your server may be busy.`
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
log.debug({ code: `ALK0282`, level: `note`, }, page_error );
|
|
1415
1423
|
}
|
|
1416
|
-
// console.log(`👀 4 ${ foo == scope.page } ${ JSON.stringify(scope.page, null, 2) }`);
|
|
1417
|
-
await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-11.jpg`});
|
|
1418
|
-
|
|
1419
|
-
// Save/download a picture of the screen that's showing during the unexpected status
|
|
1420
|
-
// Save one copy in the outer-most artifact folder
|
|
1421
|
-
let scenario_filename = await scope.getSafeScenarioFilename( scope, { prefix: `error_on` });
|
|
1422
|
-
let path_outer = `${ scope.paths.artifacts }/${ scenario_filename }.jpg`;
|
|
1423
|
-
await scope.take_a_screenshot( scope, {
|
|
1424
|
-
path: path_outer,
|
|
1425
|
-
disable_pic: scope.disable_error_screenshot,
|
|
1426
|
-
disable_html: false,
|
|
1427
|
-
});
|
|
1428
|
-
// console.log(`👀 5 ${ foo == scope.page } ${ JSON.stringify(scope.page, null, 2) }`);
|
|
1429
|
-
await scope.take_a_screenshot(scope, {path:`${scope.paths.artifacts}/Temp-12.jpg`});
|
|
1430
|
-
|
|
1431
|
-
// Save another copy in the artifact's Scenario folder
|
|
1432
|
-
let screenshot_name = `error_on`;
|
|
1433
|
-
let { id } = await scope.examinePageID( scope, 'none to match' );
|
|
1434
|
-
let short_id = `${ id }`.substring(0, 20);
|
|
1435
|
-
screenshot_name += `-${ short_id }`;
|
|
1436
|
-
let path_scenario = `${ scope.paths.scenario }/${ screenshot_name }.jpg`;
|
|
1437
|
-
await scope.take_a_screenshot( scope, {
|
|
1438
|
-
path: path_scenario,
|
|
1439
|
-
disable_pic: scope.disable_error_screenshot,
|
|
1440
|
-
disable_html: false,
|
|
1441
|
-
});
|
|
1442
|
-
// console.log(`👀 6`);
|
|
1443
1424
|
|
|
1444
1425
|
} // ends if scope.page exists
|
|
1445
1426
|
|
|
@@ -1447,59 +1428,48 @@ async function afterScenario(scenario) {
|
|
|
1447
1428
|
if (changeable_test_status === `FAILED`) {
|
|
1448
1429
|
reports.addToReport(scope, { type: `outcome failure info`, code: `ALK0096`, value: `**-- Scenario Failed --**` });
|
|
1449
1430
|
}
|
|
1450
|
-
// console.log(`👀 7`);
|
|
1451
1431
|
|
|
1452
1432
|
} // ends if not passed
|
|
1453
|
-
// console.log(`👀 8`);
|
|
1454
1433
|
|
|
1455
1434
|
// Add report text to Scenario folder after everything has been added to the report
|
|
1456
1435
|
let scenario_report_obj = scope.report.get( scope.scenario_id );
|
|
1457
|
-
// console.log(`👀 8.01`);
|
|
1458
1436
|
let report = reports.getPrintableScenario( scenario_report_obj );
|
|
1459
1437
|
// Save the report as in the Scenario folder
|
|
1460
|
-
// console.log(`👀 8.02`);
|
|
1461
1438
|
fs.writeFileSync( scope.paths.scenario_report, report );
|
|
1462
|
-
// console.log(`👀 8.03`);
|
|
1463
1439
|
// TODO: Save any cucumber failure message for the Scenario here (instead of waiting till run_cucumber.js)
|
|
1464
1440
|
|
|
1465
1441
|
// ---------------- Check internal test results ----------------
|
|
1466
1442
|
|
|
1467
1443
|
if ( scope.expected_in_report && scope.expected_in_report.length > 0) {
|
|
1468
|
-
// console.log(`👀 8.04`);
|
|
1469
1444
|
let data = await scope.reportIncludesAllExpected(
|
|
1470
1445
|
scope,
|
|
1471
1446
|
{ expected: scope.expected_in_report }
|
|
1472
1447
|
);
|
|
1473
1448
|
let report_includes_all_expected_strings = data.all_included;
|
|
1474
|
-
// console.log(`👀 8.05`);
|
|
1475
1449
|
if ( !report_includes_all_expected_strings ) {
|
|
1476
1450
|
changeable_test_status = `FAILED`;
|
|
1477
1451
|
let msg = `These strings are missing from the report:
|
|
1478
1452
|
${ JSON.stringify(data.missing, null, 2) }
|
|
1479
1453
|
Instead the report had this text:
|
|
1480
1454
|
${ report }`;
|
|
1455
|
+
// These failure messages won't match exactly, which is a shame, but at
|
|
1456
|
+
// least our devs will have more data _somewhere_ about their failure.
|
|
1481
1457
|
expect( report, msg ).to.contain( data.missing[0] );
|
|
1482
1458
|
}
|
|
1483
1459
|
// Reset report values no matter what so they don't mess up future scenarios
|
|
1484
1460
|
scope.expected_in_report = null;
|
|
1485
1461
|
|
|
1486
1462
|
}
|
|
1487
|
-
// console.log(`👀 8.06`);
|
|
1488
1463
|
|
|
1489
1464
|
if (scope.expected_not_in_report && scope.expected_not_in_report.length > 0) {
|
|
1490
|
-
// console.log(`👀 8.07`);
|
|
1491
1465
|
let all_prohibited_strings_were_absent = await scope.reportDoesNotInclude(
|
|
1492
1466
|
scope,
|
|
1493
1467
|
{ not_expected: scope.expected_not_in_report }
|
|
1494
1468
|
);
|
|
1495
|
-
// console.log(`👀 8.08`);
|
|
1496
1469
|
if ( !all_prohibited_strings_were_absent ) { changeable_test_status = `FAILED`;}
|
|
1497
|
-
// console.log(`👀 8.09`);
|
|
1498
1470
|
// Reset report values no matter what so they don't mess up future scenarios
|
|
1499
1471
|
scope.expected_not_in_report = null;
|
|
1500
|
-
// console.log(`👀 8.091`);
|
|
1501
1472
|
}
|
|
1502
|
-
// console.log(`👀 9`);
|
|
1503
1473
|
|
|
1504
1474
|
// ---------------- Ends internal results check ----------------
|
|
1505
1475
|
|
|
@@ -1537,7 +1507,6 @@ async function afterScenario(scenario) {
|
|
|
1537
1507
|
);
|
|
1538
1508
|
}
|
|
1539
1509
|
}
|
|
1540
|
-
// console.log(`👀 10`);
|
|
1541
1510
|
scope.expected_status = null; // reset for next Scenario
|
|
1542
1511
|
|
|
1543
1512
|
let need_to_force_failed_status = false;
|
|
@@ -1578,15 +1547,12 @@ async function afterScenario(scenario) {
|
|
|
1578
1547
|
let signout_error_msg = ``;
|
|
1579
1548
|
// If there is a page open, then sign out and close it
|
|
1580
1549
|
if ( scope.page ) {
|
|
1581
|
-
// console.log(`👀 11`);
|
|
1582
1550
|
// Catch a possible reload error.
|
|
1583
1551
|
try {
|
|
1584
1552
|
// puppeteer will ensure proper timeout.
|
|
1585
|
-
// console.log(`👀 12`);
|
|
1586
1553
|
await scope.page.goto(`${ session_vars.get_da_server_url() }/user/sign-out`, {waitUntil: `domcontentloaded`});
|
|
1587
1554
|
|
|
1588
1555
|
} catch ( error ) {
|
|
1589
|
-
// console.log(`👀 13`);
|
|
1590
1556
|
signout_succeeded = false;
|
|
1591
1557
|
|
|
1592
1558
|
if ( error.name === `TimeoutError` ) {
|
|
@@ -1613,7 +1579,6 @@ async function afterScenario(scenario) {
|
|
|
1613
1579
|
} // ends try/catch
|
|
1614
1580
|
|
|
1615
1581
|
} // ends if scope.page
|
|
1616
|
-
// console.log(`👀 14`);
|
|
1617
1582
|
|
|
1618
1583
|
// Now that we're no longer on the interview page, one way or
|
|
1619
1584
|
// another, try to delete the interviews created during the test
|
|
@@ -1670,7 +1635,6 @@ async function afterScenario(scenario) {
|
|
|
1670
1635
|
internal_errors
|
|
1671
1636
|
);
|
|
1672
1637
|
}
|
|
1673
|
-
// console.log(`👀 15`);
|
|
1674
1638
|
|
|
1675
1639
|
// Find the race condition.
|
|
1676
1640
|
log.debug({ code: `ALK0100`, context: `scenario`, },
|
package/package.json
CHANGED