diff --git a/.ds.baseline b/.ds.baseline index 461d36912..1668b5757 100644 --- a/.ds.baseline +++ b/.ds.baseline @@ -133,7 +133,7 @@ "filename": ".github/workflows/checks.yml", "hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8", "is_verified": false, - "line_number": 80, + "line_number": 79, "is_secret": false } ], @@ -684,5 +684,5 @@ } ] }, - "generated_at": "2024-10-07T17:03:38Z" + "generated_at": "2024-10-07T17:44:55Z" } diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index ac308b20b..70fc65ef8 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -71,7 +71,6 @@ jobs: NOTIFY_E2E_TEST_EMAIL: ${{ secrets.NOTIFY_E2E_TEST_EMAIL }} NOTIFY_E2E_TEST_PASSWORD: ${{ secrets.NOTIFY_E2E_TEST_PASSWORD }} NOTIFY_E2E_TEST_URI: http://localhost:6012/ - GRRR_SERVICES: ${{ VCAP_SERVICES }} services: postgres: image: postgres @@ -114,26 +113,6 @@ jobs: run: | - if [ -z "${{ env.VCAP_SERVICES }}" ]; then - echo "env vcap is not set" - else - echo "env vcap is ${#SECRET_KEY}" - fi - if [ -z "${{ PLAIN_VCAP }}" ]; then - echo "Plain vcap is not set" - else - echo "Length of plain is ${#PLAIN_VCAP}" - fi - if [ -z "${{ env.GRRR_SERVICES }}" ]; then - echo "env grrr is not set" - else - echo "env grrr is ${#GRRR_SERVICES}" - fi - if [ -z "${{ PLAIN_GRRR }}" ]; then - echo "Plain grrr is not set" - else - echo "Length of plain grrr is ${#PLAIN_GRRR}" - fi make run-flask > admin-server.log 2>&1 & tail -f admin-server.log & make e2e-test @@ -149,10 +128,7 @@ jobs: NOTIFY_E2E_TEST_EMAIL: ${{ secrets.NOTIFY_E2E_TEST_EMAIL }} NOTIFY_E2E_TEST_PASSWORD: ${{ secrets.NOTIFY_E2E_TEST_PASSWORD }} NOTIFY_E2E_TEST_URI: http://localhost:6012/ - VCAP_SERVICES: ${{ env.VCAP_SERVICES }} - PLAIN_VCAP: $VCAP_SERVICES - GRRR_SERVICES: ${{ env.GRRR_SERVICES }} - PLAIN_GRRR: $GRRR_SERVICES + VCAP_SERVICES: ${{ secrets.VCAP_SERVICES }} validate-new-relic-config: runs-on: ubuntu-latest environment: staging diff --git a/README.md b/README.md index 04458e394..21b140613 100644 --- a/README.md +++ b/README.md @@ -507,3 +507,19 @@ insurance. For more information on what we're working on, the Notify tool, and how to get involved with our team, [see our flyer.](https://github.com/GSA/notifications-admin/blob/main/docs/notify-pilot-flyer.md) + +## Updating secrets for the E2E tests + +At some point, E2E tests will fail because the secrets held in VCAP_SERVICES have expired. To refresh +them, you will need to do the following: + +1. Log in the normal way to access cloudfoundry command line options +2. Run `cf env notify-admin-staging` +3. Copy everything for the json in VCAP_SERVICES +4. Open a test file and make a new test anywhere that is convenient +5. Paste the secret into the test file +6. Make your test look like this: `print(json.dumps(VCAP_SERVICES))` +7. Copy the output of this test (stringified VCAP_SERVICES) into the VCAP_SERVICES secret in github on the staging tier +8. Delete everything you did in #4, #5, and #6. +9. Rerun the E2E tests +10. Note: Pay attention to whitespace, etc. It's very sensitive to formatting. diff --git a/tests/end_to_end/test_accounts_page.py b/tests/end_to_end/test_accounts_page.py index 2d1e77e49..0275b661c 100644 --- a/tests/end_to_end/test_accounts_page.py +++ b/tests/end_to_end/test_accounts_page.py @@ -85,16 +85,22 @@ def test_add_new_service_workflow(authenticated_page, end_to_end_context): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + page.click("text='Delete this service'") # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + page.click("text='Yes, delete'") # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + # Check to make sure that we've arrived at the next page. # Check the page title exists and matches what we expect. diff --git a/tests/end_to_end/test_create_new_template.py b/tests/end_to_end/test_create_new_template.py index 76086acf0..da75c2fb3 100644 --- a/tests/end_to_end/test_create_new_template.py +++ b/tests/end_to_end/test_create_new_template.py @@ -4,6 +4,7 @@ import re import uuid from playwright.sync_api import expect +from tests.end_to_end.conftest import check_axe_report E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI") @@ -16,6 +17,8 @@ def create_new_template(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + send_messages_button = page.get_by_role("link", name="Send messages") expect(send_messages_button).to_be_visible() @@ -23,6 +26,8 @@ def create_new_template(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + create_template_button = page.get_by_role("button", name="New template") expect(create_template_button).to_be_visible() @@ -30,6 +35,8 @@ def create_new_template(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + start_with_a_blank_template_radio = page.get_by_text("Start with a blank template") expect(start_with_a_blank_template_radio).to_be_visible() @@ -43,6 +50,8 @@ def create_new_template(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + template_name_input = page.get_by_text("Template name") expect(template_name_input).to_be_visible() @@ -59,6 +68,8 @@ def create_new_template(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + use_this_template_button = page.get_by_text("Use this template") expect(use_this_template_button).to_be_visible() @@ -80,6 +91,8 @@ def create_new_template(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + # We are not going to send the message for this test, we just want to confirm # that the template has been created and we are now seeing the message from the @@ -92,6 +105,8 @@ def test_create_new_template(end_to_end_context): page.goto(f"{E2E_TEST_URI}/sign-in") # Wait for the next page to fully load. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + current_date_time = datetime.datetime.now() new_service_name = "E2E Federal Test Service {now} - {browser_type}".format( @@ -102,6 +117,8 @@ def test_create_new_template(end_to_end_context): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + # Check to make sure that we've arrived at the next page. # Check the page title exists and matches what we expect. @@ -130,6 +147,8 @@ def test_create_new_template(end_to_end_context): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + # Check for the sign in heading. about_heading = page.get_by_role("heading", name="About your service") @@ -150,6 +169,8 @@ def test_create_new_template(end_to_end_context): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + # TODO this fails on staging due to duplicate results on 'get_by_text' # Check for the service name title and heading. @@ -168,16 +189,22 @@ def _teardown(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + page.click("text='Delete this service'") # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + page.click("text='Yes, delete'") # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + # Check to make sure that we've arrived at the next page. # Check the page title exists and matches what we expect. diff --git a/tests/end_to_end/test_invite_team_member_to_service.py b/tests/end_to_end/test_invite_team_member_to_service.py index d70ae0b7b..bbee9e3ce 100644 --- a/tests/end_to_end/test_invite_team_member_to_service.py +++ b/tests/end_to_end/test_invite_team_member_to_service.py @@ -21,6 +21,8 @@ def _setup(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + # Check to make sure that we've arrived at the next page. # Check the page title exists and matches what we expect. @@ -49,6 +51,8 @@ def _setup(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + # Check for the sign in heading. about_heading = page.get_by_role("heading", name="About your service") @@ -69,6 +73,8 @@ def _setup(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + # TODO this fails on staging due to duplicate results on 'get_by_text' # Check for the service name title and heading. @@ -98,6 +104,8 @@ def test_invite_team_member_to_service(authenticated_page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + # Check for invite a team member button invite_team_member_button = page.get_by_role("button", name="Invite a team member") @@ -172,6 +180,8 @@ def _teardown(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + # Check to make sure that we've arrived at the next page. # Check the page title exists and matches what we expect. diff --git a/tests/end_to_end/test_send_message_from_existing_template.py b/tests/end_to_end/test_send_message_from_existing_template.py index ce99f8055..64a3ba64c 100644 --- a/tests/end_to_end/test_send_message_from_existing_template.py +++ b/tests/end_to_end/test_send_message_from_existing_template.py @@ -23,6 +23,8 @@ def _setup(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + # Check to make sure that we've arrived at the next page. # Check the page title exists and matches what we expect. @@ -72,6 +74,8 @@ def _setup(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + # TODO this fails on staging due to duplicate results on 'get_by_text' # Check for the service name title and heading. @@ -352,6 +356,8 @@ def _teardown(page): # Check to make sure that we've arrived at the next page. page.wait_for_load_state("domcontentloaded") + check_axe_report(page) + page.click("text='Yes, delete'")