homepage.test.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. jest.setTimeout(30000);
  2. describe('Homepage', () => {
  3. beforeAll(async () => {
  4. await page.goto(`${TEST_ORIGIN}/admin/`, {
  5. waitUntil: 'domcontentloaded',
  6. });
  7. });
  8. it('has the right heading', async () => {
  9. const pageHeader = await page.$('h1');
  10. const pageHeaderValue = await pageHeader.evaluate((el) => el.textContent);
  11. expect(pageHeaderValue).toContain('Test Site');
  12. });
  13. it('axe', async () => {
  14. await expect(page).toPassAxeTests({
  15. exclude: '.stats, .skiplink, #wagtail-sidebar, .sidebar__collapse-toggle',
  16. });
  17. });
  18. it('axe page explorer', async () => {
  19. const trigger = await page.$(
  20. '.sidebar-page-explorer-item [aria-haspopup="dialog"]',
  21. );
  22. await trigger.click();
  23. await expect(page).toPassAxeTests({
  24. include: '.sidebar-main-menu',
  25. });
  26. });
  27. it('axe sidebar sub-menu', async () => {
  28. const trigger = await page.$(
  29. '.sidebar-sub-menu-item [aria-haspopup="menu"]',
  30. );
  31. await trigger.click();
  32. await expect(page).toPassAxeTests({
  33. include: '.sidebar-main-menu',
  34. });
  35. });
  36. });