diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index 24b3e0490..4d5aca14d 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -76,6 +76,7 @@ def service_dashboard(service_id): "notifications": aggregate_notifications_by_job.get(job["id"], []), } for job in job_response + if aggregate_notifications_by_job.get(job["id"], []) ] return render_template( "views/dashboard/dashboard.html", diff --git a/app/templates/views/guidance/index.html b/app/templates/views/guidance/index.html index e754ef245..b7d6ffa1a 100644 --- a/app/templates/views/guidance/index.html +++ b/app/templates/views/guidance/index.html @@ -41,7 +41,7 @@

To create and format your message

  1. All messages start from a template
  2. -
  3. Click “Send Messages”. You’ll see existing templates.
  4. +
  5. Click “Send Messages”. You’ll see existing templates.
  6. Add a new template or choose an existing template and select Edit.
@@ -120,7 +120,7 @@ {# Identify your program #} -

Identify your program

+

Identify your program

You can help your recipients identify your texts as legitimate by customizing your messages to clearly state who they are from. Consider using the program or benefit name that is most familiar to your recipients.

diff --git a/app/templates/views/pricing/index.html b/app/templates/views/pricing/index.html index 436da7735..73c67770e 100644 --- a/app/templates/views/pricing/index.html +++ b/app/templates/views/pricing/index.html @@ -30,7 +30,7 @@ more parts towards the allowance if you:

Long text messages

-

If a text message is longer than 160 characters (including spaces), it counts as more than one message.

+

If a text message is longer than 160 characters (including spaces), it counts as more than one message part.

{% call mapping_table( diff --git a/app/templates/views/roadmap.html b/app/templates/views/roadmap.html index 6ea2e7cfb..58c9ad4d1 100644 --- a/app/templates/views/roadmap.html +++ b/app/templates/views/roadmap.html @@ -50,9 +50,9 @@
  • Message send/failure analytics
  • - Next +

    Next

    -

    If the pilot is successful, we hope to recruit additional high-impact partners to improve outcomes for low-income individuals and families.

    +

    If the pilot is successful, we hope to recruit additional partners to improve outcomes for low-income individuals and families.

    Goals during this stage:

    diff --git a/app/templates/views/security.html b/app/templates/views/security.html index d676b37bf..6d0b3e67d 100644 --- a/app/templates/views/security.html +++ b/app/templates/views/security.html @@ -65,9 +65,9 @@

    Protect sensitive information

    Some messages include sensitive information like security codes or password reset links.

    If you’re sending a message with sensitive information, you can choose to hide those details on the Notify dashboard once the message has been sent. This means that only the message recipient will be able to see that information.

    + Screenshot of a test message in review with the link to 'hide personalization after sending' circled. -

    User permissions and signing in

    -

    You can set different user permissions in Notify. This lets you control who in your team has access to certain parts of the service.

    Two-factor authentication

    To sign in to Notify, you’ll need to enter:

    If signing in with a text message is a problem for your team, contact us to find out about using an email link instead.

    - Screenshot of a teat message in review with the link to 'hide personalization after sending' circled. - -

    How to hide PII after sending a message

    -

    User permissions and signing in

    You can set different user permissions in Notify. This lets you control who in your team has access to certain parts of the service.

    @@ -93,32 +88,4 @@

    If signing in with a text message is a problem for your team, contact us to find out about using an email link instead.

    - - - - - - {% endblock %} diff --git a/app/templates/views/support/index.html b/app/templates/views/support/index.html index d9d6abd53..dd5ad9c10 100644 --- a/app/templates/views/support/index.html +++ b/app/templates/views/support/index.html @@ -13,9 +13,9 @@

    Contact us

    Notify is designed to be easy to use.

    If you have other questions, we are available at notify-support@gsa.gov.

    diff --git a/docs/end_to_end_tests.md b/docs/end_to_end_tests.md index 02eec2e8b..11758a16e 100644 --- a/docs/end_to_end_tests.md +++ b/docs/end_to_end_tests.md @@ -106,6 +106,104 @@ All of the E2E tests are found in the `tests/end_to_end` folder and are written as `pytest` scripts using [Playwright's Python Framework](https://playwright.dev/python/docs/writing-tests). +Inside the `tests/end_to_end` folder you'll see a `conftest.py` file, +which is similar to the one found in the root `tests` folder but is +specific to the E2E tests. + +There a few fixtures defined in here, but the two most important at this +time are these: + +- `end_to_end_context`: A Playwright context object needed to interact + with a browser instance. +- `authenticated_page`: A Playwright page object that has gone through + the sign in process the E2E user is authenticated. + +In short, if you're starting a test from scratch and testing pages that +do not require authentication, you'll start with the +`end_to_end_context` fixture and work from there. + +Any test that requires you to be authenticated, you'll start with the +`authenticated_page` object as that'll have taken care of getting +everything set for you and logged into the site with the E2E test user. + + +### Creating a new test file + +If you want to create a new test file to help organize tests (a great +idea!), it will be handy to import the Playwright `expect` and set the +base URL/URI for yourself, like this: + +```python +from playwright.sync_api import expect + +E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI") +``` + +By importing Playwright's `expect` object for tests and setting +something like `E2E_TEST_URI` for yourself, it will make writing tests +much easier. + + +### Using the fixtures + +To use the `authenticated_page` or `end_to_end_context` fixtures, you +start by defining a test function and then passing in the fixture you +need as a positional argument. This works the same as the other +functions defined to create a test for pytest. + +For example, the test for the landing page starts with this: + +```python +def test_landing_page(end_to_end_context): + # Open a new page and go to the site. + page = end_to_end_context.browser.new_page() + page.goto(f"{E2E_TEST_URI}/") + + # Check to make sure that we've arrived at the next page. + page.wait_for_load_state("domcontentloaded") + ... +``` + +Note the passing in of the `end_to_end_context` fixture - there is no +need to import this or anything, just pass it into the function. pytest +takes care of everything else for you. + +The second line that defines a `page` variable is a convenience, since +you'll be referencing the page object a lot. This is recommended to +help keep tests readable while keeping fixture names descriptive. + +If you need to test an authenticate page, such as the accounts page, +use the `authenticated_page` fixture instead, like so: + +```python +def test_add_new_service_workflow(authenticated_page): + page = authenticated_page + ... +``` + +Again, it's helpful to assign the fixture to a `page` variable for easy +reference throughout the test. + +Lastly, if you need want access to the Playwright context object that is +used behind the page fixtures, you can reference it directly as well +using the `end_to_end_context` fixture: + +```python +def test_add_new_service_workflow(authenticated_page, end_to_end_context): + page = authenticated_page + + # Prepare for adding a new service later in the test. + current_date_time = datetime.datetime.now() + new_service_name = "E2E Federal Test Service {now} - {browser_type}".format( + now=current_date_time.strftime("%m/%d/%Y %H:%M:%S"), + browser_type=end_to_end_context.browser.browser_type.name, + ) + ... +``` + +In this example, I've used the context to get to the browser object +itself to get the name of the browser for test data. + ## Maintaining E2E Tests with GitHub diff --git a/tests/end_to_end/conftest.py b/tests/end_to_end/conftest.py index 48d1bcd35..16940d4e0 100644 --- a/tests/end_to_end/conftest.py +++ b/tests/end_to_end/conftest.py @@ -68,12 +68,6 @@ def login_for_end_to_end_testing(browser): context.storage_state(path=auth_state_path) -@pytest.fixture(scope="session") -def end_to_end_context(browser): - context = browser.new_context() - return context - - @pytest.fixture(scope="session") def end_to_end_authenticated_context(browser): # Create and load a previously authenticated context for Playwright E2E @@ -89,17 +83,25 @@ def end_to_end_authenticated_context(browser): @pytest.fixture(scope="session") -def authenticated_page(end_to_end_context): - # Open a new page and go to the staging site. - page = end_to_end_context.new_page() +def end_to_end_context(browser): + context = browser.new_context() + return context + +@pytest.fixture(scope="session") +def authenticated_page(end_to_end_context): + # Open a new page and go to the site. + page = end_to_end_context.new_page() page.goto(f"{E2E_TEST_URI}/") - sign_in_button = page.get_by_role("link", name="Sign in") + # Wait for the next page to fully load. + page.wait_for_load_state("domcontentloaded") # Sign in to the site - E2E test accounts are set to flow through. + sign_in_button = page.get_by_role("link", name="Sign in") sign_in_button.click() # Wait for the next page to fully load. page.wait_for_load_state("domcontentloaded") + return page diff --git a/tests/end_to_end/test_accounts_page.py b/tests/end_to_end/test_accounts_page.py index 411728e33..b6fe8c5ac 100644 --- a/tests/end_to_end/test_accounts_page.py +++ b/tests/end_to_end/test_accounts_page.py @@ -9,10 +9,6 @@ E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI") def test_add_new_service_workflow(authenticated_page, end_to_end_context): page = authenticated_page - page.goto(f"{E2E_TEST_URI}/") - - # Wait for the next page to fully load. - page.wait_for_load_state("domcontentloaded") # Prepare for adding a new service later in the test. current_date_time = datetime.datetime.now() diff --git a/tests/end_to_end/test_landing_and_sign_in_pages.py b/tests/end_to_end/test_landing_and_sign_in_pages.py index dd6a70beb..a9148cb31 100644 --- a/tests/end_to_end/test_landing_and_sign_in_pages.py +++ b/tests/end_to_end/test_landing_and_sign_in_pages.py @@ -7,7 +7,7 @@ E2E_TEST_URI = os.getenv("NOTIFY_E2E_TEST_URI") def test_landing_page(end_to_end_context): - # Open a new page and go to the staging site. + # Open a new page and go to the site. page = end_to_end_context.browser.new_page() page.goto(f"{E2E_TEST_URI}/")