Skip to content

Commit

Permalink
Merge pull request #636 from GuillaumeGomez/fix-click
Browse files Browse the repository at this point in the history
Fix `click` with coordinates
  • Loading branch information
GuillaumeGomez authored Feb 5, 2025
2 parents 78c926a + 05a2a39 commit 08af871
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/commands/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function parseClick(parser) {
const tuple = p.entries;
return {
'instructions': [
`await page.click(${tuple[0].value.value}, ${tuple[1].value.value});`,
`await pages[0].mouse.click(${tuple[0].value.value}, ${tuple[1].value.value});`,
],
};
}
Expand Down
2 changes: 1 addition & 1 deletion tests/api-output/parseClick/multiline-3.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
instructions = [
"""await page.click(1, 2);""",
"""await pages[0].mouse.click(1, 2);""",
]
2 changes: 1 addition & 1 deletion tests/api-output/parseClick/pos-1.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
instructions = [
"""await page.click(1, 2);""",
"""await pages[0].mouse.click(1, 2);""",
]
2 changes: 1 addition & 1 deletion tests/api-output/parseClick/pos-2.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
instructions = [
"""await page.click(1, 2);""",
"""await pages[0].mouse.click(1, 2);""",
]
7 changes: 7 additions & 0 deletions tests/ui/click.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Ensure that `click` works for both coordinates and selector.
go-to: "file://" + |CURRENT_DIR| + "/" + |DOC_PATH| + "/elements.html"
store-position: ("#js-call", {"x": x, "y": y})
click: (|x|, |y|)
wait-for-css-false: ("#js-call", {"margin-top": "0px"})
click: "#the-input"
assert: "#the-input"
5 changes: 5 additions & 0 deletions tests/ui/click.output
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
=> Starting doc-ui tests...

click... OK

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

0 comments on commit 08af871

Please sign in to comment.