# Shortcut actions (S006) not covered by basics.txt: bookmarks, pages, developer tools, source, QR code,
# hard reload, home, address bar, zoom out, find previous, media, close window. Offline.
# Save page / Save as PDF open a native file dialog (rfd), and incognito starts a second process (which would
# inherit NACRE_SCRIPT), so they are not run here.
wait 3
open @PAGES@/basics.html
waitload
expect /bookmarks 0
do bookmark
wait 0.5
expect /bookmarks 1
do new_tab
wait 0.5
open @PAGES@/hello.html
waitload
do bookmark_all
wait 0.5
expect /bookmarks 3
do toggle_bookmarks_bar
wait 0.5
shot bookmarks-bar
do toggle_bookmarks_bar
do bookmarks_manager
wait 1
expect /active/url "nacre://bookmarks"
do history
wait 1
expect /active/url "nacre://history"
do downloads
wait 1
expect /active/url "nacre://downloads"
do passwords
wait 1
expect /active/url "nacre://passwords"
do settings
wait 1
expect /active/url "nacre://settings"
do clear_data
wait 1
expect /active/url "nacre://clear-data"
do task_manager
wait 1
expect /active/url "nacre://task-manager"
shot task-manager
# Pages open in their own tab (or reuse it): count what the tab strip has now.
status pages
do tab_1
wait 0.5
expect /active/title "Basics"
do view_source
wait 1.5
status source
shot source
do tab_1
wait 0.5
do devtools
wait 1.5
shot devtools
do tab_1
wait 0.5
do qr_code
wait 1
shot qr
flyout none
# Hard reload, home, address bar focus.
js window.marker = 1
do hard_reload
waitload
wait 0.5
assert window.marker === undefined
do zoom_out
wait 0.5
status zoom-out
do zoom_reset
wait 0.5
expect /active/zoom 1.0
cmd find needle
wait 1
expect /active/find [1,3]
do find_prev
wait 0.5
expect /active/find [3,3]
key Escape
do focus_address
wait 0.5
shot focus-address
blur
do home
waitload
wait 0.5
expect /active/url "nacre://newtab"
# Media: play the local video, then pause it with the shortcut.
open @PAGES@/video.html
waitload
js document.querySelector("video").play()
waitfor 15 !document.querySelector("video").paused && document.querySelector("video").currentTime > 0.5
wait 1.5
do media_play_pause
waitfor 5 document.querySelector("video").paused
status media
# Network error page: nothing listens on port 9.
open http://127.0.0.1:9/
wait 4
expect /active/title "Couldn't open this page"
status error-page
shot error-page
# Close window keeps the other one.
do new_window
wait 2
expect /windows 2
do close_window
wait 1
expect /windows 1
status done
quit
