-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.spec.js
More file actions
30 lines (25 loc) · 1.11 KB
/
index.spec.js
File metadata and controls
30 lines (25 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const { test, expect } = require('@playwright/test');
import AxeBuilder from '@axe-core/playwright';
test.describe('Generic Webpage Tests', () => {
test('should load the webpage successfully', async ({ page }) => {
const response = await page.goto('/');
const title = await page.title();
await expect(response.status()).toBe(200);
});
test('should take a screenshot of the webpage', async ({ page }) => {
await page.goto('/');
await page.screenshot({ path: 'example-screenshot.png', fullPage: true });
});
// https://playwright.dev/docs/accessibility-testing
test('should not have any automatically detectable accessibility issues', async ({ page }) => {
await page.goto('/');
const accessibilityScanResults = await new AxeBuilder({ page }).analyze();
expect(accessibilityScanResults.violations).toEqual([]);
});
// Example test of finding a an html element on the index/home page
// test('should check for an element to be visible', async ({ page }) => {
// await page.goto('/');
// const element = page.locator('h1');
// await expect(element).toBeVisible();
// });
});