Skip to content

Conversation

@jmagman
Copy link
Member

@jmagman jmagman commented Jan 12, 2026

Part of flutter/flutter#180787

Add some test parameterization.

◇ Test run started.
↳ Testing Library Version: 102 (arm64-apple-ios13.0-simulator)
◇ Suite URLLauncherTests started.
◇ Test canLaunchFailureWithInvalidURL() started.
◇ Test canLaunch(url:expected:) started.
◇ Test launchWithUniversalLinks() started.
◇ Test launch(url:expected:) started.
◇ Test launchSafariViewControllerWithClose() started.
◇ Test launchSafariViewControllerFailureWithNoViewPresenter() started.
◇ Test launchWithoutUniversalLinks() started.
◇ Test launchFailureWithInvalidURL() started.
◇ Passing 2 arguments url → "good://url", expected → .success to launch(url:expected:)
◇ Passing 2 arguments url → "bad://url", expected → .failure to launch(url:expected:)
2026-01-12 12:53:39.222409-0800 Runner[62355:494810] [Warning] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<SFSafariViewController: 0x1018cd200>)
◇ Passing 2 arguments url → "bad://url", expected → .failure to canLaunch(url:expected:)
◇ Passing 2 arguments url → "good://url", expected → .success to canLaunch(url:expected:)
✔ Test canLaunchFailureWithInvalidURL() passed after 0.001 seconds.
✔ Test launchWithUniversalLinks() passed after 0.001 seconds.
✔ Test launchSafariViewControllerWithClose() passed after 0.042 seconds.
✔ Test launchWithoutUniversalLinks() passed after 0.042 seconds.
✔ Test launchSafariViewControllerFailureWithNoViewPresenter() passed after 0.042 seconds.
✔ Test launchFailureWithInvalidURL() passed after 0.042 seconds.
​​​​✔ Test launch(url:expected:) passed after 0.043 seconds.
✔ Test canLaunch(url:expected:) passed after 0.043 seconds.
✔ Suite URLLauncherTests passed after 0.043 seconds.
✔ Test run with 8 tests passed after 0.043 seconds.

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8692848274232556065/+/u/Run_package_tests/native_test/stdout

Adding CHANGELOG override per #10761 (comment)

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 3

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

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 migrates the url_launcher_ios unit tests from XCTest to Swift Testing. This involves updating the Swift version to 6.0 in the project configuration and rewriting the tests in URLLauncherTests.swift. The XCTest APIs are replaced with Swift Testing APIs, such as using @Test instead of XCTestCase methods, #expect for assertions, and await confirmation for asynchronous operations. Some tests have been combined and parameterized, such as canLaunch and launch, reducing code duplication.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@jmagman
Copy link
Member Author

jmagman commented Jan 13, 2026

2026-01-12 12:53:39.222409-0800 Runner[62355:494810] [Warning] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<SFSafariViewController: 0x1018cd200>)

Hm that doesn't look good...

@jmagman
Copy link
Member Author

jmagman commented Jan 14, 2026

2026-01-12 12:53:39.222409-0800 Runner[62355:494810] [Warning] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<SFSafariViewController: 0x1018cd200>)

Hm that doesn't look good...

Actually this warning was happening before my change, probably because TestViewPresenter mocks the presentation, so the view isn't actually loaded, which causes weirdness:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8692766281012941425/+/u/Run_package_tests/native_test/stdout#L24622_0

I'll ignore it since it's not related to the Swift Testing change.

@jmagman jmagman added the override: no changelog needed Override the check requiring CHANGELOG updates for most changes label Jan 14, 2026
@jmagman jmagman marked this pull request as ready for review January 14, 2026 06:37
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

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 successfully migrates the url_launcher_ios example tests from XCTest to the modern Swift Testing framework. The changes include updating the project to Swift 6.0, refactoring test classes into @MainActor structs, and adopting new Swift Testing APIs like @Test, #expect, and async confirmations. A notable improvement is the use of parameterized tests, which consolidates several test cases and makes the test suite more concise. My review focuses on ensuring the migration correctly preserves the original testing intent, especially regarding how error conditions are handled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

override: no changelog needed Override the check requiring CHANGELOG updates for most changes p: url_launcher platform-ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant