firefox-ios icon indicating copy to clipboard operation
firefox-ios copied to clipboard

Refactor FXIOS-12796 [Swift 6 Migration] Fix main actor isolation warnings that are Swift 6 errors in the XCUITests suite - Batch 3

Open ih-codes opened this issue 1 month ago • 6 comments

:scroll: Tickets

Jira ticket Github issue

:bulb: Description

⚠️ Temporarily set the merge destination to my other PR just so I can check that Bitrise passes ⚠️

  • Fix setUp/tearDown warnings in the XCUITests suite by using the async throws version of the methods
  • Fix main actor isolation warnings for some local state with @MainActor

See the Swift 6 Migration channel (#tmp-swift-6-migration) for details on how to migrate the setUp and tearDown methods.

Batch 1: https://github.com/mozilla-mobile/firefox-ios/pull/31025 Batch 2: https://github.com/mozilla-mobile/firefox-ios/pull/31027

cc @Cramsden @lmarceau @dataports

:pencil: Checklist

  • [x] I filled in the ticket numbers and a description of my work
  • [x] I updated the PR name to follow our PR naming guidelines
  • [x] I ensured unit tests pass and wrote tests for new code
  • [ ] If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
  • [ ] If adding telemetry, I read the data stewardship requirements and will request a data review
  • [ ] If adding or modifying strings, I read the guidelines and will request a string review from l10n
  • [ ] If needed, I updated documentation and added comments to complex code

ih-codes avatar Dec 01 '25 20:12 ih-codes

Warnings
:warning: Print() function seems to be used in file firefox-ios/firefox-ios-tests/Tests/XCUITests/DownloadsTests.swift at line 21. Please remove this usage from production code or use BrowserKit Logger. Since bypass label danger-bypass detected we are reporting as warning only for this PR.

💪 Quality guardian

9 tests files modified. You're a champion of test coverage! 🚀

🥇 Perfect PR size

Smaller PRs are easier to review. Thanks for making life easy for reviewers! ✨

🙌 Friday high-five

Thanks for pushing us across the finish line this week! 🙌

💬 Description craftsman

Great PR description! Reviewers salute you 🫡

✅ Per-file coverage

All changed files meet the threshold of 35.0%.

Generated by :no_entry_sign: Danger Swift against c1504f390f27bc62e354183d068a3fd9720adbf5

mobiletest-ci-bot avatar Dec 05 '25 21:12 mobiletest-ci-bot

Hey @lmarceau how can we get Danger not to fail the PR for this work?

Error 1

🚫 SwiftUI 'Text(""' in file firefox-ios/firefox-ios-tests/Tests/XCUITests/C_AddressesTests.swift at line 683 needs to be avoided, use Strings.swift localization instead.

For the second error it's a UI test and I also don't see any Text() objects on line 683 of the XCUITests/C_AddressesTests.swift file... Screenshot 2025-12-05 at 3 56 45 PM

Error 2

🚫 Print() function seems to be used in file firefox-ios/firefox-ios-tests/Tests/XCUITests/DownloadsTests.swift at line 21. Please remove this usage from production code or use BrowserKit Logger.

For this one I think a print should be permissible in the UI tests? Screenshot 2025-12-05 at 3 54 43 PM

ih-codes avatar Dec 05 '25 21:12 ih-codes

🚫 SwiftUI 'Text(""' in file firefox-ios/firefox-ios-tests/Tests/XCUITests/C_AddressesTests.swift at line 683 needs to be avoided, use Strings.swift localization instead.

Yes, I have encountered the same type of error from Danger, too. A Text("....") resolves the issue.

clarmso avatar Dec 05 '25 23:12 clarmso

🚫 SwiftUI 'Text(""' in file firefox-ios/firefox-ios-tests/Tests/XCUITests/C_AddressesTests.swift at line 683 needs to be avoided, use Strings.swift localization instead.

Yes, I have encountered the same type of error from Danger, too. A Text("....") resolves the issue.

Do you know @clarmso which SwiftUI Text(...) it is even complaining about in that file? I don't think I saw one... 😅

ih-codes avatar Dec 05 '25 23:12 ih-codes

Opened a PR to fix the Danger detection in https://github.com/mozilla-mobile/firefox-ios/pull/31159

lmarceau avatar Dec 08 '25 15:12 lmarceau

This pull request has conflicts when rebasing. Could you fix it @ih-codes? 🙏

mergify[bot] avatar Dec 08 '25 18:12 mergify[bot]

@lmarceau is there a way we can ignore danger for the print statement in the tests? I didn't really want to actually change any of the UI test code I was touching for this 👀

ih-codes avatar Dec 10 '25 22:12 ih-codes

@lmarceau is there a way we can ignore danger for the print statement in the tests? I didn't really want to actually change any of the UI test code I was touching for this 👀

Yeah let me add an option for that, Ill do that shortly to unblock this

lmarceau avatar Dec 11 '25 17:12 lmarceau

@mergifyio rebase

ih-codes avatar Dec 12 '25 16:12 ih-codes

rebase

✅ Branch has been successfully rebased

mergify[bot] avatar Dec 12 '25 16:12 mergify[bot]

🚀 PR merged to main, targeting version: 147.0

github-actions[bot] avatar Dec 12 '25 17:12 github-actions[bot]