Skip to content

Commit

Permalink
tests: fix broken e2e tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-codes committed Oct 24, 2024
1 parent 533de20 commit 5358fb2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .devcontainer/manually-start-services-for-e2e.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
set -o allexport
. $PWD/apps/playnite-web/local.env
set +o allexport

docker stop playnite-web-db mqtt || true
docker container rm playnite-web-db mqtt || true

docker run --name playnite-web-db -d \
-p 27017:27017 \
-e MONGO_INITDB_ROOT_USERNAME=$DB_USERNAME \
-e MONGO_INITDB_ROOT_PASSWORD=$DB_PASSWORD \
-v $PWD/.data/games:/data/backup/games \
mongo:7.0.3-jammy

docker exec -t playnite-web-db mongorestore --nsInclude games.* /data/backup

rm -rf apps/playnite-web/public/assets-by-id
cp -r .data/asset-by-id apps/playnite-web/public/assets

docker run --name mqtt -d \
-p 1883:1883 \
-v $PWD/.data/mqtt/config:/mosquitto/config \
eclipse-mosquitto:latest

echo 'Dependent services started.'
7 changes: 7 additions & 0 deletions apps/playnite-web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@
"cwd": "{projectRoot}"
}
},
"test/e2e/ci/prepare": {
"executor": "nx:run-commands",
"options": {
"command": "bash -c '.devcontainer/manually-start-services-for-e2e.sh'",
"cwd": "{projectRoot}"
}
},
"test/e2e/ci": {
"executor": "nx:run-commands",
"options": {
Expand Down
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"cache": false
},
"test/e2e/ci": {
"dependsOn": ["prepare", "test/e2e/prepare"],
"dependsOn": ["prepare", "test/e2e/ci/prepare"],
"cache": false
},
"test/e2e/update": {
Expand Down

0 comments on commit 5358fb2

Please sign in to comment.