File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
playwright/src/test/java/com/microsoft/playwright Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -57,14 +57,21 @@ void shouldCreateDirectoriesAsNeeded(@TempDir Path tempDir) {
57
57
}
58
58
}
59
59
60
+ private static void rafraf (Page page ) {
61
+ int count = 2 ;
62
+ for (int i = 0 ; i < count ; i ++) {
63
+ page .evaluate ("() => new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f)))" );
64
+ }
65
+ }
66
+
60
67
@ Test
61
68
void shouldRunWithCustomCategoriesIfProvided (@ TempDir Path tempDir ) throws IOException {
62
69
try (Page page = browser .newPage ()) {
63
70
Path outputTraceFile = tempDir .resolve ("trace.json" );
64
71
browser .startTracing (page , new Browser .StartTracingOptions ()
65
72
.setPath (outputTraceFile )
66
73
.setCategories (asList ("disabled-by-default-cc.debug" )));
67
- page . evaluate ( "() => 1 + 1" );
74
+ rafraf ( page );
68
75
browser .stopTracing ();
69
76
try (FileReader fileReader = new FileReader (outputTraceFile .toFile ())) {
70
77
JsonObject traceJson = new Gson ().fromJson (fileReader , JsonObject .class );
@@ -75,7 +82,7 @@ void shouldRunWithCustomCategoriesIfProvided(@TempDir Path tempDir) throws IOExc
75
82
boolean hasTraceEvents = traceJson .getAsJsonArray ("traceEvents" ).asList ().stream ()
76
83
.anyMatch (event -> {
77
84
JsonObject eventObj = (JsonObject ) event ;
78
- return eventObj .has ("cat" ) &&
85
+ return eventObj .has ("cat" ) &&
79
86
eventObj .get ("cat" ).getAsString ().equals ("disabled-by-default-cc.debug" );
80
87
});
81
88
assertTrue (hasTraceConfig || hasTraceEvents );
You can’t perform that action at this time.
0 commit comments