From 130bb6327ec23dccac0522ee49eabc5a3f28003c Mon Sep 17 00:00:00 2001 From: Nick Clyde Date: Thu, 28 Jan 2021 10:33:55 -0800 Subject: [PATCH 1/4] Fix E2E tests --- frontend/e2e/.env | 2 -- frontend/e2e/docker-compose.yml | 18 +----------------- frontend/e2e/pages/patients.js | 16 ++++++++-------- frontend/package.json | 2 +- 4 files changed, 10 insertions(+), 28 deletions(-) delete mode 100644 frontend/e2e/.env diff --git a/frontend/e2e/.env b/frontend/e2e/.env deleted file mode 100644 index f212ebab29..0000000000 --- a/frontend/e2e/.env +++ /dev/null @@ -1,2 +0,0 @@ -ROOT_DIR=../.. -E2E_DIR=. \ No newline at end of file diff --git a/frontend/e2e/docker-compose.yml b/frontend/e2e/docker-compose.yml index 28ed1a1713..f435331d59 100644 --- a/frontend/e2e/docker-compose.yml +++ b/frontend/e2e/docker-compose.yml @@ -20,31 +20,15 @@ services: - HUB_PORT=4444 - START_XFVB=FALSE - chrome: - image: selenium/node-chrome - command: bash -c "sudo chown -R seluser:seluser /app && /opt/bin/entry_point.sh" - network_mode: "host" - volumes: - - /dev/shm:/dev/shm - - downloads:/app/downloads - depends_on: - - selenium-hub - environment: - - HUB_HOST=localhost - - HUB_PORT=4444 - - NODE_PORT=5556 - - START_XFVB=FALSE - nightwatch: image: gitlab-dev.bespinmobile.cloud:4567/gearfit/gearfit/nightwatch:latest build: . network_mode: "host" depends_on: - firefox - - chrome volumes: - /dev/shm:/dev/shm - - "${E2E_DIR}:/app/e2e" + - ".:/app/e2e" - downloads:/app/downloads volumes: diff --git a/frontend/e2e/pages/patients.js b/frontend/e2e/pages/patients.js index 39c831e2fd..3f4a86448f 100644 --- a/frontend/e2e/pages/patients.js +++ b/frontend/e2e/pages/patients.js @@ -68,14 +68,14 @@ module.exports = { editPatient: { selector: '.prime-edit-patient', elements: { - firstName: '#text-4-1', - lastName: '#text-8-1', - facility: '#drop-14-1', - dob: '#text-16-1', - phone: '#text-18-1', - address: '#text-22-1', - state: '#drop-30-1', - zip: '#text-32-1', + firstName: '#text-10-1', + lastName: '#text-14-1', + facility: '#drop-20-1', + dob: '#text-22-1', + phone: '#text-24-1', + address: '#text-28-1', + state: '#drop-36-1', + zip: '#text-38-1', resident: 'input[name="residentCongregateSetting"]+label', healthcareWorker: 'input[name="employedInHealthcare"]+label', saveButton: '.prime-save-patient-changes', diff --git a/frontend/package.json b/frontend/package.json index 37aa5562ad..a807925aea 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -53,7 +53,7 @@ "lint:prettier": "prettier -c ./src", "lint:write": "prettier --write ./src", "test": "TZ='UTC' react-scripts test", - "e2e": "docker-compose -f e2e/docker-compose.yml --env-file e2e/.env run nightwatch ./nightwatch-entrypoint.bash; docker-compose -f e2e/docker-compose.yml --env-file e2e/.env down -v", + "e2e": "docker-compose -f e2e/docker-compose.yml run nightwatch ./nightwatch-entrypoint.bash; docker-compose -f e2e/docker-compose.yml down -v", "eject": "react-scripts eject", "compile-scss": "node-sass --include-path ./src/scss --include-path ./node_modules/uswds/dist/scss --output-style compressed -o ./src/styles/ ./src/scss/App.scss", "watch-css": "yarn compile-scss && node-sass --include-path ./src/scss --include-path ./node_modules/uswds/dist/scss -o src/styles/ --watch --recursive src/scss/App.scss", From d7e123f2d4141e72440599b5fe4d13ce56ef7907 Mon Sep 17 00:00:00 2001 From: Nick Clyde Date: Thu, 28 Jan 2021 10:43:13 -0800 Subject: [PATCH 2/4] Update GH action --- .github/workflows/e2e.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 09bbd7697c..4e1a83d7f4 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -58,7 +58,7 @@ jobs: chmod 0600 $PGPASSFILE backend/db-setup/create-db.sh - name: Run API - env: + env: OKTA_API_KEY: ${{ secrets.OKTA_API_KEY }} OKTA_OAUTH2_CLIENT_ID: ${{ secrets.OKTA_OAUTH2_CLIENT_ID }} run: cd backend; ./gradlew bootRun --args='--spring.profiles.active=dev' &> ../gradle-log.txt & @@ -76,5 +76,7 @@ jobs: run: cd frontend; yarn - name: Run frontend run: cd frontend; yarn start &> ../yarn-log.txt & + - name: Build e2e container images + run: cd frontend/e2e; docker-compose build - name: Run e2e tests - run: docker-compose -f frontend/e2e/docker-compose.yml --env-file frontend/e2e/.env run nightwatch ./nightwatch-entrypoint.bash; + run: cd frontend/e2e; docker-compose run nightwatch ./nightwatch-entrypoint.bash; From 847850f6ebc8acb6bbfe4fb58c0edd8f7f755663 Mon Sep 17 00:00:00 2001 From: Nick Clyde Date: Thu, 28 Jan 2021 11:00:29 -0800 Subject: [PATCH 3/4] Use names instead of IDs --- frontend/e2e/pages/patients.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/e2e/pages/patients.js b/frontend/e2e/pages/patients.js index 3f4a86448f..92740660ca 100644 --- a/frontend/e2e/pages/patients.js +++ b/frontend/e2e/pages/patients.js @@ -68,14 +68,14 @@ module.exports = { editPatient: { selector: '.prime-edit-patient', elements: { - firstName: '#text-10-1', - lastName: '#text-14-1', - facility: '#drop-20-1', - dob: '#text-22-1', - phone: '#text-24-1', - address: '#text-28-1', - state: '#drop-36-1', - zip: '#text-38-1', + firstName: 'input[name="firstName"]', + lastName: 'input[name="lastName"]', + facility: 'select[name="currentFacilityId"]', + dob: 'input[name="birthDate"]', + phone: 'input[name="telephone"]', + address: 'input[name="street"]', + state: 'select[name="state"]', + zip: 'input[name="zipCode"]', resident: 'input[name="residentCongregateSetting"]+label', healthcareWorker: 'input[name="employedInHealthcare"]+label', saveButton: '.prime-save-patient-changes', From be2a0a724f282107b83b5462455bf82daac32499 Mon Sep 17 00:00:00 2001 From: Nick Clyde Date: Mon, 1 Feb 2021 13:20:26 -0800 Subject: [PATCH 4/4] Add image build into yarn e2e command --- frontend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/package.json b/frontend/package.json index a807925aea..7a808bf461 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -53,7 +53,7 @@ "lint:prettier": "prettier -c ./src", "lint:write": "prettier --write ./src", "test": "TZ='UTC' react-scripts test", - "e2e": "docker-compose -f e2e/docker-compose.yml run nightwatch ./nightwatch-entrypoint.bash; docker-compose -f e2e/docker-compose.yml down -v", + "e2e": "cd e2e; docker-compose build; docker-compose run nightwatch ./nightwatch-entrypoint.bash; docker-compose down -v; cd ..", "eject": "react-scripts eject", "compile-scss": "node-sass --include-path ./src/scss --include-path ./node_modules/uswds/dist/scss --output-style compressed -o ./src/styles/ ./src/scss/App.scss", "watch-css": "yarn compile-scss && node-sass --include-path ./src/scss --include-path ./node_modules/uswds/dist/scss -o src/styles/ --watch --recursive src/scss/App.scss",