Skip to content

Commit c64410d

Browse files
committed
added assertion to clickWithModifier Test
1 parent 4095505 commit c64410d

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

src/test/java/io/github/mfaisalkhatri/tests/ClickOperationTests.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import java.util.Arrays;
1313
import java.util.List;
14+
import java.util.regex.Pattern;
1415

1516
import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;
1617
import static org.testng.Assert.assertEquals;
@@ -110,21 +111,24 @@ public void testClickWithModifiers () {
110111
FrameLocator frame = this.page.frameLocator (".demo-frame");
111112

112113
Locator items = frame.locator ("#selectable li");
114+
Locator itemOne = items.nth (0);
115+
Locator itemFour = items.nth (3);
113116

114-
items.nth (0)
115-
.click (new Locator.ClickOptions ().setModifiers (List.of (KeyboardModifier.CONTROL)));
117+
itemOne.click (new Locator.ClickOptions ().setModifiers (List.of (KeyboardModifier.CONTROL)));
116118

117-
items.nth (3)
118-
.click (new Locator.ClickOptions ().setModifiers (List.of (KeyboardModifier.CONTROL)));
119+
itemFour.click (new Locator.ClickOptions ().setModifiers (List.of (KeyboardModifier.CONTROL)));
119120

120-
this.page.waitForTimeout (2000);
121+
assertThat (itemOne).hasClass (Pattern.compile (".*ui-selected.*"));
122+
assertThat (itemFour).hasClass (Pattern.compile (".*ui-selected.*"));
121123

122-
this.page.navigate ("https://the-internet.herokuapp.com/");
123-
this.page.getByRole (AriaRole.LINK, new Page.GetByRoleOptions ().setName ("File Download")
124-
.setExact (true))
125-
.click (new Locator.ClickOptions ().setModifiers (List.of (KeyboardModifier.SHIFT)));
124+
// this.page.waitForTimeout (2000);
126125

127-
this.page.waitForTimeout (2000);
126+
// this.page.navigate ("https://the-internet.herokuapp.com/");
127+
// this.page.getByRole (AriaRole.LINK, new Page.GetByRoleOptions ().setName ("File Download")
128+
// .setExact (true))
129+
// .click (new Locator.ClickOptions ().setModifiers (List.of (KeyboardModifier.SHIFT)));
130+
//
131+
// this.page.waitForTimeout (2000);
128132

129133
}
130134

0 commit comments

Comments
 (0)