Skip to content

Commit

Permalink
Merge pull request #537 from notriddle/notriddle/wait-for-property
Browse files Browse the repository at this point in the history
Fix crash when wait-for-property fails
  • Loading branch information
GuillaumeGomez authored Sep 18, 2023
2 parents f6452af + 91187d6 commit ed5c6c5
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/commands/wait.js
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ function parseWaitForProperty(parser) {
const varValue = varName + 'Value';

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

let checker;
if (!enabledChecks['ALL']) {
Expand Down
2 changes: 1 addition & 1 deletion tests/test-js/api-output/parseWaitForProperty/basic-1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ instructions = [
}
const prop = e[parseWaitForPropKey];
if (prop !== parseWaitForPropValue) {
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
}
}
return nonMatchingProps;
Expand Down
2 changes: 1 addition & 1 deletion tests/test-js/api-output/parseWaitForProperty/basic-2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ instructions = [
}
const prop = e[parseWaitForPropKey];
if (prop !== parseWaitForPropValue) {
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
}
}
return nonMatchingProps;
Expand Down
2 changes: 1 addition & 1 deletion tests/test-js/api-output/parseWaitForProperty/basic-3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ instructions = [
}
const prop = e[parseWaitForPropKey];
if (prop !== parseWaitForPropValue) {
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
}
}
return nonMatchingProps;
Expand Down
2 changes: 1 addition & 1 deletion tests/test-js/api-output/parseWaitForProperty/color-1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ instructions = [
}
const prop = e[parseWaitForPropKey];
if (prop !== parseWaitForPropValue) {
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
}
}
return nonMatchingProps;
Expand Down
2 changes: 1 addition & 1 deletion tests/test-js/api-output/parseWaitForProperty/extra-1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ instructions = [
}
const prop = e[parseWaitForPropKey];
if (prop !== parseWaitForPropValue) {
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
}
}
return nonMatchingProps;
Expand Down
2 changes: 1 addition & 1 deletion tests/test-js/api-output/parseWaitForProperty/extra-2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ instructions = [
}
const prop = e[parseWaitForPropKey];
if (!prop.includes(parseWaitForPropValue)) {
nonMatchingAttrs.push(\"property `\" + parseWaitForPropKey + \"` (`\" + prop + \"`) doesn't contain `\" + parseWaitForPropValue + \"` (for CONTAINS check)\");
nonMatchingProps.push(\"property `\" + parseWaitForPropKey + \"` (`\" + prop + \"`) doesn't contain `\" + parseWaitForPropValue + \"` (for CONTAINS check)\");
}
}
return nonMatchingProps;
Expand Down
2 changes: 1 addition & 1 deletion tests/test-js/api-output/parseWaitForProperty/extra-3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ instructions = [
}
const prop = e[parseWaitForPropKey];
if (!prop.includes(parseWaitForPropValue)) {
nonMatchingAttrs.push(\"property `\" + parseWaitForPropKey + \"` (`\" + prop + \"`) doesn't contain `\" + parseWaitForPropValue + \"` (for CONTAINS check)\");
nonMatchingProps.push(\"property `\" + parseWaitForPropKey + \"` (`\" + prop + \"`) doesn't contain `\" + parseWaitForPropValue + \"` (for CONTAINS check)\");
}
}
return nonMatchingProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ instructions = [
}
const prop = e[parseWaitForPropKey];
if (prop !== parseWaitForPropValue) {
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
}
}
return nonMatchingProps;
Expand Down
2 changes: 1 addition & 1 deletion tests/test-js/api-output/parseWaitForProperty/xpath-2.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ instructions = [
}
const prop = e[parseWaitForPropKey];
if (prop !== parseWaitForPropValue) {
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
}
}
return nonMatchingProps;
Expand Down
2 changes: 1 addition & 1 deletion tests/test-js/api-output/parseWaitForProperty/xpath-3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ instructions = [
}
const prop = e[parseWaitForPropKey];
if (prop !== parseWaitForPropValue) {
nonMatchingAttrs.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
nonMatchingProps.push(\"expected `\" + parseWaitForPropValue + \"` for property `\" + parseWaitForPropKey + \"`, found `\" + prop + \"`\");
}
}
return nonMatchingProps;
Expand Down
6 changes: 6 additions & 0 deletions tests/ui-tests/wait-for-property-3.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This test ensures that the `wait-for-property` command is behaving like expected.
go-to: "file://" + |CURRENT_DIR| + "/" + |DOC_PATH| + "/elements.html"
set-timeout: 500
// Try a property with a different type.
// This should give a failure, not an internal error.
wait-for-property: ("html", {"offsetLeft": "0"})
7 changes: 7 additions & 0 deletions tests/ui-tests/wait-for-property-3.output
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
=> Starting doc-ui tests...

wait-for-property-3... FAILED
[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"})`


<= doc-ui tests done: 0 succeeded, 1 failed

0 comments on commit ed5c6c5

Please sign in to comment.