feat(testing): Implement Full E2E Cypress Test Suite for Admin Settings and Auto-Close Workflows#655
Conversation
… auto-close workflows Closes ritesh-1918#635 - Add cypress.config.js: Cypress 13 configuration with baseUrl, admin credentials env, and standard timeouts - Add cypress/fixtures/admin.json: standardized admin login fixture for all test suites - Add cypress/support/commands.js: custom commands loginAsAdmin, goToAdminSettings, stubSettingsApi, and emitRealtimeTicketUpdate (CustomEvent WebSocket mock) - Add cypress/support/e2e.js: global setup with suppression of known third-party uncaught exceptions - Add cypress/e2e/admin-settings.cy.js: 6 specs covering settings load, slider interaction, toggle state changes, and persistence on page reload via store hydration - Add cypress/e2e/auto-close-timeline.cy.js: 8 specs covering ticket auto-close timeline, realtime WebSocket status updates, notification popover rendering, and manual close flow - Add cypress/e2e/webhook-settings.cy.js: 6 specs covering page load, toggle interaction, accessibility landmarks, and unauthenticated redirect guard
|
@advikdivekar is attempting to deploy a commit to the ritesh Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98d1c7a25c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ...overrides, | ||
| }; | ||
|
|
||
| cy.intercept('GET', '**/company_settings**', { body: defaultSettings }).as('getSettings'); |
There was a problem hiding this comment.
Don't wait on a settings API the page never calls
The admin settings page reads and updates useAdminStore state directly, so visiting /admin/settings does not issue any company_settings request. Because the new specs call cy.wait('@getSettings') after stubSettingsApi(), those tests time out waiting for an alias that is never hit instead of exercising the page; either hydrate the Zustand storage/state in the test or add/apply the real API integration before waiting on this route.
Useful? React with 👍 / 👎.
| cy.intercept('GET', `**/tickets?ticket_id=eq.${MOCK_TICKET.ticket_id}**`, { | ||
| body: [MOCK_TICKET], | ||
| }).as('getTicketDetail'); |
There was a problem hiding this comment.
Match the ticket detail query the app actually sends
The detail page fetches tickets with .eq('id', ticket_id) after navigating to /admin/ticket/:ticket_id, but this alias only matches ticket_id=eq.... In the detail-view tests that do cy.wait('@getTicketDetail'), the Supabase request will be id=eq.test-ticket-001 (or be caught by the broad @getTickets route), so the @getTicketDetail wait times out and the specs never reach their assertions.
Useful? React with 👍 / 👎.
|
@ritesh-1918 please review my PR, thank you |
Summary
Fixes #635
This PR adds a complete Cypress E2E test suite covering admin settings persistence, webhook configuration, and auto-close ticket notification timeline workflows.
Changes
Frontend/cypress.config.js— Cypress configuration withbaseUrl, timeout settings, env vars for admin credentials, and spec patternFrontend/cypress/fixtures/admin.json— Standardized admin login fixture reused across all test filesFrontend/cypress/support/commands.js— Custom commands:cy.loginAsAdmin()— logs in via the full UI login formcy.goToAdminSettings()— navigates and waits for settings page loadcy.stubSettingsApi()— intercepts GET/PATCH company settings API callscy.emitRealtimeTicketUpdate()— dispatches a CustomEvent to mock Supabase realtime WebSocket eventsFrontend/cypress/support/e2e.js— Global support file; suppresses known third-party uncaught exceptionsFrontend/cypress/e2e/admin-settings.cy.js— 6 specs:Frontend/cypress/e2e/auto-close-timeline.cy.js— 8 specs:Frontend/cypress/e2e/webhook-settings.cy.js— 6 specs:Test Plan
npx cypress openfrom/Frontenddirectorylocalhost:5173