diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-13 18:43:03 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-13 18:43:03 -0800 |
| commit | 21b4eec6c1e096573bcd5f2079bc21e23a960621 (patch) | |
| tree | 58c8fe2e86aef9859debd05344084e9060dc38c9 /run_e2e.sh | |
| parent | 01d4bbe4b2842cb8c2e4319b6cf03d3050f38d06 (diff) | |
| download | neko-21b4eec6c1e096573bcd5f2079bc21e23a960621.tar.gz neko-21b4eec6c1e096573bcd5f2079bc21e23a960621.tar.bz2 neko-21b4eec6c1e096573bcd5f2079bc21e23a960621.zip | |
refactor(backend): improve testability and add tests (NK-6q9nyg)
Diffstat (limited to 'run_e2e.sh')
| -rwxr-xr-x | run_e2e.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/run_e2e.sh b/run_e2e.sh new file mode 100755 index 0000000..d77441a --- /dev/null +++ b/run_e2e.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -e + +# Cleanup function to kill the neko process and remove the test db +cleanup() { + echo "Cleaning up..." + if [ -n "$NEKO_PID" ]; then + kill $NEKO_PID 2>/dev/null || true + fi + rm -f neko_test.db +} + +# Register cleanup to run on exit +trap cleanup EXIT + +echo "Building neko..." +go build -o neko . + +echo "Starting neko backend on port 4994..." +./neko -d neko_test.db -s 4994 > /dev/null 2>&1 & +NEKO_PID=$! + +echo "Waiting for backend to start..." +# simple wait loop +for i in {1..10}; do + if nc -z localhost 4994; then + echo "Backend is up!" + break + fi + sleep 1 +done + +echo "Running Playwright tests..." +cd frontend +# Ensure we use the correct credentials/config if needed by the tests +# The tests currently hardcode /v2/login but don't seem to have the password hardcoded in the fill step yet? +# Looking at e2e.spec.ts: await page.fill('#password', ''); - it fills empty string? +# usage of 'secret' matches nothing in the test. +# Let's check e2e.spec.ts again to match expectations exactly. +# In e2e.spec.ts: await page.fill('#password', ''); +# It implies it expects no password or ignores it? +# Or maybe the previous test run failed because of this too. +# I will set a simple password 'secret' and we might need to update the test to use it. +# Actually, let's look at the test content again. + +npm run test:e2e |
