Skip to content

Commit

Permalink
Merge pull request #450 from GuillaumeGomez/switch-to-toml
Browse files Browse the repository at this point in the history
Switch output test file format to TOML to allow multi-line strings
  • Loading branch information
GuillaumeGomez authored Mar 30, 2023
2 parents 3d20355 + 3a627a3 commit 9e2e2e0
Show file tree
Hide file tree
Showing 2,642 changed files with 12,848 additions and 6,362 deletions.
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
},
"devDependencies": {
"babel-eslint": "^10.0.2",
"eslint": "^6.1.0"
"eslint": "^6.1.0",
"@iarna/toml": "2.2.5"
}
}
7 changes: 0 additions & 7 deletions tests/test-js/api-output/parseAssert/css-1.json

This file was deleted.

5 changes: 5 additions & 0 deletions tests/test-js/api-output/parseAssert/css-1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
instructions = [
"""if ((await page.$(\"a\")) === null) { throw '\"a\" not found'; }""",
]
wait = false
checkResult = true
7 changes: 0 additions & 7 deletions tests/test-js/api-output/parseAssert/css-2.json

This file was deleted.

5 changes: 5 additions & 0 deletions tests/test-js/api-output/parseAssert/css-2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
instructions = [
"""if ((await page.$(\"a\")) === null) { throw '\"a\" not found'; }""",
]
wait = false
checkResult = true
3 changes: 0 additions & 3 deletions tests/test-js/api-output/parseAssert/err-float.json

This file was deleted.

1 change: 1 addition & 0 deletions tests/test-js/api-output/parseAssert/err-float.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error = """expected a tuple, a CSS selector or an XPath, found `1.1`"""
3 changes: 0 additions & 3 deletions tests/test-js/api-output/parseAssert/err-int.json

This file was deleted.

1 change: 1 addition & 0 deletions tests/test-js/api-output/parseAssert/err-int.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error = """expected a tuple, a CSS selector or an XPath, found `1`"""
3 changes: 0 additions & 3 deletions tests/test-js/api-output/parseAssert/err-quote.json

This file was deleted.

1 change: 1 addition & 0 deletions tests/test-js/api-output/parseAssert/err-quote.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error = """expected `\"` at the end of the string"""
3 changes: 0 additions & 3 deletions tests/test-js/api-output/parseAssert/err-tuple-2.json

This file was deleted.

1 change: 1 addition & 0 deletions tests/test-js/api-output/parseAssert/err-tuple-2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error = """expected only a CSS selector or an XPath in the tuple, found 2 elements"""
3 changes: 0 additions & 3 deletions tests/test-js/api-output/parseAssert/err-tuple-3.json

This file was deleted.

1 change: 1 addition & 0 deletions tests/test-js/api-output/parseAssert/err-tuple-3.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error = """expected only a CSS selector or an XPath in the tuple, found 0 elements"""
3 changes: 0 additions & 3 deletions tests/test-js/api-output/parseAssert/err-tuple.json

This file was deleted.

1 change: 1 addition & 0 deletions tests/test-js/api-output/parseAssert/err-tuple.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error = """expected only a CSS selector or an XPath in the tuple, found 2 elements"""
7 changes: 0 additions & 7 deletions tests/test-js/api-output/parseAssert/multiline-2.json

This file was deleted.

5 changes: 5 additions & 0 deletions tests/test-js/api-output/parseAssert/multiline-2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
instructions = [
"""if ((await page.$x(\"//a\\nhello\")).length === 0) { throw 'XPath \"//a\\nhello\" not found'; }""",
]
wait = false
checkResult = true
7 changes: 0 additions & 7 deletions tests/test-js/api-output/parseAssert/multiline.json

This file was deleted.

5 changes: 5 additions & 0 deletions tests/test-js/api-output/parseAssert/multiline.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
instructions = [
"""if ((await page.$x(\"//a\")).length === 0) { throw 'XPath \"//a\" not found'; }""",
]
wait = false
checkResult = true
3 changes: 0 additions & 3 deletions tests/test-js/api-output/parseAssert/xpath-1.json

This file was deleted.

1 change: 1 addition & 0 deletions tests/test-js/api-output/parseAssert/xpath-1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error = """XPath must start with `//`"""
7 changes: 0 additions & 7 deletions tests/test-js/api-output/parseAssert/xpath-2.json

This file was deleted.

5 changes: 5 additions & 0 deletions tests/test-js/api-output/parseAssert/xpath-2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
instructions = [
"""if ((await page.$x(\"//a\")).length === 0) { throw 'XPath \"//a\" not found'; }""",
]
wait = false
checkResult = true
8 changes: 0 additions & 8 deletions tests/test-js/api-output/parseAssertAttribute/basic-1.json

