-
Notifications
You must be signed in to change notification settings - Fork 82
[PM-25906] Add account switcher visibility tests #2168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[PM-25906] Add account switcher visibility tests #2168
Conversation
|
Claude finished @LRNcardozoWDF's task —— View job Code Review CompleteSummaryThis PR adds comprehensive test coverage for account switcher visibility on iOS 26. The changes add 1207 lines across 5 test files, providing parallel iOS 26 test coverage for profile switcher functionality previously only tested on iOS <26. However, there are critical test setup ordering issues in 2 files that will cause these tests to fail or produce incorrect results. Critical IssuesFinding 1: Test setup ordering violation in VaultItemSelectionProcessorTests❌ Location: The test subject.state.profileSwitcherState.isVisible = true
await subject.perform(.profileSwitcher(.accountPressed(ProfileSwitcherItem.fixture(userId: "1"))))
authRepository.activeAccount = .fixture(profile: .fixture(userId: "42")) // ❌ Too late!
authRepository.altAccounts = [.fixture()] // ❌ Too late!
authRepository.vaultTimeout = [...] // ❌ Too late!Impact: The mocks are configured after Fix: Move lines 173-180 above line 172 (before the Reference: Per Testing.md:1033-1037, tests must follow "Arrange-Act-Assert" ordering: configure mocks → perform action → verify results. Finding 2: Identical test setup ordering violation in VaultAutofillListProcessorTests❌ Location: The test subject.state.profileSwitcherState.isVisible = true
await subject.perform(.profileSwitcher(.accountPressed(ProfileSwitcherItem.fixture(userId: "1"))))
authRepository.activeAccount = .fixture(profile: .fixture(userId: "42")) // ❌ Too late!
authRepository.altAccounts = [.fixture()] // ❌ Too late!
authRepository.vaultTimeout = [...] // ❌ Too late!Impact: Same as Finding 1 - the test executes with uninitialized mocks. Fix: Move lines 201-208 above line 200 (before the PR Title and Description💭 The PR title and description are adequate but could be improved: Title: Currently "PM-25906 Add account switcher visibility tests"
Description:
Suggested improvementsTitle: Objective section: ## 📔 Objective
Backfill test coverage for iOS 26 account switcher visibility behavior. The account switcher on iOS 26 uses a new sheet-based presentation that requires different dismiss handling compared to iOS <26. This PR adds parallel iOS 26 tests for:
- Profile switcher visibility toggling
- Account switching with proper dismissal
- Lock/logout actions with sheet dismissal
- Error handling with sheet cleanup
Tests use `#available(iOS 26, *)` guards and XCTSkip for proper version gating.Good Practices Observed
Action Items
|
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2168 +/- ##
==========================================
+ Coverage 85.39% 85.57% +0.18%
==========================================
Files 1731 1731
Lines 145718 146774 +1056
==========================================
+ Hits 124433 125606 +1173
+ Misses 21285 21168 -117 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| subject.state.profileSwitcherState.isVisible = true | ||
| await subject.perform(.profileSwitcher(.accountPressed(ProfileSwitcherItem.fixture(userId: "1")))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Test setup ordering issue: Mock data is configured AFTER the action is performed (line 173), but these values should be set up BEFORE calling perform() on line 173.
The lines 174-181 should be moved above line 172. The test setup should follow this order:
- Configure all mock dependencies and initial state
- Perform the action being tested
- Assert the results
This same issue appears in VaultAutofillListProcessorTests.swift:test_perform_profileSwitcher_accountPressed_iOS26() at line 201.
| } | ||
|
|
||
| subject.state.profileSwitcherState.isVisible = true | ||
| await subject.perform(.profileSwitcher(.accountPressed(ProfileSwitcherItem.fixture(userId: "1")))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Test setup ordering issue: Same problem as in VaultItemSelectionProcessorTests.swift - mock data (lines 202-209) is configured AFTER the action is performed (line 201).
Move lines 202-209 above line 200 to ensure proper test setup order.
| } | ||
|
|
||
| subject.state.profileSwitcherState.isVisible = true | ||
| await subject.perform(.profileSwitcher(.accountPressed(ProfileSwitcherItem.fixture(userId: "1")))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Critical: Test setup ordering violation
Mock data is configured AFTER the action is performed. Lines 173-180 must be moved above line 172.
Current (incorrect) order:
- Set state (line 171) ✅
- Perform action (line 172) ❌ Too early!
- Configure mocks (lines 173-180) ❌ Too late!
Correct order should be:
- Set state
- Configure all mocks (activeAccount, altAccounts, vaultTimeout)
- Then perform action
- Assert results
This follows the standard Arrange-Act-Assert pattern (Testing.md:1033-1037). Currently the test runs with uninitialized mock values, producing incorrect results.
| await subject.perform(.profileSwitcher(.accountPressed(ProfileSwitcherItem.fixture(userId: "1")))) | |
| await subject.perform(.profileSwitcher(.accountPressed(ProfileSwitcherItem.fixture(userId: "1")))) | |
| authRepository.activeAccount = .fixture(profile: .fixture(userId: "42")) | |
| authRepository.altAccounts = [ | |
| .fixture(), | |
| ] | |
| authRepository.vaultTimeout = [ | |
| "1": .fiveMinutes, | |
| "42": .immediately, | |
| ] | |
| } | ||
|
|
||
| subject.state.profileSwitcherState.isVisible = true | ||
| await subject.perform(.profileSwitcher(.accountPressed(ProfileSwitcherItem.fixture(userId: "1")))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Critical: Test setup ordering violation
Same issue as VaultItemSelectionProcessorTests - mock data (lines 201-208) is configured AFTER the action is performed (line 200).
Move lines 201-208 above line 200 to ensure mocks are configured before the test executes.
| await subject.perform(.profileSwitcher(.accountPressed(ProfileSwitcherItem.fixture(userId: "1")))) | |
| await subject.perform(.profileSwitcher(.accountPressed(ProfileSwitcherItem.fixture(userId: "1")))) | |
| authRepository.activeAccount = .fixture(profile: .fixture(userId: "42")) | |
| authRepository.altAccounts = [ | |
| .fixture(), | |
| ] | |
| authRepository.vaultTimeout = [ | |
| "1": .fiveMinutes, | |
| "42": .immediately, | |
| ] | |

🎟️ Tracking
PM-25906
📔 Objective
Add tests for account switcher for iOS 26.
📸 Screenshots
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes