|
11 | 11 |
|
12 | 12 | import java.util.Arrays; |
13 | 13 | import java.util.List; |
| 14 | +import java.util.regex.Pattern; |
14 | 15 |
|
15 | 16 | import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; |
16 | 17 | import static org.testng.Assert.assertEquals; |
@@ -110,21 +111,24 @@ public void testClickWithModifiers () { |
110 | 111 | FrameLocator frame = this.page.frameLocator (".demo-frame"); |
111 | 112 |
|
112 | 113 | Locator items = frame.locator ("#selectable li"); |
| 114 | + Locator itemOne = items.nth (0); |
| 115 | + Locator itemFour = items.nth (3); |
113 | 116 |
|
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))); |
116 | 118 |
|
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))); |
119 | 120 |
|
120 | | - this.page.waitForTimeout (2000); |
| 121 | + assertThat (itemOne).hasClass (Pattern.compile (".*ui-selected.*")); |
| 122 | + assertThat (itemFour).hasClass (Pattern.compile (".*ui-selected.*")); |
121 | 123 |
|
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); |
126 | 125 |
|
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); |
128 | 132 |
|
129 | 133 | } |
130 | 134 |
|
|
0 commit comments