fix: stop two Playwright test races

Merged
EV
1d ago
+94-10

Description

This PR fixes two Playwright test races.

Project files visual regression (chat/project_files_visual_regression.spec.ts)

  • The test needed a retry in almost every CI run.
  • beforeAll uploads the file through the API. The page loads about 2 s later and fetches the project details once, while the file is still PROCESSING.
  • The projects provider polls /file/statuses only for files that the page itself uploaded. So "Processing..." never changes.
  • Fix: beforeAll now polls POST /api/user/projects/file/statuses until the file is COMPLETED, before any page loads. The new helper is OnyxApiClient.waitForUserFilesCompleted. It fails if a file ends in a different status or does not finish in time.

Group-manager fixture cleanup (admin/group-manager/fixtures.ts)

  • Teardown logged cleanup: TypeError: groups.find is not a function.
  • Teardown started the deletion of four cc_pairs, then called setGroupCcPairs. That call lists the groups. The list endpoint returns 500 while a linked connector is being deleted.
  • getGroupUserIds did not check the response, so it called .find on the error body.
  • Fix: teardown now detaches the foreign group and the managed group from their cc_pairs before it deletes the cc_pairs. getGroupUserIds now goes through handleResponse, so a failure gives a clear error.

Not fixed here: the list endpoint itself is a separate product bug. ConnectorSnapshot.from_connector_db_model (backend/ee/onyx/server/user_group/models.py) raises AttributeError when a group still links a cc_pair whose connector is deleted. One such group makes GET /manage/admin/user-group fail for all groups.

How Has This Been Tested?

  • Pre-commit passed on the changed files (TypeScript type check and coverage, oxlint, oxfmt).
  • I did not run the specs locally. The local backend returned 500 on login during the Playwright global setup, so the specs could not start. CI runs both specs.

Additional Options

  • [Optional] Please cherry-pick this PR to the latest release version.
  • [Optional] Override Linear Check

🤖 Generated with Claude Code


Summary by cubic

Fixes two Playwright test races that caused flaky CI runs.

Project files visual regression: the file uploaded through the API in beforeAll was still PROCESSING when the page loaded, and the page only polls files it uploaded itself, so it showed "Processing..." forever. beforeAll now waits on the file status endpoint until the file is COMPLETED via the new OnyxApiClient.waitForUserFilesCompleted.

Group-manager fixture teardown: getGroupUserIds called .find on a 500 error body, logging groups.find is not a function. Teardown now detaches groups from their cc_pairs before deleting the cc_pairs, and getGroupUserIds goes through handleResponse so failures surface clearly.

The 500 from GET /manage/admin/user-group while a linked connector is being deleted is a separate backend bug not fixed here.

Summary by CodeRabbit

  • Tests
    • Improved visual regression test reliability by validating uploads and waiting for files to finish processing before execution.
    • Added clearer handling and reporting for file-processing failures and timeouts.
    • Improved test cleanup to fully remove group and connector associations.
    • Strengthened API response validation used by automated tests.
    • Updated testing documentation for file-processing utilities.