-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #451 from GuillaumeGomez/assert-window-property-null
Add `null` support for `assert-document-property*` and `assert-window-property*`
- Loading branch information
Showing
71 changed files
with
832 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tests/test-js/api-output/parseAssertDocumentProperty/null-1.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
error = """Forbidden `ident` used (`undefined`). Allowed idents: [null]""" |
28 changes: 28 additions & 0 deletions
28
tests/test-js/api-output/parseAssertDocumentProperty/null-2.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
instructions = [ | ||
"""await page.evaluate(() => { | ||
const nonMatchingProps = []; | ||
const parseAssertDictPropDict = {}; | ||
const undefProps = [\"a\"]; | ||
for (const prop of undefProps) { | ||
if (document[prop] !== undefined) { | ||
nonMatchingProps.push(\"Expected property `\" + prop + \"` to not exist, found: `\" + document[prop] + \"`\"); | ||
continue; | ||
} | ||
} | ||
for (const [parseAssertDictPropKey, parseAssertDictPropValue] of Object.entries(parseAssertDictPropDict)) { | ||
if (document[parseAssertDictPropKey] === undefined) { | ||
nonMatchingProps.push('Unknown document property `' + parseAssertDictPropKey + '`'); | ||
continue; | ||
} | ||
if (String(document[parseAssertDictPropKey]) != parseAssertDictPropValue) { | ||
nonMatchingProps.push('Expected `' + parseAssertDictPropValue + '` for property `' + parseAssertDictPropKey + '`, found `' + document[parseAssertDictPropKey] + '`'); | ||
} | ||
} | ||
if (nonMatchingProps.length !== 0) { | ||
const props = nonMatchingProps.join(\", \"); | ||
throw \"The following errors happened: [\" + props + \"]\"; | ||
} | ||
});""", | ||
] | ||
wait = false | ||
checkResult = true |
31 changes: 31 additions & 0 deletions
31
tests/test-js/api-output/parseAssertDocumentProperty/null-3.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
instructions = [ | ||
"""await page.evaluate(() => { | ||
const nonMatchingProps = []; | ||
const parseAssertDictPropDict = {}; | ||
const undefProps = [\"a\"]; | ||
for (const prop of undefProps) { | ||
if (document[prop] !== undefined) { | ||
nonMatchingProps.push(\"Expected property `\" + prop + \"` to not exist, found: `\" + document[prop] + \"`\"); | ||
continue; | ||
} | ||
} | ||
for (const [parseAssertDictPropKey, parseAssertDictPropValue] of Object.entries(parseAssertDictPropDict)) { | ||
if (document[parseAssertDictPropKey] === undefined) { | ||
nonMatchingProps.push('Unknown document property `' + parseAssertDictPropKey + '`'); | ||
continue; | ||
} | ||
if (!String(document[parseAssertDictPropKey]).endsWith(parseAssertDictPropValue)) { | ||
nonMatchingProps.push('Property `' + parseAssertDictPropKey + '` (`' + document[parseAssertDictPropKey] + '`) does not end with `' + parseAssertDictPropValue + '`'); | ||
} | ||
} | ||
if (nonMatchingProps.length !== 0) { | ||
const props = nonMatchingProps.join(\", \"); | ||
throw \"The following errors happened: [\" + props + \"]\"; | ||
} | ||
});""", | ||
] | ||
wait = false | ||
warnings = [ | ||
"""Special checks (ENDS_WITH) will be ignored for `null`""", | ||
] | ||
checkResult = true |
36 changes: 36 additions & 0 deletions
36
tests/test-js/api-output/parseAssertDocumentProperty/null-4.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
instructions = [ | ||
"""await page.evaluate(() => { | ||
const nonMatchingProps = []; | ||
const parseAssertDictPropDict = {}; | ||
const undefProps = [\"a\"]; | ||
for (const prop of undefProps) { | ||
if (document[prop] !== undefined) { | ||
nonMatchingProps.push(\"Expected property `\" + prop + \"` to not exist, found: `\" + document[prop] + \"`\"); | ||
continue; | ||
} | ||
} | ||
for (const [parseAssertDictPropKey, parseAssertDictPropValue] of Object.entries(parseAssertDictPropDict)) { | ||
if (document[parseAssertDictPropKey] === undefined) { | ||
nonMatchingProps.push('Unknown document property `' + parseAssertDictPropKey + '`'); | ||
continue; | ||
} | ||
if (!String(document[parseAssertDictPropKey]).startsWith(parseAssertDictPropValue)) { | ||
nonMatchingProps.push('Property `' + parseAssertDictPropKey + '` (`' + document[parseAssertDictPropKey] + '`) does not start with `' + parseAssertDictPropValue + '`'); | ||
} | ||
if (Number.isNaN(document[parseAssertDictPropKey])) { | ||
nonMatchingProps.push('Property `' + parseAssertDictPropKey + '` (`' + document[parseAssertDictPropKey] + '`) is NaN (for NEAR check)'); | ||
} else if (Math.abs(document[parseAssertDictPropKey] - parseAssertDictPropValue) > 1) { | ||
nonMatchingProps.push('Property `' + parseAssertDictPropKey + '` (`' + document[parseAssertDictPropKey] + '`) is not within 1 of `' + parseAssertDictPropValue + '` (for NEAR check)'); | ||
} | ||
} | ||
if (nonMatchingProps.length !== 0) { | ||
const props = nonMatchingProps.join(\", \"); | ||
throw \"The following errors happened: [\" + props + \"]\"; | ||
} | ||
});""", | ||
] | ||
wait = false | ||
warnings = [ | ||
"""Special checks (STARTS_WITH, NEAR) will be ignored for `null`""", | ||
] | ||
checkResult = true |
36 changes: 36 additions & 0 deletions
36
tests/test-js/api-output/parseAssertDocumentProperty/null-5.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
instructions = [ | ||
"""await page.evaluate(() => { | ||
const nonMatchingProps = []; | ||
const parseAssertDictPropDict = {\"b\":\"12\"}; | ||
const undefProps = [\"a\"]; | ||
for (const prop of undefProps) { | ||
if (document[prop] !== undefined) { | ||
nonMatchingProps.push(\"Expected property `\" + prop + \"` to not exist, found: `\" + document[prop] + \"`\"); | ||
continue; | ||
} | ||
} | ||
for (const [parseAssertDictPropKey, parseAssertDictPropValue] of Object.entries(parseAssertDictPropDict)) { | ||
if (document[parseAssertDictPropKey] === undefined) { | ||
nonMatchingProps.push('Unknown document property `' + parseAssertDictPropKey + '`'); | ||
continue; | ||
} | ||
if (!String(document[parseAssertDictPropKey]).startsWith(parseAssertDictPropValue)) { | ||
nonMatchingProps.push('Property `' + parseAssertDictPropKey + '` (`' + document[parseAssertDictPropKey] + '`) does not start with `' + parseAssertDictPropValue + '`'); | ||
} | ||
if (Number.isNaN(document[parseAssertDictPropKey])) { | ||
nonMatchingProps.push('Property `' + parseAssertDictPropKey + '` (`' + document[parseAssertDictPropKey] + '`) is NaN (for NEAR check)'); | ||
} else if (Math.abs(document[parseAssertDictPropKey] - parseAssertDictPropValue) > 1) { | ||
nonMatchingProps.push('Property `' + parseAssertDictPropKey + '` (`' + document[parseAssertDictPropKey] + '`) is not within 1 of `' + parseAssertDictPropValue + '` (for NEAR check)'); | ||
} | ||
} | ||
if (nonMatchingProps.length !== 0) { | ||
const props = nonMatchingProps.join(\", \"); | ||
throw \"The following errors happened: [\" + props + \"]\"; | ||
} | ||
});""", | ||
] | ||
wait = false | ||
warnings = [ | ||
"""Special checks (STARTS_WITH, NEAR) will be ignored for `null`""", | ||
] | ||
checkResult = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.