Drama Finder - Vaadin Add-on Directory
Playwright utility classes for Vaadin
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.
The documentation can be found in this repository and also deployed on https://parttio-dramafinder.mintlify.app/ if you find some errors please file an issue.
```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
Drama Finder covers most of the Vaadin components (see TODO.md for the list of supported components and the remaining gaps) and follows semantic versioning since 1.0. It is built and tested against Vaadin 25.
If you notice something missing please create a ticket or a Pull Request.
## 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.
Drama Finder version 1.0.2
Add more helpers for:
- Upload
- Context Menu
- Side navigation
- Card
First release for Vaadin 25
Drama Finder version 1.1.0
Add new test elements for the Grid, TreeGrid, Combobox.
Drama Finder version 1.2.0
Update to Vaadin 25.3.
New elements
- AppLayoutElement (vaadin-app-layout)
- AvatarGroupElement (vaadin-avatar-group)
- BadgeElement
- BreadcrumbsElement and BreadcrumbsItemElement
- CheckboxGroupElement
- FormLayoutElement
- LoginFormElement and LoginOverlayElement
- MarkdownElement (vaadin-markdown)
- SliderElement (vaadin-slider)
- SwitchElement (the experimental Switch in Vaadin 25.3)
- TabsElement
- TooltipElement. HasTooltipElement now goes through it.
New shared mixins
- HasCheckedElement
- HasDisabledAttributeElement, for components whose host element isn't a nat Jump to bottom (click) ↓ , Playwright's isEnabled() gets the disabled state wrong.