@bucky24/jsbehave 0.12.6 → 0.12.8
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/package.json +1 -1
- package/src/index.js +10 -3
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -444,7 +444,13 @@ async function clickElementWithOffset([ selector, x, y ]) {
|
|
|
444
444
|
|
|
445
445
|
async function takeScreenshot(test) {
|
|
446
446
|
const activeBrowser = getVariable("jsbehave.active_driver");
|
|
447
|
-
const
|
|
447
|
+
const activeDriver = await driver();
|
|
448
|
+
if (!activeDriver) {
|
|
449
|
+
// don't throw, we get here when an error happens so we're already handling a problem
|
|
450
|
+
console.error(`Unable to take screenshot - driver does not exist`);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
const image = activeDriver.takeScreenshot();
|
|
448
454
|
const useTest = test.replace(/ /g, "_");
|
|
449
455
|
let configPath = getVariable("screenshotDirectory");
|
|
450
456
|
const fileName = `test_${useTest}_failure_${activeBrowser}.png`;
|
|
@@ -528,7 +534,8 @@ const operations = {
|
|
|
528
534
|
};
|
|
529
535
|
|
|
530
536
|
async function handleLines(lines) {
|
|
531
|
-
for (let
|
|
537
|
+
for (let i=0;i<lines.length;i++) {
|
|
538
|
+
const line = lines[i];
|
|
532
539
|
if (line === "") {
|
|
533
540
|
continue;
|
|
534
541
|
}
|
|
@@ -566,7 +573,7 @@ async function handleLines(lines) {
|
|
|
566
573
|
const test = variables["jsbehave.activeBlock"];
|
|
567
574
|
if (test) {
|
|
568
575
|
console.log(`Test ${test} - FAILURE`);
|
|
569
|
-
console.log(`
|
|
576
|
+
console.log(`Failed on line ${i+1}: "${line}" for "${operation}"`);
|
|
570
577
|
console.log(error);
|
|
571
578
|
const screenshotOnFailure = getVariable("screenshotOnFailure") === 'true';
|
|
572
579
|
if (screenshotOnFailure) {
|