Find works in browsers.
This commit is contained in:
1 parent
1074904c5d
commit
ac67236eca
8 files changed
+307
-7
No files matched your search
@@ -0,0 +1,8 @@
|
||||
<!doctype html>
|
||||
<html lang="en"><meta charset="utf-8"><title>Cthulhu Browser Probe</title>
|
||||
<h1 tabindex="0">Find fixture start</h1>
|
||||
<p>First searchable paragraph.</p>
|
||||
<a href="#destination">Searchable link</a>
|
||||
<h2 id="destination">Searchable destination</h2>
|
||||
<label>Answer <input></label>
|
||||
</html>
|
||||
@@ -12,6 +12,7 @@ from native_test_session import run_private_session
|
||||
|
||||
|
||||
BROWSER_PROOFS = {
|
||||
"find": ("./internal/app", "^TestNativeBrowserFind$", 35, 40, "browser-find.html"),
|
||||
"actions": ("./internal/app", "^TestNativeBrowserActionOwnership$", 35, 40, "browser-actions.html"),
|
||||
"link-sounds": ("./internal/app", "^TestNativeBrowserCaretLinkSounds$", 40, 45, "browser-link-sounds.html"),
|
||||
"article": ("./internal/atspi", "^TestNativeBrowserArticleContext$", 30, 35, "browser-article.html"),
|
||||
|
||||
+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