Skip to content

[image_picker_ios] Fix test failure on Xcode 27.2 - #13779

Open
vashworth wants to merge 8 commits into
flutter:mainfrom
vashworth:image_picker_ios_xcode_27_2_fix
Open

vashworth wants to merge 8 commits into
flutter:mainfrom
vashworth:image_picker_ios_xcode_27_2_fix

Conversation

@vashworth

@vashworth vashworth commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Newer simulators sometimes come without photos on the device. A change was added in #9759 that inserts a photo. However, this triggers a dialog that causes a race condition with the dialog interceptors in the tests.

This PR moves the photo insertion logic to the test setup and explicitly clicks the "Allow" button on the permission dialog.

Fixes flutter/flutter#197341.

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request relocates the photo library seeding logic from AppDelegate.swift to a shared XCTestCase extension, enabling its use in both ImagePickerFromGalleryUITests and ImagePickerFromLimitedGalleryUITests. It also updates UI element queries in the tests to use .firstMatch. Feedback recommends refactoring the seeding implementation to use the asynchronous performChanges(_:completionHandler:) API instead of performChangesAndWait within the authorization callback to avoid blocking the background thread, and verifying the authorization status.

@vashworth
vashworth requested a review from jmagman November 24, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ImagePickerFromGalleryUITests testCancel fails on Xcode 27.2

2 participants