Skip to content

Commit 3c7ce15

Browse files
committed
Fix flakiness by removing the per-test wiremock.resend.resetRequests() call in newsletter-api.spec.ts
1 parent 019e2ff commit 3c7ce15

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

eslint.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export default [
9797
'^astro:.*', // Ignore Astro virtual modules
9898
'^virtual:pwa-register$',
9999
'^\\./.*', // Ignore relative imports (let TypeScript handle these)
100+
'test/e2e/specs/14-system/package-release.spec.ts', // Ignore dynamic imports
100101
],
101102
},
102103
],
@@ -260,7 +261,7 @@ export default [
260261
],
261262
ignores: [
262263
'test/e2e/helpers/pageObjectModels/**/*',
263-
'src/test/e2e/specs/__tests__/**',
264+
'test/e2e/specs/__tests__/**',
264265
],
265266
rules: {
266267
'no-restricted-syntax': [

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

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

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

13-
test.beforeEach(async () => {
14-
await wiremock.resend.resetRequests()
15-
})
16-
1713
test('@mocks sends double opt-in email through Resend mock', async ({ request }) => {
1814
const uniqueEmail = `newsletter-${Date.now()}@example.com`
1915
const response = await request.post(NEWSLETTER_ENDPOINT, {
@@ -58,12 +54,13 @@ test.describe('Newsletter API integrations', () => {
5854
})
5955

6056
test('@mocks requires consent before sending any emails', async ({ request }) => {
57+
const emailWithoutConsent = 'noconsent@example.com'
6158
const response = await request.post(NEWSLETTER_ENDPOINT, {
6259
headers: {
6360
'x-e2e-mocks': '1',
6461
},
6562
data: {
66-
email: 'noconsent@example.com',
63+
email: emailWithoutConsent,
6764
consentGiven: false,
6865
},
6966
})
@@ -72,6 +69,7 @@ test.describe('Newsletter API integrations', () => {
7269
const requests = await wiremock.resend.findRequests({
7370
method: 'POST',
7471
urlPath: RESEND_EMAIL_PATH,
72+
bodyIncludes: emailWithoutConsent,
7573
})
7674
expect(requests.length).toBe(0)
7775
})

0 commit comments

Comments
 (0)