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
Problem.
clear()exists onTextFieldLocator,BigDecimalFieldLocator,EmailFieldLocator,PasswordFieldLocator— and is absent fromTextAreaLocator,NumberFieldLocator,IntegerFieldLocator,DatePickerLocator,DateTimePickerLocator,TimePickerLocator. There's noobvious rule behind the split, so you find out by compiling.
It matters most on the pickers, because
setValueon a picker refuses invalidinput by design:
findDatePicker().setValue(null)throwsIllegalArgumentException: Given date is not a valid value. That is the correctcall 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: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