Skip to content

test: Fix flaky replay sampling test #7749

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 3 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .github/workflows/flaky-test-detector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
- 'packages/browser-integration-tests/suites/**'
branches-ignore:
- master
- develop

env:
HEAD_COMMIT: ${{ github.event.inputs.commit || github.sha }}
Expand All @@ -27,6 +26,8 @@ jobs:
runs-on: ubuntu-20.04
timeout-minutes: 60
name: 'Check tests for flakiness'
# Also skip if PR is from master -> develop
if: ${{ github.base_ref != 'master' && github.ref != 'refs/heads/master' }}
steps:
- name: Check out current branch
uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { expect } from '@playwright/test';
import type { ReplayContainer } from '@sentry/replay/build/npm/types/types';

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

await page.click('button');

await page.waitForFunction(() => {
const replayIntegration = (window as unknown as Window & { Replay: { _replay: ReplayContainer } }).Replay;
return !!replayIntegration._replay.session;
});
const replay = await getReplaySnapshot(page);

expect(replay.session?.sampled).toBe(false);
Expand Down