mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
rip. you served a purpose once, but now you're just getting in the way. this improves typesafety quite a bit, because `BrowserInterface` had a whole bunch of random `any`s everywhere also - removes `evalAsync`. no idea why that was needed, but we're happily using promises in normal eval, so it can be dropped - adds more safety to `chain`
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
import { check } from 'next-test-utils'
|
|
import type { Playwright } from 'next-webdriver'
|
|
|
|
describe('app a11y features', () => {
|
|
const { next, skipped } = nextTestSetup({
|
|
files: __dirname,
|
|
packageJson: {},
|
|
skipDeployment: true,
|
|
})
|
|
|
|
if (skipped) {
|
|
return
|
|
}
|
|
|
|
describe('route announcer', () => {
|
|
async function getAnnouncerContent(browser: Playwright) {
|
|
return browser.eval(
|
|
`document.getElementsByTagName('next-route-announcer')[0]?.shadowRoot.childNodes[0]?.innerHTML`
|
|
)
|
|
}
|
|
|
|
it('should not announce the initital title', async () => {
|
|
const browser = await next.browser('/page-with-h1')
|
|
await check(() => getAnnouncerContent(browser), '')
|
|
})
|
|
|
|
it('should announce document.title changes', async () => {
|
|
const browser = await next.browser('/page-with-h1')
|
|
await browser.elementById('page-with-title').click()
|
|
await check(() => getAnnouncerContent(browser), 'page-with-title')
|
|
})
|
|
|
|
it('should announce h1 changes', async () => {
|
|
const browser = await next.browser('/page-with-h1')
|
|
await browser.elementById('noop-layout-page-1').click()
|
|
await check(() => getAnnouncerContent(browser), 'noop-layout/page-1')
|
|
})
|
|
|
|
it('should announce route changes when h1 changes inside an inner layout', async () => {
|
|
const browser = await next.browser('/noop-layout/page-1')
|
|
await browser.elementById('noop-layout-page-2').click()
|
|
await check(() => getAnnouncerContent(browser), 'noop-layout/page-2')
|
|
})
|
|
})
|
|
})
|