aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/run_e2e.sh
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-14 15:44:02 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-14 15:44:02 -0800
commit701e0e8e919d2929ecc98b555e468bd29bf606cf (patch)
treee78856b8ffc83406499b34bb7fdf0892dd2ce6b4 /scripts/run_e2e.sh
parent17fd19c8f822ff84b1855d7729a3030ebf1f68ae (diff)
downloadneko-701e0e8e919d2929ecc98b555e468bd29bf606cf.tar.gz
neko-701e0e8e919d2929ecc98b555e468bd29bf606cf.tar.bz2
neko-701e0e8e919d2929ecc98b555e468bd29bf606cf.zip
Cleanup root directory by moving scripts to scripts/ and fix CSRF cookie policy for dev env
Diffstat (limited to 'scripts/run_e2e.sh')
-rwxr-xr-xscripts/run_e2e.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/scripts/run_e2e.sh b/scripts/run_e2e.sh
new file mode 100755
index 0000000..12d5f90
--- /dev/null
+++ b/scripts/run_e2e.sh
@@ -0,0 +1,47 @@
+#!/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 ./cmd/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
+cd ..