|
| 1 | +--- |
| 2 | +title: 'Create Playwright Component Test for Neo.form.field.Password' |
| 3 | +labels: 'enhancement, testing, hacktoberfest, good first issue, help wanted' |
| 4 | +--- |
| 5 | +GH ticket id: (leave blank, will be assigned) |
| 6 | +**Epic:** Migrate Component Tests from Siesta to Playwright (R&D) |
| 7 | +**Phase:** 2 |
| 8 | +**Status:** To Do |
| 9 | + |
| 10 | +## Description |
| 11 | + |
| 12 | +This ticket is to create a new Playwright-based component test for `Neo.form.field.Password`. |
| 13 | + |
| 14 | +This test plan was generated using the AI-Native workflow defined in the "Cookbook Epic" and will serve as the acceptance criteria for the implementation. The test should be created in a new file `test/playwright/component/form/field/Password.spec.mjs` and follow the "Empty Viewport" architecture. |
| 15 | + |
| 16 | +## Component Analysis |
| 17 | + |
| 18 | +The `Neo.form.field.Password` component extends `Neo.form.field.Text` and only overrides the `inputType` configuration to set it to `'password'`. This means it inherits all functionality from the text field but renders as a password input type, which masks user input. |
| 19 | + |
| 20 | +## Acceptance Criteria |
| 21 | + |
| 22 | +### 1. Inherited Behavior Tests (from Neo.form.field.Text) |
| 23 | + |
| 24 | +- [ ] **disabled config:** Test that setting `disabled: true` adds the `.neo-disabled` class, prevents user interaction, and disables the input element. |
| 25 | +- [ ] **hidden config:** Test that setting `hidden: true` removes the component from the DOM (using the default `removeDom` hideMode). |
| 26 | +- [ ] **cls & style configs:** Test that custom classes and inline styles are correctly applied to the component's root element. |
| 27 | +- [ ] **value config:** Test setting the field's value programmatically and verifying the input element reflects the change. |
| 28 | +- [ ] **isDirty flag:** Test that the `isDirty` flag is correctly set when the value changes from its original value. |
| 29 | +- [ ] **clearable config:** Test that the clear trigger appears when the field has value and `clearable: true`. Test that clicking the trigger clears the value. |
| 30 | +- [ ] **labelText & labelPosition configs:** Test that changing `labelPosition` applies the correct `.label-[position]` class. For `labelPosition: 'inline'`, test that the label animation works correctly on focus and when content is present. |
| 31 | +- [ ] **Validation (minLength, maxLength, required):** Test that entering a value that violates a validation rule correctly applies the `.neo-invalid` class and that an error message is displayed. |
| 32 | +- [ ] **Triggers:** Test that custom triggers can be added and that they are interactive. |
| 33 | +- [ ] **Styling States:** Test that `.neo-focus` and `.neo-hovered` classes are applied correctly on user interaction. |
| 34 | + |
| 35 | +### 2. Password-Specific Feature Tests |
| 36 | + |
| 37 | +- [ ] **inputType configuration:** Verify that the underlying HTML input element has `type="password"` attribute set. |
| 38 | +- [ ] **Password masking:** Test that entered text is visually masked (displayed as dots or asterisks) while the actual value is preserved. |
| 39 | +- [ ] **Value persistence:** Ensure that even though the display is masked, the actual value property maintains the clear text. |
| 40 | +- [ ] **Copy/paste behavior:** Test that copy operations from the password field don't expose clear text (browser-dependent behavior). |
| 41 | +- [ ] **Password visibility toggle:** If the component supports a visibility toggle trigger (common in password fields), test that clicking it toggles between masked and clear text display. |
| 42 | + |
| 43 | +### 3. Accessibility Tests |
| 44 | + |
| 45 | +- [ ] **Screen reader compatibility:** Verify that the password field is properly announced as a password field to screen readers. |
| 46 | +- [ ] **ARIA attributes:** Test that appropriate ARIA attributes are present for accessibility. |
| 47 | +- [ ] **Keyboard navigation:** Ensure the field can be focused and interacted with using keyboard navigation. |
| 48 | + |
| 49 | +### 4. Security Considerations |
| 50 | + |
| 51 | +- [ ] **Autocomplete attributes:** Verify that appropriate `autocomplete` attributes are set (e.g., `autocomplete="current-password"` or `autocomplete="new-password"`). |
| 52 | +- [ ] **No value exposure:** Ensure that the component doesn't inadvertently expose the password value through DOM attributes or properties. |
| 53 | + |
| 54 | +### 5. Integration Tests |
| 55 | + |
| 56 | +- [ ] **Form submission:** Test that the password value is correctly submitted when contained within a form. |
| 57 | +- [ ] **Data binding:** Verify that data binding works correctly with the password field's masked display. |
| 58 | + |
| 59 | +## Test Implementation Notes |
| 60 | + |
| 61 | +- Use Playwright's `page.locator()` to target the password input element specifically |
| 62 | +- Verify password masking by checking that the displayed value differs from the actual value |
| 63 | +- Test both programmatic value setting and user input scenarios |
| 64 | +- Ensure tests run in isolated viewports to prevent interference |
| 65 | + |
| 66 | +## File Location |
| 67 | + |
| 68 | +The test should be created at: `test/playwright/component/form/field/Password.spec.mjs` |
0 commit comments