sadpandajoe opened a new pull request, #41436:
URL: https://github.com/apache/superset/pull/41436

   ### SUMMARY
   
   Migrates the deprecated Cypress database-modal E2E suite to Jest + React 
Testing
   Library, continuing the testing-strategy modernization (prefer 
unit/integration
   over E2E; Cypress is being removed).
   
   All four original Cypress tests in 
`cypress-base/cypress/e2e/database/modal.test.ts`
   are ported into the existing consolidated RTL file
   `src/features/databases/DatabaseModal/index.test.tsx` (added to that file 
rather
   than a new one to reuse its ~250-line `fetchMock` fixture), and the Cypress 
spec
   is deleted:
   
   1. **Opens the dynamic form with empty connection fields** — selects 
PostgreSQL
      and asserts the connection fields are empty (the display-name field 
defaults
      to the engine name).
   2. **Switches to the SQLAlchemy URI form via the connect link** — exercises 
the
      `sqla-connect-btn` switch flow.
   3 & 4. **Surfaces a host / port validation error** — parametrized via 
`test.each`.
   
   #### Determination on the two "error alert" cases (the ticket's open 
question)
   
   The ticket flagged the two error-alert cases as "not RTL" and asked whether 
they
   should become Playwright tests or could be converted to RTL with API-response
   mocks. **They can be RTL, and that is the better choice here.** The original
   Cypress tests drove a real backend connection attempt (real DNS / socket
   behaviour), which is exactly what made them flaky; a 
Playwright-against-a-real-backend
   version would be just as flaky. The frontend's only real responsibility is
   mapping an `extra.invalid` field error from `validate_parameters` onto the
   matching form field, so these tests mock that response and assert the error
   renders as an inline error **on the named field** (`.ant-form-item` for the 
field
   in `extra.invalid`).
   
   **Trade-off (reviewer veto welcome):** these cover the frontend 
error-surfacing
   pipeline, **not** the backend contract that a bad host/port actually yields 
that
   error — that belongs in backend tests. The mocked `error_type` values are 
inert
   here (they don't drive frontend behaviour on the create path); they're 
included
   only to mirror a realistic `validate_parameters` payload.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — test-only change.
   
   ### TESTING INSTRUCTIONS
   
   ```
   cd superset-frontend
   npx jest src/features/databases/DatabaseModal/index.test.tsx
   ```
   
   All tests in the file pass (the four migrated tests live under the
   `Migrated from Cypress: database/modal.test.ts` describe block). The error 
cases
   were run repeatedly to confirm they are not flaky.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [x] Removes existing feature or API (deletes the deprecated Cypress 
`database/modal` spec)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to