Add-on Directory

Drama Finder - Vaadin Add-on Directory

Playwright utility classes for Vaadin Drama Finder - Vaadin Add-on Directory
Drama Finder is a set of helper classes to test a Vaadin application using Playwright. It gives you access to a list of assertions and actions you can do for our components. ```java @Test public void testTooltip() { // get a text that has an accessible name (label or aria label,...) equals to text field TextFieldElement textfield = TextFieldElement.getByLabel(page, "Textfield"); // assert that is visible textfield.assertVisible(); // assert that the textfield has a tooltip textfield.assertTooltipHasText("Tooltip for textfield"); } ``` ## Note The API is in early stage of development and a lot of components are not yet covered. You can see the list of covered components: https://github.com/parttio/dramafinder/blob/master/TODO.md ## How to use it Add the addon as a test dependency: ```xml org.vaadin.addons dramafinder version test ``` You also need to add Playwright dependency in your test project ```xml com.microsoft.playwright playwright 1.55.0 test ``` With Spring Boot you can copy the `SpringPlaywrightIT` then create a simple test: ```java @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) public class SimpleExampleViewIT extends SpringPlaywrightIT { @Test public void testTooltip() { TextFieldElement textfield = TextFieldElement.getByLabel(page, "Textfield"); textfield.assertVisible(); textfield.assertTooltipHasText("Tooltip for textfield"); } } ``` To start in your project you can read the official documentation and use the helpers: https://vaadin.com/docs/latest/flow/testing/playwright For example replace this: ```java page.locator("//vaadin-button[contains(text(),'Click me')]").click(); assertThat(page.locator("#msg")).containsText("Clicked!"); ``` By: ```java ButtonElement.getByText(page, "Click me").click(); assertThat(page.locator("#msg")).containsText("Clicked!"); // in that case msg is a Paragraph so you can use plain Playwright ```
Issue tracker
View on GitHub

Drama Finder version 0.0.4
The addon has been tested with 24.8 and 24.9. It might not work with previous version of Vaadin 24.