accessibility.spec.ts 731 B

12345678910111213141516171819202122
  1. import { test } from './fixtures'
  2. import { createRandomPage } from './utils'
  3. import { expect } from '@playwright/test'
  4. import AxeBuilder from '@axe-core/playwright'
  5. test('should not have any automatically detectable accessibility issues', async ({ page }) => {
  6. try {
  7. await page.waitForSelector('.notification-clear', { timeout: 10 })
  8. page.click('.notification-clear')
  9. } catch (error) {
  10. }
  11. await createRandomPage(page)
  12. await page.waitForTimeout(2000)
  13. const accessibilityScanResults = await new AxeBuilder({ page })
  14. .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
  15. .disableRules(['meta-viewport'])
  16. .setLegacyMode()
  17. .analyze()
  18. expect(accessibilityScanResults.violations).toEqual([]);
  19. })