Skip to content

Conversation

@LRNcardozoWDF
Copy link
Member

@LRNcardozoWDF LRNcardozoWDF commented Nov 28, 2025

🎟️ Tracking

PM-25906

📔 Objective

Add tests for account switcher for iOS 26.

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 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

@LRNcardozoWDF LRNcardozoWDF requested review from a team and matt-livefront as code owners November 28, 2025 04:40
@claude
Copy link

claude bot commented Nov 28, 2025

Claude finished @LRNcardozoWDF's task in 3m 44s —— View job


Review Complete

I've completed a comprehensive review of the iOS 26 account switcher visibility tests.


Critical Issue Found

VaultUnlockProcessorTests.swift:887 - Contradictory iOS version guard

The test test_receive_accountLongPressed_lock() has mismatched guard logic:

  • Guard statement: #available(iOS 26, *) → runs on iOS 26+
  • Skip message: "This test requires iOS 18.6 or earlier"

This test should use #unavailable(iOS 26) instead of #available(iOS 26, *) to match its skip message and run on pre-iOS 26 versions only.

All other pre-iOS 26 tests in this file correctly use #unavailable(iOS 26) (lines 292, 314, 967, 1028, 1109, 1203, 1291, 1360, 1423, 1492, 1565, 1636, 1699, 1748).


Suggested Improvement

VaultAutofillListProcessorTests.swift:115 - Unrelated whitespace change

A blank line was removed from a multi-line string assertion. Consider documenting this change or reverting if unintentional to keep the PR focused on iOS 26 test additions.


Positive Observations

  • ✅ Consistent _iOS26 suffix naming convention
  • ✅ Proper iOS version gating for new tests
  • ✅ Comprehensive coverage of lock, logout, and switching scenarios
  • ✅ All PM-25906 TODOs successfully removed
  • ✅ Tests correctly verify sheet dismissal via .dismiss route
  • ✅ Mock setup follows established patterns
  • ✅ Test ordering and structure aligned with Testing.md guidelines

@github-actions
Copy link
Contributor

github-actions bot commented Nov 28, 2025

Logo
Checkmarx One – Scan Summary & Detailsd22f9896-88a9-4e27-a6e8-dde95e66f032

Great job! No new security vulnerabilities introduced in this pull request

@codecov
Copy link

codecov bot commented Nov 28, 2025

Codecov Report

❌ Patch coverage is 96.14004% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.65%. Comparing base (33da013) to head (2cae84a).

Files with missing lines Patch % Lines
...I/Auth/VaultUnlock/VaultUnlockProcessorTests.swift 96.62% 14 Missing ⚠️
...Shared/UI/Auth/Landing/LandingProcessorTests.swift 96.61% 11 Missing ⚠️
...ault/Vault/VaultList/VaultListProcessorTests.swift 95.96% 10 Missing ⚠️
...AutofillList/VaultAutofillListProcessorTests.swift 93.33% 4 Missing ⚠️
...emSelection/VaultItemSelectionProcessorTests.swift 93.93% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2168      +/-   ##
==========================================
+ Coverage   85.47%   85.65%   +0.18%     
==========================================
  Files        1746     1746              
  Lines      147479   148552    +1073     
==========================================
+ Hits       126059   127248    +1189     
+ Misses      21420    21304     -116     

☔ 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.

}

subject.state.profileSwitcherState.isVisible = true
await subject.perform(.profileSwitcher(.accountPressed(ProfileSwitcherItem.fixture(userId: "1"))))
Copy link

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:

  1. Configure all mock dependencies and initial state
  2. Perform the action being tested
  3. 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"))))
Copy link

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"))))
Copy link

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:

  1. Set state (line 171) ✅
  2. Perform action (line 172) ❌ Too early!
  3. Configure mocks (lines 173-180) ❌ Too late!

Correct order should be:

  1. Set state
  2. Configure all mocks (activeAccount, altAccounts, vaultTimeout)
  3. Then perform action
  4. 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.

Suggested change
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"))))
Copy link

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.

Suggested change
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,
]

Copy link
Contributor

@KatherineInCode KatherineInCode left a comment

Choose a reason for hiding this comment

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

On the whole, it looks good, aside from a small thing I mentioned. And the comments Claude generated noting the mock/test order...while it appears to be that way in the original test, I do find it curious. It might be worth adding a comment to them to explain why the order is the way it is?

throw XCTSkip("This test requires iOS 26 or later")
}

subject.state.profileSwitcherState.isVisible = true
Copy link
Contributor

Choose a reason for hiding this comment

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

⛏️ Doesn't the new profile switcher obviate the need for tracking the state visibility this way?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, thank you for calling this out.

@claude
Copy link

claude bot commented Dec 15, 2025

Overall Assessment: APPROVE

Reviewed comprehensive iOS 26 test coverage additions for account switcher visibility across 5 processor test files.

Summary:
This PR successfully adds iOS 26-specific test variants for account switcher visibility behavior. The changes follow established patterns, use proper iOS version gating, and maintain consistency with existing test structure. All changes are test-only with no production code modifications.

Test Coverage Added:

  • Landing: 16 new iOS 26 test cases
  • VaultUnlock: 19 new iOS 26 test cases
  • VaultList: 9 new iOS 26 test cases
  • VaultAutofillList: 2 new iOS 26 test cases
  • VaultItemSelection: 3 new iOS 26 test cases

Positive Observations:

  • Proper use of #available(iOS 26, *) version checks with descriptive XCTSkip messages
  • Consistent naming convention using _iOS26 suffix for variant tests
  • Appropriate verification that coordinator.routes.contains(.dismiss) for sheet dismissal on iOS 26
  • Tests properly grouped and follow test ordering guidelines from Testing.md
  • All tests use async/await appropriately
  • Mock setup generally follows Arrange-Act-Assert pattern

Minor Observation (Not Blocking):
In some test files (particularly VaultItemSelectionProcessorTests.swift and VaultAutofillListProcessorTests.swift), there are a few instances where state setup occurs before mock configuration. While functionally correct, a more consistent pattern would be:

  1. Configure all repository/service mocks
  2. Set subject state
  3. Perform the action
  4. Assert results

Example from VaultItemSelectionProcessorTests.swift:167-193:

// Current order works but could be clearer:
subject.state.profileSwitcherState.isVisible = true  // State set first
authRepository.activeAccount = ...                    // Then mocks
authRepository.altAccounts = ...
authRepository.vaultTimeout = ...
await subject.perform(...)                            // Then action

// Suggested (more explicit Arrange-Act-Assert):
authRepository.activeAccount = ...                    // Mocks first
authRepository.altAccounts = ...
authRepository.vaultTimeout = ...
subject.state.profileSwitcherState.isVisible = true  // State second
await subject.perform(...)                            // Action last

This is a stylistic preference for improved readability and doesn't affect test correctness.

Recommendation: APPROVE - This PR meets quality standards and adds valuable test coverage for iOS 26 compatibility.

@LRNcardozoWDF
Copy link
Member Author

@KatherineInCode about the comments Claude made about the order of the mock, I noticed that for the new profile switcher we could implement the tests in another way.

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.

3 participants