Test Specification: Feedback Submission
See Test Specs Overview for application architecture and test environment setup.
Feature Gating
The Feedback feature is gated on the FEEDBACK_INBOX_ID environment variable. All tests in this spec probe /teams/api/config at the start of each test to detect whether the feature is enabled in the current stack:
- When the feature is disabled, the "button is hidden" test runs and the submission tests skip themselves.
- When the feature is enabled, the submission and cancel tests run and the "button is hidden" test skips itself.
This lets the spec run safely against any deployment (local dev, preview, staging, production) without requiring a specific configuration.
Seed Data Requirements
- A single test user with valid authentication credentials (no multi-user setup required)
- When the feature is enabled: the configured feedback inbox must exist in the database and be resolvable by
/api/config - No write access to the feedback inbox is required — the bypass is the whole point
PUT Interception
The submit test intercepts PUT /teams/api/threads/* via page.route() and fulfills a mocked 201 response. This:
- Keeps the configured feedback inbox clean across E2E runs (especially important on preview apps where the target is
support-demo@box.ox.io) - Still exercises the full UI flow (modal open, form validation, submit click, modal close)
- Leaves the server-side bypass path to be covered by
spec/backend/routes/threads-mutations.test.ts
Test Scenarios
1.1 Feedback Button is Hidden When the Feature is Disabled
Objective: Verify that the sidebar does not render a Feedback button when FEEDBACK_INBOX_ID is not configured on the backend.
Preconditions:
- User is logged into the Teams application
/api/configdoes NOT return afeedbackfield (skip test otherwise)
Test Steps:
- Navigate to the Teams application root URL (
/) - Wait for the application to load
Expected Results:
- No element with
role="button"and accessible name "Feedback" exists on the page (toHaveCount(0))
1.2 Submit Feedback via the Sidebar Button
Objective: Verify that an authenticated user can open the feedback modal, fill in subject and comment, and submit — with form validation and UI flow working end-to-end.
Preconditions:
- User is logged into the Teams application
/api/configreturns afeedbackfield withinboxIdandinboxName(skip test otherwise)
Test Steps:
- Navigate to the Teams application root URL (
/) - Verify the
Feedbackbutton is visible in the sidebar - Click the
Feedbackbutton - Verify the
Send Feedbackheading is visible (modal opened) - Verify the dialog contains the inbox name from
/api/config(read-only display) - Verify the
Submitbutton is disabled while both fields are empty - Fill the subject textbox (
Write Subject of the Thread...) with a random subject - Verify the
Submitbutton is still disabled (subject alone is not enough) - Fill the comment textbox (
Write your comment here...) with a random sentence - Verify the
Submitbutton is now enabled - Intercept
PUT /teams/api/threads/*viapage.route()to return a mocked 201 response; other methods pass through withroute.continue() - Click the
Submitbutton - Verify the
Send Feedbackheading is no longer visible (modal closed) - Verify the PUT interception was triggered (
putSeenflag)
Expected Results:
- Button is visible when the feature is enabled
- Modal opens with the configured inbox name displayed read-only
- Submit is disabled until both subject AND comment have non-empty values
- Clicking Submit closes the modal and triggers exactly one PUT request
- The feedback inbox is NOT polluted (PUT was intercepted and never reached the backend)
Notes:
- The inbox name displayed in the modal is the one resolved server-side from the DB, not from the raw
FEEDBACK_INBOX_IDvalue — this verifies the/api/configname lookup - Subject and comment use faker-generated values so multiple runs do not collide
1.3 Cancel Closes the Modal Without Submitting and Preserves Draft
Objective: Verify that clicking Cancel closes the modal without triggering a submit, and that the subject field retains its value when the modal is reopened.
Preconditions:
- User is logged into the Teams application
/api/configreturns afeedbackfield (skip test otherwise)
Test Steps:
- Click the
Feedbackbutton in the sidebar - Verify the
Send Feedbackheading is visible - Fill the subject textbox with
draft subject - Click the
Cancelbutton - Verify the
Send Feedbackheading is no longer visible (modal closed) - Click the
Feedbackbutton again to reopen the modal - Verify the subject textbox still contains
draft subject
Expected Results:
- Cancel closes the modal without issuing any PUT request
- Reopening the modal preserves the previously typed subject
- Only a successful Submit (not Cancel) clears the form
Notes:
- Draft preservation is intentional — users may close the modal to copy something from another thread and return to finish writing
- This behavior is asymmetric with Cancel/Submit: Submit clears, Cancel keeps
Related
- Test file:
e2e/tests/feedback.spec.js - Feature spec: Feedback Submission
- Backend unit tests:
spec/backend/routes/threads-mutations.test.ts,spec/backend/routes/config.test.ts,spec/backend/resolve-inbox.test.ts - Frontend unit tests:
spec/frontend/stores/threads-feedback.test.ts

