DramaFinder 2.0.1¶
DramaFinder 2.0.1 adds the element API found missing while building a Playwright adapter on 2.0: Grid row clicks, sorting to a direction and header rows, typed number values, item labels for selection fields, disabled tabs, and a test signed in as a Spring Security user.
It also makes four helpers fail loudly where 2.0.0 did nothing or timed out. A test
that relied on that silence can fail after the upgrade; see
Behaviour changes. One overload addition can break compilation
of a call that passes a literal null.
Behaviour changes¶
Grid selection and row details verify the outcome (#221)¶
GridElement.select(int)anddeselect(int)throwIllegalArgumentExceptionwhen no row exists at the index. In 2.0.0 they did nothing.selectanddeselect(on the grid and onRowElement) fail with anAssertionErrorwhen the row's selected state did not change. That happens on a grid with no selection, a single-select grid that does not allow deselecting, or a server that rejects the selection.RowElement.openDetails()andcloseDetails()click the first data cell of the row, skipping the selection column, at a spot free of buttons and links. In 2.0.0 they clicked the second cell. That failed on a one-column grid, and could click a component rendered in the cell. They now fail with anAssertionErrornamingsetDetailsVisibleOnClick(true)when the details did not toggle; before, nothing happened. Override the protectedopenDetails(RowElement)/closeDetails(RowElement)when a grid toggles details another way.
Tabs (#228)¶
TabElement.select(), andselectTab(..)onTabsElementandTabSheetElement, throwIllegalStateExceptionat once on a disabled tab. In 2.0.0 they waited for Playwright's action timeout and failed with a genericTimeoutError. The check runs once, without retrying: a tab enabled by the server is fine, because the previous action already waited for the round-trip.TabElement.getLabel()returns the tab's own text, whitespace collapsed and trimmed, without children placed in a named slot. In 2.0.0 it returned the rawtextContent.
A literal null is ambiguous on number fields (#224)¶
NumberFieldElement gains setValue(Double) / assertValue(Double) and
IntegerFieldElement gains setValue(Integer) / assertValue(Integer), next to the
inherited String methods. A call that passes a literal null, such as
field.setValue(null), no longer compiles. Write (Double) null, (Integer) null
or clear(). With the String method such a call already failed at runtime.
Deprecated¶
GridElement.matchesCellContent(CellElement, String) is deprecated for removal
(#218). findRowIndexesWithColumnText no longer calls it; override
matchesCellText(String, String) to customise matching.
New features¶
Grid (#218, #219, #221, #222)¶
RowElement.click()anddoubleClick()fire the grid's item click and double click. Like the details methods, they click the first data cell at a spot free of interactive content, so a button or link in the cell is not triggered.HeaderCellElement.sort(GridElement.SortDirection)clicks the sorter until it showsASCENDING,DESCENDINGorNONE(at most two clicks), waiting for the grid after each click.getSortDirection()andassertSortDirection(..)read the direction back. The enum shares its simple name with Flow'scom.vaadin.flow.data.provider.SortDirection, so qualify one of them when you import both.GridElement.getHeaderCells(int columnIndex)returns a column's header cells in every header row, top first: a joined group cell above, and a filter field in an appended row below. Scope a component lookup to a cell'sgetCellContentLocator().GridElement.findColumnIndexById/getColumnIndexByIdfind a column by the id Flow sets withColumn.setId(..), for a column without header text.GridElement.getColumnTexts(int)reads a whole column. On a lazy grid it reads one rendered page at a time instead of scrolling to each row in turn.findRowIndexesWithColumnTextuses it.
Column indexes count the visible columns in display order, the multi-select
checkbox column included, as TestBench's GridElement does. Flow's
Grid.getColumns() and browserless tests leave the selection column out, so their
index is one less in a multi-select grid. Look a column up by header text or id to
stay independent of the selection mode.
Typed number values (#224)¶
NumberFieldElement:setValue(Double),getValueAsDouble(),assertValue(Double). A whole number is typed as a user types it (170, not170.0), never in exponent form; NaN and infinity throwIllegalArgumentException.IntegerFieldElement:setValue(Integer),getValueAsInteger(),assertValue(Integer).
null clears the field. The assertions retry and compare numerically: 2.5
matches 2.50, 0.0 matches -0, and text that is not a number is a mismatch.
Selection field labels (#226)¶
ComboBoxElement.getItemLabels()andMultiSelectComboBoxElement.getItemLabels()return every item the drop-down offers for the current filter. With a lazy data provider they load the remaining pages one after the other, so all items are returned, not only the rendered ones. The overlay is closed again afterwards if it was closed.ComboBoxElement.getSelectedItemLabel()reads the selected item's label. It is not affected by a filter typed into the input, and returnsnullfor a custom value.RadioButtonGroupElement.getItemLabels(),getSelectedLabel()andassertSelectedLabel(String)read the labels the user sees rather than Flow's item keys.
Tabs (#228)¶
TabElementimplementsHasEnabledElement:isEnabled(),assertEnabled(),assertDisabled().TabsElementandTabSheetElementgaingetTabLabels()andassertTabLabels(String...).
Notifications in the query builder (#220)¶
find(page, NotificationElement.class) searches the open notification cards, so
withText / withTextContaining combine with the common filters (e.g. theme) and
with all(), exists() and count(). withId and withTestId do not match:
Flow puts both on vaadin-notification, not on the card.
Sign in as a Spring Security user (#217)¶
With Spring Security, a SpringPlaywrightIT test starts signed in as the user of
Spring Security Test's @WithMockUser, @WithUserDetails or any other
@WithSecurityContext annotation, without going through the login view. Without an
annotation, or with @WithAnonymousUser, it starts signed out.
loginAs(username, roles...)switches user during a test.newPageAs(username, roles...)opens a second user's page.loginAs(BrowserContext, username, roles...)signs in a context the test opened itself.
The user goes into the HTTP session through an endpoint that exists only in the
test's Spring context, so the application must keep its security context in the
session (Spring Security's default, and Vaadin's). It needs spring-security-test.
Spring Security stays provided and optional: a project without it is not affected.
SpringPlaywrightIT gains the protected loginAs and newPageAs methods and a
public closeExtraContexts(). A test class that already declares a method with one
of those names and an incompatible signature no longer compiles.
Agent skills and documentation¶
vaadin-playwright-testskill bumped to 0.14.8 (from 0.13.0), with the new API in its bundledapi-reference.mdandelement-mapping.md.docs/specifications/GridElement.mddocuments row clicks, verified selection and details, sorting to a direction, header cells across header rows, and how column indexes compare with TestBench and Flow.
Full changelog: https://github.com/parttio/dramafinder/compare/dramafinder-2.0.0...dramafinder-2.0.1