Skip to content

Commit 0ba15ab

Browse files
committed
CI: copy local backend JSON and rebuild webapp for development before running tests
1 parent 20a67e9 commit 0ba15ab

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

mkdocs/docs/playground/run-cypress-local.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ wait_for_service() {
1818
}
1919

2020
cleanup() {
21-
git restore backend.json
21+
git restore .
2222
if test -n "$PID_MKDOCS"; then
2323
echo "Stopping mkdocs at PID $PID_MKDOCS"
2424
pkill -P "$PID_MKDOCS"
@@ -29,15 +29,22 @@ cleanup() {
2929
fi
3030
}
3131

32-
# Starts frontend and backend and ensures they are stopped when the script exits
32+
# Ensures frontend and backend are stopped when the script exits
3333
trap cleanup EXIT
34+
35+
# Start frontend in the background
36+
cp backend.local.json backend.json
37+
npx webpack --mode=development
3438
"$SCRIPT_DIR/../../serve-no-livereload.sh" &
3539
PID_MKDOCS=$!
40+
41+
# Start backend in the background
3642
docker run --rm -p 8080:8080 ghcr.io/epsilonlabs/playground-backend:standalone-server &
3743
PID_DOCKER=$!
3844

45+
# Wait for both to finish starting
3946
wait_for_service Frontend 8000
4047
wait_for_service Backend 8080
4148

42-
cp backend.local.json backend.json
49+
# Run Cypress tests
4350
npx cypress run --browser firefox --spec "cypress/e2e/*.cy.js" "$@"

0 commit comments

Comments
 (0)