mirror of
https://github.com/microsoft/playwright-java.git
synced 2025-12-28 10:20:45 +00:00
fix: respect isChecked options (#911)
This commit is contained in:
parent
59e7c0cc94
commit
b8d2ccae08
@ -257,7 +257,8 @@ public class LocatorAssertionsImpl extends AssertionsBase implements LocatorAsse
|
||||
|
||||
@Override
|
||||
public void isChecked(IsCheckedOptions options) {
|
||||
expectTrue("to.be.checked", "Locator expected to be checked", convertType(options, FrameExpectOptions.class));
|
||||
String expression = (options != null && options.checked != null && !options.checked) ? "to.be.unchecked" : "to.be.checked";
|
||||
expectTrue(expression, "Locator expected to be checked", convertType(options, FrameExpectOptions.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -118,6 +118,13 @@ public class TestLocatorAssertions extends TestBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void hasTextWTextInnerTextPass() {
|
||||
page.setContent("<div id=node>Text <span hidden>garbage</span> content</div>");
|
||||
Locator locator = page.locator("#node");
|
||||
assertThat(locator).hasText("Text content", new LocatorAssertions.HasTextOptions().setUseInnerText(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void hasTextWTextArrayPass() {
|
||||
page.setContent("<div>Text \n1</div><div>Text 2a</div>");
|
||||
@ -577,6 +584,13 @@ public class TestLocatorAssertions extends TestBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void isCheckedFalsePass() {
|
||||
page.setContent("<input type=checkbox></input>");
|
||||
Locator locator = page.locator("input");
|
||||
assertThat(locator).isChecked(new LocatorAssertions.IsCheckedOptions().setChecked(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
void isDisabledPass() {
|
||||
page.setContent("<button disabled>Text</button>");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user