NCIOCPL / clinical-trials-listing-app

React Application for listing clinical trials
3 stars 1 forks source link

Story: "404" Screen for when the intervention does not exist. #38

Closed VictoriaSunNIH closed 3 years ago

VictoriaSunNIH commented 3 years ago

As a user, I want to know that I entered the wrong intervention code by being presented with a 404 page so that I can check my URL and ensure that I entered the correct information.

Use the 404 page that we use in other apps (glossary, drug dictionary, etc.)

ESTIMATE 2

Acceptance Criteria

Scenario: Page Not Found displays when a user views a dynamic listing page with invalid intervention parameter
  Given user navigates to “/C123455”
    And "trialListingPageType" is set to "Intervention"
    When the user has entered an incorrect intervention
  Then the system redirects users to a 404 page 
     Then page title on error page is "Page Not Found"
     And the search bar appears below the text
     And the following links and texts exist on the page: "We can't find the page you're looking for." Visit the homepage, browse by cancer type, or use the search below." "Have a question? Get in touch."

      | https://www.cancer.gov          | homepage      | 
      | https://www.cancer.gov/types    | cancer type   | 
      | https://www.cancer.gov/contact  | Get in touch  |
And the system returns a 404 status code
Given the application returns a "Page not found" message
 Then the title tag should be "Page Not Found"
  Then the page should contain the markup <meta name="prerender-status-code" content="404">
Scenario: Page Load Analytics fires for a 404 with invalid intervention
 Given "trialListingPageType" is set to "Intervention"
    And "baseHost" is set to "http://localhost:3000"
    And "canonicalHost" is set to "https://www.cancer.gov"
    And "analyticsPublishedDate" is set to "02/02/2011"
    And "siteName" is set to "National Cancer Institute"
 When the user navigates to "/c123456"
   Then page title on error page is "Page Not Found"
    And browser waits
   Then there should be an analytics event with the following details

| key                                          | value                                            |
| type                                         | PageLoad                                         |
| event                                        | TrialListingPageApp:Load:PageNotFound            |
| page.name                                    | www.cancer.gov/c123456                           |
| page.title                                   | Page Not Found                                   |
| page.metaTitle                               | Page Not Found                                   |
| page.language                                | english                                          |
| page.type                                    | nciAppModulePage                                 |
| page.channel                                 | Clinical Trials                                  |
| page.contentGroup                            | Clinical Trials: Custom                          |
| page.additionalDetails.trialListingPageType  | intervention                |

Resources:

Notes

Adding markup will allow a pre-renderer to detect the error and report the correct 404 status code.

Some complementary notes if necessary:


Solution

As had been designed, the higher order component that fetches the listing info will be responsible for showing the 404 when one of the parameters that is fetched returns a 404 from the API.

Prerequisites

Tasks

Technical Notes

VictoriaSunNIH commented 3 years ago

Covered by #18