1
0
mirror of synced 2026-09-11 00:49:39 +00:00

feat: roll driver, comoute count in util world (#769)

This commit is contained in:
Yury Semikhatsky
2022-01-10 13:20:20 -08:00
committed by GitHub
parent e9b379f5ed
commit 25a0927056
6 changed files with 41 additions and 27 deletions
@@ -47,7 +47,7 @@ public interface APIResponseAssertions {
*/
APIResponseAssertions not();
/**
* Ensures the response status code is within [200..299) range.
* Ensures the response status code is within [200..299] range.
* <pre>{@code
* assertThat(response).isOK();
* }</pre>
@@ -452,7 +452,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }</pre>
@@ -469,7 +469,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }</pre>
@@ -484,7 +484,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }</pre>
@@ -501,7 +501,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }</pre>
@@ -516,7 +516,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }</pre>
@@ -533,7 +533,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }</pre>
@@ -548,7 +548,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }</pre>
@@ -565,7 +565,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).containsText("substring");
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
* }</pre>
@@ -623,7 +623,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }</pre>
@@ -639,7 +639,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }</pre>
@@ -653,7 +653,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }</pre>
@@ -669,7 +669,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }</pre>
@@ -683,7 +683,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }</pre>
@@ -699,7 +699,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }</pre>
@@ -713,7 +713,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }</pre>
@@ -729,7 +729,7 @@ public interface LocatorAssertions {
* assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
* }</pre>
@@ -872,7 +872,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }</pre>
@@ -889,7 +889,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }</pre>
@@ -904,7 +904,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }</pre>
@@ -921,7 +921,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }</pre>
@@ -936,7 +936,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }</pre>
@@ -953,7 +953,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }</pre>
@@ -968,7 +968,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }</pre>
@@ -985,7 +985,7 @@ public interface LocatorAssertions {
* assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
* }</pre>
*
* <p> Note that if array is passed as an expected value, entire lists can be asserted:
* <p> Note that if array is passed as an expected value, entire lists of elements can be asserted:
* <pre>{@code
* assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
* }</pre>
@@ -823,4 +823,11 @@ public class TestLocatorAssertions extends TestBase {
assertTrue(e.getMessage().contains("Locator expected not to be visible"), e.getMessage());
}
}
@Test
void locatorCountShouldWorkWithDeletedMapInMainWorld() {
page.evaluate("Map = 1");
page.locator("#searchResultTableDiv .x-grid3-row").count();
assertThat(page.locator("#searchResultTableDiv .x-grid3-row")).hasCount(0);
}
}
@@ -1017,6 +1017,13 @@ public class FrameImpl extends ChannelOwner implements Frame {
waitForNavigationImpl(() -> {}, convertType(options, WaitForNavigationOptions.class), matcher);
}
int queryCount(String selector) {
JsonObject params = new JsonObject();
params.addProperty("selector", selector);
JsonObject result = sendMessage("queryCount", params).getAsJsonObject();
return result.get("value").getAsInt();
}
protected void handleEvent(String event, JsonObject params) {
if ("loadstate".equals(event)) {
JsonElement add = params.get("add");
@@ -92,7 +92,7 @@ class LocatorImpl implements Locator {
@Override
public int count() {
return ((Number) evaluateAll("ee => ee.length")).intValue();
return frame.queryCount(selector);
}
@Override
+1 -1
View File
@@ -1 +1 @@
1.18.0-alpha-1641508844000
1.18.0-alpha-jan-10-2022