Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scripts/ci/qualify-candidate-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ for mode in runtime instrumented; do
fail "${mode}_browser"
fi
grep -Eq "^WINE11_CANDIDATE_BROWSER mode=$mode result=pass$" "$work/browser.log" || fail browser_result_missing
# Project only the fixed, mode-bound keyboard success marker; never emit the raw browser log.
[[ "$(grep -Ec "^WINE11_CANDIDATE_KEYBOARD mode=$mode result=pass$" "$work/browser.log")" == 1 ]] || fail keyboard_result_missing
printf 'WINE11_CANDIDATE_KEYBOARD mode=%s result=pass\n' "$mode"
printf 'WINE11_CANDIDATE_BROWSER mode=%s result=pass\n' "$mode"
emit_screenshot "artifacts/candidate-images/$mode-dashboard.png" "$mode-dashboard.png"
# Exercise abrupt disposable runtime loss with the exact same persistent
Expand Down
94 changes: 94 additions & 0 deletions tests/qualification/candidate_browser_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,99 @@ def receive_frame(_payload):
# A few caret/cursor/clock pixels may change between native and RFB capture.
assert match >= 0.98

PHASE = "keyboard_dashboard"
# Exercise the live dashboard with keyboard input only after view-only
# admission. Do not synthesize focus or dispatch events into Wine.
def focus_style(target):
return target.evaluate("""element => {
const style = getComputedStyle(element);
return {
outline: style.outline,
outlineStyle: style.outlineStyle,
outlineWidth: parseFloat(style.outlineWidth),
outlineColor: style.outlineColor,
boxShadow: style.boxShadow,
border: style.border,
background: style.backgroundColor,
};
}""")

def tab_to(target, key="Tab"):
# The pseudo-class alone does not establish a rendered focus cue.
# Compare the computed unfocused and keyboard-focused styling.
expect(target).to_be_visible()
assert not target.evaluate("element => element === document.activeElement")
before = focus_style(target)
for _ in range(80):
page.keyboard.press(key)
if target.evaluate("element => element === document.activeElement"):
assert target.evaluate("element => element.matches(':focus-visible')")
after = focus_style(target)
outline = (
after["outlineStyle"] not in {"none", "hidden"}
and after["outlineWidth"] > 0
and after["outlineColor"] not in {"transparent", "rgba(0, 0, 0, 0)"}
and after["outline"] != before["outline"]
)
shadow = after["boxShadow"] != "none" and after["boxShadow"] != before["boxShadow"]
changed_surface = (
after["border"] != before["border"]
or after["background"] != before["background"]
)
assert outline or shadow or changed_surface, "keyboard_focus_style_unchanged"
# Visibility and focus-visible do not exclude an overlay or
# clipped scroll container. Probe the actual rendered
# control at five interior points without sending clicks.
assert target.evaluate("""element => {
const r = element.getBoundingClientRect();
if (r.width <= 0 || r.height <= 0 ||
r.left < 0 || r.top < 0 ||
r.right > document.documentElement.clientWidth ||
r.bottom > document.documentElement.clientHeight) {
return false;
}
return [[.5, .5], [.25, .25], [.75, .25],
[.25, .75], [.75, .75]].every(([x, y]) => {
const hit = document.elementFromPoint(
r.left + r.width * x, r.top + r.height * y);
return hit === element || (hit && element.contains(hit));
});
}"""), "keyboard_focus_control_occluded"
return
raise AssertionError("keyboard_focus_unreachable")

keyboard_settings = page.get_by_role("button", name="Toggle VNC Settings", exact=True)
presentation = page.locator("#viewer-presentation")
expect(presentation).to_be_hidden()
tab_to(keyboard_settings)
page.keyboard.press("Enter")
expect(presentation).to_be_visible()
tab_to(presentation)
# Native select keyboard interaction; derive order from the actual DOM.
def choose_presentation(value):
values = presentation.locator("option").evaluate_all(
"options => options.map(option => option.value)"
)
assert value in values
page.keyboard.press("Home")
for _ in range(values.index(value)):
page.keyboard.press("ArrowDown")
expect(presentation).to_have_value(value)

choose_presentation("cv")
expect(page.locator("#vnc-scale")).to_be_disabled()
choose_presentation("human")
# Verify the native presentation control has a nonempty accessible
# name, in addition to the already role-named settings button.
expect(presentation).to_have_accessible_name(re.compile(r"\S"))
tab_to(keyboard_settings, "Shift+Tab")
page.keyboard.press("Space")
expect(presentation).to_be_hidden()
expect(keyboard_settings).to_be_focused()
expect(page.locator("#toolbar-viewonly")).to_have_attribute("aria-pressed", "true")
expect(page.locator("#badge-vnc")).to_have_text("connected")
print(f"WINE11_CANDIDATE_KEYBOARD mode={mode} result=pass", flush=True)

PHASE = "cv_geometry"
settings = page.get_by_role("button", name="Toggle VNC Settings", exact=True)
settings.click()
Expand Down Expand Up @@ -213,6 +306,7 @@ def receive_frame(_payload):
"bytes": len(screenshot),
"sha256": hashlib.sha256(screenshot).hexdigest(),
},
"dashboard_keyboard_focus_qualified": True,
"assistive_technology_qualified": False,
"wininspect_event_delivery_qualified": False,
}
Expand Down