mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 20:42:21 +00:00
Tests: Add vendor-specific testdriver click()
function
This uses `Internals.click()` which doesn't do as much as the equivalent WebDriver method, but should be enough to satify most tests that use it.
This commit is contained in:
parent
1ff556a2bd
commit
1bd10a5443
Notes:
github-actions[bot]
2024-12-11 08:49:24 +00:00
Author: https://github.com/tcl3
Commit: 1bd10a5443
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2868
Reviewed-by: https://github.com/trflynn89
3 changed files with 35 additions and 0 deletions
|
@ -0,0 +1,6 @@
|
||||||
|
Harness status: OK
|
||||||
|
|
||||||
|
Found 1 tests
|
||||||
|
|
||||||
|
1 Pass
|
||||||
|
Pass TestDriver click method
|
|
@ -0,0 +1,19 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>TestDriver click method</title>
|
||||||
|
<script src="../../resources/testharness.js"></script>
|
||||||
|
<script src="../../resources/testharnessreport.js"></script>
|
||||||
|
<script src="../../resources/testdriver.js"></script>
|
||||||
|
<script src="../../resources/testdriver-vendor.js"></script>
|
||||||
|
|
||||||
|
<button type="button" id="button">Button</button>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
async_test(t => {
|
||||||
|
let button = document.getElementById("button");
|
||||||
|
test_driver
|
||||||
|
.click(button)
|
||||||
|
.then(() => t.done())
|
||||||
|
.catch(t.unreached_func("click failed"));
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -1,3 +1,13 @@
|
||||||
|
window.test_driver_internal.click = function(element) {
|
||||||
|
const boundingRect = element.getBoundingClientRect();
|
||||||
|
const centerPoint = {
|
||||||
|
x: boundingRect.left + boundingRect.width / 2,
|
||||||
|
y: boundingRect.top + boundingRect.height / 2
|
||||||
|
};
|
||||||
|
window.internals.click(centerPoint.x, centerPoint.y);
|
||||||
|
return Promise.resolve();
|
||||||
|
};
|
||||||
|
|
||||||
window.test_driver_internal.get_computed_label = async function(element) {
|
window.test_driver_internal.get_computed_label = async function(element) {
|
||||||
return await window.internals.getComputedLabel(element);
|
return await window.internals.getComputedLabel(element);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue