11package com .serenitydojo .playwright .toolshop .catalog ;
22
3- import com .microsoft .playwright .Browser ;
4- import com .microsoft .playwright .BrowserContext ;
53import com .microsoft .playwright .Page ;
6- import com .microsoft .playwright .Tracing ;
74import com .microsoft .playwright .junit .UsePlaywright ;
85import com .serenitydojo .playwright .HeadlessChromeOptions ;
96import com .serenitydojo .playwright .toolshop .catalog .pageobjects .*;
10- import com .serenitydojo .playwright .toolshop .fixtures .PlaywrightTestCase ;
7+ import com .serenitydojo .playwright .toolshop .fixtures .WithTracing ;
118import org .assertj .core .api .Assertions ;
12- import org .junit .jupiter .api .AfterEach ;
139import org .junit .jupiter .api .BeforeEach ;
1410import org .junit .jupiter .api .Test ;
15- import org .junit .jupiter .api .TestInfo ;
16- import org .junit .jupiter .api .parallel .Execution ;
17- import org .junit .jupiter .api .parallel .ExecutionMode ;
1811
19- import java .nio .file .Paths ;
2012import java .util .List ;
2113
2214@ UsePlaywright (HeadlessChromeOptions .class )
23- public class AddToCartTest {
15+ public class AddToCartTest implements WithTracing {
2416
2517 SearchComponent searchComponent ;
2618 ProductList productList ;
@@ -42,25 +34,6 @@ void setUp(Page page) {
4234 checkoutCart = new CheckoutCart (page );
4335 }
4436
45- @ BeforeEach
46- void setupTrace (BrowserContext context ) {
47- context .tracing ().start (
48- new Tracing .StartOptions ()
49- .setScreenshots (true )
50- .setSnapshots (true )
51- .setSources (true )
52- );
53- }
54-
55- @ AfterEach
56- void recordTrace (TestInfo testInfo , BrowserContext context ) {
57- String traceName = testInfo .getDisplayName ().replace (" " ,"-" ).toLowerCase ();
58- context .tracing ().stop (
59- new Tracing .StopOptions ()
60- .setPath (Paths .get ("trace-" + traceName + ".zip" ))
61- );
62- }
63-
6437 @ Test
6538 void whenCheckingOutASingleItem () {
6639 searchComponent .searchBy ("pliers" );
0 commit comments