# Integrations pass (S009): memory saver and gamepad enumeration. Takes about 3.5 minutes (tab rest is counted in
# minutes, checked every 30 s). Run: SMOKE_TIMEOUT=400 tools/smoke.sh tests/smoke/integ-perf.txt <outdir>
# Memory numbers come from `status`: /memory and /threads. Gamepad: no device here, so only that the API exists and
# lists nothing (CPU use while idle is checked by tests/smoke/integ-idle-cpu.sh).
set /perf/freeze_min 1
set /perf/discard_min 2
set /perf/lite "off"
status mem-start
wait 2
open http://127.0.0.1:8768/hello.html
waitload
assert typeof navigator.getGamepads === 'function' && navigator.getGamepads().filter(Boolean).length === 0
newtab http://127.0.0.1:8768/basics.html
waitload
status two-tabs
expect /tabs/1/has_web true
# Back to the first tab: the second one is now hidden and idle.
cmd select 0
wait 100
status frozen
expect /tabs/1/frozen true
expect /tabs/1/has_web true
wait 90
status discarded
expect /tabs/1/has_web false
# Showing it again loads it again.
cmd select 1
wait 5
status restored
expect /tabs/1/has_web true
expect /tabs/1/frozen false
status done
quit
