Skip to content

Agent DX improvement: clear() is inconsistent — and missing exactly where invalid-state tests need it #153

Description

@peholmst

Problem. clear() exists on TextFieldLocator, BigDecimalFieldLocator,
EmailFieldLocator, PasswordFieldLocator — and is absent from
TextAreaLocator, NumberFieldLocator, IntegerFieldLocator,
DatePickerLocator, DateTimePickerLocator, TimePickerLocator. There's no
obvious rule behind the split, so you find out by compiling.

It matters most on the pickers, because setValue on a picker refuses invalid
input by design
: findDatePicker().setValue(null) throws
IllegalArgumentException: Given date is not a valid value. That is the correct
call for "user typed something invalid", but it also blocks the very common
"user emptied a required field → validation fires → error summary appears" test.
With no clear() on the picker there is no locator-level way to model it:

// Wanted
findDatePicker().withLabel("Report date").clear();

// Actual — drop out of the locator API entirely
$(DatePicker.class).first().clear();

Ask. Give every value locator clear() with "user emptied the field"
semantics (bypassing the set-time validity check, since emptying is a legal user
action even when it makes the field invalid). Uniform presence matters as much as
the behaviour: partial coverage makes the API unpredictable.

Copied from https://github.com/vaadin/agentic-dx-improvement/issues/107

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions