chore: roll driver to 1.26.0 (#1071)
This commit is contained in:
@@ -30,7 +30,7 @@ import java.util.regex.Pattern;
|
||||
* <p> **Strictness**
|
||||
*
|
||||
* <p> Frame locators are strict. This means that all operations on frame locators will throw if more than one element matches
|
||||
* given selector.
|
||||
* a given selector.
|
||||
* <pre>{@code
|
||||
* // Throws if there are several frames in DOM:
|
||||
* page.frame_locator(".result-frame").locator("button").click();
|
||||
|
||||
+4
-26
@@ -795,7 +795,7 @@ public interface LocatorAssertions {
|
||||
*/
|
||||
void containsText(Pattern[] expected, ContainsTextOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an element with given attribute value.
|
||||
* Ensures the {@code Locator} points to an element with given attribute.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).hasAttribute("type", "text");
|
||||
* }</pre>
|
||||
@@ -807,7 +807,7 @@ public interface LocatorAssertions {
|
||||
hasAttribute(name, value, (HasAttributeOptions) null);
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an element with given attribute value.
|
||||
* Ensures the {@code Locator} points to an element with given attribute.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).hasAttribute("type", "text");
|
||||
* }</pre>
|
||||
@@ -817,7 +817,7 @@ public interface LocatorAssertions {
|
||||
*/
|
||||
void hasAttribute(String name, String value, HasAttributeOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an element with given attribute value.
|
||||
* Ensures the {@code Locator} points to an element with given attribute.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).hasAttribute("type", "text");
|
||||
* }</pre>
|
||||
@@ -829,7 +829,7 @@ public interface LocatorAssertions {
|
||||
hasAttribute(name, value, (HasAttributeOptions) null);
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an element with given attribute value.
|
||||
* Ensures the {@code Locator} points to an element with given attribute.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).hasAttribute("type", "text");
|
||||
* }</pre>
|
||||
@@ -838,28 +838,6 @@ public interface LocatorAssertions {
|
||||
* @param value Expected attribute value.
|
||||
*/
|
||||
void hasAttribute(String name, Pattern value, HasAttributeOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an element with given attribute. The method will assert attribute presence.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).hasAttribute("disabled");
|
||||
* assertThat(page.locator("input")).not().hasAttribute("open");
|
||||
* }</pre>
|
||||
*
|
||||
* @param name Attribute name.
|
||||
*/
|
||||
default void hasAttribute(String name) {
|
||||
hasAttribute(name, (HasAttributeOptions) null);
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an element with given attribute. The method will assert attribute presence.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).hasAttribute("disabled");
|
||||
* assertThat(page.locator("input")).not().hasAttribute("open");
|
||||
* }</pre>
|
||||
*
|
||||
* @param name Attribute name.
|
||||
*/
|
||||
void hasAttribute(String name, HasAttributeOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an element with given CSS classes. This needs to be a full match or using a relaxed
|
||||
* regular expression.
|
||||
|
||||
@@ -105,18 +105,7 @@ public class LocatorAssertionsImpl extends AssertionsBase implements LocatorAsse
|
||||
if (expectedValue instanceof Pattern) {
|
||||
message += " matching regex";
|
||||
}
|
||||
expectImpl("to.have.attribute.value", expectedText, expectedValue, message, commonOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hasAttribute(String name, HasAttributeOptions options) {
|
||||
if (options == null) {
|
||||
options = new HasAttributeOptions();
|
||||
}
|
||||
FrameExpectOptions commonOptions = convertType(options, FrameExpectOptions.class);
|
||||
commonOptions.expressionArg = name;
|
||||
String message = "Locator expected to have attribute '" + name + "'";
|
||||
expectImpl("to.have.attribute", (List<ExpectedTextValue>) null, null, message, commonOptions);
|
||||
expectImpl("to.have.attribute", expectedText, expectedValue, message, commonOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -284,28 +284,6 @@ public class TestLocatorAssertions extends TestBase {
|
||||
assertTrue(e.getMessage().contains("Locator expected to have attribute 'id' matching regex: .Nod..\nReceived: node"), e.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void hasAttributeBooleanPass() {
|
||||
page.setContent("<div checked id=node>Text content</div>");
|
||||
Locator locator = page.locator("#node");
|
||||
assertThat(locator).hasAttribute("id");
|
||||
assertThat(locator).hasAttribute("checked");
|
||||
assertThat(locator).not().hasAttribute("open");
|
||||
assertThat(locator).hasAttribute("id", Pattern.compile("n..e"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void hasAttributeBooleanFail() {
|
||||
page.setContent("<div checked id=node>Text content</div>");
|
||||
Locator locator = page.locator("#node");
|
||||
AssertionFailedError e = assertThrows(AssertionFailedError.class,
|
||||
() -> assertThat(locator).hasAttribute("disabled", new LocatorAssertions.HasAttributeOptions().setTimeout(100)));
|
||||
assertTrue(e.getMessage().contains("Locator expected to have attribute 'disabled'"), e.getMessage());
|
||||
e = assertThrows(AssertionFailedError.class,
|
||||
() -> assertThat(locator).not().hasAttribute("checked", new LocatorAssertions.HasAttributeOptions().setTimeout(100)));
|
||||
assertTrue(e.getMessage().contains("Locator expected not to have attribute 'checked'"), e.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void hasClassTextPass() {
|
||||
page.setContent("<div class=\"foo bar baz\"></div>");
|
||||
|
||||
Reference in New Issue
Block a user