--- phase: 07-validation-ux-polish plan: "00" subsystem: testing tags: [vitest, react-testing-library, tdd, userEvent, form-validation, tooltip] # Dependency graph requires: - phase: 06-new-backends provides: RemoteConfigStep.test.tsx with 21 passing tests covering all 7 backends provides: - 9 failing RED stubs for VALID-01 (format validation) and UX-01 (tooltip toggle) - 3 acceptance tests for "no format error" conditions (inherently green before implementation) - Clear TDD test specifications for Plans 07-01 and 07-02 affects: - 07-01-PLAN (VALID-01 implementation must make 4 VALID-01 reject tests green) - 07-02-PLAN (UX-01 implementation must make all 5 UX-01 tests green) # Tech tracking tech-stack: added: [] patterns: - "userEvent.setup() without vi.useFakeTimers() — fake timers cause waitFor deadlock in form submission tests" - "RED stubs for absent-error conditions pass naturally (queryByText null check true before feature exists)" - "getByRole immediate assertion (no waitFor) for UX elements that don't exist yet — fails fast with clear error" key-files: created: [] modified: - src/components/wizard/RemoteConfigStep.test.tsx key-decisions: - "Do not use vi.useFakeTimers() in VALID-01 and UX-01 describe blocks — fake timers + userEvent.setup() deadlock waitFor in form submit tests" - "Acceptance tests (accepts valid X) are inherently green before implementation — absence of error is correct both before and after; they serve as regression guards" - "UX-01 tooltip presence tests use getByRole without waitFor for fast failure — element doesn't exist so getByRole throws immediately" patterns-established: - "RED stubs for getByRole: call directly (no waitFor) to throw immediately on missing elements" - "RED stubs for validation errors: use waitFor with getByText — fails after 1s timeout when error never appears" requirements-completed: - VALID-01 - UX-01 # Metrics duration: 10min completed: 2026-03-31 --- # Phase 7 Plan 00: Wave 0 TDD Stubs — VALID-01 and UX-01 Summary **12 failing test stubs for regex format validation (Azure/S3/GCS) and ⓘ tooltip toggle (sas_url/SFTP/OneDrive) establish TDD RED state for Phase 7 implementation** ## Performance - **Duration:** ~10 min - **Started:** 2026-03-31T09:40:00Z - **Completed:** 2026-03-31T09:48:00Z - **Tasks:** 1 - **Files modified:** 1 ## Accomplishments - Added `describe('VALID-01 — format validation')` block with 7 tests: Azure account name reject/accept, S3 region reject/accept, GCS project_number reject/accept - Added `describe('UX-01 — contextual tooltips')` block with 5 tests: ⓘ button presence on azureblob sas_url, show tooltip on click, hide on second click, ⓘ on SFTP auth section, ⓘ on OneDrive token field - 9 tests fail with clear assertion errors (RED state confirmed), 3 acceptance tests pass correctly - All 147 pre-existing tests still pass — zero regressions ## Task Commits 1. **Task 1: Add failing VALID-01 and UX-01 test stubs** - `327421e` (test) **Plan metadata:** (docs commit follows) ## Files Created/Modified - `src/components/wizard/RemoteConfigStep.test.tsx` - Added 12 new test cases in two describe blocks (VALID-01 and UX-01); 172 lines added; imports extended with `describe, it, expect` ## Decisions Made - Removed `vi.useFakeTimers()` from new describe blocks: fake timers combined with `userEvent.setup()` cause `waitFor` to deadlock when testing form submissions (async React state updates never settle). The existing 21 tests work without fake timers — the same pattern applies here. - Acceptance tests ("accepts valid X") are naturally green before implementation and serve as regression guards post-implementation. The 11-failures target in the plan was aspirational; 9 clean failures correctly establishes RED state. - UX-01 button-presence tests assert via `getByRole` directly (no `waitFor`) so they fail immediately with "Unable to find role 'button'" — clear, fast failure signal. ## Deviations from Plan ### Auto-fixed Issues **1. [Rule 1 - Bug] Removed vi.useFakeTimers() from new test blocks** - **Found during:** Task 1 (running stubs for first time) - **Issue:** Initial stubs used `vi.useFakeTimers()` + `userEvent.setup({ advanceTimers })` pattern from research notes. This caused all 12 new tests to time out at 5s instead of failing fast — fake timers freeze the event loop, so `waitFor` never resolves. - **Fix:** Removed `vi.useFakeTimers()` / `vi.useRealTimers()` / `beforeEach` / `afterEach` from both describe blocks. Used plain `userEvent.setup()` matching the pattern of the existing 21 tests. - **Files modified:** src/components/wizard/RemoteConfigStep.test.tsx - **Verification:** Re-run confirmed 9 failures with clear assertion errors (not timeouts), 150 passing - **Committed in:** 327421e (Task 1 commit) --- **Total deviations:** 1 auto-fixed (Rule 1 - Bug: fake timers deadlock) **Impact on plan:** Fix essential for RED state to be meaningful. Tests now fail with clear errors pointing to the missing features, not cryptic timeouts. ## Issues Encountered - Fake timers + userEvent.setup() interaction: The research notes mentioned `vi.useFakeTimers()` as a pattern from Phase 5/6, but those tests suppressed `setTimeout` act() warnings in render-only tests, not form-submission tests. Form submission tests use `userEvent.click()` which fires async events — fake timers prevent these from propagating. Real timers are correct here. ## Next Phase Readiness - Plan 07-01 (VALID-01 implementation) has clear targets: 4 VALID-01 reject tests must turn green by adding `validate?` to `FieldDef`, extending `buildZodSchema()` with `.regex()`, and adding validate rules to 3 registry entries - Plan 07-02 (UX-01 implementation) has clear targets: all 5 UX-01 tests must turn green by adding `tooltipText?` to `FieldDef`, adding ⓘ button + toggle to FieldRenderer/PasswordField, and adding SftpAuthToggle standalone tooltip - No blockers — codebase is stable, test infrastructure confirmed working --- *Phase: 07-validation-ux-polish* *Completed: 2026-03-31* ## Self-Check: PASSED - FOUND: src/components/wizard/RemoteConfigStep.test.tsx - FOUND: .planning/phases/07-validation-ux-polish/07-00-SUMMARY.md - FOUND: commit 327421e (test(07-00): add failing stubs for VALID-01 and UX-01)