diff --git a/e2e/support/bamboo/docker-compose.yml b/e2e/support/bamboo/docker-compose.yml new file mode 100644 index 000000000..87fd7ddb6 --- /dev/null +++ b/e2e/support/bamboo/docker-compose.yml @@ -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: diff --git a/e2e/support/bamboo/e2e-test-runner.sh b/e2e/support/bamboo/e2e-test-runner.sh new file mode 100644 index 000000000..3d2df2ef6 --- /dev/null +++ b/e2e/support/bamboo/e2e-test-runner.sh @@ -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 diff --git a/e2e/support/bamboo/playwright.Dockerfile b/e2e/support/bamboo/playwright.Dockerfile new file mode 100644 index 000000000..4fd9020ac --- /dev/null +++ b/e2e/support/bamboo/playwright.Dockerfile @@ -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 diff --git a/package.json b/package.json index deab57ff2..1ad07675e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index 850247fc3..6c2a38ea7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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 @@ -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 @@ -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