Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(chore) O3-2502: Add docker setup to run E2E on Bamboo #791

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.39.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.39.0",
"@swc/core": "^1.3.58",
"@swc/jest": "^0.2.22",
"@testing-library/dom": "^8.16.0",
Expand Down
40 changes: 25 additions & 15 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.39.0
"@swc/core": ^1.3.58
"@swc/jest": ^0.2.22
"@testing-library/dom": ^8.16.0
Expand Down Expand Up @@ -4173,19 +4173,14 @@ __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.39.0":
version: 1.39.0
resolution: "@playwright/test@npm:1.39.0"
dependencies:
"@types/node": "*"
fsevents: 2.3.2
playwright-core: 1.36.2
dependenciesMeta:
fsevents:
optional: true
playwright: 1.39.0
bin:
playwright: cli.js
checksum: 659304e0bbbafb2fa36395fbd8bd2c5db2b7791bbb55fa62409946ec7ec726cf8fff89f2b8a1a74fe831bf50a8780a37a5322a1251a6f7db2a9220a57ac408f0
checksum: e93e58fc1af4239f239b890374f066c9a758e2492d25e2c1a532f3f00782ab8e7706956a07540fd14882c74e75f5de36273621adce9b79afb8e36e6c15f1d539
languageName: node
linkType: hard

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

"playwright-core@npm:1.36.2":
version: 1.36.2
resolution: "playwright-core@npm:1.36.2"
"playwright-core@npm:1.39.0":
version: 1.39.0
resolution: "playwright-core@npm:1.39.0"
bin:
playwright-core: cli.js
checksum: 2193ce802ef93c28b9b5e11a0b1d7b60778c686015659978d1cbf0eb9cda2cdc85ec5575b887c1346e9d161cc2805bf27638d76a2f7f857dffeae968e6ceffcd
checksum: 556e78dee4f9890facf2af8249972e0d6e01a5ae98737b0f6b0166c660a95ffee4cb79350335b1ef96430a0ef01d3669daae9099fa46c8d403d11c623988238b
languageName: node
linkType: hard

"playwright@npm:1.39.0":
version: 1.39.0
resolution: "playwright@npm:1.39.0"
dependencies:
fsevents: 2.3.2
playwright-core: 1.39.0
dependenciesMeta:
fsevents:
optional: true
bin:
playwright: cli.js
checksum: 96d8ca5aa25465c1c5d554d0d6071981d55e22477800ff8f5d47a53ca75193d60ece2df538a01b7165b3277dd5493c67603a5acda713029df7fbd95ce2417bc9
languageName: node
linkType: hard

Expand Down
Loading