Skip to content

Commit 5202e76

Browse files
committed
await envelopePromise after clicking
1 parent e1ffe52 commit 5202e76

File tree

1 file changed

+12
-4
lines changed
  • dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions

1 file changed

+12
-4
lines changed

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/interactions/test.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ sentryTest('should capture interaction transaction. @firefox', async ({ browserN
3232
await page.goto(url);
3333
await getFirstSentryEnvelopeRequest<SentryEvent>(page);
3434

35+
const envelopesPromise = getMultipleSentryEnvelopeRequests<TransactionJSON>(page, 1);
36+
3537
await page.locator('[data-test-id=interaction-button]').click();
3638
await page.locator('.clicked[data-test-id=interaction-button]').isVisible();
3739

38-
const envelopes = await getMultipleSentryEnvelopeRequests<TransactionJSON>(page, 1);
40+
const envelopes = await envelopesPromise;
41+
3942
expect(envelopes).toHaveLength(1);
4043

4144
const eventData = envelopes[0];
@@ -73,9 +76,10 @@ sentryTest(
7376
await getFirstSentryEnvelopeRequest<SentryEvent>(page);
7477

7578
for (let i = 0; i < 4; i++) {
79+
const envelopePromise = getMultipleSentryEnvelopeRequests<SentryEvent>(page, 1);
7680
await wait(100);
7781
await page.locator('[data-test-id=interaction-button]').click();
78-
const envelope = await getMultipleSentryEnvelopeRequests<SentryEvent>(page, 1);
82+
const envelope = await envelopePromise;
7983
expect(envelope[0].spans).toHaveLength(1);
8084
}
8185
},
@@ -99,9 +103,11 @@ sentryTest(
99103
await page.goto(url);
100104
await getFirstSentryEnvelopeRequest<SentryEvent>(page);
101105

106+
const envelopePromise = getMultipleSentryEnvelopeRequests<TransactionJSON>(page, 1);
107+
102108
await page.locator('[data-test-id=annotated-button]').click();
103109

104-
const envelopes = await getMultipleSentryEnvelopeRequests<TransactionJSON>(page, 1);
110+
const envelopes = await envelopePromise;
105111
expect(envelopes).toHaveLength(1);
106112
const eventData = envelopes[0];
107113

@@ -131,9 +137,11 @@ sentryTest(
131137
await page.goto(url);
132138
await getFirstSentryEnvelopeRequest<SentryEvent>(page);
133139

140+
const envelopesPromise = getMultipleSentryEnvelopeRequests<TransactionJSON>(page, 1);
141+
134142
await page.locator('[data-test-id=styled-button]').click();
135143

136-
const envelopes = await getMultipleSentryEnvelopeRequests<TransactionJSON>(page, 1);
144+
const envelopes = await envelopesPromise;
137145
expect(envelopes).toHaveLength(1);
138146
const eventData = envelopes[0];
139147

0 commit comments

Comments
 (0)