File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
src/test/java/com/serenitydojo/playwright Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 1+ package com .serenitydojo .playwright ;
2+
3+ import com .microsoft .playwright .BrowserType ;
4+ import com .microsoft .playwright .junit .Options ;
5+ import com .microsoft .playwright .junit .OptionsFactory ;
6+
7+ import java .util .Arrays ;
8+
9+ public class HeadlessChromeOptions implements OptionsFactory {
10+ @ Override
11+ public Options getOptions () {
12+ return new Options ().setLaunchOptions (
13+ new BrowserType .LaunchOptions ()
14+ .setArgs (Arrays .asList ("--no-sandbox" , "--disable-extensions" , "--disable-gpu" ))
15+ ).setHeadless (true )
16+ .setTestIdAttribute ("data-test" );
17+ }
18+ }
Original file line number Diff line number Diff line change 11package com .serenitydojo .playwright .toolshop .catalog ;
22
3+ import com .microsoft .playwright .Page ;
4+ import com .microsoft .playwright .junit .UsePlaywright ;
5+ import com .serenitydojo .playwright .HeadlessChromeOptions ;
36import com .serenitydojo .playwright .toolshop .catalog .pageobjects .*;
47import com .serenitydojo .playwright .toolshop .fixtures .PlaywrightTestCase ;
58import org .assertj .core .api .Assertions ;
1013
1114import java .util .List ;
1215
13- @ Execution ( ExecutionMode . SAME_THREAD )
14- public class AddToCartTest extends PlaywrightTestCase {
16+ @ UsePlaywright ( HeadlessChromeOptions . class )
17+ public class AddToCartTest {
1518
1619 SearchComponent searchComponent ;
1720 ProductList productList ;
@@ -20,12 +23,12 @@ public class AddToCartTest extends PlaywrightTestCase {
2023 CheckoutCart checkoutCart ;
2124
2225 @ BeforeEach
23- void openHomePage () {
26+ void openHomePage (Page page ) {
2427 page .navigate ("https://practicesoftwaretesting.com" );
2528 }
2629
2730 @ BeforeEach
28- void setUp () {
31+ void setUp (Page page ) {
2932 searchComponent = new SearchComponent (page );
3033 productList = new ProductList (page );
3134 productDetails = new ProductDetails (page );
You can’t perform that action at this time.
0 commit comments