mirror of
https://github.com/microsoft/playwright-java.git
synced 2025-12-28 02:15:15 +00:00
chore: roll driver to 1.18.0-alpha-1637257604000 (#711)
This commit is contained in:
parent
3b4d8dc955
commit
b4100a4d68
@ -11,7 +11,7 @@ Playwright is a Java library to automate [Chromium](https://www.chromium.org/Hom
|
||||
|
||||
| | Linux | macOS | Windows |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Chromium <!-- GEN:chromium-version -->98.0.4695.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Chromium <!-- GEN:chromium-version -->98.0.4708.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| WebKit <!-- GEN:webkit-version -->15.4<!-- GEN:stop --> | ✅ | ✅ | ✅ |
|
||||
| Firefox <!-- GEN:firefox-version -->94.0.1<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
|
||||
|
||||
@ -40,6 +40,118 @@ import com.microsoft.playwright.Locator;
|
||||
* }</pre>
|
||||
*/
|
||||
public interface LocatorAssertions {
|
||||
class IsCheckedOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsCheckedOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class IsDisabledOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsDisabledOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class IsEditableOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsEditableOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class IsEmptyOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsEmptyOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class IsEnabledOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsEnabledOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class IsFocusedOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsFocusedOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class IsHiddenOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsHiddenOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class IsVisibleOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsVisibleOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class ContainsTextOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
@ -188,118 +300,146 @@ public interface LocatorAssertions {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class IsCheckedOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsCheckedOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Makes the assertion check for the opposite condition. For example, this code tests that the Locator doesn't contain text
|
||||
* {@code "error"}:
|
||||
* <pre>{@code
|
||||
* assertThat(locator).not().containsText("error");
|
||||
* }</pre>
|
||||
*/
|
||||
LocatorAssertions not();
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a checked input.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator(".subscribe")).isChecked();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isChecked() {
|
||||
isChecked(null);
|
||||
}
|
||||
class IsDisabledOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsDisabledOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a checked input.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator(".subscribe")).isChecked();
|
||||
* }</pre>
|
||||
*/
|
||||
void isChecked(IsCheckedOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a disabled element.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("button.submit")).isDisabled();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isDisabled() {
|
||||
isDisabled(null);
|
||||
}
|
||||
class IsEditableOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsEditableOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a disabled element.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("button.submit")).isDisabled();
|
||||
* }</pre>
|
||||
*/
|
||||
void isDisabled(IsDisabledOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an editable element.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).isEditable();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isEditable() {
|
||||
isEditable(null);
|
||||
}
|
||||
class IsEmptyOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsEmptyOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an editable element.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).isEditable();
|
||||
* }</pre>
|
||||
*/
|
||||
void isEditable(IsEditableOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an empty editable element or to a DOM node that has no text.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("div.warning")).isEmpty();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isEmpty() {
|
||||
isEmpty(null);
|
||||
}
|
||||
class IsEnabledOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsEnabledOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an empty editable element or to a DOM node that has no text.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("div.warning")).isEmpty();
|
||||
* }</pre>
|
||||
*/
|
||||
void isEmpty(IsEmptyOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an enabled element.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("button.submit")).isEnabled();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isEnabled() {
|
||||
isEnabled(null);
|
||||
}
|
||||
class IsFocusedOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsFocusedOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an enabled element.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("button.submit")).isEnabled();
|
||||
* }</pre>
|
||||
*/
|
||||
void isEnabled(IsEnabledOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a focused DOM node.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).isFocused();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isFocused() {
|
||||
isFocused(null);
|
||||
}
|
||||
class IsHiddenOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsHiddenOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a focused DOM node.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).isFocused();
|
||||
* }</pre>
|
||||
*/
|
||||
void isFocused(IsFocusedOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a hidden DOM node, which is the opposite of <a
|
||||
* href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator(".my-element")).isHidden();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isHidden() {
|
||||
isHidden(null);
|
||||
}
|
||||
class IsVisibleOptions {
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public Double timeout;
|
||||
|
||||
/**
|
||||
* Time to retry the assertion for.
|
||||
*/
|
||||
public IsVisibleOptions setTimeout(double timeout) {
|
||||
this.timeout = timeout;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a hidden DOM node, which is the opposite of <a
|
||||
* href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator(".my-element")).isHidden();
|
||||
* }</pre>
|
||||
*/
|
||||
void isHidden(IsHiddenOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a <a href="https://playwright.dev/java/docs/actionability/#visible">visible</a> DOM
|
||||
* node.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator(".my-element")).toBeVisible();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isVisible() {
|
||||
isVisible(null);
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a <a href="https://playwright.dev/java/docs/actionability/#visible">visible</a> DOM
|
||||
* node.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator(".my-element")).toBeVisible();
|
||||
* }</pre>
|
||||
*/
|
||||
void isVisible(IsVisibleOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an element that contains the given text. You can use regular expressions for the value
|
||||
* as well.
|
||||
@ -676,6 +816,26 @@ public interface LocatorAssertions {
|
||||
* @param id Element id.
|
||||
*/
|
||||
void hasId(String id, HasIdOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an element with the given DOM Node ID.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).hasId("lastname");
|
||||
* }</pre>
|
||||
*
|
||||
* @param id Element id.
|
||||
*/
|
||||
default void hasId(Pattern id) {
|
||||
hasId(id, null);
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an element with the given DOM Node ID.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).hasId("lastname");
|
||||
* }</pre>
|
||||
*
|
||||
* @param id Element id.
|
||||
*/
|
||||
void hasId(Pattern id, HasIdOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an element with given JavaScript property. Note that this property can be of a primitive
|
||||
* type as well as a plain serializable JavaScript object.
|
||||
@ -872,145 +1032,5 @@ public interface LocatorAssertions {
|
||||
* @param value Expected value.
|
||||
*/
|
||||
void hasValue(Pattern value, HasValueOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a checked input.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator(".subscribe")).isChecked();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isChecked() {
|
||||
isChecked(null);
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a checked input.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator(".subscribe")).isChecked();
|
||||
* }</pre>
|
||||
*/
|
||||
void isChecked(IsCheckedOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a disabled element.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("button.submit")).isDisabled();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isDisabled() {
|
||||
isDisabled(null);
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a disabled element.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("button.submit")).isDisabled();
|
||||
* }</pre>
|
||||
*/
|
||||
void isDisabled(IsDisabledOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an editable element.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).isEditable();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isEditable() {
|
||||
isEditable(null);
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an editable element.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).isEditable();
|
||||
* }</pre>
|
||||
*/
|
||||
void isEditable(IsEditableOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an empty editable element or to a DOM node that has no text.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("div.warning")).isEmpty();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isEmpty() {
|
||||
isEmpty(null);
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an empty editable element or to a DOM node that has no text.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("div.warning")).isEmpty();
|
||||
* }</pre>
|
||||
*/
|
||||
void isEmpty(IsEmptyOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an enabled element.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("button.submit")).isEnabled();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isEnabled() {
|
||||
isEnabled(null);
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to an enabled element.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("button.submit")).isEnabled();
|
||||
* }</pre>
|
||||
*/
|
||||
void isEnabled(IsEnabledOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a focused DOM node.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).isFocused();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isFocused() {
|
||||
isFocused(null);
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a focused DOM node.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator("input")).isFocused();
|
||||
* }</pre>
|
||||
*/
|
||||
void isFocused(IsFocusedOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a hidden DOM node, which is the opposite of <a
|
||||
* href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator(".my-element")).isHidden();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isHidden() {
|
||||
isHidden(null);
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a hidden DOM node, which is the opposite of <a
|
||||
* href="https://playwright.dev/java/docs/actionability/#visible">visible</a>.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator(".my-element")).isHidden();
|
||||
* }</pre>
|
||||
*/
|
||||
void isHidden(IsHiddenOptions options);
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a <a href="https://playwright.dev/java/docs/actionability/#visible">visible</a> DOM
|
||||
* node.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator(".my-element")).isVisible();
|
||||
* }</pre>
|
||||
*/
|
||||
default void isVisible() {
|
||||
isVisible(null);
|
||||
}
|
||||
/**
|
||||
* Ensures the {@code Locator} points to a <a href="https://playwright.dev/java/docs/actionability/#visible">visible</a> DOM
|
||||
* node.
|
||||
* <pre>{@code
|
||||
* assertThat(page.locator(".my-element")).isVisible();
|
||||
* }</pre>
|
||||
*/
|
||||
void isVisible(IsVisibleOptions options);
|
||||
/**
|
||||
* Makes the assertion check for the opposite condition. For example, this code tests that the Locator doesn't contain text
|
||||
* {@code "error"}:
|
||||
* <pre>{@code
|
||||
* assertThat(locator).not().containsText("error");
|
||||
* }</pre>
|
||||
*/
|
||||
LocatorAssertions not();
|
||||
}
|
||||
|
||||
|
||||
@ -68,6 +68,14 @@ public interface PageAssertions {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Makes the assertion check for the opposite condition. For example, this code tests that the page URL doesn't contain
|
||||
* {@code "error"}:
|
||||
* <pre>{@code
|
||||
* assertThat(page).not().hasURL("error");
|
||||
* }</pre>
|
||||
*/
|
||||
PageAssertions not();
|
||||
/**
|
||||
* Ensures the page has the given title.
|
||||
* <pre>{@code
|
||||
@ -148,13 +156,5 @@ public interface PageAssertions {
|
||||
* @param urlOrRegExp Expected substring or RegExp.
|
||||
*/
|
||||
void hasURL(Pattern urlOrRegExp, HasURLOptions options);
|
||||
/**
|
||||
* Makes the assertion check for the opposite condition. For example, this code tests that the page URL doesn't contain
|
||||
* {@code "error"}:
|
||||
* <pre>{@code
|
||||
* assertThat(page).not().hasURL("error");
|
||||
* }</pre>
|
||||
*/
|
||||
PageAssertions not();
|
||||
}
|
||||
|
||||
|
||||
@ -181,6 +181,12 @@ public class LocatorAssertionsImpl extends AssertionsBase implements LocatorAsse
|
||||
expectImpl("to.have.id", expected, id, "Locator expected to have ID", convertType(options, FrameExpectOptions.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hasId(Pattern pattern, HasIdOptions options) {
|
||||
ExpectedTextValue expected = expectedRegex(pattern);
|
||||
expectImpl("to.have.id", expected, pattern, "Locator expected to have ID matching regex", convertType(options, FrameExpectOptions.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hasJSProperty(String name, Object value, HasJSPropertyOptions options) {
|
||||
if (options == null) {
|
||||
|
||||
@ -154,7 +154,7 @@ class Utils {
|
||||
} catch (IOException e) {
|
||||
throw new PlaywrightException("Failed to read from file", e);
|
||||
}
|
||||
return new FilePayload(file.getFileName().toString(), mimeType(file), buffer);
|
||||
return new FilePayload(file.getFileName().toString(), null, buffer);
|
||||
}
|
||||
|
||||
static void mkParentDirs(Path file) {
|
||||
|
||||
@ -597,7 +597,7 @@ public class TestBrowserContextFetch extends TestBase {
|
||||
"\r\n" +
|
||||
"Doe"), body);
|
||||
assertTrue(body.contains("content-disposition: form-data; name=\"file\"; filename=\"simplezip.json\"\r\n" +
|
||||
(isMac ? "content-type: application/octet-stream\r\n" : "content-type: application/json\r\n") +
|
||||
"content-type: application/json\r\n" +
|
||||
"\r\n" +
|
||||
"{\"foo\":\"bar\"}"), body);
|
||||
assertEquals(200, response.status());
|
||||
|
||||
@ -1 +1 @@
|
||||
1.18.0-alpha-1637178126000
|
||||
1.18.0-alpha-1637257604000
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user