Skip to content

Fix B2C provider selection render readiness race - #3135

Open
josephpab wants to merge 1 commit into
devfrom
fix/b2c-provider-render-readiness
Open

josephpab wants to merge 1 commit into
devfrom
fix/b2c-provider-render-readiness

Conversation

@josephpab

Copy link
Copy Markdown
Contributor

Proposed changes

Fix the render timing race affecting testInteractiveB2CLogin_withEmbeddedWebView_withoutLoginHint_withSigninPolicy_withGUIDTenantId_withMSAAccount and the other B2C scenarios using b2cSelectProvider:.

The provider button can exist in the accessibility tree before it is ready for interaction. Replace the existence-only wait with an XCTest predicate requiring the button to exist, be enabled, and be hittable before tapping. Then wait for the provider button to disappear before proceeding to the sign-in form (whose email field is already awaited by the existing helper).

Both waits use the existing 60-second UI-test timeout convention. No fixed sleeps, retries, shared helper changes, or production-code changes.

Type of change

  • Feature work
  • Bug fix
  • Documentation
  • Engineering change
  • Test
  • Logging/Telemetry

Risk

  • High – Errors could cause MAJOR regression of many scenarios. (Example: new large features or high level infrastructure changes)
  • Medium – Errors could cause regression of 1 or more scenarios. (Example: somewhat complex bug fixes, small new features)
  • Small – No issues are expected. (Example: Very small bug fixes, string changes, or configuration settings changes)

Additional information

git diff --check passed. Attempted the exact affected test using the MSAL Test Automation (iOS) scheme on an iPhone 15 Pro / iOS 17.5 simulator with Xcode 26.6. Test execution was blocked during compilation:

  1. Existing NSString+MSALAccountIdenfiers.m:103 fails with -Werror,-Wgnu-folding-constant.
  2. Retrying with a command-line-only override for that diagnostic reaches an existing MSAL/IdentityCore API mismatch in MSALRedirectUri.m:70: no known class method redirectUriIsBrokerCapable:.

The UI test has not run, so the flake reduction is not yet empirically verified. The checkout's pre-existing IdentityCore pointer, project settings, app settings, and Info.plist changes are excluded from this PR.

Wait for the identity provider button to exist, be enabled, and be hittable before tapping. Wait for the provider chooser to disappear before proceeding to sign-in.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 23, 2026 17:17
@josephpab
josephpab requested a review from a team as a code owner October 23, 2026 17:17
@@ -81,8 +81,15 @@ - (void)runSharedB2CLoginStartWithTestRequest:(MSIDAutomationTestRequest *)reque
- (void)b2cSelectProvider:(NSString *)identityProvider

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This pull request does not update CHANGELOG.md.

Please consider if this change would be noticeable to a partner or user and either update CHANGELOG.md or resolve this conversation.

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.

🟢 Approval recommended

No blocking issues were identified in this localized test-only change, though reported compilation blockers prevented runtime verification of flake reduction.

No open issues 🎉

What changed in this PR

Addresses a render-readiness race in B2C UI tests by synchronizing provider selection with the button’s interaction readiness and subsequent disappearance. The change is limited to test code.

Changes:

  • Waits until the provider button exists, is enabled, and is hittable before tapping.
  • Waits for the button to disappear before continuing, using 60-second timeouts for both waits.
File Description
MSAL/​test/​automation/​tests/​interactive/​MSALB2CInteractiveTests.m Adds readiness and disappearance waits to b2cSelectProvider:.

Review effort: Balanced

This branch has not been deployed

No deployments
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.

2 participants