0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 01:22:07 +01:00
wagtail/client/tests/integration/homepage.test.js
LB (Ben Johnston) 042d077fc1
Minor accessibility fixes to new slim sidebar menu items (#8015)
* Consistently set `aria-haspopup="menu"` for all sidebar menu items that have sub-menus (LB (Ben Johnston))
 * Make sure `aria-expanded` is always explicitly set as a string in sidebar (LB (Ben Johnston))
 * Use a button element instead of a link for page explorer menu item, for the correct semantics and behavior (LB (Ben Johnston))
2022-03-15 14:53:40 +00:00

48 lines
1.3 KiB
JavaScript

describe('Homepage', () => {
beforeAll(async () => {
await page.goto(`${TEST_ORIGIN}/admin/`, {
waitUntil: 'domcontentloaded',
});
});
it('has the right heading', async () => {
const pageHeader = await page.$('h1');
const pageHeaderValue = await pageHeader.evaluate((el) => el.textContent);
expect(pageHeaderValue).toContain('Welcome to the Test Site Wagtail CMS');
});
it('axe', async () => {
await expect(page).toPassAxeTests({
exclude: '.stats, .skiplink, #wagtail-sidebar, .sidebar__collapse-toggle',
});
});
it('axe page explorer', async () => {
const trigger = await page.$(
'.sidebar-page-explorer-item [aria-haspopup="menu"]',
);
await trigger.click();
await expect(page).toPassAxeTests({
include: '.sidebar-main-menu',
});
});
it('axe sidebar sub-menu', async () => {
const trigger = await page.$(
'.sidebar-sub-menu-item [aria-haspopup="menu"]',
);
await trigger.click();
await expect(page).toPassAxeTests({
include: '.sidebar-main-menu',
});
});
it('axe sidebar footer', async () => {
const trigger = await page.$('[aria-label="Edit your account"]');
await trigger.click();
await expect(page).toPassAxeTests({
include: '.sidebar-footer',
});
});
});