Commit graph

373 commits

Author SHA1 Message Date
Euclid Ye
9543482f51
webdriver: Greatly improve execution speed for all tests using SetWindowSize (#37712)
1. Remove the unnecessary new thread which use GetWindowRect command and
blocks for 500ms. Previously this is necessary because constellation
forward "resize" to embedder, and WebDriver wait for a constant
sufficient time to `GetWindowRect` in the new thread. This caused long
delay because there are many subtests and SetWindowRect is called
between each.
2. Remove `resize_timeout`
3. Return current dimension instead of 0 from embedder when it fails to
resize.
4. Do resizing as long as one of width/height is `Some`, according to
spec.

Testing: All Conformance test with new passing cases.
Fixes: https://github.com/servo/servo/pull/37663#issuecomment-2999120615

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-07-01 06:26:01 +00:00
Euclid Ye
d781d1b1cb
[WebDriver] Implement XPath Locator Strategy (#37783)
1. Implement XPath Locator Strategy
2. Use it for "Find Element(s)", "Find Element(s) from Element", "Find
Element(s) from Shadow Root"

Testing: `tests\wpt\tests\webdriver\tests\classic\find_element*\find.py`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-30 17:20:52 +00:00
Euclid Ye
0329f33520
[WebDriver] Reuse "Find Elements" handler in "Find element" (#37737)
All "Find Element ..." in
[spec](https://w3c.github.io/webdriver/#find-element-from-element) has
exactly same step has "Find Elements ...", except they extract the first
element if there is any. We now reuse the handler instead of running
numerous repetitive steps, same as what we did for ["Find Element from
Shadow
Root"](https://w3c.github.io/webdriver/#find-element-from-shadow-root)
in #37578.

This reduces binary size by 98KB for Release profile in Windows and
improves maintainability.

Testing: `./mach test-wpt -r
.\tests\wpt\tests\webdriver\tests\classic\find_element* --product
servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-27 08:45:58 +00:00
Euclid Ye
f9880637e9
[WebDriver] Fully implement "switch to (parent) frame" (#37685)
1. Separate the handling of ["switch to parent
frame"](https://w3c.github.io/webdriver/#switch-to-parent-frame) from
the rest as the processing is a bit different
2. Implement "Select frame by 16-bits numbered ID" for ["switch to
frame"](https://w3c.github.io/webdriver/#switch-to-frame)
3. Implement other missing steps

Testing: All WebDriver Conformance test with new passing cases

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-26 07:44:16 +00:00
batu_hoang
62a009399f
webdriver: Move navigation commands to servoshell (#37665)
- Move webdriver `GetViewportSize`, `LoadURL` and `Refresh` to
servoshell.
- Add `GoBack` and `GoFoward` commands.

Testing: Need to finish moving webdriver to servoshell then evaluate
again
Fixes: https://github.com/servo/servo/issues/37370

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-25 12:35:13 +00:00
batu_hoang
d970584332
webdriver: Move NewWebView, FocusWebView, GetWindowSize, and SetWindowSize to servoshell (#37555)
Follow up to: https://github.com/servo/servo/pull/36714
Moving webdriver [context
commands](https://www.w3.org/TR/webdriver2/#contexts) to be handled in
embedder:

- [x] New Window command - `WebdriverCommandMsg::NewWebView`
- [x]  Switch To Window command - `WebdriverCommandMsg::FocusWebView`
- [x] Resizing commands

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-25 10:29:34 +00:00
Euclid Ye
94a7428912
[WebDriver] Grant top_level_script_command and browsing_context_script_command freedom to not verify existence of pipeline (#37632)
Sometimes, it is redundant to verify existence of pipeline over and over
again.
Sometimes, it is just wrong to check it. See [Switch to Parent
Frame](https://w3c.github.io/webdriver/#switch-to-parent-frame), where
we only care about existence of parent frame.
1. This PR adds a constant compile-time bool flag to enable this. This
will be essential to fix "no_browsing_context" next.
2. Fix some wrong usage of `top_level_script_command` in `is_selected`
and `is_enabled`.
3. Add and unify some WARN info related to pipeline in Constellation

Testing: All WebDriver test with new passing cases

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-24 06:42:34 +00:00
Euclid Ye
5e252d0ef6
[WebDriver: Release Action] Fix panic by work around buggy spec (#37624)
1. Narrow the lifetime of `input_cancel_list` to avoid Runtime multiple
BorrowMut error.
2. Work around the buggy spec by removing matching item in
`input_cancel_list` when dispatch `keyUp` and `mouseUp`. See
https://github.com/servo/servo/issues/37579#issuecomment-2990762713

Testing: All WebDriver WPT test.
Fixes: #37579

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-23 08:33:18 +00:00
Euclid Ye
3feec90528
[WebDriver:Release Actions] Fix wrong comments and Improve codestyle (#37585)
[Spec](https://w3c.github.io/webdriver/#release-actions)
Testing: No behaviour change.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-21 18:31:19 +00:00
Euclid Ye
ce4da2bf97
[WebDriver] Implement "Find Element(s) From ShadowRoot" (#37578)
Also renamed all "CSS" selector variants of `WebDriverScriptCommand` to
avoid confusion.

Testing: Mostly `./mach test-wpt -r
tests\wpt\tests\webdriver\tests\classic\find_*_from_shadow_root\find.py
--product servodriver`
But many other test also relies on finding element(s) from shadow root,
so I ran the entire test.
All deleted lines are from test expectations.

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-20 11:54:39 +00:00
Euclid Ye
b331cb4603
[WebDriver: handle_get_shadow_root] Fix Serialization problem (#37564)
1. Correctly Serialize the ShadowRoot. Previously, it contains a nested
element identifier "element-6066-11e4-a52e-4f735466cecf"
2. Improve coding style with what I learnt from Josh today

Testing: Passing way more "Find Elements from Shadow Root" test locally
now
Fixes: #37559

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-20 03:07:36 +00:00
batu_hoang
d0100797e8
[webdriver] Move Webdriver to ServoShell (#36714)
Moving `webdriver` to `servoshell`:

- Let `servoshell` manage lifecycle of `webdriver`
- One by one, move the handling of webdriver commands from
`constellation` to `embedder`

Partially fix: https://github.com/servo/servo/issues/37370
Partially fix webdriver test timeout with `no_top_browsing_context`

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-19 09:52:01 +00:00
batu_hoang
49be5ca05a
Implement webdriver release action (#37484)
- Implement webdriver release action.
- Improve `Input Cancel List`.

Testing: `./mach test-wpt -r --product servodriver
./tests/wpt/tests/webdriver/tests/classic/release_actions/sequence.py`

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-19 07:03:38 +00:00
Kenzie Raditya Tirtarahardja
cdc8b45965
[WebDriver] Add synchronization for key action (#37403)
Implement action synchronization for key event. Previously only done for
pointer https://github.com/servo/servo/pull/36932 and wheel
https://github.com/servo/servo/pull/37260.

---------

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-06-18 07:26:44 +00:00
Euclid Ye
e26532e19b
webdriver_server: Implement find element(s) from element according to spec (#37521)
Report `InvalidArgument` and `NoSuchElement` properly for [Find Element
from
Element](https://w3c.github.io/webdriver/#find-element-from-element) +
[Find Elements from
Element](https://w3c.github.io/webdriver/#find-elements-from-element)

Testing: `./mach test-wpt -r
.\tests\wpt\tests\webdriver\tests\classic\element_click
.\tests\wpt\tests\webdriver\tests\classic\find_* --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-18 06:39:55 +00:00
batu_hoang
152467bc67
Webdriver get focused webview id only request once (#37506)
The retry in previous implementation doesn't have a good reason, it
seems like webdriver just want to try its luck.
If get focused webview return None, better just return it.
There is a case webdriver still runs when all webview are closed.

cc: @xiaochengh

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-18 03:51:08 +00:00
Euclid Ye
f8f7c6ebd1
[WebDriver] Properly report error for find_element & find_elements; Get correct visible text when matching links (#37452)
1. Properly report new types of errors for `find_element` and
`find_elements`. Previously never reported.
1.1. `InvalidSelector`
1.2. `NoSuchElement`
1.3. `InvalidArgument`

2. Get the visible text for `<a>` correctly in
`script::webdriver_handler` so that matching would work.

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
webdriver/tests/classic/find_element/find.py
webdriver/tests/classic/find_elements/find.py --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-16 05:23:26 +00:00
Euclid Ye
9352a9db7c
script: Support webdriver's Get Element Text operation for non-HTML elements (#37470)
Fix `WebDriverScriptCommand::GetElementText` similar to
https://github.com/servo/servo/pull/37452#discussion_r2146350739, by
correctly retrieving rendered text.

Testing: `./mach test-wpt -r --log-raw "D:\servo test
log\gt_ele_txt.txt" webdriver/tests/classic/get_element_text --product
servodriver`

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-15 05:32:29 +00:00
Euclid Ye
5d42ab05fb
[WebDriver] Improve get active element (#37425)
Report `NoSuchElement` if the active element is null, according to spec.

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
.\tests\wpt\tests\webdriver\tests\classic\get_active_element --product
servodriver`
Partly fixes: #37420. We can pass `get_active_element` test once #37424
is done.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-15 05:17:59 +00:00
batu_hoang
6818d5c600
Wait enough time for tick duration in webdriver dispatch actions (#37423)
Add step `wait at least tick duration milliseconds have passed`
https://w3c.github.io/webdriver/#dfn-dispatch-actions-inner

Testing: Fix intermittent timeout in:

`/tests/wpt/tests/webdriver/tests/classic/perform_actions/pointer_dblclick.py`

cc: @xiaochengh , @jdm

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-13 08:40:23 +00:00
batu_hoang
4c598037a5
Verify webview still open in webdriver switch frame command (#37411)
SwitchToParentFrame webdriver commands do not handle the case where the
current top-level browsing context has been closed.

Tests:

`./tests/wpt/tests/webdriver/tests/classic/switch_to_parent_frame/switch.py`
`./tests/wpt/tests/webdriver/tests/classic/switch_to_frame/switch.py`

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-13 08:32:59 +00:00
Euclid Ye
f242c120b6
[WebDriver] Improve some session/window handling (#37406)
Improve some session/window handling according to spec.

Testing:`./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
.\tests\wpt\tests\webdriver\tests\classic\ --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-12 09:06:51 +00:00
Euclid Ye
c1ee354c38
webdriver: Assume more consistently that the BrowsingContext exists (#37389)
1. Tidy up some WebDriver handling with browsing context
2. Enable more wpt-test which no longer panic

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
.\tests\wpt\tests\webdriver\tests\classic\ --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-11 14:23:47 +00:00
Euclid Ye
5f1452f9d3
[WebDriver: Dispatch Action] Check if browsing context still open for each tick action (#37393)
As titled. This is what
[spec](https://w3c.github.io/webdriver/#dfn-dispatch-actions-inner)
requires. The motivation is that the previous action might have changed
the browsing context.

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
.\tests\wpt\tests\webdriver\tests\classic\ --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-11 09:53:06 +00:00
Kenzie Raditya Tirtarahardja
15eadb56a4
[webdriver] Add synchronization for wheel action (#37260)
Implement action synchronization for wheel event. Previously only done
for pointer here https://github.com/servo/servo/pull/36932.

Testing:
`tests/wpt/meta/webdriver/tests/classic/perform_actions/wheel.py`

---------

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-06-11 09:03:08 +00:00
Euclid Ye
56bbc49f21
[WebDriver] Properly report error: "No such window" (#37385)
For WebDriver, return "No Such Window" properly according to spec.

Testing: `./mach test-wpt -r --log-raw "D:\servo test log\all.txt"
.\tests\wpt\tests\webdriver\tests\classic\ --product servodriver`

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-10 19:43:03 +00:00
Euclid Ye
a3c792e5aa
servoshell: Do not focus and raise new auxiliary WebDriver-created WebViews (#37284)
For Desktop port of `request_open_auxiliary_webview`, stay on the
original WebView if the request originates WebDriver.

This is to make sure `webdriver_server::handle_new_window` does not
focus the new window, according to spec. See
c7eba2dbba/tests/wpt/tests/webdriver/tests/classic/new_window/new_window.py (L31-L37)

**To clarify**: this won't change the behaviour when user interacts, but
only affects WebDriver [New
Window](https://w3c.github.io/webdriver/#new-window).

Testing: `./mach test-wpt -r --log-raw "D:/servo log/all.txt"
./tests/wpt/tests/webdriver/tests/classic --product servodriver` based
on 96b0973037

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-09 11:07:09 +00:00
Euclid Ye
4e9993128b
[WebDriver] Unify Cookie related Error types (#37339)
Remove `embedder/webdriver.rs::WebDriverCookieError` and use universal
`ErrorStatus` from webdriver crate. This is needed as we might need to
send back more universal error such as `NoSuchWindow`.

Testing: No behaviour change.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-06-09 06:23:31 +00:00
batu_hoang
aeca81c091
[webdriver] Implement get shadow root (#37280)
Implement Get Element Shadow Root
https://www.w3.org/TR/webdriver2/#dfn-get-element-shadow-root

cc: @xiaochengh, @yezhizhen, @PotatoCP 

Testing:
`\tests\wpt\tests\webdriver\tests\classic\get_element_shadow_root\get.py`
is blocked by `no_browsing_context` and `closed_window`
pass for other sub-tests.

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-07 20:54:36 +00:00
Kenzie Raditya Tirtarahardja
097bd9d87f
Fix mistakes in webdriver element send keys (#37286)
Fix mistakes from https://github.com/servo/servo/pull/37224. We should
return in the middle of send keys if the element is either file input or
non typeable form control.

Fixes:
https://github.com/servo/servo/pull/37224#pullrequestreview-2903871157

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-06-06 12:39:15 +00:00
Kenzie Raditya Tirtarahardja
d66e4fc459
Implement wb element send keys for file input (#37224)
We can now send keys to file input, which results in uploading file with
given filename. Needs
`pref=dom_testing_html_input_element_select_files_enabled` flag to work.

https://w3c.github.io/webdriver/#element-send-keys

Testing:
`tests/wpt/meta/webdriver/tests/classic/element_send_keys/{events,
file_upload}.py.`

Signed-off-by: PotatoCP <kenzieradityatirtarahardja18@gmail.com>
2025-06-05 06:48:14 +00:00
batu_hoang
e0d96163c7
Fix events filter in wait_for_user_agent_handling_complete (#37241)
Fix a mistake from https://github.com/servo/servo/pull/37095
cc: @xiaochengh

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-04 06:39:31 +00:00
batu_hoang
5ef66ce386
Fix webdriver wait for response from constellation (#37095)
Webdriver actions only wait for response from constellation if
`dispatch_tick_actions` sends at least 1 event.

Testing: 
`./mach test-wpt -r --product servodriver
./tests/wpt/tests/webdriver/tests/classic/perform_actions/perform.py `

cc: @xiaochengh, @yezhizhen

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-03 11:51:12 +00:00
batu_hoang
ad95a74389
Implement actions_by_tick for webdriver (#37153)
Implement `actions by tick` according to the spec. 
The major change is `dispatch_actions` should receive a `actions by
ticks` as param.

https://w3c.github.io/webdriver/#dispatching-actions
> The algorithm to [dispatch
actions](https://w3c.github.io/webdriver/#dfn-dispatch-actions) takes a
list of actions grouped by
[tick](https://w3c.github.io/webdriver/#dfn-ticks), and then causes each
action to be run at the appropriate point in the sequence.

Reference for types in webdriver:
https://hackmd.io/b59NiPcLR_Gagh7r6r7BEw?view

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-06-03 08:20:00 +00:00
Mukilan Thiyagarajan
8a20e42de4
Add support for static SVG images using resvg crate (#36721)
This change adds support for rendering static SVG images using the
`resvg` crate, allowing svg sources in the `img` tag and in CSS
`background` and `content` properties. There are some limitations in
using resvg:

1. There is no support for animations or interactivity as these would
require implementing the full DOM layer of SVG specification.
2. Only system fonts can be used for text rendering. There is some
mechanism to provide a custom font resolver to usvg, but that is not
explored in this change.
3. resvg's handling of certain edge cases involving lack of explicit
`width` and `height` on the root svg element deviates from what the
specification expects from browsers. For example, resvg uses the values
in `viewBox` to derive the missing width or height dimension, but
without scaling that dimension to preserve the aspect ratio. It also
doesn't allow overriding this behavior.

Demo screenshot:
![servo - resvg
img](https://github.com/user-attachments/assets/8ecb2de2-ab7c-48e2-9f08-2d09d2cb8791)

<details>
<summary>Source</summary>

```
<style>
 #svg1 {
   border: 1px solid red;
 }

 #svg2 {
   border: 1px solid red;
   width: 300px;
 }
 #svg3 {
   border: 1px solid red;
   width: 300px;
   height: 200px;
   object-fit: contain;
 }
 #svg4 {
   border: 1px solid red;
   width: 300px;
   height: 200px;
   object-fit: cover;
 }
 #svg5 {
   border: 1px solid red;
   width: 300px;
   height: 200px;
   object-fit: fill;
 }
 #svg6 {
   border: 1px solid red;
   width: 300px;
   height: 200px;
   object-fit: none;
 }
</style>
</head>
<body>
        <div>
          <img id="svg1" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo">
        </div>
        <div>
          <img id="svg2" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo">
          <img id="svg3" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo">
          <img id="svg4" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo">
        </div>
        <div>
          <img id="svg5" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo">
          <img id="svg6" src="https://raw.githubusercontent.com/servo/servo/refs/heads/main/resources/servo.svg" alt="Servo logo">
        </div>
</body>
```

</details>

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-05-27 11:02:40 +00:00
Narfinger
8788248fec
Removing unused dependencies in crates. (#37096)
Removed unused dependencies in various crates using cargo-machete, grep
and cargo-udeps.

Testing: The CI tests if any dependencies were used that are removed.

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
2025-05-23 12:58:00 +00:00
Euclid Ye
6d04ef2d6a
Remove accidentally re-added logic to WebDriverSession::input_cancel_list (#37081)
Re-remove deleted logic from `WebDriverSession::input_cancel_list` logic
in #37010 which was re-adedd during merge resolution in #36932.
Otherwise, duplicate items would be registered in Release Actions.

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-05-23 07:50:42 +00:00
batu_hoang
f52fa9b672
Synchronize dispatch_actions in WebDriver (#36932)
Implement missing synchronization in `dispatch_actions` of `WebDriver`.
https://w3c.github.io/webdriver/#dispatching-actions

> The user agent event loop has spun enough times to process the DOM
events generated by the last invocation of the >[dispatch tick
actions](https://w3c.github.io/webdriver/#dfn-dispatch-tick-actions)
steps.

- Add a way for `ScriptThread` to notify `WebDriver` about the
completion of input commands.
- Add a `webdriver_id` field for `InputEvent`. `ScriptThread` uses it to
distinguish WebDriver events and sends notification.

Tests:
`./mach test-wpt --product servodriver -r
tests\wpt\tests\webdriver\tests\classic\element_click\events.py` pass if
`hit_testing` pass. Check
[issue](https://github.com/servo/servo/issues/36676#issuecomment-2882917136)

cc: @xiaochengh

---------

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2025-05-21 11:03:04 +00:00
Simon Wülker
384d8f1ff8
Coalesce animated image frame data into a single shared memory region (#37058)
This makes servo use less file descriptors for animated images and
avoids the crash described in
https://github.com/servo/servo/issues/36792.

Doing this also forces the end users to be more explicit about whether
they want to deal with all image frames or just the first one.
Previously, `Image::bytes` silently returned only the data for the first
frame. With this change there's now a `frames` method which returns an
iterator over all frames in the image.

Testing: No tests - this simply reduces the number of fds used. Servo
doesn't currently display animated gifs anyways.
Fixes: https://github.com/servo/servo/issues/36792

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-05-20 20:40:46 +00:00
Euclid Ye
7ac302f255
Fix WebDriverSession::input_cancel_list related logic (#37010)
- Remove incorrect addition to `input_cancel_list` in
`dispatch_keyup_action`
- For `KeyDown` and `PointerDown`, delay the addition to
`input_cancel_list` until "Dispatching action algorithm" is done to
match the spec. Previously the addition is done before notifying
constellation. Moreover, this makes sure that `pointerUp` is appended
even if `dispatch_pointerdown_action` returns early, so that [Release
Actions](https://w3c.github.io/webdriver/#release-actions) always have
the correct order.
- Remove incorrect addition to `input_cancel_list` in
`dispatch_pointerup_action`. This wrongly added "pointerdown" in
[Release Actions](https://w3c.github.io/webdriver/#release-actions)
- Reduce code duplication
- Add TODO for PointerInputState::subtype and pointerID

Testing: `./mach test-wpt -r --log-raw "D:\servo test
log\perform-actions.txt"
tests\wpt\tests\webdriver\tests\classic\perform_actions --product
servodriver` has no new failures so no regression. There are a lot more
passing tests, but I think mostly are because there is no CI for
webdriver.

cc @xiaochengh @jdm @PotatoCP @longvatrong111

---------

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-05-19 08:34:04 +00:00
webbeef
3aff272e14
chore: update webdriver to 0.53 (#37001)
Updates webdriver to the current version.

Testing: No breakage of CI tests

Signed-off-by: webbeef <me@webbeef.org>
2025-05-14 08:22:40 +00:00
Kenzie Raditya Tirtarahardja
91c4c7b998
Fix origin relative coordinate for wheel scroll and refactoring (#36985)
- Wheel scroll action can get coordinates relative to an element origin
([previously](https://github.com/servo/servo/pull/36744) only
implemented for viewport).
- Extract the element coordinate into a function

Testing: Partially
`tests/wpt/tests/infrastructure/testdriver/actions/wheelScroll.html`,
but we still have synchronization problem. You can try to add sleep in
the test to see OK result.

cc: @xiaochengh @longvatrong111 @yezhizhen

Signed-off-by: PotatoCP <kenzieradityatirtarahardja.18@gmail.com>
Co-authored-by: PotatoCP <kenzieradityatirtarahardja.18@gmail.com>
2025-05-13 10:46:27 +00:00
Euclid Ye
db83601b62
Fix comment and add TODO for webdriver pointermove (#36929)
Testing: No. Just updating comments

Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
2025-05-12 08:20:43 +00:00
Kenzie Raditya Tirtarahardja
924fd06f14
Check receiver response in actions.rs (#36928)
Extend `wait_for_script_response()`
(https://github.com/servo/servo/pull/35024) for `actions.rs`

Signed-off-by: PotatoCP <kenzieradityatirtarahardja.18@gmail.com>
Co-authored-by: PotatoCP <kenzieradityatirtarahardja.18@gmail.com>
2025-05-10 19:27:19 +00:00
batu_hoang
b2e51820e4
Set proper button value in WebDriver - ElementClick command (#36871)
Fix ElementClick: `ElementClick` should use `MouseButton::Left` to
create `action`.

Testing: No pass test now. Tests still fail because of other issues.
For: https://github.com/servo/servo/issues/36658

cc: @xiaochengh , @yezhizhen , @PotatoCP

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
2025-05-07 08:58:01 +00:00
Kenzie Raditya Tirtarahardja
eaf9224799
Implement wheel action in webdriver (#36744)
https://w3c.github.io/webdriver/#wheel-actions

Test:
`tests/wpt/tests/webdriver/tests/classic/perform_actions/wheel.py::{test_null_response_value,test_params_actions_origin_outside_viewport[element],test_params_actions_origin_outside_viewport[viewport]},
tests/wpt/tests/webdriver/tests/classic/perform_actions/perform.py`
Fixes: https://github.com/servo/servo/issues/36720

cc: @xiaochengh @longvatrong111 @yezhizhen

Signed-off-by: PotatoCP <kenzieradityatirtarahardja.18@gmail.com>
Co-authored-by: PotatoCP <kenzieradityatirtarahardja.18@gmail.com>
2025-05-07 08:41:34 +00:00
Josh Matthews
f47e69c112
Improve some webdriver conformance tests results (#36673)
These changes allow test_dom_token_list from
/execute_script/collections.py to pass, and various tests in
/execute_script/arguments.py to expose new failures.

Testing: Not run in CI yet, but verified results from
tests/wpt/tests/webdriver/tests/classic/{execute_script,execute_async_script}
locally.
Fixes: #35738

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-05-07 07:22:29 +00:00
Josh Matthews
46f59e329c
Establish baseline webdriver conformance results (#35024)
https://github.com/web-platform-tests/wpt/pull/50041 allows us to start
running the webdriver conformance tests in Servo, which will make it
easier for us to track regressions/improvements in our webdriver server
implementation.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes are part of #15274
- [x] There are tests for these changes

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-05-01 21:13:27 +00:00
Josh Matthews
dc0c067c9b
Report exceptions for async script executions to webdriver (#27041)
Improving the accuracy of the async script execution for our webdriver
implementation allows us to run many more webdriver tests without
timeouts, which should help with
https://github.com/web-platform-tests/wpt/issues/24257.

Specification:
* https://w3c.github.io/webdriver/#dfn-clone-an-object
* https://w3c.github.io/webdriver/#execute-async-script

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #27036 and fix #27035 and fix #27031.
- [x] There are tests for these changes (but we don't run them in CI
yet)

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-04-25 06:50:00 +00:00
Kenzie Raditya Tirtarahardja
15199ba2ef
Implement GetComputedRole in wd (#36552)
Implement Webdriver Get Computed Role.

[spec](https://w3c.github.io/webdriver/#get-computed-role)

Signed-off-by: Kenzie Raditya Tirtarahardja <kenzieradityatirtarahardja.18@gmail.com>
Co-authored-by: Kenzie Raditya Tirtarahardja <kenzieradityatirtarahardja.18@gmail.com>
2025-04-16 03:55:15 +00:00