fix: CMP E2E — relax selectors + replace networkidle in preview tests
Dashboard: 3 selector fixes (banner link, KPI values, DSR link). Preview: replaced all networkidle with domcontentloaded + 2s wait. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,8 @@ const PREVIEW_URL = '/sdk/cookie-banner/preview'
|
||||
test.describe('Preview Banner — First Visit', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(PREVIEW_URL)
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForLoadState('domcontentloaded')
|
||||
await page.waitForTimeout(2000)
|
||||
})
|
||||
|
||||
test('should show banner on page load', async ({ page }) => {
|
||||
@@ -45,7 +46,8 @@ test.describe('Preview Banner — First Visit', () => {
|
||||
test.describe('Preview Banner — EWR-Only Toggle', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(PREVIEW_URL)
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForLoadState('domcontentloaded')
|
||||
await page.waitForTimeout(2000)
|
||||
await page.waitForTimeout(500)
|
||||
})
|
||||
|
||||
@@ -75,7 +77,8 @@ test.describe('Preview Banner — EWR-Only Toggle', () => {
|
||||
test.describe('Preview Banner — Accept All', () => {
|
||||
test('should close banner and show consent in debug panel', async ({ page }) => {
|
||||
await page.goto(PREVIEW_URL)
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForLoadState('domcontentloaded')
|
||||
await page.waitForTimeout(2000)
|
||||
|
||||
// Click "Alle akzeptieren"
|
||||
await page.getByRole('button', { name: 'Alle akzeptieren' }).click()
|
||||
@@ -91,7 +94,8 @@ test.describe('Preview Banner — Accept All', () => {
|
||||
|
||||
test('should show API response in debug panel after accept', async ({ page }) => {
|
||||
await page.goto(PREVIEW_URL)
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForLoadState('domcontentloaded')
|
||||
await page.waitForTimeout(2000)
|
||||
|
||||
await page.getByRole('button', { name: 'Alle akzeptieren' }).click()
|
||||
await page.waitForTimeout(1000)
|
||||
@@ -107,7 +111,8 @@ test.describe('Preview Banner — Accept All', () => {
|
||||
test.describe('Preview Banner — Nur notwendige Cookies', () => {
|
||||
test('should save minimal consent and close banner', async ({ page }) => {
|
||||
await page.goto(PREVIEW_URL)
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForLoadState('domcontentloaded')
|
||||
await page.waitForTimeout(2000)
|
||||
|
||||
// Click "Nur notwendige Cookies"
|
||||
await page.getByText('Nur notwendige Cookies').click()
|
||||
@@ -131,7 +136,8 @@ test.describe('Preview Banner — Nur notwendige Cookies', () => {
|
||||
test.describe('Preview Banner — Consent Persistence', () => {
|
||||
test('banner should not reappear after accepting and reloading', async ({ page }) => {
|
||||
await page.goto(PREVIEW_URL)
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForLoadState('domcontentloaded')
|
||||
await page.waitForTimeout(2000)
|
||||
|
||||
// Accept all
|
||||
await page.getByRole('button', { name: 'Alle akzeptieren' }).click()
|
||||
@@ -139,7 +145,8 @@ test.describe('Preview Banner — Consent Persistence', () => {
|
||||
|
||||
// Reload the page
|
||||
await page.reload()
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForLoadState('domcontentloaded')
|
||||
await page.waitForTimeout(2000)
|
||||
await page.waitForTimeout(2000)
|
||||
|
||||
// The banner checks consent via API, so the overlay should not appear
|
||||
@@ -155,7 +162,8 @@ test.describe('Preview Banner — Consent Persistence', () => {
|
||||
test.describe('Preview Banner — Cookie FAB Button', () => {
|
||||
test('should show footer link to reopen banner after consent', async ({ page }) => {
|
||||
await page.goto(PREVIEW_URL)
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForLoadState('domcontentloaded')
|
||||
await page.waitForTimeout(2000)
|
||||
|
||||
// Accept to close the banner
|
||||
await page.getByRole('button', { name: 'Alle akzeptieren' }).click()
|
||||
@@ -168,7 +176,8 @@ test.describe('Preview Banner — Cookie FAB Button', () => {
|
||||
|
||||
test('should reopen banner when footer button is clicked', async ({ page }) => {
|
||||
await page.goto(PREVIEW_URL)
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForLoadState('domcontentloaded')
|
||||
await page.waitForTimeout(2000)
|
||||
|
||||
// Accept to close
|
||||
await page.getByRole('button', { name: 'Alle akzeptieren' }).click()
|
||||
@@ -189,7 +198,8 @@ test.describe('Preview Banner — Cookie FAB Button', () => {
|
||||
test.describe('Preview Banner — Consent Reset', () => {
|
||||
test('should reset consent when "zuruecksetzen" is clicked', async ({ page }) => {
|
||||
await page.goto(PREVIEW_URL)
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForLoadState('domcontentloaded')
|
||||
await page.waitForTimeout(2000)
|
||||
|
||||
// Accept consent first
|
||||
await page.getByRole('button', { name: 'Alle akzeptieren' }).click()
|
||||
@@ -215,7 +225,8 @@ test.describe('Preview Banner — Consent Reset', () => {
|
||||
test.describe('Preview Banner — API Debug Panel', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(PREVIEW_URL)
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForLoadState('domcontentloaded')
|
||||
await page.waitForTimeout(2000)
|
||||
})
|
||||
|
||||
test('should display API Debug section', async ({ page }) => {
|
||||
@@ -244,7 +255,8 @@ test.describe('Preview Banner — API Debug Panel', () => {
|
||||
test.describe('Preview Banner — Category Toggles', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(PREVIEW_URL)
|
||||
await page.waitForLoadState('networkidle')
|
||||
await page.waitForLoadState('domcontentloaded')
|
||||
await page.waitForTimeout(2000)
|
||||
await page.waitForTimeout(500)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user