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. 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.

Drama Finder version 1.2.4
## New elements ### `ConfirmDialogElement` for `vaadin-confirm-dialog` (#195) - Finds an open confirm dialog by its `alertdialog` role (`get`) or by its header (`getByHeaderText`). - Reads the header and the message. - Answers the dialog with `confirm()`, `cancel()`, `reject()` or `closeWithEscape()`. - `assertClosed()` passes once Flow has removed the answered dialog. ### `CustomFieldElement` for `vaadin-custom-field` (#196) - Finds a custom field by its label (`group` role). - Reads its label, helper text, error message and tooltip, plus its required, invalid, disabled and read-only states. - Reaches the wrapped fields with `getField(type, label)` or `getField(type, index)`. - Has no value getter on purpose. The client value is a tab-joined string of the wrapped fields' client values, so assert on the wrapped fields instead. ## Improvements ### Clearer assertion failures (#192) Assertions that poll with `page.waitForCondition` used to fail with a bare `TimeoutError`. They now throw an `AssertionError

Drama Finder version 2.0.0
DramaFinder 2.0 has breaking changes. It makes lookups strict and actions synchronous with the server: - label lookups match the whole label; - a label is the visible label: an `aria-label` is the accessible name, and the query builder finds it and the placeholder; - every action waits for the Vaadin round-trip it triggers; - a typed query builder gives every element the same lookup grammar; - the Spring Boot base class ships in the library. 1.x test suites **compile unchanged**, unless a test class declares its own `navigate`, `assertAt`, `assertPath` or `assertQueryParameter`, or calls the removed `AccessibleNameLocator`. The `getByLabel` factories of components without a visible label are deprecated. Read the **[migration guide](https://github.com/parttio/dramafinder/blob/master/src/main/resources/META-INF/dramafinder/MIGRATION-2.0.md)** before upgrading.