fix(actions): tick duration = max(pause) across sources, not sum#497
Conversation
W3C WebDriver Actions §17.4.3 defines a tick's duration as the *maximum* pause/move/scroll duration across its sources, not the sum. Both embedded drivers slept each source's duration sequentially within a tick, so a tick with pause(100) in one source and pause(200) in another took 300ms instead of the required 200ms. Both handlers now compute the tick duration up front via a pure `ActionSequence::duration_at(tick)` helper (mirroring `action_count`), dispatch the tick's actions without per-source sleeps, and sleep the single max once at the end. Adds a `tick_duration_is_max_across_sources_not_sum` unit test to each crate. Closes #496. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
| Filename | Overview |
|---|---|
| packages/dioxus-embedded-driver/src/server/handlers/actions.rs | Adds duration_at helper, replaces per-source sleeps with a single tick-level max sleep, removes sleep_for, and adds the new unit test. Logic is correct and spec-aligned. |
| packages/tauri-plugin-webdriver/src/server/handlers/actions.rs | Mirror of the dioxus changes: duration_at added, per-source sleeps removed from all action arms, single tick sleep at end, new unit test. Kept converged with the dioxus handler. |
Reviews (2): Last reviewed commit: "refactor(dioxus): inline tick-end sleep ..." | Re-trigger Greptile
|
Standing release PR: #456 · 10 packages queued · open 165h 34m · ✅ ready to merge Release Preview — 13 packages
These changes will be added to the release PR (#456) when merged: Changelog@wdio/dioxus-bridge 1.0.0-next.3 → 1.0.1Changed
@wdio/dioxus-service 1.0.0-next.3 → 1.0.1Changed
wdio-dioxus-driver 1.0.0-next.3 → 1.0.1Changed
wdio-dioxus-embedded-driver 1.0.0-next.3 → 1.0.1Changed
Fixed
@wdio/tauri-service 1.2.0 → 1.2.1Changed
tauri-plugin-wdio-webdriver 1.2.0 → 1.2.1Fixed
@wdio/flutter-service 1.0.0-next.1 → 1.0.1Changed
wdio_flutter N/A → 1.0.1Changed
@wdio/electron-service 10.1.0 → 10.1.1Changed
@wdio/native-core 1.0.0 → 1.0.1Changed
@wdio/native-mobile-core 1.0.0 → 1.0.1Changed
@wdio/native-spy 1.1.0 → 1.1.1Changed
@wdio/native-utils 2.4.0 → 2.4.1Changed
@wdio/react-native-service 1.0.0-next.0 → 1.0.1Changed
After merge — predicted release
Updated automatically by ReleaseKit |
Greptile P2: tick_duration_ms is already a resolved u64, so wrapping it in
Some() for sleep_for just to unwrap it again was roundabout. Inline the
`if > 0 { tokio::time::sleep(...) }` form (identical to the Tauri handler,
keeping the two converged) and drop the now-unused sleep_for helper.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Closes #496. Follow-up to the tick-by-tick work (#491/#488/#492).
Problem
W3C WebDriver Actions §17.4.3 defines a tick's duration as the maximum pause/move/scroll duration across its sources — not the sum. After the tick-by-tick refactor, both embedded-driver handlers still slept each source's duration sequentially within a tick, so e.g.
pause(100ms)in one source +pause(200ms)in another at the same tick took 300 ms instead of the spec's 200 ms.Fix (both handlers, kept converged)
packages/dioxus-embedded-driver/src/server/handlers/actions.rspackages/tauri-plugin-webdriver/src/server/handlers/actions.rsEach handler now computes the tick duration up front via a pure
ActionSequence::duration_at(tick)helper (mirroring the existingaction_count), dispatches the tick's actions without per-source sleeps, and sleeps the single max once at the end of the tick. Pause arms become no-ops; pointer-move / wheel-scroll dispatch immediately and contribute theirdurationto the tick max.This also makes a single-source pointerMove/scroll fire the event at tick start and wait afterward (vs. wait-then-dispatch before) — same end state per tick, and more spec-aligned (all tick actions dispatch, then the tick lasts its max duration).
Tests
tick_duration_is_max_across_sources_not_sumunit test in each crate: a 3-source request asserts tick 0 =max(100,200,80)=200(not the sum 380) and tick 1 =max(50,30)=50(exhausted source contributes nothing).cargo test --lib: 17 passed (was 16). Tauricargo test --lib: 4 passed (was 3).cargo clippy --all-targetsclean on both (the 2 Tauriincompatible_msrvwarnings are pre-existing inplatform/executor.rs, untouched).Cargo.locks unchanged.🤖 Generated with Claude Code