Skip to content

feat(testing): Implement Full E2E Cypress Test Suite for Admin Settings and Auto-Close Workflows#655

Open
advikdivekar wants to merge 1 commit into
ritesh-1918:gssocfrom
advikdivekar:fix/issue-635-cypress-e2e-tests
Open

feat(testing): Implement Full E2E Cypress Test Suite for Admin Settings and Auto-Close Workflows#655
advikdivekar wants to merge 1 commit into
ritesh-1918:gssocfrom
advikdivekar:fix/issue-635-cypress-e2e-tests

Conversation

@advikdivekar
Copy link
Copy Markdown

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 with baseUrl, timeout settings, env vars for admin credentials, and spec pattern

  • Frontend/cypress/fixtures/admin.json — Standardized admin login fixture reused across all test files

  • Frontend/cypress/support/commands.js — Custom commands:

    • cy.loginAsAdmin() — logs in via the full UI login form
    • cy.goToAdminSettings() — navigates and waits for settings page load
    • cy.stubSettingsApi() — intercepts GET/PATCH company settings API calls
    • cy.emitRealtimeTicketUpdate() — dispatches a CustomEvent to mock Supabase realtime WebSocket events
  • Frontend/cypress/support/e2e.js — Global support file; suppresses known third-party uncaught exceptions

  • Frontend/cypress/e2e/admin-settings.cy.js — 6 specs:

    • All settings sections render correctly
    • AI confidence threshold slider shows and updates value
    • Auto Resolve toggle changes state
    • Settings persist on page reload (Zustand hydration)
    • Email notifications toggle switches states
    • Auto-close days selector is present
  • Frontend/cypress/e2e/auto-close-timeline.cy.js — 8 specs:

    • Ticket list shows resolved tickets
    • Timeline section visible in ticket detail
    • Realtime WebSocket event updates ticket status dynamically
    • Notification popover renders after realtime update
    • Auto-close days reflected in admin settings
    • Changing auto-close days sends PATCH to settings API
    • Auto-close countdown badge visible for stale resolved tickets
    • Admin can manually close ticket before auto-close fires
  • Frontend/cypress/e2e/webhook-settings.cy.js — 6 specs:

    • Page loads without uncaught errors
    • AI settings section has interactive elements
    • All toggle buttons are clickable without throwing
    • Notification toggles render correctly
    • Unauthenticated access redirects properly
    • Page has accessible heading landmarks

Test Plan

  • Run npx cypress open from /Frontend directory
  • Verify all 3 spec files appear in Cypress UI
  • Run all specs with app running on localhost:5173
  • All 20 tests should pass (or skip gracefully for unimplemented selectors)

… 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
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

@advikdivekar is attempting to deploy a commit to the ritesh Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f74123c8-8ffa-4a2c-af8a-78d732ef6ca0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +23 to +25
cy.intercept('GET', `**/tickets?ticket_id=eq.${MOCK_TICKET.ticket_id}**`, {
body: [MOCK_TICKET],
}).as('getTicketDetail');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@advikdivekar
Copy link
Copy Markdown
Author

@ritesh-1918 please review my PR, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant