@bucky24/jsbehave 0.12.5 → 0.12.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +21 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bucky24/jsbehave",
3
- "version": "0.12.5",
3
+ "version": "0.12.6",
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
@@ -41,15 +41,26 @@ const variables = {
41
41
  "screenshotDirectory": ".",
42
42
  };
43
43
 
44
- const allTests = {};
45
- const allActions = {};
46
- const beforeAll = [];
47
- const beforeEach = [];
48
- const afterAll = [];
49
- const afterEach = [];
44
+ let allTests = {};
45
+ let allActions = {};
46
+ let beforeAll = [];
47
+ let beforeEach = [];
48
+ let afterAll = [];
49
+ let afterEach = [];
50
50
  let customSelectors = {};
51
51
  let customOperations = {};
52
52
 
53
+ function reset() {
54
+ allTests = {};
55
+ allActions = {};
56
+ beforeAll = [];
57
+ beforeEach = [];
58
+ afterAll = [];
59
+ afterEach = [];
60
+ customSelectors = {};
61
+ customOperations = {};
62
+ }
63
+
53
64
  function getVariable(name) {
54
65
  if (name === 'clipboard') {
55
66
  return clipboardy.readSync();
@@ -401,6 +412,7 @@ async function compareContent([ selector, text ]) {
401
412
 
402
413
  function doSetVariable([ key, input ]) {
403
414
  const finalInput = getText(input);
415
+ console.log(`Setting variable ${key} to ${finalInput}`);
404
416
  setVariable(key, finalInput);
405
417
  }
406
418
 
@@ -582,6 +594,9 @@ async function handleLines(lines) {
582
594
  const contents = fs.readFileSync(fileName, "utf-8");
583
595
  const lines = contents.split(EOL);
584
596
 
597
+ // reset the test framework
598
+ reset();
599
+
585
600
  console.log(`Processing ${fileName}`);
586
601
 
587
602
  // first pass, consolidate all the code into test blocks