Skip to content

Commit 91187d6

Browse files
committed
Fix crash when wait-for-property fails
1 parent f6452af commit 91187d6

13 files changed

+24
-11
lines changed

src/commands/wait.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ function parseWaitForProperty(parser) {
752752
const varValue = varName + 'Value';
753753

754754
const { checks, hasSpecialChecks } = makeExtendedChecks(
755-
enabledChecks, false, 'nonMatchingAttrs', 'property', 'prop', varKey, varValue);
755+
enabledChecks, false, 'nonMatchingProps', 'property', 'prop', varKey, varValue);
756756

757757
let checker;
758758
if (!enabledChecks['ALL']) {

tests/test-js/api-output/parseWaitForProperty/basic-1.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ instructions = [
1818
}
1919
const prop = e[parseWaitForPropKey];
2020
if (prop !== parseWaitForPropValue) {
21-
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
21+
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
2222
}
2323
}
2424
return nonMatchingProps;

tests/test-js/api-output/parseWaitForProperty/basic-2.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ instructions = [
1818
}
1919
const prop = e[parseWaitForPropKey];
2020
if (prop !== parseWaitForPropValue) {
21-
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
21+
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
2222
}
2323
}
2424
return nonMatchingProps;

tests/test-js/api-output/parseWaitForProperty/basic-3.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ instructions = [
1818
}
1919
const prop = e[parseWaitForPropKey];
2020
if (prop !== parseWaitForPropValue) {
21-
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
21+
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
2222
}
2323
}
2424
return nonMatchingProps;

tests/test-js/api-output/parseWaitForProperty/color-1.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ instructions = [
1818
}
1919
const prop = e[parseWaitForPropKey];
2020
if (prop !== parseWaitForPropValue) {
21-
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
21+
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
2222
}
2323
}
2424
return nonMatchingProps;

tests/test-js/api-output/parseWaitForProperty/extra-1.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ instructions = [
1818
}
1919
const prop = e[parseWaitForPropKey];
2020
if (prop !== parseWaitForPropValue) {
21-
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
21+
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
2222
}
2323
}
2424
return nonMatchingProps;

tests/test-js/api-output/parseWaitForProperty/extra-2.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ instructions = [
1818
}
1919
const prop = e[parseWaitForPropKey];
2020
if (!prop.includes(parseWaitForPropValue)) {
21-
nonMatchingAttrs.push(\"property `\" + parseWaitForPropKey + \"` (`\" + prop + \"`) doesn't contain `\" + parseWaitForPropValue + \"` (for CONTAINS check)\");
21+
nonMatchingProps.push(\"property `\" + parseWaitForPropKey + \"` (`\" + prop + \"`) doesn't contain `\" + parseWaitForPropValue + \"` (for CONTAINS check)\");
2222
}
2323
}
2424
return nonMatchingProps;

tests/test-js/api-output/parseWaitForProperty/extra-3.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ instructions = [
1818
}
1919
const prop = e[parseWaitForPropKey];
2020
if (!prop.includes(parseWaitForPropValue)) {
21-
nonMatchingAttrs.push(\"property `\" + parseWaitForPropKey + \"` (`\" + prop + \"`) doesn't contain `\" + parseWaitForPropValue + \"` (for CONTAINS check)\");
21+
nonMatchingProps.push(\"property `\" + parseWaitForPropKey + \"` (`\" + prop + \"`) doesn't contain `\" + parseWaitForPropValue + \"` (for CONTAINS check)\");
2222
}
2323
}
2424
return nonMatchingProps;

tests/test-js/api-output/parseWaitForProperty/pseudo-1.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ instructions = [
1818
}
1919
const prop = e[parseWaitForPropKey];
2020
if (prop !== parseWaitForPropValue) {
21-
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
21+
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
2222
}
2323
}
2424
return nonMatchingProps;

tests/test-js/api-output/parseWaitForProperty/xpath-2.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ instructions = [
1818
}
1919
const prop = e[parseWaitForPropKey];
2020
if (prop !== parseWaitForPropValue) {
21-
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
21+
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
2222
}
2323
}
2424
return nonMatchingProps;

tests/test-js/api-output/parseWaitForProperty/xpath-3.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ instructions = [
1818
}
1919
const prop = e[parseWaitForPropKey];
2020
if (prop !== parseWaitForPropValue) {
21-
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
21+
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
2222
}
2323
}
2424
return nonMatchingProps;
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// This test ensures that the `wait-for-property` command is behaving like expected.
2+
go-to: "file://" + |CURRENT_DIR| + "/" + |DOC_PATH| + "/elements.html"
3+
set-timeout: 500
4+
// Try a property with a different type.
5+
// This should give a failure, not an internal error.
6+
wait-for-property: ("html", {"offsetLeft": "0"})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
=> Starting doc-ui tests...
2+
3+
wait-for-property-3... FAILED
4+
[ERROR] (line 6) Error: The following properties still don't match: [expected `0` for property `offsetLeft`, found `0`]: for command `wait-for-property: ("html", {"offsetLeft": "0"})`
5+
6+
7+
<= doc-ui tests done: 0 succeeded, 1 failed

0 commit comments

Comments
 (0)