Find works in browsers.
This commit is contained in:
1 parent
1074904c5d
commit
ac67236eca
8 files changed
+307
-7
No files matched your search
+16
-1
@@ -18,7 +18,10 @@ PAGE = Path(__file__).with_name("firefox-baseline.html")
|
||||
|
||||
def run_inside():
|
||||
linked = os.environ.get("CTHULHU_FIREFOX_LINKED") == "1"
|
||||
find = os.environ.get("CTHULHU_FIREFOX_FIND") == "1"
|
||||
page = Path(__file__).with_name("browser-linked-headings.html") if linked else PAGE
|
||||
if find:
|
||||
page = Path(__file__).with_name("browser-find.html")
|
||||
browser = os.environ.get("CTHULHU_FIREFOX") or shutil.which("firefox")
|
||||
if not browser:
|
||||
raise RuntimeError("Firefox executable not found")
|
||||
@@ -40,8 +43,13 @@ def run_inside():
|
||||
if process.poll() is not None:
|
||||
log.seek(0)
|
||||
raise RuntimeError("Firefox exited before the probe: " + log.read().decode(errors="replace"))
|
||||
windowName = "Cthulhu Firefox Baseline"
|
||||
if find:
|
||||
windowName = "Cthulhu Browser Probe"
|
||||
elif linked:
|
||||
windowName = "Cthulhu Linked Headings Probe"
|
||||
result = subprocess.run(
|
||||
["xdotool", "search", "--onlyvisible", "--name", "Cthulhu Linked Headings Probe" if linked else "Cthulhu Firefox Baseline"],
|
||||
["xdotool", "search", "--onlyvisible", "--name", windowName],
|
||||
capture_output=True, text=True,
|
||||
)
|
||||
if result.stdout.strip():
|
||||
@@ -53,6 +61,13 @@ def run_inside():
|
||||
raise RuntimeError("Firefox fixture window missing")
|
||||
environment["CTHULHU_NATIVE_FIREFOX"] = "1"
|
||||
environment.setdefault("GOCACHE", "/tmp/cthulhu-cache")
|
||||
if find:
|
||||
subprocess.run(
|
||||
["go", "test", "./internal/app", "-run", "^TestNativeBrowserFind$",
|
||||
"-count=1", "-v", "-timeout=35s"],
|
||||
cwd=ROOT, env=environment, check=True, timeout=40,
|
||||
)
|
||||
return
|
||||
if linked:
|
||||
environment["CTHULHU_NATIVE_LINKED_HEADINGS"] = "1"
|
||||
subprocess.run(
|
||||
|
||||
Reference in new issue
Block a user