# Video site ad tricks (S061): pages/player-ad.html has a transparent click catcher over the player (an ad the list
# hides), a pop-under that opens a listed ad window on the first click, and a window opened without any click. The
# content filter stops the listed one, Nacre the one without a click (a 'pop-up blocked' bar), and the click reaches
# the player. An ad frame's load never takes the tab over (frame-hijack.html). Hidden only
# (real clicks). Offline. Start the server first:
#   python3 tests/smoke/net/server.py &   then   tools/smoke.sh tests/smoke/player-ad.txt
wait 3
set /adblock/update_days 0
set /adblock/lists []
set /adblock/custom ["http://127.0.0.1:8766/popup-list.txt"]
wait 5
expect /adblock/rules 3
waitstatus 60 /adblock/filters_ready true
open http://127.0.0.1:8766/pages/player-ad.html
waitload
wait 3
shot before
expect /tab_count 1
expect /active/prompts 1
assert getComputedStyle(document.querySelector(".nacre-click-ad")).display === "none" || getComputedStyle(document.querySelector(".nacre-click-ad")).pointerEvents === "none"
click 300 200
wait 2
shot after
status after
expect /tab_count 1
assert window.popped === true && window.played === 1 && document.getElementById("v").paused === false
expect /active/prompts 1
# An ad frame inside a cross-site frame loads an address with a tracking parameter: the tab stays on its page (before
# S061 Nacre stripped it and loaded it in the tab).
open http://127.0.0.1:8766/pages/frame-hijack.html
waitload
wait 3
status frame
expect /active/url "http://127.0.0.1:8766/pages/frame-hijack.html"
expect /tab_count 1
status done
quit
