docs(java): assertion docs fixes (#10144)

This commit is contained in:
Yury Semikhatsky 2021-11-08 11:31:11 -08:00 committed by GitHub
parent 9a7b4b745b
commit ac25a67140
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -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: Note that if array is passed as an expected value, entire lists can be asserted:
```java ```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 ### 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: Note that if array is passed as an expected value, entire lists can be asserted:
```java ```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 ### 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. Ensures the [Locator] points to an element with the given text. You can use regular expressions for the value as well.
```java ```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, .*")); assertThat(page.locator(".title")).hasText(Pattern.compile("Welcome, .*"));
``` ```
Note that if array is passed as an expected value, entire lists can be asserted: Note that if array is passed as an expected value, entire lists can be asserted:
```java ```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 ### param: LocatorAssertions.hasText.expected

View file

@ -23,7 +23,7 @@ Expected title or RegExp.
Ensures the page is navigated to the given URL. Ensures the page is navigated to the given URL.
```java ```java
assertThat(page).hasURL('.com'); assertThat(page).hasURL(".com");
``` ```
### param: PageAssertions.hasURL.urlOrRegExp ### 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"`: Makes the assertion check for the opposite condition. For example, this code tests that the page URL doesn't contain `"error"`:
```java ```java
assertThat(page).not().hasURL('error'); assertThat(page).not().hasURL("error");
``` ```