Add Comprehensive Automation Tests for Single Family Refresh Token (SFRT) Flows #1557
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds comprehensive automation tests for Single Family Refresh Token (SFRT) functionality to ensure robust testing coverage for all SFRT scenarios and edge cases. The current codebase has SFRT implementation but lacks comprehensive test coverage for all the flows and edge cases.
Overview
Single Family Refresh Tokens (SFRTs) are a critical feature that enables seamless Single Sign-On (SSO) across multiple applications within an app family. This test suite provides complete automation coverage to validate SFRT functionality across all supported scenarios.
Test Files Added
Core Functionality Tests
MSIDFamilyRefreshTokenTests.m- Tests coreMSIDFamilyRefreshTokenclass functionality including initialization, properties, credential type validation, and cache item generationMSIDFRTEnabledStatusTests.m- Tests all FRT enablement status scenarios including feature flag controls, client-side disabling, and error conditionsToken Management Tests
MSIDDefaultTokenCacheAccessorSFRTTests.m- Tests SFRT token retrieval logic, fallback mechanisms, and integration with the token cacheMSIDSFRTStorageTests.m- Tests SFRT storage logic based on feature flag status and family ID presenceRequest Flow Tests
MSIDSilentTokenRequestSFRTTests.m- Tests token acquisition flows with SFRT, including app refresh token fallback to family refresh token scenariosMSIDInteractiveTokenRequestSFRTTests.m- Tests FRT support in interactive flows including custom header injectionError Handling and Integration Tests
MSIDSFRTErrorHandlingTests.m- Tests client mismatch scenarios and error recovery mechanismsMSIDSFRTIntegrationTests.m- End-to-end SFRT flow tests covering multi-app family scenariosKey Test Coverage Areas
Feature Management
Token Retrieval and Storage
Request Flows
Error Scenarios
Integration Scenarios
Implementation Quality
MSIDTestSwizzle,MSIDTestURLSession, andMSIDTestURLResponsefor reliable test isolationMSIDTestCacheAccessorHelper,MSIDTestIdentifiers, etc.)Benefits
The test suite provides complete automation coverage for SFRT functionality, ensuring robust validation of all flows, edge cases, and multi-app integration scenarios as specified in the original requirements.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.