Skip to content

Commit 3c9e578

Browse files
committed
unflake some tests?
1 parent 22b161f commit 3c9e578

File tree

3 files changed

+17
-11
lines changed
  • dev-packages/browser-integration-tests

3 files changed

+17
-11
lines changed

dev-packages/browser-integration-tests/scripts/detectFlakyTests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ ${changedPaths.join('\n')}
100100
* Returns how many time one test should run based on the chosen mode and a bunch of heuristics
101101
*/
102102
function getPerTestRunCount(testPaths: string[]) {
103-
if (process.env.TEST_RUN_COUNT === 'AUTO' && testPaths.length > 0) {
103+
if ((!process.env.TEST_RUN_COUNT || process.env.TEST_RUN_COUNT === 'AUTO') && testPaths.length > 0) {
104104
// Run everything up to 100x, assuming that total runtime is less than 60min.
105105
// We assume an average runtime of 3s per test, times 4 (for different browsers) = 12s per detected testPaths
106106
// We want to keep overall runtime under 30min

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-animation-frame-enabled/test.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ sentryTest(
3030

3131
const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui.long-animation-frame'));
3232

33-
expect(uiSpans?.length).toEqual(1);
33+
expect(uiSpans?.length).toBeGreaterThanOrEqual(1);
3434

35-
const [topLevelUISpan] = uiSpans || [];
35+
const topLevelUISpan = (uiSpans || []).find(
36+
span => span.data?.['browser.script.invoker'] === 'https://example.com/path/to/script.js',
37+
)!;
3638
expect(topLevelUISpan).toEqual(
3739
expect.objectContaining({
3840
op: 'ui.long-animation-frame',
@@ -84,10 +86,11 @@ sentryTest(
8486

8587
const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui.long-animation-frame'));
8688

87-
expect(uiSpans?.length).toEqual(2);
89+
expect(uiSpans?.length).toBeGreaterThanOrEqual(2);
8890

89-
// ignore the first ui span (top-level long animation frame)
90-
const [, eventListenerUISpan] = uiSpans || [];
91+
const eventListenerUISpan = (uiSpans || []).find(
92+
span => span.data?.['browser.script.invoker'] === 'BUTTON#clickme.onclick',
93+
)!;
9194

9295
expect(eventListenerUISpan).toEqual(
9396
expect.objectContaining({

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/long-tasks-and-animation-frame-enabled/test.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ sentryTest(
3232

3333
const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui.long-animation-frame'));
3434

35-
expect(uiSpans?.length).toEqual(1);
35+
expect(uiSpans?.length).toBeGreaterThanOrEqual(1);
3636

37-
const [topLevelUISpan] = uiSpans || [];
37+
const topLevelUISpan = (uiSpans || []).find(
38+
span => span.data?.['browser.script.invoker'] === 'https://example.com/path/to/script.js',
39+
)!;
3840
expect(topLevelUISpan).toEqual(
3941
expect.objectContaining({
4042
op: 'ui.long-animation-frame',
@@ -86,10 +88,11 @@ sentryTest(
8688

8789
const uiSpans = eventData.spans?.filter(({ op }) => op?.startsWith('ui.long-animation-frame'));
8890

89-
expect(uiSpans?.length).toEqual(2);
91+
expect(uiSpans?.length).toBeGreaterThanOrEqual(2);
9092

91-
// ignore the first ui span (top-level long animation frame)
92-
const [, eventListenerUISpan] = uiSpans || [];
93+
const eventListenerUISpan = (uiSpans || []).find(
94+
span => span.data?.['browser.script.invoker'] === 'BUTTON#clickme.onclick',
95+
)!;
9396

9497
expect(eventListenerUISpan).toEqual(
9598
expect.objectContaining({

0 commit comments

Comments
 (0)