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) {
5757 }
5858 }
5959
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+
6067 @ Test
6168 void shouldRunWithCustomCategoriesIfProvided (@ TempDir Path tempDir ) throws IOException {
6269 try (Page page = browser .newPage ()) {
6370 Path outputTraceFile = tempDir .resolve ("trace.json" );
6471 browser .startTracing (page , new Browser .StartTracingOptions ()
6572 .setPath (outputTraceFile )
6673 .setCategories (asList ("disabled-by-default-cc.debug" )));
67- page . evaluate ( "() => 1 + 1" );
74+ rafraf ( page );
6875 browser .stopTracing ();
6976 try (FileReader fileReader = new FileReader (outputTraceFile .toFile ())) {
7077 JsonObject traceJson = new Gson ().fromJson (fileReader , JsonObject .class );
@@ -75,7 +82,7 @@ void shouldRunWithCustomCategoriesIfProvided(@TempDir Path tempDir) throws IOExc
7582 boolean hasTraceEvents = traceJson .getAsJsonArray ("traceEvents" ).asList ().stream ()
7683 .anyMatch (event -> {
7784 JsonObject eventObj = (JsonObject ) event ;
78- return eventObj .has ("cat" ) &&
85+ return eventObj .has ("cat" ) &&
7986 eventObj .get ("cat" ).getAsString ().equals ("disabled-by-default-cc.debug" );
8087 });
8188 assertTrue (hasTraceConfig || hasTraceEvents );
You can’t perform that action at this time.
0 commit comments