Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions application/CohortManager/src/Web/tests/features/home.feature
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,22 @@ Feature: testing Breast screening - Cohort Manager home page
Scenario: verify navigation to cookies screen
And the user clicks on cookies link
Then they should navigate to 'Cookies on Cohort Manager - Cohort Manager - NHS'

@epic_4a @req_6330
Scenario: verify error message for invalid URL
When the user navigates to an invalid URL
Then the page should display 'Page not found' on screen
And the page not found error screen should include a 'Return to the homepage' link
And the page not found error screen should include a 'Contact us' link

@epic_4a @req_6330
Scenario: verify navigation to home from error page
When the user navigates to an invalid URL
And the user clicks on the 'Return to the homepage' link
Then they should navigate to 'Breast screening - Cohort Manager - NHS'

@epic_4a @req_6330
Scenario: verify navigation to contact us from error page
When the user navigates to an invalid URL
And the user clicks on the 'Contact us' link
Then they should navigate to 'Get help with Cohort Manager - Cohort Manager - NHS'
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,20 @@ When('the user clicks on cookies link', async ({ page }) => {
homePage = new HomePage(page);
await homePage.clickOnCookiesLink()
});
When('the user navigates to an invalid URL', async ({ page }) => {
// Navigate to a non-existent page to trigger 404
await page.goto('https://localhost:3000/exception');
});
Then("the page should display {string} on screen", async ({ page }, errorType) => {
// Check for a heading or text that indicates 404
await expect(page.getByRole('heading', { name: new RegExp(errorType, 'i') })).toBeVisible();
});
Then("the page not found error screen should include a {string} link", async ({ page }, link) => {
// Check for the presence of the return link
const linkLocator = page.getByRole('link', { name: new RegExp(link, 'i') }).first();
await expect(linkLocator).toBeVisible();
});
When('the user clicks on the {string} link', async ({ page }, linkText) => {
const linkLocator = page.getByRole('link', { name: new RegExp(linkText, 'i') }).first();
await linkLocator.click();
});
Loading