Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkgs/id/nix/tests/e2e-test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
f"chromium --headless --disable-gpu --no-sandbox --dump-dom "
f"--timeout=15000 {BASE}/ 2>/dev/null"
)
assert "Files" in home_dom, f"[port {port}] Home page DOM missing 'Files': {home_dom[:500]}"
assert "new-file-name" in home_dom, f"[port {port}] Home page missing new file form"
assert "<title>Home - id</title>" in home_dom, f"[port {port}] Home page DOM missing title: {home_dom[:500]}"
assert "Browse files" in home_dom, f"[port {port}] Home page DOM missing files link"

# ── Create a file for further tests ───────────────────────────────
create_resp = server.succeed(
Expand All @@ -93,7 +93,7 @@
# ── Chromium renders the file in the list ─────────────────────────
list_dom = server.succeed(
f"chromium --headless --disable-gpu --no-sandbox --dump-dom "
f"--timeout=15000 {BASE}/ 2>/dev/null"
f"--timeout=15000 {BASE}/files 2>/dev/null"
)
assert "browser-test.txt" in list_dom, f"[port {port}] Created file not in rendered list"

Expand Down Expand Up @@ -138,14 +138,14 @@
# Verify it appears in primary's DOM
primary_dom = server.succeed(
"chromium --headless --disable-gpu --no-sandbox --dump-dom "
"--timeout=15000 http://localhost:4173/ 2>/dev/null"
"--timeout=15000 http://localhost:4173/files 2>/dev/null"
)
assert "isolation-dom.txt" in primary_dom, "Isolation file missing from primary DOM"

# Verify it does NOT appear in secondary's DOM
secondary_dom = server.succeed(
"chromium --headless --disable-gpu --no-sandbox --dump-dom "
"--timeout=15000 http://localhost:4174/ 2>/dev/null"
"--timeout=15000 http://localhost:4174/files 2>/dev/null"
)
assert "isolation-dom.txt" not in secondary_dom, "Isolation FAILED: file leaked to secondary instance DOM"
'';
Expand Down
5 changes: 4 additions & 1 deletion pkgs/id/nix/tests/integration-test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
virtualisation.cores = 2;
};

globalTimeout = 300; # 5 minutes
# The complete cli_integration binary runs roughly 134 tests with two
# workers, and individual child processes may wait up to three minutes.
# Five minutes is enough for the VM to boot but not for the full suite.
globalTimeout = 1200; # 20 minutes for the full integration suite

testScript = ''
ID_BIN = "${idPackage}/bin/id"
Expand Down
11 changes: 6 additions & 5 deletions pkgs/id/nix/tests/serve-test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@
"""Run the full API test suite against a single instance."""
BASE = f"http://localhost:{port}"

# ── Home page renders ─────────────────────────────────────────────
# ── Discovery home page renders ────────────────────────────────────
html = server.succeed(f"curl -sf {BASE}/")
assert "Files" in html, f"[port {port}] Home page missing 'Files': {html[:200]}"
assert "<title>Home - id</title>" in html, f"[port {port}] Home page missing title: {html[:200]}"
assert "Browse files" in html, f"[port {port}] Home page missing files link: {html[:200]}"

# ── Static assets served ──────────────────────────────────────────
server.succeed(f"curl -sf -o /dev/null {BASE}/assets/manifest.json")
Expand All @@ -78,7 +79,7 @@
file_hash = resp["hash"]

# ── File appears in list ──────────────────────────────────────────
list_html = server.succeed(f"curl -sf {BASE}/")
list_html = server.succeed(f"curl -sf {BASE}/files")
assert "hello.txt" in list_html, f"[port {port}] Created file not in file list"

# ── File accessible by name ───────────────────────────────────────
Expand Down Expand Up @@ -157,11 +158,11 @@
assert iso.get("name") == "isolation-test.txt", f"Isolation file creation failed: {iso_resp}"

# Verify it exists on primary
primary_html = server.succeed("curl -sf http://localhost:3000/")
primary_html = server.succeed("curl -sf http://localhost:3000/files")
assert "isolation-test.txt" in primary_html, "Isolation file missing on primary"

# Verify it does NOT exist on secondary
secondary_html = server.succeed("curl -sf http://localhost:3001/")
secondary_html = server.succeed("curl -sf http://localhost:3001/files")
assert "isolation-test.txt" not in secondary_html, "Isolation FAILED: file leaked to secondary instance"
'';
}
Loading