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-2515: Add docker setup to run E2E on Bamboo #195

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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ dist/
/playwright-report/
/playwright/.cache/
e2e/storageState.json

results.xml
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ Then, in a separate terminal, run:
yarn test-e2e --headed
```

Please read [our e2e docs](e2e/README.md) for more information about E2E testing.

Read the [e2e testing guide](/e2e/README.md) to learn more about End-to-End tests in this project.
## Building

```sh
Expand Down
115 changes: 0 additions & 115 deletions e2e/README.md

This file was deleted.

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: form-builder-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 @@ -71,7 +71,7 @@
"@dnd-kit/utilities": "^3.2.1",
"@openmrs/esm-framework": "next",
"@openmrs/esm-styleguide": "next",
"@playwright/test": "^1.38.0",
"@playwright/test": "1.39.0",
"@swc/cli": "^0.1.62",
"@swc/core": "^1.3.85",
"@swc/jest": "^0.2.29",
Expand Down
7 changes: 2 additions & 5 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ const config: PlaywrightTestConfig = {
expect: {
timeout: 20 * 1000,
},
fullyParallel: true,
outputDir: '../test-results/results',
workers: 1,
forbidOnly: !!process.env.CI,
retries: 0,
reporter: process.env.CI
? [['junit', { outputFile: 'results.xml' }], ['html']]
: [['html', { outputFolder: '../test-results/report' }]],
reporter: process.env.CI ? [['junit', { outputFile: 'results.xml' }], ['html']] : [['html']],
globalSetup: require.resolve('./e2e/core/global-setup'),
use: {
baseURL: `${process.env.E2E_BASE_URL}/spa/`,
Expand Down
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3176,7 +3176,7 @@ __metadata:
"@openmrs/esm-framework": next
"@openmrs/esm-styleguide": next
"@openmrs/openmrs-form-engine-lib": next
"@playwright/test": ^1.38.0
"@playwright/test": 1.39.0
"@swc/cli": ^0.1.62
"@swc/core": ^1.3.85
"@swc/jest": ^0.2.29
Expand Down Expand Up @@ -3441,14 +3441,14 @@ __metadata:
languageName: node
linkType: hard

"@playwright/test@npm:^1.38.0":
version: 1.38.0
resolution: "@playwright/test@npm:1.38.0"
"@playwright/test@npm:1.39.0":
version: 1.39.0
resolution: "@playwright/test@npm:1.39.0"
dependencies:
playwright: 1.38.0
playwright: 1.39.0
bin:
playwright: cli.js
checksum: 0768b6b98f0993d9d8017e4bcca3a5c3fe1bf0270acaa89b141479c4319c16350d60e6d2511cbd655283942059fa409ce23fce30435f0936f5e2577834f356ba
checksum: e93e58fc1af4239f239b890374f066c9a758e2492d25e2c1a532f3f00782ab8e7706956a07540fd14882c74e75f5de36273621adce9b79afb8e36e6c15f1d539
languageName: node
linkType: hard

Expand Down Expand Up @@ -14935,27 +14935,27 @@ __metadata:
languageName: node
linkType: hard

"playwright-core@npm:1.38.0":
version: 1.38.0
resolution: "playwright-core@npm:1.38.0"
"playwright-core@npm:1.39.0":
version: 1.39.0
resolution: "playwright-core@npm:1.39.0"
bin:
playwright-core: cli.js
checksum: 9eb43fc6c3cb392d5f35b0fd0b7291b38a8cbdc3cbb944a8261f744f30d09196dfa3b5d84aa02ffc09af87d08d31b385b007b6af20d0b6cd50a29344f3b0db8d
checksum: 556e78dee4f9890facf2af8249972e0d6e01a5ae98737b0f6b0166c660a95ffee4cb79350335b1ef96430a0ef01d3669daae9099fa46c8d403d11c623988238b
languageName: node
linkType: hard

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

Expand Down
Loading