From 34e55007d0141b52e70127881bc260ed42cdcaef Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Fri, 29 Oct 2021 08:33:07 -0700 Subject: [PATCH] docs: clarify how to import assertions (#9868) --- docs/src/api/class-playwrightassertions.md | 23 +++++++++++++++++++++- docs/src/intro-java.md | 2 +- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/src/api/class-playwrightassertions.md b/docs/src/api/class-playwrightassertions.md index aa83119950..214bd42d94 100644 --- a/docs/src/api/class-playwrightassertions.md +++ b/docs/src/api/class-playwrightassertions.md @@ -6,7 +6,18 @@ The [PlaywrightAssertions] class provides convenience methods for creating asser Consider the following example: ```java -assertThat(page.locator('.status')).hasText('Submitted'); +... +import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; + +public class TestExample { + ... + @Test + void statusBecomesSubmitted() { + ... + page.click("#submit-button"); + assertThat(page.locator(".status")).hasText("Submitted"); + } +} ``` Playwright will be re-testing the node with the selector `.status` until fetched Node has the `"Submitted"` @@ -15,6 +26,16 @@ reached. You can pass this timeout as an option. By default, the timeout for assertions is set to 5 seconds. +To use Playwright assertions add the following dependency into the `pom.xml` of your Maven project: + +```xml + + com.microsoft.playwright + assertions + 1.16.0 + +``` + ## method: PlaywrightAssertions.assertThatLocator * langs: java - alias-java: assertThat diff --git a/docs/src/intro-java.md b/docs/src/intro-java.md index 35e7dc6761..b14e46f845 100644 --- a/docs/src/intro-java.md +++ b/docs/src/intro-java.md @@ -59,7 +59,7 @@ public class Example { com.microsoft.playwright playwright - 1.9.0-alpha-0 + 1.16.0