Repository navigation
[iOS] Add native deep link lifecycle integration tests for UIScene plugins - #192173
Conversation
…ugins Extends native iOS Add-to-App UIScene lifecycle testing by validating deep link (Universal Links and custom URL schemes) delivery to plugins across both cold and warm starts. As discussed with reviewers on flutter#191443, this decouples native plugin lifecycle verification from the standalone app route delivery test: 1. Renames module_uiscene_test_ios to uiscene_plugin_lifecycle_test_ios across CI, testowners, and task runners to accurately reflect its role in verifying plugin lifecycle events. 2. Adds two new test scenarios to uiscene_plugin_lifecycle_test_ios.dart: - AppMigrated-FlutterSceneDelegate-PluginMigrated-DeepLink: Verifies plugins adopting FlutterSceneLifeCycleDelegate receive connection options, openURLContexts, and continueUserActivity. - AppMigrated-FlutterSceneDelegate-PluginNotMigrated-DeepLink: Verifies legacy plugins implementing FlutterApplicationLifeCycleDelegate receive fallback callbacks via FlutterPluginAppLifeCycleDelegate. 3. Adds UITests-DeepLinks.swift verifying all 4 permutations (warm/cold x universal link/custom scheme) using native app.open(url) with exact occurrence validation. 4. Configures associated domains entitlements (applinks:flutter-dashboard.appspot.com) and bundle identifier (com.google.experimental0.dev) for the test projects.
There was a problem hiding this comment.
Code Review
This pull request renames the iOS UI scene test task to uiscene_plugin_lifecycle_test_ios and introduces deep link testing scenarios. It configures custom URL schemes and associated domains (entitlements) for the integration test apps, updates the migrated and unmigrated lifecycle plugins to log incoming URLs, and adds a new UI test suite (UITests-DeepLinks.swift) to verify warm and cold starts via universal links and custom schemes. I have no feedback to provide.
|
This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
There was a problem hiding this comment.
Code Review
This pull request renames the iOS UI scene test to uiscene_plugin_lifecycle_test_ios and introduces comprehensive deep link and universal link testing scenarios. It configures associated domain entitlements, URL schemes, and deep link event logging in both migrated and unmigrated lifecycle plugins, supported by new UI tests for cold and warm starts. Feedback on the changes identifies several indentation and spacing violations in LifecyclePlugin-migrated.swift that should be corrected to adhere to the Google Swift Style Guide.
hellohuanlin
left a comment
There was a problem hiding this comment.
overall looks great!
| return true | ||
| } | ||
|
|
||
| @objc(application:continueUserActivity:restorationHandler:) |
There was a problem hiding this comment.
I initially added it in @objc(application:continueUserActivity:restorationHandler:) because the selector wasn't mapping properly when restorationHandler was an optional closure. After updating the signature to @escaping ([Any]) -> Void, the protocol handles the Objective-C selector mapping naturally, so I've removed the @objc tags.
| button.tap() | ||
|
|
||
| let expectedEvents = [ | ||
| "applicationDidFinishLaunchingWithOptions", |
There was a problem hiding this comment.
why duplicate calls above, but no duplicate here
There was a problem hiding this comment.
On cold start, unmigrated plugins receive applicationDidFinishLaunchingWithOptions twice: once during initial plugin registration with FlutterEngine, and once when FlutterAppDelegate forwards it.
On warm start, the app has already completed its initial launch. When the deep link is opened while the app is backgrounded, iOS resumes the existing process via scene continuation / openURL without re-running the app launch lifecycle. Therefore, applicationDidFinishLaunchingWithOptions only appears from the initial launch and is not duplicated.
|
As a note for future reference: didFinishLaunchingWithOptions called twice is expected behavior for unmigrated plugins on deep link launches under UIScene. In iOS 13+, UIKit delivers empty launch options to didFinishLaunchingWithOptions and sends the actual URL via scene:willConnectToSession:options:. To maintain backward compatibility for plugins that haven't adopted FlutterSceneLifeCycleDelegate, the Flutter engine triggers sceneWillConnectFallback:, which converts the scene's connection options into UIApplicationLaunchOptionsURLKey and calls didFinishLaunchingWithOptions a second time (with isFallbackForScene: YES) specifically so legacy plugins can still receive the launch URL. Migrated plugins skip this fallback pass, which is why unmigrated plugins receive it twice. |
This is a pivot of flutter#191201 to run on the iOS Simulator instead of physical devicelab hardware to conserve capacity. This PR introduces automated integration tests for iOS deep linking and Universal Links for standard standalone Flutter apps on the iOS Simulator. 1. **UIScene Lifecycle (`ios_universal_link`):** - Tests the standard `UISceneDelegate` lifecycle (`UIApplicationSceneManifest`) used by default Flutter apps. 2. **Complete Cold and Warm Start Coverage:** - **HTTPS Universal Links:** Verified on both cold launch and warm background resume. - **Custom Schemes (`testscheme://`):** Verified on both cold launch and warm background resume. 3. **End-to-End Route Delivery:** - Verifies that the iOS deep link correctly traverses the Flutter Engine and is delivered to the Dart framework (`pushRouteInformation`), rendering the destination route on the UI for XCUITest assertion. 4. **Devicelab Automation:** - Implemented `dev/devicelab/bin/tasks/ios_universal_link_test.dart` to provision a clean simulator runtime, build the test app, run XCUITests via `xcodebuild test`, and guarantee simulator teardown. - Pre-warms simulator caches before assertion loops to prevent first-frame deadline timeouts. *(Note: Plugin lifecycle and Add-to-App deep link testing is decoupled into flutter#192173).*
|
autosubmit label was removed for flutter/flutter/192173, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label. |
flutter/flutter@5a6cfa7...63170e9 2026-09-05 [email protected] Roll Dart SDK from 6882c3b4b542 to 77094991d1c1 (1 revision) (flutter/flutter#192339) 2026-09-05 [email protected] Roll Skia from 10652f9d64d6 to db200e27a634 (1 revision) (flutter/flutter#192338) 2026-09-05 [email protected] Roll Fuchsia Linux SDK from FgDQeF6jb1dVRVh3K... to _IgixhH4vEgdz9Oqn... (flutter/flutter#192333) 2026-09-05 [email protected] Roll Dart SDK from 5744c2480a12 to 6882c3b4b542 (1 revision) (flutter/flutter#192331) 2026-09-05 [email protected] Roll Skia from 9b1e5fd08d2c to 10652f9d64d6 (4 revisions) (flutter/flutter#192329) 2026-09-05 [email protected] ci(engine): target ignore_phone|none for new macs (flutter/flutter#192317) 2026-09-04 [email protected] [devicelab] Fix Mac ios_universal_link_test CI build and scheme configuration (flutter/flutter#192321) 2026-09-04 [email protected] Roll Dart SDK from 5501d02b583d to 5744c2480a12 (5 revisions) (flutter/flutter#192316) 2026-09-04 [email protected] [iOS] Add native deep link lifecycle integration tests for UIScene plugins (flutter/flutter#192173) 2026-09-04 [email protected] Roll Skia from 93ac1e630d1d to 9b1e5fd08d2c (3 revisions) (flutter/flutter#192314) 2026-09-04 [email protected] [tool] Migrate AssembleCommand and GenerateCommand to modular dependency injection (flutter/flutter#190773) 2026-09-04 [email protected] [tool] Migrate Apple build subcommands and toolchain to modular dependency injection (flutter/flutter#190780) 2026-09-04 [email protected] [flutter_tools] Safely handle non-JSON messages in test stream parsers (flutter/flutter#192089) 2026-09-04 [email protected] [tool] Migrate LogsCommand to modular dependency injection (flutter/flutter#190765) 2026-09-04 [email protected] [tool] Migrate DevicesCommand to modular dependency injection (flutter/flutter#190768) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#12767) flutter/flutter@5a6cfa7...63170e9 2026-09-05 [email protected] Roll Dart SDK from 6882c3b4b542 to 77094991d1c1 (1 revision) (flutter/flutter#192339) 2026-09-05 [email protected] Roll Skia from 10652f9d64d6 to db200e27a634 (1 revision) (flutter/flutter#192338) 2026-09-05 [email protected] Roll Fuchsia Linux SDK from FgDQeF6jb1dVRVh3K... to _IgixhH4vEgdz9Oqn... (flutter/flutter#192333) 2026-09-05 [email protected] Roll Dart SDK from 5744c2480a12 to 6882c3b4b542 (1 revision) (flutter/flutter#192331) 2026-09-05 [email protected] Roll Skia from 9b1e5fd08d2c to 10652f9d64d6 (4 revisions) (flutter/flutter#192329) 2026-09-05 [email protected] ci(engine): target ignore_phone|none for new macs (flutter/flutter#192317) 2026-09-04 [email protected] [devicelab] Fix Mac ios_universal_link_test CI build and scheme configuration (flutter/flutter#192321) 2026-09-04 [email protected] Roll Dart SDK from 5501d02b583d to 5744c2480a12 (5 revisions) (flutter/flutter#192316) 2026-09-04 [email protected] [iOS] Add native deep link lifecycle integration tests for UIScene plugins (flutter/flutter#192173) 2026-09-04 [email protected] Roll Skia from 93ac1e630d1d to 9b1e5fd08d2c (3 revisions) (flutter/flutter#192314) 2026-09-04 [email protected] [tool] Migrate AssembleCommand and GenerateCommand to modular dependency injection (flutter/flutter#190773) 2026-09-04 [email protected] [tool] Migrate Apple build subcommands and toolchain to modular dependency injection (flutter/flutter#190780) 2026-09-04 [email protected] [flutter_tools] Safely handle non-JSON messages in test stream parsers (flutter/flutter#192089) 2026-09-04 [email protected] [tool] Migrate LogsCommand to modular dependency injection (flutter/flutter#190765) 2026-09-04 [email protected] [tool] Migrate DevicesCommand to modular dependency injection (flutter/flutter#190768) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#12767) flutter/flutter@5a6cfa7...63170e9 2026-09-05 [email protected] Roll Dart SDK from 6882c3b4b542 to 77094991d1c1 (1 revision) (flutter/flutter#192339) 2026-09-05 [email protected] Roll Skia from 10652f9d64d6 to db200e27a634 (1 revision) (flutter/flutter#192338) 2026-09-05 [email protected] Roll Fuchsia Linux SDK from FgDQeF6jb1dVRVh3K... to _IgixhH4vEgdz9Oqn... (flutter/flutter#192333) 2026-09-05 [email protected] Roll Dart SDK from 5744c2480a12 to 6882c3b4b542 (1 revision) (flutter/flutter#192331) 2026-09-05 [email protected] Roll Skia from 9b1e5fd08d2c to 10652f9d64d6 (4 revisions) (flutter/flutter#192329) 2026-09-05 [email protected] ci(engine): target ignore_phone|none for new macs (flutter/flutter#192317) 2026-09-04 [email protected] [devicelab] Fix Mac ios_universal_link_test CI build and scheme configuration (flutter/flutter#192321) 2026-09-04 [email protected] Roll Dart SDK from 5501d02b583d to 5744c2480a12 (5 revisions) (flutter/flutter#192316) 2026-09-04 [email protected] [iOS] Add native deep link lifecycle integration tests for UIScene plugins (flutter/flutter#192173) 2026-09-04 [email protected] Roll Skia from 93ac1e630d1d to 9b1e5fd08d2c (3 revisions) (flutter/flutter#192314) 2026-09-04 [email protected] [tool] Migrate AssembleCommand and GenerateCommand to modular dependency injection (flutter/flutter#190773) 2026-09-04 [email protected] [tool] Migrate Apple build subcommands and toolchain to modular dependency injection (flutter/flutter#190780) 2026-09-04 [email protected] [flutter_tools] Safely handle non-JSON messages in test stream parsers (flutter/flutter#192089) 2026-09-04 [email protected] [tool] Migrate LogsCommand to modular dependency injection (flutter/flutter#190765) 2026-09-04 [email protected] [tool] Migrate DevicesCommand to modular dependency injection (flutter/flutter#190768) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
<!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> remove ios_universal_link_test and uiscene_plugin_lifecycle_test_ios deeplink integration tests from bringup Part of flutter#191443, flutter#192173 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].* ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant in-code documentation (doc comments with `///`). - [ ] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). 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. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [flutter/website]: https://github.com/flutter/website [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Description
Extends native iOS Add-to-App UIScene lifecycle testing by validating deep link (Universal Links and custom URL schemes) delivery to plugins across both cold and warm starts.
As discussed on #191443, this PR decouples native plugin lifecycle verification from the standalone app route delivery test:
module_uiscene_test_iostouiscene_plugin_lifecycle_test_iosacross CI (.ci.yaml),TESTOWNERS, and task runners to accurately reflect its role in verifying plugin lifecycle events.uiscene_plugin_lifecycle_test_ios.dart:AppMigrated-FlutterSceneDelegate-PluginMigrated-DeepLink: Verifies plugins adoptingFlutterSceneLifeCycleDelegatereceive connection options,openURLContexts, andcontinueUserActivity.AppMigrated-FlutterSceneDelegate-PluginNotMigrated-DeepLink: Verifies legacy plugins implementingFlutterApplicationLifeCycleDelegatereceive fallback callbacks viaFlutterPluginAppLifeCycleDelegate.UITests-DeepLinks.swiftverifying warm/cold × universal link/custom schemePart of #191443
Pre-launch Checklist
///).