This file was deleted.

33 changes: 33 additions & 0 deletions tests/test-js/api-output/parseAssertAttribute/basic-1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
instructions = [
"""let parseAssertElemAttr = await page.$(\"a\");
if (parseAssertElemAttr === null) { throw '\"a\" not found'; }
await page.evaluate(e => {
const nonMatchingAttrs = [];
const parseAssertElemAttrDict = {\"a\":\"1\"};
const nullAttributes = [];
for (const attr of nullAttributes) {
if (e.hasAttribute(attr)) {
nonMatchingAttrs.push(\"Expected `null` for attribute `\" + attr + \"`, found: `\" + e.getAttribute(attr) + \"`\");
continue;
}
}
for (const [parseAssertElemAttrAttribute, parseAssertElemAttrValue] of Object.entries(parseAssertElemAttrDict)) {
if (!e.hasAttribute(parseAssertElemAttrAttribute)) {
nonMatchingAttrs.push(\"No attribute named `\" + parseAssertElemAttrAttribute + \"`\");
continue;
}
const attr = e.getAttribute(parseAssertElemAttrAttribute);
if (attr !== parseAssertElemAttrValue) {
nonMatchingAttrs.push(\"attribute `\" + parseAssertElemAttrAttribute + \"` isn't equal to `\" + parseAssertElemAttrValue + \"` (`\" + attr + \"`)\");
}
}
if (nonMatchingAttrs.length !== 0) {
const props = nonMatchingAttrs.join(\", \");
throw \"The following errors happened (for selector `a`): [\" + props + \"]\";
}
}, parseAssertElemAttr);""",
]
wait = false
warnings = [
]
checkResult = true
8 changes: 0 additions & 8 deletions tests/test-js/api-output/parseAssertAttribute/basic-2.json

This file was deleted.

35 changes: 35 additions & 0 deletions tests/test-js/api-output/parseAssertAttribute/basic-2.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
instructions = [
"""let parseAssertElemAttr = await page.$$(\"a\");
if (parseAssertElemAttr.length === 0) { throw '\"a\" not found'; }
for (let i = 0, len = parseAssertElemAttr.length; i < len; ++i) {
await page.evaluate(e => {
const nonMatchingAttrs = [];
const parseAssertElemAttrDict = {\"a\":\"1\"};
const nullAttributes = [];
for (const attr of nullAttributes) {
if (e.hasAttribute(attr)) {
nonMatchingAttrs.push(\"Expected `null` for attribute `\" + attr + \"`, found: `\" + e.getAttribute(attr) + \"`\");
continue;
}
}
for (const [parseAssertElemAttrAttribute, parseAssertElemAttrValue] of Object.entries(parseAssertElemAttrDict)) {
if (!e.hasAttribute(parseAssertElemAttrAttribute)) {
nonMatchingAttrs.push(\"No attribute named `\" + parseAssertElemAttrAttribute + \"`\");
continue;
}
const attr = e.getAttribute(parseAssertElemAttrAttribute);
if (attr !== parseAssertElemAttrValue) {
nonMatchingAttrs.push(\"attribute `\" + parseAssertElemAttrAttribute + \"` isn't equal to `\" + parseAssertElemAttrValue + \"` (`\" + attr + \"`)\");
}
}
if (nonMatchingAttrs.length !== 0) {
const props = nonMatchingAttrs.join(\", \");
throw \"The following errors happened (for selector `a`): [\" + props + \"]\";
}
}, parseAssertElemAttr[i]);
}""",
]
wait = false
warnings = [
]
checkResult = true
8 changes: 0 additions & 8 deletions tests/test-js/api-output/parseAssertAttribute/css-1.json

This file was deleted.

