Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion test/e2e/_ahrefs-analytics-suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ function buildStubAnalyticsJs(endpoint: string): string {
`
}

// The loader tag renders after Nuxt resolves suspense and the idle callback
// runs. A cold fixture start on CI can push that well past domcontentloaded,
// so the wait needs a cold-start budget the 60s test timeout cannot cover.
const COLD_START_TIMEOUT_MS = 30000

const CDN_STUB = buildStubAnalyticsJs('https://analytics.ahrefs.com/api/event')
const BUNDLED_PROXY_PATH = '/_scripts/p/analytics.ahrefs.com/api/event'

Expand Down Expand Up @@ -153,7 +158,7 @@ export function defineAhrefsAnalyticsSuite(opts: SuiteOptions) {
const scriptSelector = opts.bundled
? 'script[src*="/_scripts/assets/"]'
: 'script[src*="analytics.ahrefs.com/analytics.js"]'
await page.waitForSelector(scriptSelector, { state: 'attached', timeout: 30000 })
await page.waitForSelector(scriptSelector, { state: 'attached', timeout: COLD_START_TIMEOUT_MS })
const tag = await page.evaluate((sel: string) => {
const el = document.querySelector<HTMLScriptElement>(sel)
return el ? { src: el.src, key: el.getAttribute('data-key') } : null
Expand Down
9 changes: 7 additions & 2 deletions test/e2e/_usercentrics-suite.ts

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open (82/100): The flake budget bump may be insufficient: short waits after the initial selector wait and unchanged suites can still exceed their timeouts on a cold CI start, and CI on head is red.

Proof: The required check "test" fails on the head commit cf712e0 while the PR's purpose is to stop that flake. Line 82 still bounds a later waitForFunction at 15000, and other suites (calendly, linkedin, partytown) keep 15000 waits under 60000 te.

Next: Raise the remaining 15000 waitForFunction budget in this suite (and audit calendly/linkedin/partytown suites) to a cold-start-safe value, then confirm the "test" check passes on head.

Harlan Agent Kit posted this automated review. It is not Harlan's personal review or approval. AI open source policy.

Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { getBrowser, url } from '@nuxt/test-utils/e2e'
import { expect, it } from 'vitest'

// The v3 loader tag renders after Nuxt resolves suspense and the idle callback
// runs. A cold fixture start on CI can push that well past domcontentloaded,
// so this wait needs the same cold-start budget as the other suites.
const COLD_START_TIMEOUT_MS = 30000

// The real Usercentrics CMP v3 loader validates `data-ruleset-id` against
// registered domains and silently no-ops on unknown origins. Tests stub the
// loader request and inject a minimal `__ucCmp` shim plus synthesised
Expand Down Expand Up @@ -45,7 +50,7 @@ export function defineUsercentricsSuite() {
const page = await newPage()
try {
await page.goto(url('/'), { waitUntil: 'domcontentloaded', timeout: 30000 })
await page.waitForSelector('script#usercentrics-cmp', { state: 'attached', timeout: 15000 })
await page.waitForSelector('script#usercentrics-cmp', { state: 'attached', timeout: COLD_START_TIMEOUT_MS })
const attrs = await page.evaluate(() => {
const el = document.getElementById('usercentrics-cmp') as HTMLScriptElement | null
if (!el)
Expand All @@ -62,7 +67,7 @@ export function defineUsercentricsSuite() {
finally {
await page.close()
}
}, 60000)
}, 90000)

it('fires UC_UI_CMP_EVENT events that the composable surfaces via onConsentChange', async () => {
const page = await newPage()
Expand Down
Loading