MVp
This commit is contained in:
33
tests/e2e/home.spec.ts
Normal file
33
tests/e2e/home.spec.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { test, expect } from '@playwright/test'
|
||||
|
||||
test('sticky CTA present and i18n toggle works', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
const cta = page.locator('.floatingCTA')
|
||||
await expect(cta).toBeVisible()
|
||||
const toggle = page.getByRole('button', { name: /switch language/i })
|
||||
await expect(toggle).toBeVisible()
|
||||
await toggle.click()
|
||||
await page.waitForURL(/lang=de/)
|
||||
await expect(page.locator('text=Jetzt anfragen').first()).toBeVisible()
|
||||
})
|
||||
|
||||
test('CLS guard on hero: cumulative layout shift stays under 0.05', async ({ page }) => {
|
||||
await page.addInitScript(() => {
|
||||
(window as any).__cls = 0
|
||||
new PerformanceObserver((list) => {
|
||||
for (const entry of list.getEntries() as PerformanceEntry[] & any) {
|
||||
if (!entry.hadRecentInput) {
|
||||
;(window as any).__cls += (entry as any).value
|
||||
}
|
||||
}
|
||||
}).observe({ type: 'layout-shift', buffered: true })
|
||||
})
|
||||
await page.goto('/')
|
||||
await page.waitForTimeout(1000)
|
||||
const cls = await page.evaluate(() => (window as any).__cls || 0)
|
||||
expect(cls).toBeLessThan(0.05)
|
||||
})
|
||||
|
||||
test.skip('FAQ a11y keyboard toggling (deferred)', async ({ page }) => {
|
||||
await page.goto('/')
|
||||
})
|
||||
Reference in New Issue
Block a user