aboutsummaryrefslogtreecommitdiffstats
path: root/run_e2e.sh
blob: d77441ae62d3d2788c5214c3c9d21a2f287c782c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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