Skip to content

Add read-only assertions via HasReadOnlyElement mixin (#113) - #117

Merged
jcgueriaud1 merged 2 commits into
masterfrom
fix-113-assert-readonly
Jul 23, 2026
Merged

Add read-only assertions via HasReadOnlyElement mixin (#113)#117
jcgueriaud1 merged 2 commits into
masterfrom
fix-113-assert-readonly

Conversation

@jcgueriaud1

Copy link
Copy Markdown
Collaborator

Fixes #113.

Problem

Asserting a field's read-only state required a raw property check:

TextFieldElement orderId = TextFieldElement.getByLabel(page, "Order Id");
assertEquals(Boolean.TRUE, orderId.getProperty("readonly"));

Change

Introduces a shared HasReadOnlyElement mixin (following the existing HasEnabledElement pattern) so fields expose first-class read-only helpers:

  • isReadOnly(), isReadOnly(boolean)
  • assertReadOnly(), assertReadOnly(boolean), assertNotReadOnly()

The issue's example becomes:

TextFieldElement orderId = TextFieldElement.getByLabel(page, "Order Id");
orderId.assertReadOnly();

Details

  • TextFieldElement implements the mixin — inherited automatically by PasswordFieldElement, EmailFieldElement, and TextAreaElement.
  • ComboBoxElement and MultiSelectComboBoxElement had duplicated read-only methods; they now use the shared mixin (behavior unchanged).
  • Added a "Read-only Example" (with a toggle button) to TextFieldView and a testReadOnly IT.

Testing

  • mvn test-compile passes.
  • New TextFieldViewIT#testReadOnly passes.
  • Existing ComboBoxViewIT#testReadOnly / MultiSelectComboBoxViewIT#testReadOnly still pass after the refactor.

🤖 Generated with Claude Code

jcgueriaud1 and others added 2 commits July 23, 2026 16:13
Introduce a shared HasReadOnlyElement mixin so fields expose
assertReadOnly()/assertNotReadOnly()/isReadOnly() instead of relying on
raw getProperty("readonly") checks.

- TextFieldElement implements the mixin (inherited by PasswordField,
  EmailField and TextArea elements).
- ComboBoxElement and MultiSelectComboBoxElement drop their duplicated
  read-only methods in favor of the mixin.
- Add a read-only example to TextFieldView and a testReadOnly IT.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jcgueriaud1
jcgueriaud1 merged commit 2c40b16 into master Jul 23, 2026
3 checks passed
@jcgueriaud1
jcgueriaud1 deleted the fix-113-assert-readonly branch July 23, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assert readonly

1 participant