tests/playwright-python: fix text to look for

The Nix Manual now includes its release in the middle of the title,
i.e. "Nix 2.28.1 Reference Manual", so we just use a regex
This commit is contained in:
phaer 2025-05-08 12:36:26 +02:00
parent 1f12271a92
commit 5d205401b1

View file

@ -21,6 +21,7 @@ import ./make-test-python.nix (
}
''
import sys
import re
from playwright.sync_api import sync_playwright
from playwright.sync_api import expect
@ -29,6 +30,7 @@ import ./make-test-python.nix (
"firefox": {},
"webkit": {}
}
needle = re.compile("Nix.*Reference Manual")
if len(sys.argv) != 3 or sys.argv[1] not in browsers.keys():
print(f"usage: {sys.argv[0]} [{'|'.join(browsers.keys())}] <url>")
sys.exit(1)
@ -42,7 +44,7 @@ import ./make-test-python.nix (
context = browser.new_context()
page = context.new_page()
page.goto(url)
expect(page.get_by_text("Nix Reference Manual")).to_be_visible()
expect(page.get_by_text(needle)).to_be_visible()
''
)
];