Skip to content

Commit 811b365

Browse files
committed
feat: browser tests
feat: browser tests
1 parent ae01e32 commit 811b365

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

nix/checks/podman/default.nix

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,33 @@
2626
testScript =
2727
#python
2828
''
29+
def launch_browser():
30+
"""Launches the web browser with the correct options."""
31+
# Determine the name of the binary:
32+
binary = ${pkgs.chromium}/bin/chromium
33+
# Add optional CLI options:
34+
options = []
35+
if major_version > "95" and not pname.startswith("google-chrome"):
36+
# Workaround to avoid a GPU crash:
37+
options.append("--use-gl=swiftshader")
38+
# Launch the process:
39+
options.append("http://localhost:3000")
40+
machine.succeed(ru(f'ulimit -c unlimited; {binary} {shlex.join(options)} >&2 & disown'))
41+
if binary.startswith("google-chrome"):
42+
# Need to click away the first window:
43+
machine.wait_for_text("Make Google Chrome the default browser")
44+
machine.screenshot("google_chrome_default_browser_prompt")
45+
machine.send_key("ret")
46+
2947
machine.wait_for_unit("multi-user.target")
3048
machine.succeed("cd")
3149
machine.succeed("curl -L https://raw.githubusercontent.com/AET-DevOps25/team-nixops/refs/heads/main/docker-compose.yml -o docker-compose.yml")
3250
machine.copy_from_host( "${./env.txt}", ".env")
3351
machine.succeed("docker compose pull")
3452
machine.succeed("docker compose up -d")
3553
54+
launch_browser()
55+
3656
machine.sleep(20)
3757
output = machine.succeed("docker ps -a --format '{{.Names}} {{.Status}}'").strip().splitlines()
3858

0 commit comments

Comments
 (0)