Skip to content

Commit e8aaca0

Browse files
committed
Sample solution
1 parent 667b7fa commit e8aaca0

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/test/java/com/serenitydojo/playwright/ASimplePlaywrightTest.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,42 @@
11
package com.serenitydojo.playwright;
22

3+
import com.microsoft.playwright.Browser;
4+
import com.microsoft.playwright.BrowserType;
35
import com.microsoft.playwright.Page;
46
import com.microsoft.playwright.junit.UsePlaywright;
7+
import com.microsoft.playwright.junit.Options;
8+
import com.microsoft.playwright.junit.OptionsFactory;
59
import org.junit.jupiter.api.Assertions;
610
import org.junit.jupiter.api.Test;
711

8-
@UsePlaywright
12+
import java.util.Arrays;
13+
14+
@UsePlaywright(ASimplePlaywrightTest.CustomOptions.class)
915
public class ASimplePlaywrightTest {
1016

17+
public static class CustomOptions implements OptionsFactory {
18+
@Override
19+
public Options getOptions() {
20+
return new Options()
21+
// .setHeadless(false)
22+
.setLaunchOptions(
23+
new BrowserType.LaunchOptions()
24+
.setArgs(Arrays.asList("--no-sandbox",
25+
"--disable-gpu",
26+
"--disable-extensions"))
27+
);
28+
}
29+
}
30+
1131
@Test
1232
void shouldShowThePageTitle(Page page) {
1333
page.navigate("https://practicesoftwaretesting.com");
1434
String title = page.title();
15-
1635
Assertions.assertTrue(title.contains("Practice Software Testing"));
1736
}
1837

1938
@Test
20-
void shouldShowSearchTermsInTheTitle(Page page) {
39+
void shouldShowSearchTermsInTheTitle1(Page page) {
2140
page.navigate("https://practicesoftwaretesting.com");
2241
page.locator("[placeholder=Search]").fill("Pliers");
2342
page.locator("button:has-text('Search')").click();

0 commit comments

Comments
 (0)