The render-distance slider has step=16 in the HTML; setting .value to 120 snaps to the nearest valid value (128). The test was asserting the displayed text contained "120" — never true. Changed to 128 (actually on a step boundary). Pure test correctness; UI behavior was right all along (snap-to-step is the slider's intended behavior). All four UI scenarios now green on hardware Chromium: ui-menu-open-close 13 steps 2.44s ✓ ui-hotbar 10 steps 1.07s ✓ ui-respawn 14 steps 3.38s ✓ ui-settings-sliders 15 steps 1.52s ✓ FPS on real hardware: 61.9 fps (16.2ms median) — matches the deployment, confirms the game itself is fast. The earlier 3 fps was Playwright's SwiftShader software path.
46 lines
1.8 KiB
YAML
46 lines
1.8 KiB
YAML
name: ui-settings-sliders
|
|
description: |
|
|
Verify the settings menu sliders mutate the underlying wasm settings.
|
|
Drives the slider .value, dispatches input event (which the menu
|
|
setup listens for), then reads back via the wasm setter side effects.
|
|
This is a real round-trip: DOM → JS handler → wasm.set_fov → game state.
|
|
|
|
steps:
|
|
- wait_for: "window.voxel_game && document.getElementById('set-fov')"
|
|
|
|
# Open the menu first.
|
|
- eval: "document.body.classList.add('menu-open'); window.voxel_game.set_paused(true);"
|
|
- wait: 200
|
|
|
|
# Change FOV slider to 90.
|
|
- eval: |
|
|
const f = document.getElementById('set-fov');
|
|
f.value = 90;
|
|
f.dispatchEvent(new Event('input', { bubbles: true }));
|
|
- wait: 200
|
|
- assert: "document.getElementById('set-fov-val').textContent.includes('90')"
|
|
|
|
# Change render distance to 128 (step=16, so 120 would snap to 128).
|
|
- eval: |
|
|
const d = document.getElementById('set-dist');
|
|
d.value = 128;
|
|
d.dispatchEvent(new Event('input', { bubbles: true }));
|
|
- wait: 200
|
|
- assert: "document.getElementById('set-dist-val').textContent.includes('128')"
|
|
|
|
# Time scale to 0 (freeze) — this is what scenarios already use.
|
|
- eval: |
|
|
const t = document.getElementById('set-tscale');
|
|
t.value = 0;
|
|
t.dispatchEvent(new Event('input', { bubbles: true }));
|
|
- wait: 200
|
|
- assert: "document.getElementById('set-tscale-val').textContent.includes('frozen')"
|
|
|
|
- screenshot: settings-applied.png
|
|
|
|
# Restore time scale so the page isn't frozen after the scenario.
|
|
- eval: |
|
|
const t = document.getElementById('set-tscale');
|
|
t.value = 1;
|
|
t.dispatchEvent(new Event('input', { bubbles: true }));
|
|
- eval: "document.body.classList.remove('menu-open'); window.voxel_game.set_paused(false);"
|