Skip to content

Commit 0c247a7

Browse files
committed
Moved changes to new branch
1 parent 8e3b9df commit 0c247a7

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed
Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package com.serenitydojo.playwright;
22

3+
import com.microsoft.playwright.Browser;
34
import com.microsoft.playwright.Page;
5+
import com.microsoft.playwright.Playwright;
6+
import com.microsoft.playwright.impl.AssertionsTimeout;
47
import com.microsoft.playwright.junit.UsePlaywright;
58
import org.junit.jupiter.api.Assertions;
69
import org.junit.jupiter.api.Test;
@@ -9,21 +12,35 @@
912
public class ASimplePlaywrightTest {
1013

1114
@Test
12-
void shouldShowThePageTitle(Page page) {
15+
void shouldShowThePageTitle() {
16+
Playwright playwright = Playwright.create();
17+
Browser browser = playwright.chromium().launch();
18+
Page page = browser.newPage();
19+
1320
page.navigate("https://practicesoftwaretesting.com");
1421
String title = page.title();
1522

1623
Assertions.assertTrue(title.contains("Practice Software Testing"));
24+
25+
browser.close();
26+
playwright.close();
1727
}
1828

1929
@Test
20-
void shouldShowSearchTermsInTheTitle(Page page) {
30+
void shouldShowSearchTermsInTheTitle() {
31+
Playwright playwright = Playwright.create();
32+
Browser browser = playwright.chromium().launch();
33+
Page page = browser.newPage();
34+
2135
page.navigate("https://practicesoftwaretesting.com");
2236
page.locator("[placeholder=Search]").fill("Pliers");
2337
page.locator("button:has-text('Search')").click();
2438

2539
int matchingProductCount = page.locator(".card-title").count();
2640

2741
Assertions.assertTrue(matchingProductCount > 0);
42+
43+
browser.close();
44+
playwright.close();
2845
}
2946
}

0 commit comments

Comments
 (0)