Reviewer · Testing
Centralized test selectors
Avoid `ember-cli-page-object` and ad-hoc, hardcoded CSS-class or attribute selectors scattered across test files. Instead, use the shared `GENERAL` selectors helper (`vault/tests/helpers/general-selectors`) for common elements like inputs, validation errors, toggles, and labels. Page objects are confusing and have "sharp edges," and one-off selectors...
Avoid ember-cli-page-object and ad-hoc, hardcoded CSS-class or attribute selectors scattered across test files. Instead, use the shared GENERAL selectors helper (vault/tests/helpers/general-selectors) for common elements like inputs, validation errors, toggles, and labels. Page objects are confusing and have “sharp edges,” and one-off selectors duplicate logic, become brittle when markup/classes change (e.g., switching to HDS components), and are harder to discover/reuse. When a needed selector doesn’t exist yet in GENERAL, add it there rather than inlining it locally, and update existing one-off selectors to use GENERAL when you touch that code.
Example:
// Avoid
assert.dom(CUSTOM_MESSAGES.input('message')).hasClass('hds-form-textarea--is-invalid');
assert.dom(`${CUSTOM_MESSAGES.fieldValidation('message')} ${CUSTOM_MESSAGES.inlineErrorMessage}`).hasText('Message is required.');
// Prefer
assert.dom(GENERAL.inputByAttr('message')).hasClass('hds-form-textarea--is-invalid');
assert.dom(GENERAL.validationErrorByAttr('message')).hasText('Message is required.');
This keeps selectors consistent, discoverable, and easier to update in one place as the UI evolves.