@@ -18,7 +18,11 @@ sentryTest('should capture a "GOOD" CLS vital with its source(s).', async ({ get
18
18
19
19
expect ( eventData . measurements ) . toBeDefined ( ) ;
20
20
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
+
22
26
expect ( eventData . tags ?. [ 'cls.source.1' ] ) . toBe ( 'body > div#content > p#partial' ) ;
23
27
} ) ;
24
28
@@ -28,7 +32,11 @@ sentryTest('should capture a "MEH" CLS vital with its source(s).', async ({ getL
28
32
29
33
expect ( eventData . measurements ) . toBeDefined ( ) ;
30
34
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
+
32
40
expect ( eventData . tags ?. [ 'cls.source.1' ] ) . toBe ( 'body > div#content > p' ) ;
33
41
} ) ;
34
42
@@ -38,11 +46,8 @@ sentryTest('should capture a "POOR" CLS vital with its source(s).', async ({ get
38
46
39
47
expect ( eventData . measurements ) . toBeDefined ( ) ;
40
48
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
46
51
expect ( eventData . measurements ?. cls ?. value ) . toBeGreaterThan ( 0.34 ) ;
47
52
expect ( eventData . measurements ?. cls ?. value ) . toBeLessThan ( 0.36 ) ;
48
53
expect ( eventData . tags ?. [ 'cls.source.1' ] ) . toBe ( 'body > div#content > p' ) ;
0 commit comments