@bucky24/jsbehave 0.13.0 → 0.13.1
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/README.md +2 -0
- package/package.json +1 -1
- package/src/index.js +9 -2
package/README.md
CHANGED
|
@@ -105,6 +105,8 @@ close browser
|
|
|
105
105
|
|
|
106
106
|
`concat variable <variable name> with <text>`
|
|
107
107
|
|
|
108
|
+
`concat variables <variable name> and <variable name>` - concats two variables, storing the result in the first variable
|
|
109
|
+
|
|
108
110
|
`run test <test name>` - runs the test regardless if it has been run before
|
|
109
111
|
|
|
110
112
|
`run action <action name>` - runs the given action
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -410,11 +410,11 @@ async function compareContent([ selector, text ]) {
|
|
|
410
410
|
if (text instanceof RegExp && text.test(value)) {
|
|
411
411
|
return;
|
|
412
412
|
}
|
|
413
|
-
if (value
|
|
413
|
+
if (value?.includes(text)) {
|
|
414
414
|
return;
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
-
throw new Error(`Expected element to have inner html of "${text}". Instead it had inner html of "${html}"`);
|
|
417
|
+
throw new Error(`Expected element to have inner html of "${text}". Instead it had inner html of "${html}" and value of "${value}"`);
|
|
418
418
|
}
|
|
419
419
|
|
|
420
420
|
function doSetVariable([ key, input ]) {
|
|
@@ -429,6 +429,12 @@ function concatVariable([ key, input ]) {
|
|
|
429
429
|
setVariable(key, `${oldValue}${finalInput}`);
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
+
function concatVariable([ key, key2 ]) {
|
|
433
|
+
const var1 = getVariable(key) || '';
|
|
434
|
+
const var2 = getVariable(key2) || "";
|
|
435
|
+
setVariable(key, `${var1}${var2}`);
|
|
436
|
+
}
|
|
437
|
+
|
|
432
438
|
async function executeJS(code) {
|
|
433
439
|
return driver().executeScript(code);
|
|
434
440
|
}
|
|
@@ -532,6 +538,7 @@ const operations = {
|
|
|
532
538
|
"expect element (.+) to have content (.+)": compareContent,
|
|
533
539
|
"set variable (.+) to (.+)": doSetVariable,
|
|
534
540
|
"concat variable (.+) with (.+)": concatVariable,
|
|
541
|
+
"concat variables (.+) and (.+)": concatVariables,
|
|
535
542
|
"run test (.+)": doRunTest,
|
|
536
543
|
"run action (.+)": doRunAction,
|
|
537
544
|
[startActionRegex]: startBlock,
|