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.

Drama Finder version 2.1.0
DramaFinder 2.1.0 makes GridElement and the typed queries cheaper to use: grid reads take far fewer browser round trips and waits, and the CSS-expressible query filters compile into a single selector.

Drama Finder version 2.2.0
DramaFinder 2.2.0 keeps checkboxes, radio buttons, switches and vaadin-select working on Vaadin 25.4, and rounds out the API for components without an element class: a GenericElement can be focused and checked for its enabled state, and a typed query can search any tag.

Drama Finder version 2.2.1
DramaFinder 2.2.1 makes getText() leave out tooltips, so a component reports the same text a withText(..) query found it by, and adds a getter for the accessible name a withAccessibleName(..) query matches. Label lookups find a field by its FormLayout item label, Grid header lookups read column captions under a header group row, a row click works on a grid inside a template and on a card that fills its cell, and the wait after an action covers a server-side navigation and a page whose Flow UI has not started yet.

Drama Finder version 2.2.2
DramaFinder 2.2.2 makes the wait after an action one browser call again.

Drama Finder version 2.2.3
DramaFinder 2.2.3 makes the selection methods of the multi-select combo box and the list box do what their names say. ### Upgrading from 2.2.2 One behaviour differs: - **`MultiSelectComboBoxElement.selectItem` no longer deselects** (#321). `selectItem(s)`, `deselectItem(s)` and `filterAndSelectItem` used to click the item whatever its state, so selecting a selected item deselected it and deselecting an unselected one selected it. They now skip an item that is already in the requested state. A test that relied on the click toggling should call the new `toggleItem(label)`. - **`ListBoxElement.selectItem` no longer deselects** (#322). In multiple mode it clicked the item whatever its state, so selecting a selected item deselected it. It now skips an item that is already selected. Call the new `deselectItem(label)` or `toggleItem(label)` instead.

Drama Finder version 2.2.4
DramaFinder 2.2.4 handles menu bar items collapsed into the overflow menu and reads more of the Grid's accessibility: its own name, its column alignment and the i18n names Vaadin 25.3 gives its sorters and selection checkboxes. ## Upgrading from 2.2.3 One behaviour differs: - **`MenuBarElement.getItemLabels()` no longer lists "More options"** (#334). Once the overflow button was shown, it was returned as one of the menu bar's items. It is now left out; the items collapsed into it are still listed.

Drama Finder version 2.2.6
DramaFinder 2.2.6 fixes a regression in 2.2.5's combo box selection: a pick in a field the application replaces as it takes the value no longer waits until the timeout, and a value the server rejects fails as soon as the server has answered. https://github.com/parttio/dramafinder/releases/tag/dramafinder-2.2.6