@@ -18,7 +18,11 @@ sentryTest('should capture a "GOOD" CLS vital with its source(s).', async ({ get
1818
1919 expect ( eventData . measurements ) . toBeDefined ( ) ;
2020 expect ( eventData . measurements ?. cls ?. value ) . toBeDefined ( ) ;
21- expect ( eventData . measurements ?. cls ?. value ) . toBeCloseTo ( 0.05 ) ;
21+
22+ // Flakey value dependent on timings -> we check for a range
23+ expect ( eventData . measurements ?. cls ?. value ) . toBeGreaterThan ( 0.03 ) ;
24+ expect ( eventData . measurements ?. cls ?. value ) . toBeLessThan ( 0.07 ) ;
25+
2226 expect ( eventData . tags ?. [ 'cls.source.1' ] ) . toBe ( 'body > div#content > p#partial' ) ;
2327} ) ;
2428
@@ -28,7 +32,11 @@ sentryTest('should capture a "MEH" CLS vital with its source(s).', async ({ getL
2832
2933 expect ( eventData . measurements ) . toBeDefined ( ) ;
3034 expect ( eventData . measurements ?. cls ?. value ) . toBeDefined ( ) ;
31- expect ( eventData . measurements ?. cls ?. value ) . toBeCloseTo ( 0.21 ) ;
35+
36+ // Flakey value dependent on timings -> we check for a range
37+ expect ( eventData . measurements ?. cls ?. value ) . toBeGreaterThan ( 0.18 ) ;
38+ expect ( eventData . measurements ?. cls ?. value ) . toBeLessThan ( 0.23 ) ;
39+
3240 expect ( eventData . tags ?. [ 'cls.source.1' ] ) . toBe ( 'body > div#content > p' ) ;
3341} ) ;
3442
@@ -38,11 +46,8 @@ sentryTest('should capture a "POOR" CLS vital with its source(s).', async ({ get
3846
3947 expect ( eventData . measurements ) . toBeDefined ( ) ;
4048 expect ( eventData . measurements ?. cls ?. value ) . toBeDefined ( ) ;
41- // This test in particular seems to be flaky, such that the received value is frequently within 0.006 rather than the
42- // 0.005 that `toBeCloseTo()` requires. While it's true that each test is retried twice if it fails, in the flaky
43- // cases all three attempts always seem to come up with the exact same slightly-too-far-away number. Rather than ramp
44- // down `toBeCloseTo()`'s precision (which would make it accept anything between 0.30 and 0.40), we can just do the
45- // check manually.
49+
50+ // Flakey value dependent on timings -> we check for a range
4651 expect ( eventData . measurements ?. cls ?. value ) . toBeGreaterThan ( 0.34 ) ;
4752 expect ( eventData . measurements ?. cls ?. value ) . toBeLessThan ( 0.36 ) ;
4853 expect ( eventData . tags ?. [ 'cls.source.1' ] ) . toBe ( 'body > div#content > p' ) ;
0 commit comments