Skip to content

Github test fix: Fix SetupAssistant.tests.tsx failing in CI - #45378

Merged
RachelElysia merged 2 commits into
mainfrom
setupassistant-test-fail
May 13, 2026
Merged

Github test fix: Fix SetupAssistant.tests.tsx failing in CI#45378
RachelElysia merged 2 commits into
mainfrom
setupassistant-test-fail

Conversation

@RachelElysia

@RachelElysia RachelElysia commented May 13, 2026

Copy link
Copy Markdown
Member

Description

  • All 3 tests pass. The fix was adding a mock for the defaultEnrollmentProfileUrl endpoint — when the enrollment profile returns 404, the component triggers a follow-up fetch for the default profile. Without that mock, the request hung in CI, keeping the loading spinner visible.

From Claude

The most likely answer is that commit eb661f9 (which added the default enrollment profile fetch) introduced the potential for this test to fail, but it only flakes under slower CI conditions. The fix is correct either way — a test should mock everything its component fetches.

Testing

  • Added/updated automated tests

Summary by CodeRabbit

  • Tests
    • Enhanced Setup Assistant tests: added a mock for the default enrollment profile endpoint returning an empty profile while keeping the primary enrollment-profile endpoint returning 404, improving scenario coverage for "MDM isn't configured."

Review Change Stack

@codecov

codecov Bot commented May 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.73%. Comparing base (117a137) to head (9aef550).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #45378      +/-   ##
==========================================
- Coverage   66.73%   66.73%   -0.01%     
==========================================
  Files        2732     2732              
  Lines      218551   218569      +18     
  Branches    10803    10681     -122     
==========================================
- Hits       145857   145852       -5     
- Misses      59480    59504      +24     
+ Partials    13214    13213       -1     
Flag Coverage Δ
frontend 55.50% <ø> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@RachelElysia
RachelElysia marked this pull request as ready for review May 13, 2026 15:26
@RachelElysia
RachelElysia requested a review from a team as a code owner May 13, 2026 15:26
Copilot AI review requested due to automatic review settings May 13, 2026 15:26

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 544d8116-44d8-4207-ab47-3832c096a603

📥 Commits

Reviewing files that changed from the base of the PR and between 8185314 and 9aef550.

📒 Files selected for processing (1)
  • frontend/pages/ManageControlsPage/SetupExperience/cards/SetupAssistant/SetupAssistant.tests.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/pages/ManageControlsPage/SetupExperience/cards/SetupAssistant/SetupAssistant.tests.tsx

Walkthrough

This PR updates the SetupAssistant test for the "MDM isn't configured" scenario by adding an MSW GET handler for the defaultEnrollmentProfileUrl endpoint that returns JSON { enrollment_profile: {} }. The existing enrollmentProfileUrl handler continues to return 404. The change is limited to test setup.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description explains the problem, root cause, and solution, but does not follow the repository's checklist template with required sections. Provide context about which checklist items apply to this change and mark them as completed, especially confirming changes file status and QA verification.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies this as a test fix for SetupAssistant.tests.tsx failing in CI, which directly corresponds to the main change in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch setupassistant-test-fail

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a CI-only/flaky failure in SetupAssistant.tests.tsx by ensuring the test suite mocks all network calls triggered by the SetupAssistant component (including the follow-up fetch for the default enrollment profile when the team profile returns 404).

Changes:

  • Adds an MSW mock handler for the default setup enrollment profile endpoint in the “MDM isn’t configured” test case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@RachelElysia
RachelElysia merged commit c64897c into main May 13, 2026
24 checks passed
@RachelElysia
RachelElysia deleted the setupassistant-test-fail branch May 13, 2026 16:06
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.

4 participants