aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/run_e2e_safe.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_safe.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_safe.sh')
-rwxr-xr-xscripts/run_e2e_safe.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/scripts/run_e2e_safe.sh b/scripts/run_e2e_safe.sh
new file mode 100755
index 0000000..a68e7be
--- /dev/null
+++ b/scripts/run_e2e_safe.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+set -e
+
+# Cleanup first
+scripts/clean_test_env.sh
+
+echo "Building backend..."
+go build -o neko_server ./cmd/neko
+
+echo "Creating data directory..."
+mkdir -p .data
+
+echo "Starting backend on port 4994..."
+./neko_server --http=4994 --database=.data/test.db > backend.log 2>&1 &
+SERVER_PID=$!
+
+echo "Backend PID: $SERVER_PID"
+
+# Wait for server to be ready
+echo "Waiting for backend to start..."
+for i in {1..30}; do
+ if nc -z localhost 4994; then
+ echo "Backend is up!"
+ break
+ fi
+ echo "Waiting..."
+ sleep 1
+done
+
+if ! nc -z localhost 4994; then
+ echo "Backend failed to start. Check backend.log"
+ cat backend.log
+ kill $SERVER_PID || true
+ exit 1
+fi
+
+echo "Running E2E tests..."
+cd frontend
+if npm run test:e2e; then
+ echo "Tests passed!"
+ EXIT_CODE=0
+else
+ echo "Tests failed!"
+ EXIT_CODE=1
+fi
+cd ..
+
+echo "Cleaning up..."
+kill $SERVER_PID || true
+scripts/clean_test_env.sh
+
+exit $EXIT_CODE