1 import ./make-test-python.nix (
4 name = "playwright-python";
6 meta = with pkgs.lib.maintainers; {
7 maintainers = [ phaer ];
13 environment.variables = {
14 NIX_MANUAL_DOCROOT = "file://${pkgs.nix.doc}/share/doc/nix/manual/index.html";
15 PLAYWRIGHT_BROWSERS_PATH = pkgs.playwright-driver.browsers;
17 environment.systemPackages = [
18 (pkgs.writers.writePython3Bin "test_playwright"
20 libraries = [ pkgs.python3Packages.playwright ];
24 from playwright.sync_api import sync_playwright
25 from playwright.sync_api import expect
28 "chromium": ["--headless", "--disable-gpu"],
32 if len(sys.argv) != 3 or sys.argv[1] not in browsers.keys():
33 print(f"usage: {sys.argv[0]} [{'|'.join(browsers.keys())}] <url>")
35 browser_name = sys.argv[1]
37 browser_args = browsers.get(browser_name)
38 print(f"Running test on {browser_name} {' '.join(browser_args)}")
39 with sync_playwright() as p:
40 browser = getattr(p, browser_name).launch(args=browser_args)
41 context = browser.new_context()
42 page = context.new_page()
44 expect(page.get_by_text("Nix Reference Manual")).to_be_visible()
51 # FIXME: Webkit segfaults
52 for browser in ["firefox", "chromium"]:
53 with subtest(f"Render Nix Manual in {browser}"):
54 machine.succeed(f"test_playwright {browser} $NIX_MANUAL_DOCROOT")