docs(java): assertion docs fixes (#10144)
This commit is contained in:
parent
9a7b4b745b
commit
ac25a67140
|
|
@ -14,7 +14,7 @@ assertThat(page.locator(".title")).containsText("substring");
|
|||
Note that if array is passed as an expected value, entire lists can be asserted:
|
||||
|
||||
```java
|
||||
assertThat(page.locator("list > .list-item")).containsText(Arrays.asList("Text 1", "Text 4", "Text 5"));
|
||||
assertThat(page.locator("list > .list-item")).containsText(new String[] {"Text 1", "Text 4", "Text 5"});
|
||||
```
|
||||
|
||||
### param: LocatorAssertions.containsText.expected
|
||||
|
|
@ -60,7 +60,7 @@ assertThat(page.locator("#component")).hasClass(Pattern.compile("selected"));
|
|||
Note that if array is passed as an expected value, entire lists can be asserted:
|
||||
|
||||
```java
|
||||
assertThat(page.locator("list > .component")).hasClass(Arrays.asList("component", "component selected", "component"));
|
||||
assertThat(page.locator("list > .component")).hasClass(new String[] {"component", "component selected", "component"});
|
||||
```
|
||||
|
||||
### param: LocatorAssertions.hasClass.expected
|
||||
|
|
@ -145,14 +145,14 @@ Property value.
|
|||
Ensures the [Locator] points to an element with the given text. You can use regular expressions for the value as well.
|
||||
|
||||
```java
|
||||
assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, Test User"));
|
||||
assertThat(page.locator(".title")).hasText("Welcome, Test User");
|
||||
assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
|
||||
```
|
||||
|
||||
Note that if array is passed as an expected value, entire lists can be asserted:
|
||||
|
||||
```java
|
||||
assertThat(page.locator("list > .component")).hasText(Arrays.asList("Text 1", "Text 2", "Text 3"));
|
||||
assertThat(page.locator("list > .component")).hasText(new String[] {"Text 1", "Text 2", "Text 3"});
|
||||
```
|
||||
|
||||
### param: LocatorAssertions.hasText.expected
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ Expected title or RegExp.
|
|||
Ensures the page is navigated to the given URL.
|
||||
|
||||
```java
|
||||
assertThat(page).hasURL('.com');
|
||||
assertThat(page).hasURL(".com");
|
||||
```
|
||||
|
||||
### param: PageAssertions.hasURL.urlOrRegExp
|
||||
|
|
@ -39,5 +39,5 @@ Expected substring or RegExp.
|
|||
Makes the assertion check for the opposite condition. For example, this code tests that the page URL doesn't contain `"error"`:
|
||||
|
||||
```java
|
||||
assertThat(page).not().hasURL('error');
|
||||
assertThat(page).not().hasURL("error");
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in a new issue