tests: keep trace even on failure

This commit is contained in:
ibizaman 2026-05-28 23:16:59 +02:00 committed by Pierre Penninckx
parent 337f3ec8bc
commit 2c23d8a258
2 changed files with 27 additions and 0 deletions

View file

@ -61,6 +61,25 @@ If the test includes playwright tests, you can see the playwright trace with:
$ nix run .#playwright -- show-trace $(nix eval .#checks.x86_64-linux.vm_grocy_basic --raw)/trace/0.zip
```
If the test fails, you won't have the output directory available.
Instead, run the test with `--keep-failed` and at the end you will see a line saying
```
Keeping build directory '/nix/var/nix/builds/nix-31776-4270051001/build'
```
Copy the path and run:
```bash
sudo cp -r /nix/var/nix/builds/nix-31776-4270051001/build/shared-xchg/trace trace && sudo chown -R $USER: trace
```
Now, open that file with playwright:
```bash
nix run .#playwright -- show-trace trace/0.zip
```
### Debug Tests {#contributing-debug-tests}
Run the test in driver interactive mode:

View file

@ -152,6 +152,10 @@ let
code, logs = server.execute("login_playwright")
print(logs)
try:
server.succeed("""
mkdir -p /tmp/shared/
cp -r trace /tmp/shared/
""")
server.copy_from_vm("trace")
except:
print("No trace found on server")
@ -163,6 +167,10 @@ let
code, logs = client.execute("login_playwright")
print(logs)
try:
client.succeed("""
mkdir -p /tmp/shared/
cp -r trace /tmp/shared/
""")
client.copy_from_vm("trace")
except:
print("No trace found on client")