Skip to content

ref(browser-integration-tests): Fix flake in interaction transaction tests #10365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 26, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Route } from '@playwright/test';
import { expect } from '@playwright/test';
import type { Event, Span, SpanContext, Transaction } from '@sentry/types';
import type { SerializedEvent, Span, SpanContext, Transaction } from '@sentry/types';

import { sentryTest } from '../../../../utils/fixtures';
import {
Expand Down Expand Up @@ -30,7 +30,7 @@ sentryTest('should capture interaction transaction. @firefox', async ({ browserN
const url = await getLocalTestPath({ testDir: __dirname });

await page.goto(url);
await getFirstSentryEnvelopeRequest<Event>(page);
await getFirstSentryEnvelopeRequest<SerializedEvent>(page);

await page.locator('[data-test-id=interaction-button]').click();
await page.locator('.clicked[data-test-id=interaction-button]').isVisible();
Expand All @@ -51,7 +51,7 @@ sentryTest('should capture interaction transaction. @firefox', async ({ browserN
expect(interactionSpan.timestamp).toBeDefined();

const interactionSpanDuration = (interactionSpan.timestamp! - interactionSpan.start_timestamp) * 1000;
expect(interactionSpanDuration).toBeGreaterThan(70);
expect(interactionSpanDuration).toBeGreaterThan(65);
expect(interactionSpanDuration).toBeLessThan(200);
});

Expand All @@ -70,12 +70,12 @@ sentryTest(

const url = await getLocalTestPath({ testDir: __dirname });
await page.goto(url);
await getFirstSentryEnvelopeRequest<Event>(page);
await getFirstSentryEnvelopeRequest<SerializedEvent>(page);

for (let i = 0; i < 4; i++) {
await wait(100);
await page.locator('[data-test-id=interaction-button]').click();
const envelope = await getMultipleSentryEnvelopeRequests<Event>(page, 1);
const envelope = await getMultipleSentryEnvelopeRequests<SerializedEvent>(page, 1);
expect(envelope[0].spans).toHaveLength(1);
}
},
Expand All @@ -97,11 +97,11 @@ sentryTest(
const url = await getLocalTestPath({ testDir: __dirname });

await page.goto(url);
await getFirstSentryEnvelopeRequest<Event>(page);
await getFirstSentryEnvelopeRequest<SerializedEvent>(page);

await page.locator('[data-test-id=annotated-button]').click();

const envelopes = await getMultipleSentryEnvelopeRequests<TransactionJSON>(page, 1);
const envelopes = await getMultipleSentryEnvelopeRequests<SerializedEvent>(page, 1);
expect(envelopes).toHaveLength(1);
const eventData = envelopes[0];

Expand Down