Skip to content

Commit c9fdf10

Browse files
authored
test: Fix flaky replay sampling test (#7749)
1 parent d7021d8 commit c9fdf10

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.github/workflows/flaky-test-detector.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
- 'packages/browser-integration-tests/suites/**'
77
branches-ignore:
88
- master
9-
- develop
109

1110
env:
1211
HEAD_COMMIT: ${{ github.event.inputs.commit || github.sha }}
@@ -27,6 +26,8 @@ jobs:
2726
runs-on: ubuntu-20.04
2827
timeout-minutes: 60
2928
name: 'Check tests for flakiness'
29+
# Also skip if PR is from master -> develop
30+
if: ${{ github.base_ref != 'master' && github.ref != 'refs/heads/master' }}
3031
steps:
3132
- name: Check out current branch
3233
uses: actions/checkout@v3

packages/browser-integration-tests/suites/replay/sampling/test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { expect } from '@playwright/test';
2+
import type { ReplayContainer } from '@sentry/replay/build/npm/types/types';
23

34
import { sentryTest } from '../../../utils/fixtures';
45
import { getReplaySnapshot, shouldSkipReplayTest } from '../../../utils/replayHelpers';
@@ -24,6 +25,10 @@ sentryTest('should not send replays if both sample rates are 0', async ({ getLoc
2425

2526
await page.click('button');
2627

28+
await page.waitForFunction(() => {
29+
const replayIntegration = (window as unknown as Window & { Replay: { _replay: ReplayContainer } }).Replay;
30+
return !!replayIntegration._replay.session;
31+
});
2732
const replay = await getReplaySnapshot(page);
2833

2934
expect(replay.session?.sampled).toBe(false);

0 commit comments

Comments
 (0)