Skip to content

Commit 421546b

Browse files
committed
Fix flaky E2E test cases - Contact API spec no longer wipes all Resend logs between tests, so concurrent suites keep their evidence intact
1 parent 2b1ac56 commit 421546b

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"Joomla",
4545
"jscoverage",
4646
"Karamov",
47+
"keyup",
4748
"KHTML",
4849
"koko",
4950
"labelledby",

test/e2e/specs/07-performance/PERFORMANCE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
Failures: Firefox + Mobile Safari FID measured 127 ms/126 ms (threshold 100 ms) and Chrome/Edge/Mobile Chrome TBT measured 297 ms-511 ms (threshold 200 ms).
44

5-
## FID regressions (Firefox, Mobile Safari)
5+
## First Input Delay (FID) regressions (Firefox, Mobile Safari)
66

77
- measureFID clicks the first interactive container right after networkidle, so any document-level listener that executes synchronously inflates this metric. index.ts binds multiple global click, touchend, and keydown handlers plus Lit store updates during initialize(). Those handlers always run before the synthetic click resolves, keeping the main thread busy for ~25 ms on desktop and ~40 ms on mobile.
88

99
- index.ts eagerly instantiates focus-trap, registers document keyup/pointerdown, and intercepts every nav link to reroute through astro:transitions. All of that work executes before the first user click completes, which is why only browsers with slower event loop scheduling (Gecko/WebKit) exceed 100 ms.
1010
Mitigations: lazily register these web components behind requestIdleCallback/queueMicrotask so initial navigation/interactions aren't blocked; bind document listeners only after the relevant UI opens; gate LitElement hydration on an IntersectionObserver so off-screen modals (theme picker) stay inert until revealed.
1111

12-
## TBT regressions (Chromium desktop + mobile)
12+
## Total Blocking Time (TBT) regressions (Chromium desktop + mobile)
1313

1414
- Carousels (index.ts and index.ts) synchronously instantiate Embla + Autoplay during DOMContentLoaded, even when the slider is below the fold. Embla's layout sync plus dot/button building accounts for ~180 ms of long tasks per carousel; Mobile Chrome shows 500 ms because hero and testimonial sliders initialize back-to-back.
1515

test/e2e/specs/08-api/contact-api.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ test.describe('Contact API integrations', () => {
1010

1111
test.describe.configure({ mode: 'serial' })
1212

13-
test.beforeEach(async () => {
14-
await wiremock.resend.resetRequests()
15-
})
16-
1713
test('@mocks delivers transactional email payload to Resend', async ({ request }) => {
1814
const uniqueEmail = `contact-${Date.now()}@example.com`
1915
const response = await request.post(CONTACT_ENDPOINT, {
@@ -58,13 +54,14 @@ test.describe('Contact API integrations', () => {
5854
})
5955

6056
test('@mocks rejects invalid submissions before reaching Resend', async ({ request }) => {
57+
const invalidEmail = `invalid-contact-${Date.now()}@example.com`
6158
const response = await request.post(CONTACT_ENDPOINT, {
6259
headers: {
6360
'x-e2e-mocks': '1',
6461
},
6562
data: {
6663
name: 'x',
67-
email: 'invalid-email',
64+
email: invalidEmail,
6865
message: 'short',
6966
},
7067
})
@@ -73,6 +70,7 @@ test.describe('Contact API integrations', () => {
7370
const requests = await wiremock.resend.findRequests({
7471
method: 'POST',
7572
urlPath: RESEND_EMAIL_PATH,
73+
bodyIncludes: invalidEmail,
7674
})
7775
expect(requests.length).toBe(0)
7876
})

0 commit comments

Comments
 (0)