1717package com .microsoft .playwright ;
1818
1919import com .google .gson .Gson ;
20+ import com .google .gson .annotations .SerializedName ;
2021import com .microsoft .playwright .options .AriaRole ;
2122import com .microsoft .playwright .options .Location ;
2223import com .microsoft .playwright .options .MouseButton ;
@@ -202,8 +203,8 @@ void traceGroupGroupEnd(@TempDir Path tempDir) throws Exception {
202203 context .tracing ().stop (new Tracing .StopOptions ().setPath (traceFile1 ));
203204
204205 List <TraceEvent > events = parseTraceEvents (traceFile1 );
205- List <String > calls = events .stream ().filter (e -> e .title != null ).map (e -> e .title ).collect (Collectors .toList ());
206- assertEquals (asList ("outer group" , "Page.navigate " , "inner group 1" , "Frame.click" , "inner group 2" , "Page .isVisible" ), calls );
206+ List <String > calls = events .stream ().filter (e -> e .renderedTitle () != null ).map (e -> e .renderedTitle () ).collect (Collectors .toList ());
207+ assertEquals (asList ("outer group" , "Frame.goto " , "inner group 1" , "Frame.click" , "inner group 2" , "Frame .isVisible" ), calls );
207208 }
208209
209210 @ Test
@@ -240,30 +241,30 @@ void shouldTraceVariousAPIs(@TempDir Path tempDir) throws Exception {
240241 context .tracing ().stop (new Tracing .StopOptions ().setPath (traceFile1 ));
241242
242243 List <TraceEvent > events = parseTraceEvents (traceFile1 );
243- List <String > calls = events .stream ().filter (e -> e .title != null ).map (e -> e .title )
244+ List <String > calls = events .stream ().filter (e -> e .renderedTitle () != null ).map (e -> e .renderedTitle () )
244245 .collect (Collectors .toList ());
245246 assertEquals (asList (
246- "Clock.install " ,
247- "Page .setContent" ,
247+ "BrowserContext.clockInstall " ,
248+ "Frame .setContent" ,
248249 "Frame.click" ,
249250 "Frame.click" ,
250- "Keyboard.type " ,
251- "Keyboard.press " ,
252- "Keyboard.down " ,
253- "Keyboard.insertText " ,
254- "Keyboard.up " ,
255- "Mouse.move " ,
256- "Mouse.down " ,
257- "Mouse.move " ,
258- "Mouse.wheel " ,
259- "Mouse.up " ,
260- "Clock.fastForward " ,
261- "Clock.fastForward " ,
262- "Clock.pauseAt " ,
263- "Clock.runFor " ,
264- "Clock.setFixedTime " ,
265- "Clock.setSystemTime " ,
266- "Clock.resume " ,
251+ "Page.keyboardType " ,
252+ "Page.keyboardPress " ,
253+ "Page.keyboardDown " ,
254+ "Page.keyboardInsertText " ,
255+ "Page.keyboardUp " ,
256+ "Page.mouseMove " ,
257+ "Page.mouseDown " ,
258+ "Page.mouseMove " ,
259+ "Page.mouseWheel " ,
260+ "Page.mouseUp " ,
261+ "BrowserContext.clockFastForward " ,
262+ "BrowserContext.clockFastForward " ,
263+ "BrowserContext.clockPauseAt " ,
264+ "BrowserContext.clockRunFor " ,
265+ "BrowserContext.clockSetFixedTime " ,
266+ "BrowserContext.clockSetSystemTime " ,
267+ "BrowserContext.clockResume " ,
267268 "Frame.click" ),
268269 calls );
269270 }
@@ -284,20 +285,31 @@ public void shouldNotRecordNetworkActions(@TempDir Path tempDir) throws IOExcept
284285 context .tracing ().stop (new Tracing .StopOptions ().setPath (traceFile1 ));
285286
286287 List <TraceEvent > events = parseTraceEvents (traceFile1 );
287- List <String > calls = events .stream ().filter (e -> e .title != null ).map (e -> e .title )
288+ List <String > calls = events .stream ().filter (e -> e .renderedTitle () != null ).map (e -> e .renderedTitle () )
288289 .collect (Collectors .toList ());
289- assertEquals (asList ("Page.navigate " ), calls );
290+ assertEquals (asList ("Frame.goto " ), calls );
290291 }
291292
292293 private static class TraceEvent {
293294 String type ;
294295 String name ;
295- String apiName ;
296296 String title ;
297+ @ SerializedName ("class" )
298+ String clazz ;
297299 String method ;
298300 Double startTime ;
299301 Double endTime ;
300302 String callId ;
303+
304+ String renderedTitle () {
305+ if (title != null ) {
306+ return title ;
307+ }
308+ if (clazz != null && method != null ) {
309+ return clazz + "." + method ;
310+ }
311+ return null ;
312+ }
301313 }
302314
303315 private static List <TraceEvent > parseTraceEvents (Path traceFile ) throws IOException {
0 commit comments