mirror of
https://github.com/feder-cr/invisible_playwright.git
synced 2026-06-19 09:08:06 +02:00
Drive gate: set the realistic newtab prefs so a human-cursor click can't lose the about:newtab race
FF150+Fission auto-loads about:newtab (TopSitesFeed) ~100ms-1s after a tab's first navigation — a cross-process BC swap that replaces the page. The wrapper always disables this (prefs.py); the raw-Playwright drive gate did not, so any action that adds latency (e.g. the human-cursor motion path) let the page vanish mid-sequence and surfaced as a phantom "waiting for locator" timeout — an environment artifact, not a binary defect. The gate now launches with the same newtab-suppression prefs every real run uses. Add republish.yml: re-gate + publish an existing build run's artifacts without rebuilding, for when all builds succeeded but a gate/test bug blocked publish.
This commit is contained in:
parent
29262a644e
commit
30a79cefc9
2 changed files with 233 additions and 1 deletions
|
|
@ -87,12 +87,30 @@ def _start_server():
|
|||
return srv, srv.server_address[1]
|
||||
|
||||
|
||||
# FF150 + Fission auto-loads about:newtab (TopSitesFeed) ~100ms-1s after a tab's
|
||||
# first navigation — a cross-process BC swap that REPLACES the page out from under
|
||||
# the test. The wrapper always disables it (see prefs.py); raw Playwright does not,
|
||||
# so the binary's realistic config must set it here too. Without this the drive page
|
||||
# can vanish mid-sequence (it loses the race whenever an action adds latency, e.g.
|
||||
# the human-cursor path), surfacing as a phantom "waiting for locator" timeout that
|
||||
# is an environment artifact, not a binary defect.
|
||||
_REALISTIC_PREFS = {
|
||||
"browser.startup.page": 0,
|
||||
"browser.newtabpage.enabled": False,
|
||||
"browser.newtab.preload": False,
|
||||
"browser.newtabpage.activity-stream.feeds.topsites": False,
|
||||
"browser.newtabpage.activity-stream.feeds.section.topstories": False,
|
||||
"browser.newtabpage.activity-stream.enabled": False,
|
||||
}
|
||||
|
||||
|
||||
def _drive(exe: str, url: str, full: bool) -> str:
|
||||
"""One full drive attempt. Returns the UA on success; raises on failure."""
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
with sync_playwright() as p:
|
||||
browser = p.firefox.launch(executable_path=exe, headless=True)
|
||||
browser = p.firefox.launch(executable_path=exe, headless=True,
|
||||
firefox_user_prefs=_REALISTIC_PREFS)
|
||||
try:
|
||||
page = browser.new_page()
|
||||
resp = page.goto(url, wait_until="load")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue