@bucky24/jsbehave 0.12.6 → 0.12.7

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +9 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bucky24/jsbehave",
3
- "version": "0.12.6",
3
+ "version": "0.12.7",
4
4
  "description": "A module that allows BDD testing for browser based testing in Selenium.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -444,7 +444,12 @@ async function clickElementWithOffset([ selector, x, y ]) {
444
444
 
445
445
  async function takeScreenshot(test) {
446
446
  const activeBrowser = getVariable("jsbehave.active_driver");
447
- const image = await driver().takeScreenshot();
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
+ }
452
+ const image = activeDriver.takeScreenshot();
448
453
  const useTest = test.replace(/ /g, "_");
449
454
  let configPath = getVariable("screenshotDirectory");
450
455
  const fileName = `test_${useTest}_failure_${activeBrowser}.png`;
@@ -528,7 +533,8 @@ const operations = {
528
533
  };
529
534
 
530
535
  async function handleLines(lines) {
531
- for (let line of lines) {
536
+ for (let i=0;i<lines.length;i++) {
537
+ const line = lines[i];
532
538
  if (line === "") {
533
539
  continue;
534
540
  }
@@ -566,7 +572,7 @@ async function handleLines(lines) {
566
572
  const test = variables["jsbehave.activeBlock"];
567
573
  if (test) {
568
574
  console.log(`Test ${test} - FAILURE`);
569
- console.log(`Failure when running line "${line}" for "${operation}"`);
575
+ console.log(`Failed on line ${i+1}: "${line}" for "${operation}"`);
570
576
  console.log(error);
571
577
  const screenshotOnFailure = getVariable("screenshotOnFailure") === 'true';
572
578
  if (screenshotOnFailure) {