33 changes: 33 additions & 0 deletions tests/test-js/api-output/parseAssertAttribute/css-1.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
instructions = [
"""let parseAssertElemAttr = await page.$(\"a\");
if (parseAssertElemAttr === null) { throw '\"a\" not found'; }
await page.evaluate(e => {
const nonMatchingAttrs = [];
const parseAssertElemAttrDict = {\"b\":\"c\",\"d\":\"e\"};
const nullAttributes = [];
for (const attr of nullAttributes) {
if (e.hasAttribute(attr)) {
nonMatchingAttrs.push(\"Expected `null` for attribute `\" + attr + \"`, found: `\" + e.getAttribute(attr) + \"`\");
continue;
}
}
for (const [parseAssertElemAttrAttribute, parseAssertElemAttrValue] of Object.entries(parseAssertElemAttrDict)) {
if (!e.hasAttribute(parseAssertElemAttrAttribute)) {
nonMatchingAttrs.push(\"No attribute named `\" + parseAssertElemAttrAttribute + \"`\");
continue;
}
const attr = e.getAttribute(parseAssertElemAttrAttribute);
if (attr !== parseAssertElemAttrValue) {
nonMatchingAttrs.push(\"attribute `\" + parseAssertElemAttrAttribute + \"` isn't equal to `\" + parseAssertElemAttrValue + \"` (`\" + attr + \"`)\");
}
}
if (nonMatchingAttrs.length !== 0) {
const props = nonMatchingAttrs.join(\", \");
throw \"The following errors happened (for selector `a`): [\" + props + \"]\";
}
}, parseAssertElemAttr);""",
]
wait = false
warnings = [
]
checkResult = true
8 changes: 0 additions & 8 deletions tests/test-js/api-output/parseAssertAttribute/css-2.json

This file was deleted.

8 changes: 0 additions & 8 deletions tests/test-js/api-output/parseAssertAttribute/css-all.json

This file was deleted.

35 changes: 35 additions & 0 deletions tests/test-js/api-output/parseAssertAttribute/css-all.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
instructions = [
"""let parseAssertElemAttr = await page.$$(\"a\");
if (parseAssertElemAttr.length === 0) { throw '\"a\" not found'; }
for (let i = 0, len = parseAssertElemAttr.length; i < len; ++i) {
await page.evaluate(e => {
const nonMatchingAttrs = [];
const parseAssertElemAttrDict = {\"b\":\"c\",\"d\":\"e\"};
const nullAttributes = [];
for (const attr of nullAttributes) {
if (e.hasAttribute(attr)) {
nonMatchingAttrs.push(\"Expected `null` for attribute `\" + attr + \"`, found: `\" + e.getAttribute(attr) + \"`\");
continue;
}
}
for (const [parseAssertElemAttrAttribute, parseAssertElemAttrValue] of Object.entries(parseAssertElemAttrDict)) {
if (!e.hasAttribute(parseAssertElemAttrAttribute)) {
nonMatchingAttrs.push(\"No attribute named `\" + parseAssertElemAttrAttribute + \"`\");
continue;
}
const attr = e.getAttribute(parseAssertElemAttrAttribute);
if (attr !== parseAssertElemAttrValue) {
nonMatchingAttrs.push(\"attribute `\" + parseAssertElemAttrAttribute + \"` isn't equal to `\" + parseAssertElemAttrValue + \"` (`\" + attr + \"`)\");
}
}
if (nonMatchingAttrs.length !== 0) {
const props = nonMatchingAttrs.join(\", \");
throw \"The following errors happened (for selector `a`): [\" + props + \"]\";
}
}, parseAssertElemAttr[i]);
}""",
]
wait = false
warnings = [
]
checkResult = true
8 changes: 0 additions & 8 deletions tests/test-js/api-output/parseAssertAttribute/css-empty.json

This file was deleted.

33 changes: 33 additions & 0 deletions tests/test-js/api-output/parseAssertAttribute/css-empty.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
instructions = [
"""let parseAssertElemAttr = await page.$(\"a\");
if (parseAssertElemAttr === null) { throw '\"a\" not found'; }
await page.evaluate(e => {
const nonMatchingAttrs = [];
const parseAssertElemAttrDict = {};
const nullAttributes = [];
for (const attr of nullAttributes) {
if (e.hasAttribute(attr)) {
nonMatchingAttrs.push(\"Expected `null` for attribute `\" + attr + \"`, found: `\" + e.getAttribute(attr) + \"`\");
continue;
}
}
for (const [parseAssertElemAttrAttribute, parseAssertElemAttrValue] of Object.entries(parseAssertElemAttrDict)) {
if (!e.hasAttribute(parseAssertElemAttrAttribute)) {
nonMatchingAttrs.push(\"No attribute named `\" + parseAssertElemAttrAttribute + \"`\");
continue;
}
const attr = e.getAttribute(parseAssertElemAttrAttribute);
if (attr !== parseAssertElemAttrValue) {
nonMatchingAttrs.push(\"attribute `\" + parseAssertElemAttrAttribute + \"` isn't equal to `\" + parseAssertElemAttrValue + \"` (`\" + attr + \"`)\");
}
}
if (nonMatchingAttrs.length !== 0) {
const props = nonMatchingAttrs.join(\", \");
throw \"The following errors happened (for selector `a`): [\" + props + \"]\";
}
}, parseAssertElemAttr);""",
]
wait = false
warnings = [
]
checkResult = true
Loading

0 comments on commit 9e2e2e0

Please sign in to comment.