test(e2e,playwright): FourOhFour component (#51962)

Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
Arjun Singh Rawat
2023-10-31 22:33:56 +05:30
committed by GitHub
parent 2dd3712054
commit 86ae296d04

36
e2e/four-oh-four.spec.ts Normal file
View File

@@ -0,0 +1,36 @@
import { test, expect } from '@playwright/test';
import translations from '../client/i18n/locales/english/translations.json';
test.beforeEach(async ({ page }) => {
await page.goto('/404');
});
test.describe('FourOhFour component', () => {
test('should display the content correctly', async ({ page }) => {
const image = page.getByTestId('not-found-image');
await expect(image).toBeVisible();
await expect(image).toHaveAttribute(
'alt',
translations['404']['not-found']
);
const heading = page.getByTestId('not-found-heading');
await expect(heading).toBeVisible();
await expect(heading).toContainText(translations['404']['page-not-found']);
const heresQuoteParagraph = page.getByTestId('heres-quote-paragraph');
await expect(heresQuoteParagraph).toBeVisible();
await expect(heresQuoteParagraph).toContainText(
translations['404']['heres-a-quote']
);
await expect(page.getByTestId('quote-wrapper')).toBeVisible();
const curriculumLinkBtn = page.getByTestId('view-curriculum-btn');
await expect(curriculumLinkBtn).toBeVisible();
await expect(curriculumLinkBtn).toHaveAttribute('href', '/learn');
await expect(curriculumLinkBtn).toContainText(
translations.buttons['view-curriculum']
);
});
});