Skip to content

Commit

Permalink
test(lapis-docs): make sure that the tests recognize the "not found" …
Browse files Browse the repository at this point in the history
…page
  • Loading branch information
fengelniederhammer committed Sep 30, 2024
1 parent d4137b3 commit f4ff783
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lapis-docs/tests/docs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ test.describe('The documentation', () => {

await clickOnAllLinksInNavigation(page);
});

test('should recognize the "not found" page', async ({ page }) => {
await page.goto(baseUrl + '/this/page/does/not/exist');
await expect(getNotFoundPageIdentifier(page)).toBeVisible();
});
});

function findNeighbouringPages(indexOfCurrentPage: number) {
Expand Down Expand Up @@ -170,12 +175,16 @@ async function clickOnAllRelativeLinksInMainBody(page: Page) {
await relativeLink.click();

const errorMessage = `Went to ${page.url()} from ${currentPageUrl}, but did not find target page.`;
await expect(page.getByText('Page not found.'), errorMessage).not.toBeVisible();
await expect(getNotFoundPageIdentifier(page), errorMessage).not.toBeVisible();

await page.goBack();
}
}

function getNotFoundPageIdentifier(page: Page) {
return page.getByText('Page not found.');
}

async function clickOnAllLinksInNavigation(page: Page) {
const clickedLinks: Record<string, number> = {};

Expand Down

0 comments on commit f4ff783

Please sign in to comment.