@bucky24/jsbehave 0.12.4 → 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.
- package/package.json +1 -1
- package/src/index.js +25 -10
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -41,15 +41,26 @@ const variables = {
|
|
|
41
41
|
"screenshotDirectory": ".",
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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();
|
|
@@ -210,12 +221,12 @@ async function waitForText([ selector, text ]) {
|
|
|
210
221
|
const sel = getSelector(selector);
|
|
211
222
|
const elem = await driver().findElement(sel);
|
|
212
223
|
text = getText(text);
|
|
213
|
-
if (elem.text
|
|
224
|
+
if (elem.text.includes(text)) {
|
|
214
225
|
return;
|
|
215
226
|
}
|
|
216
227
|
|
|
217
228
|
const value = await elem.getAttribute("value")
|
|
218
|
-
if (value
|
|
229
|
+
if (value.includes(text)) {
|
|
219
230
|
return;
|
|
220
231
|
}
|
|
221
232
|
|
|
@@ -384,7 +395,7 @@ async function compareContent([ selector, text ]) {
|
|
|
384
395
|
if (text instanceof RegExp && text.test(html)) {
|
|
385
396
|
return;
|
|
386
397
|
}
|
|
387
|
-
if (html
|
|
398
|
+
if (html.includes(text)) {
|
|
388
399
|
return;
|
|
389
400
|
}
|
|
390
401
|
|
|
@@ -392,7 +403,7 @@ async function compareContent([ selector, text ]) {
|
|
|
392
403
|
if (text instanceof RegExp && text.test(value)) {
|
|
393
404
|
return;
|
|
394
405
|
}
|
|
395
|
-
if (value
|
|
406
|
+
if (value.includes(text)) {
|
|
396
407
|
return;
|
|
397
408
|
}
|
|
398
409
|
|
|
@@ -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
|