From d95685e4f5c40a203cb037936649f3dfc1664ef1 Mon Sep 17 00:00:00 2001 From: Zedd Shmais Date: Fri, 14 Jul 2023 08:14:52 -0500 Subject: [PATCH 1/5] Refactor e2e to increase speed and reliability (#5970) Co-authored-by: Rin Concordia <93527746+rin-skylight@users.noreply.github.com> --- .dockerignore | 15 ++++ .env.cypress.sample | 4 +- .github/workflows/buildBackendImage.yml | 3 +- .github/workflows/buildFrontendImage.yml | 11 ++- .../buildFrontendLighthouseImage.yml | 78 +++++++++++++++++++ .github/workflows/checkForChanges.yml | 2 +- .github/workflows/e2eLocal.yml | 33 ++------ .github/workflows/lighthouse.yml | 50 ++++++------ .github/workflows/testingWorkflow.yml | 16 +++- .gitignore | 2 +- .run/e2e local headless.run.xml | 12 +++ .run/e2e local open.run.xml | 12 +++ backend/Dockerfile | 26 ++++--- .../src/main/resources/application-e2e.yaml | 15 ++++ cypress/Dockerfile | 9 --- cypress/README.md | 4 +- cypress/cypress.config.js | 58 +++----------- cypress/e2e.sh | 17 ++-- cypress/e2e/01-organization_sign_up.cy.js | 29 +++---- cypress/e2e/02-add_patient.cy.js | 6 +- cypress/e2e/02b-bulk_upload_patient.cy.js | 2 +- cypress/e2e/03-add_devices.cy.js | 6 +- cypress/e2e/04-conduct_test.cy.js | 10 +-- .../e2e/05-get_result_from_patient_link.cy.js | 6 +- cypress/e2e/06-self_registration.cy.js | 10 +-- cypress/e2e/07-organization_settings.cy.js | 8 +- cypress/e2e/08-account_creation.cy.js | 50 ++++++------ cypress/e2e/09-multiplex_testing.cy.js | 3 +- .../e2e/10-save_and_start_covid_test.cy.js | 10 +-- cypress/package.json | 3 +- cypress/support/commands.js | 35 +++++++-- cypress/support/e2e.js | 3 - cypress/support/wiremock/download-wiremock.sh | 5 -- cypress/support/wiremock/ping-wiremock.sh | 17 ---- cypress/support/wiremock/start-wiremock.sh | 3 - cypress/support/wiremock/stop-wiremock.sh | 5 -- docker-compose.ci.yml | 11 +-- docker-compose.cypress.yml | 45 +++++------ docker-compose.yml | 38 ++++----- frontend/Dockerfile | 56 +++++++++++-- frontend/ci-git-fix.sh | 6 -- frontend/package.json | 9 --- lighthouse.sh | 14 ++-- lighthouserc.yml | 3 - nginx/Dockerfile | 17 +++- nginx/default.conf | 4 +- ...-37f80080-892e-4522-9938-82e97d9894f0.json | 0 ...-102cf920-1120-4ad7-b455-ce28f5ef12bf.json | 0 ...-6b0e5aa9-3571-4cd6-a559-4514a99e705a.json | 0 ...-7e80ba76-5ff9-4a1f-8300-fcfc2cf43758.json | 0 ...-883e6c07-098f-4a65-b85e-d58fc4a6f4bc.json | 0 ...-8b629004-c488-4720-affc-e5dc9b767be9.json | 0 ...-d83fdaac-1ccc-4118-99af-876acce99053.json | 0 ...-faf1baa3-b44f-4db0-8be5-563127f70297.json | 0 ...-a7d9b6f1-ea9a-4af0-8b2e-f5b76253a2ac.json | 0 ...-aabe3742-778b-41a4-b965-0fd362cb0975.json | 0 ...-b3b3e41c-7db4-4243-a886-bd31eed3c64f.json | 0 ...-3e325aa5-161e-4cb6-b90e-9622e7a72368.json | 0 ...-13639c60-75f8-4cd4-a6cd-b7b7f58a3e68.json | 0 ...-23650f1d-0db0-4068-be42-f7a85db4f155.json | 0 ...-4337b755-f677-4a0c-b7be-542d8016d9cf.json | 0 ...-4487dea9-f55a-4896-93bd-7ab488000d86.json | 0 ...-6d8e60cb-50e4-46dc-8324-9d4025271599.json | 0 ...-97fd6cb8-d409-416e-bc34-4422687d9407.json | 0 ...-f279127b-a0c3-4bee-be6c-418aab0c312a.json | 0 ...-fa27b1b3-40a3-4ac8-8204-a54c93e2f4cf.json | 0 ...-9c655bc5-e1a8-4e97-a47d-33e0362c0dc0.json | 0 ...-12438cb2-b152-4403-b398-0eae6d7abc59.json | 0 ...-408cdc4f-6fa5-4963-bdab-1d41396bad19.json | 0 ...-09a48b86-d42a-4808-9325-2270dac9746e.json | 0 ...-1b28f921-dfcc-47d3-9930-860aee8fd588.json | 0 ...-67a92e43-1f14-462f-8fb5-ade1fb3765ce.json | 0 ...-801d2f77-5cd5-44fa-9e02-09e0c496e46a.json | 0 ...-9195ab5e-d856-469c-8427-ae1b3767cf6e.json | 0 ...-93c612d9-150c-4244-a316-4997b8f1112f.json | 0 ...-b00b2408-9cc0-4e2a-83bb-56ab13b7a25c.json | 0 ...-28ca51bb-4c11-4f1f-a8ee-b74d559e584a.json | 0 ...-8a0ef72a-bf1b-4cbc-9872-504b075ee96e.json | 0 ...-45985b92-cfbf-4520-870b-9e8a83589782.json | 0 ...-0e0f1036-97ee-4a9a-abb8-714f30236818.json | 0 ...-c31487c5-4a90-4cba-aaa9-68594fd67fbe.json | 0 ...-f53d763d-21d7-4bd0-a14f-9965a6f3521c.json | 0 ...-b82e4e55-9c33-4d17-98cb-6ffce901143d.json | 0 ...-0610ce14-a0ac-4d94-8d98-263a4af7a34f.json | 0 ...-233e5353-4ebf-4748-bf83-760bf1cf1376.json | 0 ...-139b14a9-4fe9-430d-88a5-36bd2136dc53.json | 0 ...-ddde229c-13fc-4245-aa68-0ae096224667.json | 0 ...-5a69690f-16d0-48b9-9bbb-f2c85171a681.json | 0 ...-01efa298-c85c-44d5-96a3-a5026f9a5118.json | 0 ...-4c7aeded-3820-4374-8543-715ba6d28bf6.json | 0 ...-50832ad6-bcf8-4ba9-8a19-90264b5312ff.json | 0 ...-5da4736f-8ed3-456f-a88b-17689cf122f0.json | 0 ...-620031b5-0665-4d54-8427-7bf02e0f9827.json | 0 ...-8707c9e1-6afb-4fa9-aed3-9c5a17382742.json | 0 ...-87a1bd7b-0205-4fc4-b971-3472692d6c5c.json | 0 ...-8a0b1094-c4eb-4950-9b84-56a2e5f65110.json | 0 ...-8dbb3d58-a55f-49c9-a239-d192a2f64b09.json | 0 ...-a3bca034-6789-4282-9613-05f6c759cd5c.json | 0 ...-cd272a21-f226-471d-9ff1-1fe3196f17ef.json | 0 ...-cf1868a4-2120-4590-8b84-280b7e387fee.json | 0 ...-ea9a4fcb-fb44-4334-ad2e-fcac747393c7.json | 0 ...-d2c41957-0331-4c20-a597-7002630980ab.json | 0 ...-bf01254d-c260-40ea-8132-2d4bd6cd66f6.json | 0 ...-03b45bc2-9445-4fdc-aefc-4812b748cda3.json | 0 ...-217728e0-c41d-4eb7-acd5-c4d30968fefa.json | 0 ...-226f7c02-859b-47f7-996b-de50475f665c.json | 0 ...-288c9ccb-a6f6-413d-9479-38e594a7824b.json | 0 ...-2a9e8dc8-c651-4529-b3be-8628b172adc0.json | 0 ...-33d3504f-7a70-408d-920f-0da17578af4d.json | 0 ...-5d6dba4b-07b5-41fe-a518-4048c0134193.json | 0 ...-7826bb04-9ed0-4b4b-b7b5-fb101d82e3aa.json | 0 ...-fa71d449-b897-4ff8-8795-46e042dac20a.json | 0 ...-f4215eb7-e3c0-4832-9980-c36c3c9114f7.json | 0 ...-70478dad-37b6-4f8f-b0a4-8d943c44cf5f.json | 0 ...-3732968e-73a4-4491-966d-83e7bbbffc4c.json | 0 ...-2f871446-37cb-4feb-af3f-51852baa68a1.json | 0 ...-34fcc1be-314a-4206-ab7e-77ffd7316ffd.json | 0 ...-41a89199-530d-4d9b-97c1-6d57bd732661.json | 0 ...-663101c1-27b3-4d65-9b3c-a85714b23fcf.json | 0 ...-8eb6461b-7e34-48ec-af5d-85dce5d03572.json | 0 ...-d14dce7c-8cd8-480a-b1a0-454840c22752.json | 0 ...-f10909bf-4507-455e-940a-29e37d149507.json | 0 ...-72b442a2-1ad6-453d-b8fd-5143358999d6.json | 0 ...-90c10278-af01-47c5-9bb6-6d0f2157c282.json | 0 ...-6e4a4d8a-5f6c-4ee4-ad42-de68bb343cfd.json | 0 125 files changed, 437 insertions(+), 344 deletions(-) create mode 100644 .dockerignore create mode 100644 .github/workflows/buildFrontendLighthouseImage.yml create mode 100644 .run/e2e local headless.run.xml create mode 100644 .run/e2e local open.run.xml delete mode 100755 cypress/support/wiremock/download-wiremock.sh delete mode 100755 cypress/support/wiremock/ping-wiremock.sh delete mode 100755 cypress/support/wiremock/start-wiremock.sh delete mode 100755 cypress/support/wiremock/stop-wiremock.sh delete mode 100755 frontend/ci-git-fix.sh rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/email/api_v1_authn-37f80080-892e-4522-9938-82e97d9894f0.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/email/api_v1_users_00ugnomzln2q84acp4h6-102cf920-1120-4ad7-b455-ce28f5ef12bf.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/email/api_v1_users_00ugnomzln2q84acp4h6-6b0e5aa9-3571-4cd6-a559-4514a99e705a.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/email/api_v1_users_00ugnomzln2q84acp4h6-7e80ba76-5ff9-4a1f-8300-fcfc2cf43758.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/email/api_v1_users_00ugnomzln2q84acp4h6-883e6c07-098f-4a65-b85e-d58fc4a6f4bc.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/email/api_v1_users_00ugnomzln2q84acp4h6-8b629004-c488-4720-affc-e5dc9b767be9.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/email/api_v1_users_00ugnomzln2q84acp4h6-d83fdaac-1ccc-4118-99af-876acce99053.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/email/api_v1_users_00ugnomzln2q84acp4h6-faf1baa3-b44f-4db0-8be5-563127f70297.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/email/api_v1_users_00ugnomzln2q84acp4h6_factors-a7d9b6f1-ea9a-4af0-8b2e-f5b76253a2ac.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/email/api_v1_users_00ugnomzln2q84acp4h6_factors_emfgnoi1js8jhq79k4h6-aabe3742-778b-41a4-b965-0fd362cb0975.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/email/api_v1_users_00ugnomzln2q84acp4h6_factors_emfgnoi1js8jhq79k4h6_lifecycle_activate-b3b3e41c-7db4-4243-a886-bd31eed3c64f.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/googleAuth/api_v1_authn-3e325aa5-161e-4cb6-b90e-9622e7a72368.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/googleAuth/api_v1_users_00ugnjag7ekhoymoa4h6-13639c60-75f8-4cd4-a6cd-b7b7f58a3e68.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/googleAuth/api_v1_users_00ugnjag7ekhoymoa4h6-23650f1d-0db0-4068-be42-f7a85db4f155.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/googleAuth/api_v1_users_00ugnjag7ekhoymoa4h6-4337b755-f677-4a0c-b7be-542d8016d9cf.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/googleAuth/api_v1_users_00ugnjag7ekhoymoa4h6-4487dea9-f55a-4896-93bd-7ab488000d86.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/googleAuth/api_v1_users_00ugnjag7ekhoymoa4h6-6d8e60cb-50e4-46dc-8324-9d4025271599.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/googleAuth/api_v1_users_00ugnjag7ekhoymoa4h6-97fd6cb8-d409-416e-bc34-4422687d9407.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/googleAuth/api_v1_users_00ugnjag7ekhoymoa4h6-f279127b-a0c3-4bee-be6c-418aab0c312a.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/googleAuth/api_v1_users_00ugnjag7ekhoymoa4h6_factors-fa27b1b3-40a3-4ac8-8204-a54c93e2f4cf.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/googleAuth/api_v1_users_00ugnjag7ekhoymoa4h6_factors_uftgnld798amf0yk34h6-9c655bc5-e1a8-4e97-a47d-33e0362c0dc0.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/googleAuth/api_v1_users_00ugnjag7ekhoymoa4h6_factors_uftgnld798amf0yk34h6_lifecycle_activate-12438cb2-b152-4403-b398-0eae6d7abc59.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/oktaVerify/api_v1_authn-408cdc4f-6fa5-4963-bdab-1d41396bad19.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/oktaVerify/api_v1_users_00ugnh0inq8mibnyg4h6-09a48b86-d42a-4808-9325-2270dac9746e.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/oktaVerify/api_v1_users_00ugnh0inq8mibnyg4h6-1b28f921-dfcc-47d3-9930-860aee8fd588.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/oktaVerify/api_v1_users_00ugnh0inq8mibnyg4h6-67a92e43-1f14-462f-8fb5-ade1fb3765ce.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/oktaVerify/api_v1_users_00ugnh0inq8mibnyg4h6-801d2f77-5cd5-44fa-9e02-09e0c496e46a.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/oktaVerify/api_v1_users_00ugnh0inq8mibnyg4h6-9195ab5e-d856-469c-8427-ae1b3767cf6e.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/oktaVerify/api_v1_users_00ugnh0inq8mibnyg4h6-93c612d9-150c-4244-a316-4997b8f1112f.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/oktaVerify/api_v1_users_00ugnh0inq8mibnyg4h6-b00b2408-9cc0-4e2a-83bb-56ab13b7a25c.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/oktaVerify/api_v1_users_00ugnh0inq8mibnyg4h6_factors-28ca51bb-4c11-4f1f-a8ee-b74d559e584a.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/oktaVerify/api_v1_users_00ugnh0inq8mibnyg4h6_factors_ostgni1eeuqcubsqj4h6-8a0ef72a-bf1b-4cbc-9872-504b075ee96e.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/oktaVerify/api_v1_users_00ugnh0inq8mibnyg4h6_factors_ostgni1eeuqcubsqj4h6_lifecycle_activate-45985b92-cfbf-4520-870b-9e8a83589782.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_apps_0oa1k0163nawfvxnw1d7-0e0f1036-97ee-4a9a-abb8-714f30236818.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_apps_0oa1k0163nawfvxnw1d7-c31487c5-4a90-4cba-aaa9-68594fd67fbe.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_apps_0oa1k0163nawfvxnw1d7-f53d763d-21d7-4bd0-a14f-9965a6f3521c.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_apps_0oa1k0163nawfvxnw1d7_groups_00g228nrj9qdj10y61d7-b82e4e55-9c33-4d17-98cb-6ffce901143d.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_apps_0oa1k0163nawfvxnw1d7_groups_00g228nuk4y75yit11d7-0610ce14-a0ac-4d94-8d98-263a4af7a34f.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_apps_0oa1k0163nawfvxnw1d7_groups_00g228nyd7uugag1l1d7-233e5353-4ebf-4748-bf83-760bf1cf1376.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_apps_0oa1k0163nawfvxnw1d7_groups_00g228od2fuscasdm1d7-139b14a9-4fe9-430d-88a5-36bd2136dc53.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_apps_0oa1k0163nawfvxnw1d7_groups_00g228ofzf89lvr8s1d7-ddde229c-13fc-4245-aa68-0ae096224667.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_apps_0oa1k0163nawfvxnw1d7_groups_00g228orh0j8unens1d7-5a69690f-16d0-48b9-9bbb-f2c85171a681.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_groups-01efa298-c85c-44d5-96a3-a5026f9a5118.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_groups-4c7aeded-3820-4374-8543-715ba6d28bf6.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_groups-50832ad6-bcf8-4ba9-8a19-90264b5312ff.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_groups-5da4736f-8ed3-456f-a88b-17689cf122f0.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_groups-620031b5-0665-4d54-8427-7bf02e0f9827.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_groups-8707c9e1-6afb-4fa9-aed3-9c5a17382742.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_groups-87a1bd7b-0205-4fc4-b971-3472692d6c5c.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_groups-8a0b1094-c4eb-4950-9b84-56a2e5f65110.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_groups-8dbb3d58-a55f-49c9-a239-d192a2f64b09.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_groups-a3bca034-6789-4282-9613-05f6c759cd5c.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_groups-cd272a21-f226-471d-9ff1-1fe3196f17ef.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_groups-cf1868a4-2120-4590-8b84-280b7e387fee.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_groups_00g228nyd7uugag1l1d7_users-ea9a4fcb-fb44-4334-ad2e-fcac747393c7.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_users-d2c41957-0331-4c20-a597-7002630980ab.json (100%) rename {cypress/stubs/orgSignUp/mappings => wiremock/stubs/mappings/org}/api_v1_users_00u228n97qlexjkqt1d7_lifecycle_activate-bf01254d-c260-40ea-8132-2d4bd6cd66f6.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/sms/api_v1_authn-03b45bc2-9445-4fdc-aefc-4812b748cda3.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/sms/api_v1_users_00ugne0jmx3ztgzyg4h6-217728e0-c41d-4eb7-acd5-c4d30968fefa.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/sms/api_v1_users_00ugne0jmx3ztgzyg4h6-226f7c02-859b-47f7-996b-de50475f665c.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/sms/api_v1_users_00ugne0jmx3ztgzyg4h6-288c9ccb-a6f6-413d-9479-38e594a7824b.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/sms/api_v1_users_00ugne0jmx3ztgzyg4h6-2a9e8dc8-c651-4529-b3be-8628b172adc0.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/sms/api_v1_users_00ugne0jmx3ztgzyg4h6-33d3504f-7a70-408d-920f-0da17578af4d.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/sms/api_v1_users_00ugne0jmx3ztgzyg4h6-5d6dba4b-07b5-41fe-a518-4048c0134193.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/sms/api_v1_users_00ugne0jmx3ztgzyg4h6-7826bb04-9ed0-4b4b-b7b5-fb101d82e3aa.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/sms/api_v1_users_00ugne0jmx3ztgzyg4h6_factors-fa71d449-b897-4ff8-8795-46e042dac20a.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/sms/api_v1_users_00ugne0jmx3ztgzyg4h6_factors_mblgnf1ftdustzcsa4h6-f4215eb7-e3c0-4832-9980-c36c3c9114f7.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/sms/api_v1_users_00ugne0jmx3ztgzyg4h6_factors_mblgnf1ftdustzcsa4h6_lifecycle_activate-70478dad-37b6-4f8f-b0a4-8d943c44cf5f.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/voiceCall/api_v1_authn-3732968e-73a4-4491-966d-83e7bbbffc4c.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/voiceCall/api_v1_users_00ugnmrroypjbijub4h6-2f871446-37cb-4feb-af3f-51852baa68a1.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/voiceCall/api_v1_users_00ugnmrroypjbijub4h6-34fcc1be-314a-4206-ab7e-77ffd7316ffd.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/voiceCall/api_v1_users_00ugnmrroypjbijub4h6-41a89199-530d-4d9b-97c1-6d57bd732661.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/voiceCall/api_v1_users_00ugnmrroypjbijub4h6-663101c1-27b3-4d65-9b3c-a85714b23fcf.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/voiceCall/api_v1_users_00ugnmrroypjbijub4h6-8eb6461b-7e34-48ec-af5d-85dce5d03572.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/voiceCall/api_v1_users_00ugnmrroypjbijub4h6-d14dce7c-8cd8-480a-b1a0-454840c22752.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/voiceCall/api_v1_users_00ugnmrroypjbijub4h6-f10909bf-4507-455e-940a-29e37d149507.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/voiceCall/api_v1_users_00ugnmrroypjbijub4h6_factors-72b442a2-1ad6-453d-b8fd-5143358999d6.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/voiceCall/api_v1_users_00ugnmrroypjbijub4h6_factors_clfgnmq9zbjkjxuqu4h6-90c10278-af01-47c5-9bb6-6d0f2157c282.json (100%) rename {cypress/stubs/accountCreation => wiremock/stubs}/mappings/voiceCall/api_v1_users_00ugnmrroypjbijub4h6_factors_clfgnmq9zbjkjxuqu4h6_lifecycle_activate-6e4a4d8a-5f6c-4ee4-ad42-de68bb343cfd.json (100%) diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..29e8410a25 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,15 @@ +#Ignore the following directories +backend/build/ +backend/.gradle/ +frontend/build/ +frontend/node_modules/ +nginx/ +ops/**/.terraform/ +ops/services/app_functions/report_stream_batched_publisher/functions/node_modules/ +docs/ +.github/ +.run/ +node_modules/ +cypress/node_modules/ +cypress/screenshots/ +cypress/videos/ \ No newline at end of file diff --git a/.env.cypress.sample b/.env.cypress.sample index 96491aa828..395a1aad04 100644 --- a/.env.cypress.sample +++ b/.env.cypress.sample @@ -4,7 +4,7 @@ COMPOSE_HTTP_TIMEOUT=180 # Backend settings SPRING_PROFILES_ACTIVE=e2e,db-dockerized -WIREMOCK_URL=http://cypress:8088 +WIREMOCK_URL=http://wiremock:8088 SPRING_LIQUIBASE_ENABLED="true" OKTA_TESTING_DISABLEHTTPSCHECK="true" @@ -28,7 +28,7 @@ REACT_APP_BACKEND_URL=https://localhost.simplereport.gov/api PUBLIC_URL=/app/ REACT_APP_OKTA_ENABLED=true REACT_APP_DISABLE_MAINTENANCE_BANNER=true -REACT_APP_OKTA_URL=http://cypress:8088 +REACT_APP_OKTA_URL=http://wiremock:8088 REACT_APP_BASE_URL=https://localhost.simplereport.gov REACT_APP_OKTA_CLIENT_ID= diff --git a/.github/workflows/buildBackendImage.yml b/.github/workflows/buildBackendImage.yml index 02ebf4489b..39e1bc4176 100644 --- a/.github/workflows/buildBackendImage.yml +++ b/.github/workflows/buildBackendImage.yml @@ -60,7 +60,8 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v4 with: - context: backend + context: ./ + file: ./backend/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/buildFrontendImage.yml b/.github/workflows/buildFrontendImage.yml index 4742706d63..e73751162d 100644 --- a/.github/workflows/buildFrontendImage.yml +++ b/.github/workflows/buildFrontendImage.yml @@ -60,10 +60,19 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v4 with: - context: frontend + context: ./ + file: ./frontend/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: | + "REACT_APP_OKTA_URL=http://wiremock:8088" + "REACT_APP_OKTA_CLIENT_ID=0oa1k0163nAwfVxNW1d7" + "REACT_APP_BASE_URL=https://localhost.simplereport.gov" + "REACT_APP_BACKEND_URL=https://localhost.simplereport.gov/api" + "PUBLIC_URL=/app/" + "REACT_APP_OKTA_ENABLED=true" + "REACT_APP_DISABLE_MAINTENANCE_BANNER=true" - name: Set version output shell: bash diff --git a/.github/workflows/buildFrontendLighthouseImage.yml b/.github/workflows/buildFrontendLighthouseImage.yml new file mode 100644 index 0000000000..c111b60b1f --- /dev/null +++ b/.github/workflows/buildFrontendLighthouseImage.yml @@ -0,0 +1,78 @@ +name: Build frontend docker image with okta disabled + +on: + workflow_dispatch: + workflow_call: + inputs: + force_build: + description: Force build + required: false + default: false + type: boolean + outputs: + version: + description: docker image version + value: ${{ jobs.build_and_push_frontend_image.outputs.version }} + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}/frontend-lighthouse + +jobs: + + frontend_changes: + with: + what_to_check: frontend + uses: ./.github/workflows/checkForChanges.yml + + build_and_push_frontend_image: + # We want to build the image if there are changes in the frontend folder, or if we are forcing a build, or if we are on the main branch + if: needs.frontend_changes.outputs.has_changes == 'true' || inputs.force_build == true || github.ref == 'refs/heads/main' + needs: [frontend_changes] + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + outputs: + version: ${{ steps.set.outputs.version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} + type=ref,event=branch + type=ref,event=pr + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: ./ + file: ./frontend/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + "REACT_APP_BASE_URL=https://localhost.simplereport.gov" + "REACT_APP_BACKEND_URL=https://localhost.simplereport.gov/api" + "PUBLIC_URL=/app/" + "REACT_APP_OKTA_ENABLED=false" + "REACT_APP_DISABLE_MAINTENANCE_BANNER=true" + + - name: Set version output + shell: bash + id: set + run: echo "version=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/checkForChanges.yml b/.github/workflows/checkForChanges.yml index 54a493a202..f56cdff91d 100644 --- a/.github/workflows/checkForChanges.yml +++ b/.github/workflows/checkForChanges.yml @@ -13,7 +13,7 @@ on: value: ${{ jobs.check_for_changes.outputs.has_changes }} jobs: check_for_changes: - runs-on: 'ubuntu-20.04' + runs-on: ubuntu-latest outputs: has_changes: ${{ steps.check_for_changes.outputs.has_changes }} steps: diff --git a/.github/workflows/e2eLocal.yml b/.github/workflows/e2eLocal.yml index 53da666f9d..a2521ae1d7 100644 --- a/.github/workflows/e2eLocal.yml +++ b/.github/workflows/e2eLocal.yml @@ -50,22 +50,6 @@ jobs: with: swap-size-gb: 10 - - name: Generate certs - run: | - echo "::group::Generate ssl certs" - sudo apt update - sudo apt install libnss3-tools - eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - brew install mkcert - mkcert -install - mkdir -p certs - cd certs - mkcert localhost.simplereport.gov - mv localhost.simplereport.gov.pem localhost.simplereport.gov.crt - mv localhost.simplereport.gov-key.pem localhost.simplereport.gov.key - cd .. - echo "::endgroup::" - - name: Update files permissions # Even though we don't use it, we need the .env file created here due to an issue similar to this one: https://github.com/mutagen-io/mutagen/issues/265 run: | @@ -104,16 +88,17 @@ jobs: SMARTY_AUTH_TOKEN: ${{ secrets.SMARTY_AUTH_TOKEN }} SPRING_LIQUIBASE_ENABLED: "true" GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 + WIREMOCK_URL: "http://wiremock:8088" # cypress settings + CYPRESS_OKTA_REDIRECT_URI: "https%3A%2F%2Flocalhost.simplereport.gov%2Fapp" CYPRESS_OKTA_USERNAME: ${{ secrets.CYPRESS_OKTA_USERNAME }} CYPRESS_OKTA_PASSWORD: ${{ secrets.CYPRESS_OKTA_PASSWORD }} CYPRESS_OKTA_SECRET: ${{ secrets.CYPRESS_OKTA_SECRET }} CYPRESS_BACKEND_URL: "https://localhost.simplereport.gov/api" - WIREMOCK_URL: "http://cypress:8088" SPEC_PATH: "cypress/e2e/**" TEST_ENV: "https://localhost.simplereport.gov" # frontend settings - REACT_APP_OKTA_URL: "http://cypress:8088" + REACT_APP_OKTA_URL: "http://wiremock:8088" REACT_APP_OKTA_CLIENT_ID: 0oa1k0163nAwfVxNW1d7 REACT_APP_BASE_URL: https://localhost.simplereport.gov REACT_APP_BACKEND_URL: https://localhost.simplereport.gov/api @@ -135,12 +120,8 @@ jobs: if: always() shell: bash run: | - CONTAINERS=$(docker ps -a --format '{{.Names}}') - for container in $CONTAINERS - do - echo "Saving $container logs" - docker logs $container >& cypress/${container}.log - done + echo "Saving $container logs" + docker compose -f docker-compose.yml -f docker-compose.cypress.yml logs --timestamps >& cypress-run.log - name: Stop containers if: always() @@ -151,7 +132,7 @@ jobs: echo "::endgroup::" - name: Archive cypress failures - if: failure() + if: always() uses: actions/upload-artifact@v3 with: name: cypress-results @@ -164,4 +145,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: logs - path: cypress/*.log + path: cypress-run.log diff --git a/.github/workflows/lighthouse.yml b/.github/workflows/lighthouse.yml index 11d6c8ce94..5c8bd23db8 100644 --- a/.github/workflows/lighthouse.yml +++ b/.github/workflows/lighthouse.yml @@ -1,9 +1,19 @@ -name: "Run Lighthouse Audit" +name: Run Lighthouse Audit on: - workflow_dispatch: - pull_request: - branches: - - "**" + workflow_call: + inputs: + DOCKER_BACKEND_IMAGE_VERSION: + required: false + type: string + DOCKER_DATABASE_IMAGE_VERSION: + required: false + type: string + DOCKER_NGINX_IMAGE_VERSION: + required: false + type: string + DOCKER_FRONTEND_LIGHTHOUSE_IMAGE_VERSION: + required: false + type: string concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -23,22 +33,6 @@ jobs: with: swap-size-gb: 10 - - name: Generate certs - run: | - echo "::group::Generate ssl certs" - sudo apt update - sudo apt install libnss3-tools - eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - brew install mkcert - mkcert -install - mkdir -p certs - cd certs - mkcert localhost.simplereport.gov - mv localhost.simplereport.gov.pem localhost.simplereport.gov.crt - mv localhost.simplereport.gov-key.pem localhost.simplereport.gov.key - cd .. - echo "::endgroup::" - - name: Add hosts to /etc/hosts run: | sudo echo "127.0.0.1 localhost.simplereport.gov" | sudo tee -a /etc/hosts @@ -66,11 +60,21 @@ jobs: # docker settings DOCKER_CLIENT_TIMEOUT: 180 COMPOSE_HTTP_TIMEOUT: 180 + DOCKER_BACKEND_IMAGE_VERSION: ${{ inputs.DOCKER_BACKEND_IMAGE_VERSION }} + DOCKER_DATABASE_IMAGE_VERSION: ${{ inputs.DOCKER_DATABASE_IMAGE_VERSION }} + DOCKER_NGINX_IMAGE_VERSION: ${{ inputs.DOCKER_NGINX_IMAGE_VERSION }} + DOCKER_FRONTEND_LIGHTHOUSE_IMAGE_VERSION: ${{ inputs.DOCKER_FRONTEND_LIGHTHOUSE_IMAGE_VERSION }} shell: bash run: | + echo "::group::Running containers" + echo "Backend branch tag (or latest): ${{ inputs.DOCKER_BACKEND_IMAGE_VERSION }}" + echo "Database branch tag (or latest): ${{ inputs.DOCKER_DATABASE_IMAGE_VERSION }}" + echo "Nginx branch tag (or latest): ${{ inputs.DOCKER_NGINX_IMAGE_VERSION }}" + echo "Frontend branch tag (or latest): ${{ inputs.DOCKER_FRONTEND_LIGHTHOUSE_IMAGE_VERSION }}" + echo "::endgroup::" + echo "::group::Run Lighthouse locally" - npm install -g @lhci/cli@0.9.x - lhci autorun + bash lighthouse.sh echo "::endgroup::" - name: Archive Lighthouse results diff --git a/.github/workflows/testingWorkflow.yml b/.github/workflows/testingWorkflow.yml index 4c757f079d..8f376da504 100644 --- a/.github/workflows/testingWorkflow.yml +++ b/.github/workflows/testingWorkflow.yml @@ -23,6 +23,9 @@ jobs: build_frontend_image: uses: ./.github/workflows/buildFrontendImage.yml + build_frontend_lighthouse_image: + uses: ./.github/workflows/buildFrontendLighthouseImage.yml + build_nginx_image: uses: ./.github/workflows/buildNginxImage.yml @@ -47,7 +50,18 @@ jobs: DOCKER_DATABASE_IMAGE_VERSION: ${{ needs.build_database_image.outputs.version }} DOCKER_FRONTEND_IMAGE_VERSION: ${{ needs.build_frontend_image.outputs.version }} DOCKER_NGINX_IMAGE_VERSION: ${{ needs.build_nginx_image.outputs.version }} - + lighthouse: + needs: + - build_backend_image + - build_database_image + - build_nginx_image + - build_frontend_lighthouse_image + uses: ./.github/workflows/lighthouse.yml + with: + DOCKER_BACKEND_IMAGE_VERSION: ${{ needs.build_backend_image.outputs.version }} + DOCKER_FRONTEND_LIGHTHOUSE_IMAGE_VERSION: ${{ needs.build_frontend_lighthouse_image.outputs.version }} + DOCKER_DATABASE_IMAGE_VERSION: ${{ needs.build_database_image.outputs.version }} + DOCKER_NGINX_IMAGE_VERSION: ${{ needs.build_nginx_image.outputs.version }} tests: needs: - build_database_image diff --git a/.gitignore b/.gitignore index 84ae3f2a94..79df860475 100644 --- a/.gitignore +++ b/.gitignore @@ -9,10 +9,10 @@ node_modules *.orig *.rej /.env +/.env.local certs/ yarn-error.log backend/locust/__pycache__/ -wiremock*.jar cypress/cypress.env.json frontend/src/.env.local .run/Backend.run.xml diff --git a/.run/e2e local headless.run.xml b/.run/e2e local headless.run.xml new file mode 100644 index 0000000000..400a476e45 --- /dev/null +++ b/.run/e2e local headless.run.xml @@ -0,0 +1,12 @@ + + + + + +