Skip to content

Commit

Permalink
Add docker setup to run E2E on Bamboo
Browse files Browse the repository at this point in the history
  • Loading branch information
jayasanka-sack committed Oct 18, 2023
1 parent 911060a commit 012c58d
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 13 deletions.
56 changes: 56 additions & 0 deletions e2e/support/bamboo/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This docker compose file is used to create a dockerized environment when running E2E tests on Bamboo.
version: "3.7"

services:
playwright:
build:
context: .
dockerfile: playwright.Dockerfile
args:
USER_ID: ${USER_ID}
GROUP_ID: ${GROUP_ID}
container_name: esm-core-e2e-tests-container
working_dir: /app
command: sh /app/e2e/support/bamboo/e2e-test-runner.sh
volumes:
- ../../../:/app
networks:
- test

gateway:
image: openmrs/openmrs-reference-application-3-gateway:${TAG:-nightly}
depends_on:
- frontend
- backend
ports:
- "80:80"
networks:
- test

frontend:
image: openmrs/openmrs-reference-application-3-frontend:${TAG:-nightly}
environment:
SPA_PATH: /openmrs/spa
API_URL: /openmrs
SPA_CONFIG_URLS:
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost/" ]
timeout: 5s
depends_on:
- backend
networks:
- test

backend:
image: openmrs/openmrs-reference-application-3-backend:nightly-with-data
depends_on:
- db
networks:
- test
db:
image: openmrs/openmrs-reference-application-3-db:nightly-with-data
networks:
- test

networks:
test:
13 changes: 13 additions & 0 deletions e2e/support/bamboo/e2e-test-runner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

export E2E_BASE_URL=http://gateway/openmrs
export CI=true

while [ "$(curl -s -o /dev/null -w ''%{http_code}'' http://gateway/openmrs/login.htm)" != "200" ]; do
echo "Waiting for the backend to be up..."
sleep 10
done

cp example.env .env

yarn test-e2e
12 changes: 12 additions & 0 deletions e2e/support/bamboo/playwright.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM mcr.microsoft.com/playwright:v1.34.0-jammy

ARG USER_ID
ARG GROUP_ID

RUN if ! getent group $GROUP_ID > /dev/null; then \
groupadd -g $GROUP_ID myusergroup; \
fi

RUN useradd -u $USER_ID -g $GROUP_ID -m playwrightuser

USER playwrightuser
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"devDependencies": {
"@babel/highlight": "^7.18.6",
"@jest/types": "^29.6.3",
"@playwright/test": "^1.30.0",
"@playwright/test": "1.34.0",
"@swc/core": "^1.3.58",
"@swc/jest": "^0.2.22",
"@testing-library/dom": "^8.16.0",
Expand Down
22 changes: 10 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3766,7 +3766,7 @@ __metadata:
dependencies:
"@babel/highlight": ^7.18.6
"@jest/types": ^29.6.3
"@playwright/test": ^1.30.0
"@playwright/test": 1.34.0
"@swc/core": ^1.3.58
"@swc/jest": ^0.2.22
"@testing-library/dom": ^8.16.0
Expand Down Expand Up @@ -4173,19 +4173,19 @@ __metadata:
languageName: unknown
linkType: soft

"@playwright/test@npm:^1.30.0":
version: 1.36.2
resolution: "@playwright/test@npm:1.36.2"
"@playwright/test@npm:1.34.0":
version: 1.34.0
resolution: "@playwright/test@npm:1.34.0"
dependencies:
"@types/node": "*"
fsevents: 2.3.2
playwright-core: 1.36.2
playwright-core: 1.34.0
dependenciesMeta:
fsevents:
optional: true
bin:
playwright: cli.js
checksum: 659304e0bbbafb2fa36395fbd8bd2c5db2b7791bbb55fa62409946ec7ec726cf8fff89f2b8a1a74fe831bf50a8780a37a5322a1251a6f7db2a9220a57ac408f0
checksum: 269074a9b58370633575b99d95135edcd8b5351c19f82b88392f9fc6b0f2dc3687e631d59864aa0cffa382534dd83163069569e67972b4fc63d1bef3fb7372d8
languageName: node
linkType: hard

Expand Down Expand Up @@ -16146,12 +16146,10 @@ __metadata:
languageName: node
linkType: hard

"playwright-core@npm:1.36.2":
version: 1.36.2
resolution: "playwright-core@npm:1.36.2"
bin:
playwright-core: cli.js
checksum: 2193ce802ef93c28b9b5e11a0b1d7b60778c686015659978d1cbf0eb9cda2cdc85ec5575b887c1346e9d161cc2805bf27638d76a2f7f857dffeae968e6ceffcd
"playwright-core@npm:1.34.0":
version: 1.34.0
resolution: "playwright-core@npm:1.34.0"
checksum: 1821ab254b3c756e52c144c26cae7250dd5a1c779277cdd583bd289501d45cceaea40a8185ebf7eaa56b8291e4a042e3eef65f511da2306349c275794c9a582d
languageName: node
linkType: hard

Expand Down

0 comments on commit 012c58d

Please sign in to comment.