Skip to content

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

Open
tomerqodo wants to merge 6 commits intocoderabbit_combined_20260121_augment_sentry_coderabbit_1_base__refactor_fxios-12796_swift_6_migration_fix_main_actor_isolation_warnings_that_are_swift_6_errors_in_the_xcuitests_suite_-_batch_2_pr240from
coderabbit_combined_20260121_augment_sentry_coderabbit_1_head__refactor_fxios-12796_swift_6_migration_fix_main_actor_isolation_warnings_that_are_swift_6_errors_in_the_xcuitests_suite_-_batch_2_pr240
Open

Refactor FXIOS-12796 [Swift 6 Migration] Fix main actor isolation warnings that are Swift 6 errors in the XCUITests suite - Batch 2#15
tomerqodo wants to merge 6 commits intocoderabbit_combined_20260121_augment_sentry_coderabbit_1_base__refactor_fxios-12796_swift_6_migration_fix_main_actor_isolation_warnings_that_are_swift_6_errors_in_the_xcuitests_suite_-_batch_2_pr240from
coderabbit_combined_20260121_augment_sentry_coderabbit_1_head__refactor_fxios-12796_swift_6_migration_fix_main_actor_isolation_warnings_that_are_swift_6_errors_in_the_xcuitests_suite_-_batch_2_pr240

Conversation

@tomerqodo
Copy link

@tomerqodo tomerqodo commented Jan 22, 2026

Benchmark PR from qodo-benchmark#240

Summary by CodeRabbit

Tests

  • Async/Await Migration – Updated test infrastructure to use Swift's async/await for asynchronous test setup and teardown, improving error handling and test reliability.
  • Concurrency Safety – Applied @mainactor annotations to UI test helpers and lifecycle methods, ensuring thread-safe execution on the main thread for improved test stability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

The pull request converts XCTest lifecycle methods across the UI test suite from synchronous to asynchronous throwing variants and applies @MainActor concurrency isolation to test utilities, navigation helpers, and test classes to ensure main-thread execution safety.

Changes

Cohort / File(s) Summary
Test Lifecycle Conversions
A11yOnboardingTests.swift, ActivityStreamTest.swift, BookmarksTests.swift, BrowsingPDFTests.swift, C_AddressesTests.swift, CookiePersistenceTests.swift, DatabaseFixtureTest.swift, DesktopModeTests.swift, DisplaySettingsTests.swift, DomainAutocompleteTests.swift, DragAndDropTests.swift, EngagementNotificationTests.swift, HistoryTests.swift, HomePageSettingsUITest.swift, InactiveTabsTest.swift, IntegrationTests.swift, LoginsTests.swift, MicrosurveyTests.swift, MultiWindowTests.swift, OnboardingTests.swift, PerformanceTests.swift, PhotonActionSheetTests.swift, PrivateBrowsingTest.swift, ReadingListTests.swift, TabsTests.swift, ToolbarTest.swift, URLValidationTests.swift, ZoomingTests.swift
Converting setUp() and tearDown() from synchronous overrides to async throws, updating super calls to try await super.setUp() / try await super.tearDown().
Base Test Classes
BaseTestCase.swift
Converting setUp() and tearDown() to async throws in BaseTestCase, IpadOnlyTestCase, and IphoneOnlyTestCase; adding two @MainActor top-level constants: urlBarAddress and homepageSearchBar.
Navigation Registry Functions
NavigationRegistry.swift, registerCommonNavigation.swift, registerContextMenuNavigation.swift, registerFxAccountNavigation.swift, registerHomePanelNavigation.swift, registerLibraryPanelNavigation.swift, registerMiscellanousActions.swift, registerMiscellanousNavigation.swift, registerMobileNavigation.swift, registerOnboardingNavigation.swift, registerSettingsNavigation.swift, registerTabMenuNavigation.swift, registerTabTrayNavigation.swift, registerToolbarNavigation.swift, registerTrackingProtection.swift, registerUrlBarNavigation.swift, registerZoomNavigation.swift
Adding @MainActor attribute to top-level registration and navigation functions for main-thread execution safety.
Test Utilities and Helpers
A11yUtils.swift
Adding @MainActor attribute to the A11yUtils class; removing license header comments.
Screen Graph and Features
FxScreenGraph.swift
Adding @MainActor to createScreenGraph() function; introducing new @MainActor-annotated top-level constants (iOS_Settings, springboard) and helper functions (navigationControllerBackAction, cancelBackAction, dismissContextMenuAction, select, type).
Screen Graph Test Base
ScreenGraphTest.swift
Adding @MainActor attribute to the class; converting setUp() to async throws with try await super.setUp().
Feature-Flagged Tests
FeatureFlaggedTestBase.swift
Converting setUp() to async throws; reordering initialization sequence (moving setUpExperimentVariables() after setUpApp()).
Today Widget Tests
TodayWidgetTests.swift
Converting global widget button properties from nonisolated(unsafe) to @MainActor; adding new @MainActor constants (normalized, screenSize, centerRightX, centerRightY, coordinate); introducing four new @MainActor private functions (widgetExist(), goToTodayWidgetPage(), checkPresenceFirefoxWidget(), checkFirefoxShortcutsOptions()).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hops with glee, async tests take flight,
MainActor guards them, thread-safe and tight,
setUp awaits, tearDown flows free,
Concurrency blooms in harmony!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly describes the main objective: fixing main actor isolation warnings as Swift 6 errors in the XCUITests suite as part of a larger Swift 6 migration effort (Batch 2).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (1)

139-142: Compile error: calling async methods from synchronous context.

forceRestartApp() calls tearDown() and setUp() which are async throws, but forceRestartApp() itself is synchronous. This will fail to compile.

Proposed fix
-    func forceRestartApp() {
-        tearDown()
-        setUp()
+    func forceRestartApp() async throws {
+        try await tearDown()
+        try await setUp()
     }

Call sites at BookmarksTests.swift:401 and AuthenticationTest.swift:52 will also need to be updated to try await forceRestartApp().

🤖 Fix all issues with AI agents
In `@firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift`:
- Around line 508-513: The override of setUp() in BaseTestCase calls the
throwing async superclass method without handling errors; change the call inside
the iPad() check to use try await when invoking super.setUp() (i.e., call try
await super.setUp()) so the async throws contract is satisfied and the code
compiles.

In `@firefox-ios/firefox-ios-tests/Tests/XCUITests/FeatureFlaggedTestBase.swift`:
- Around line 46-52: The setup order is wrong: setUpApp() calls
addLaunchArgument(jsonFileName:featureName:) which force-unwraps jsonFileName
and featureName before they are initialized; move the call to
setUpExperimentVariables() to run before setUpApp() in override func setUp()
async throws so jsonFileName and featureName are initialized prior to
addLaunchArgument(...) being invoked; verify setUpExperimentVariables(),
setUpApp(), addLaunchArgument(jsonFileName:featureName:), and the variables
jsonFileName/featureName are referenced correctly after the change.

In `@firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift`:
- Around line 132-151: The three functions navigationControllerBackAction(for:),
cancelBackAction(for:), and dismissContextMenuAction(app:) are `@MainActor` but
return unannotated () -> Void closures that can be invoked off-main and trigger
strict-concurrency warnings; update their signatures to return `@MainActor` () ->
Void so the returned closures inherit main-actor isolation (e.g., change the
return type of navigationControllerBackAction, cancelBackAction, and
dismissContextMenuAction to `@MainActor` () -> Void) and keep the existing closure
bodies that call app.waitAndTap()/tap()/coordinate().

In
`@firefox-ios/firefox-ios-tests/Tests/XCUITests/registerSettingsNavigation.swift`:
- Around line 8-9: The SwiftLint disable directive is placed as a trailing
comment after the `@MainActor` attribute so it isn't applied to
registerSettingsNavigation; move the directive `// swiftlint:disable:next
function_body_length` onto its own line directly between the `@MainActor`
attribute and the `func registerSettingsNavigation(in map:
MMScreenGraph<FxUserState>, app: XCUIApplication)` declaration so SwiftLint
recognizes and suppresses the function_body_length rule for that function.
🧹 Nitpick comments (2)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BrowsingPDFTests.swift (1)

25-25: Stale comment detected.

Line 25 contains a comment about parsing the test name ("Test name looks like: ..."), but unlike other files with this comment (e.g., HistoryTests, ActivityStreamTest), there's no corresponding test-name parsing logic here. This appears to be a leftover from a copy-paste.

🧹 Suggested cleanup
     override func setUp() async throws {
-        // Test name looks like: "[Class testFunc]", parse out the function name
         try await super.setUp()
firefox-ios/firefox-ios-tests/Tests/XCUITests/PerformanceTests.swift (1)

38-40: Avoid double lookup and force unwrap when selecting fixtures.
Line 38-40 can be simplified to a single lookup, improving clarity and removing the ! even though the guard is currently safe.

♻️ Suggested refactor
-        if fixtures.keys.contains(functionName) {
-            launchArguments.append(LaunchArguments.LoadTabsStateArchive + fixtures[functionName]!)
-            launchArguments.append(LaunchArguments.LoadDatabasePrefix + fixtures[functionName]!)
-        }
+        if let fixture = fixtures[functionName] {
+            launchArguments.append(LaunchArguments.LoadTabsStateArchive + fixture)
+            launchArguments.append(LaunchArguments.LoadDatabasePrefix + fixture)
+        }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d44382a and 5d69751.

📒 Files selected for processing (51)
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/A11yOnboardingTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/A11yUtils.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/ActivityStreamTest.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/BrowsingPDFTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/C_AddressesTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/CookiePersistenceTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/DatabaseFixtureTest.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/DisplaySettingsTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/DomainAutocompleteTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/DragAndDropTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/EngagementNotificationTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/FeatureFlaggedTestBase.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/HistoryTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/HomePageSettingsUITest.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/InactiveTabsTest.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/IntegrationTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/MicrosurveyTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/MultiWindowTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/NavigationRegistry.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/OnboardingTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/PerformanceTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/PhotonActionSheetTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/ReadingListTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/ScreenGraphTest.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/TabsTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/TodayWidgetTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/ToolbarTest.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/URLValidationTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/ZoomingTests.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerCommonNavigation.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerContextMenuNavigation.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerFxAccountNavigation.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerHomePanelNavigation.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerLibraryPanelNavigation.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerMiscellanousActions.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerMiscellanousNavigation.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerMobileNavigation.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerOnboardingNavigation.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerSettingsNavigation.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerTabMenuNavigation.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerTabTrayNavigation.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerToolbarNavigation.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerTrackingProtection.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerUrlBarNavigation.swift
  • firefox-ios/firefox-ios-tests/Tests/XCUITests/registerZoomNavigation.swift
🧰 Additional context used
🧬 Code graph analysis (20)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ToolbarTest.swift (5)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (4)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
  • tearDown (119-122)
firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift (1)
  • setUp (301-306)
firefox-ios/firefox-ios-tests/Tests/XCUITests/A11yOnboardingTests.swift (1)
  • tearDown (22-25)
firefox-ios/firefox-ios-tests/Tests/XCUITests/OnboardingTests.swift (1)
  • tearDown (27-33)
firefox-ios/firefox-ios-tests/Tests/XCUITests/SettingsTests.swift (1)
  • tearDown (10-19)
firefox-ios/firefox-ios-tests/Tests/XCUITests/HomePageSettingsUITest.swift (4)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (3)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift (1)
  • setUp (96-104)
firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift (1)
  • setUp (36-52)
firefox-ios/firefox-ios-tests/Tests/XCUITests/TabsTests.swift (1)
  • setUp (635-644)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ReadingListTests.swift (11)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (3)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ActivityStreamTest.swift (1)
  • setUp (31-51)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift (1)
  • setUp (21-29)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift (1)
  • setUp (96-104)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DragAndDropTests.swift (1)
  • setUp (294-308)
firefox-ios/firefox-ios-tests/Tests/XCUITests/HistoryTests.swift (1)
  • setUp (46-65)
firefox-ios/firefox-ios-tests/Tests/XCUITests/HomePageSettingsUITest.swift (1)
  • setUp (25-39)
firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift (1)
  • setUp (36-52)
firefox-ios/firefox-ios-tests/Tests/XCUITests/OnboardingTests.swift (1)
  • setUp (16-25)
firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift (1)
  • setUp (301-306)
firefox-ios/firefox-ios-tests/Tests/XCUITests/TabsTests.swift (1)
  • setUp (635-644)
firefox-ios/firefox-ios-tests/Tests/XCUITests/CookiePersistenceTests.swift (1)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (3)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift (3)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift (1)
  • setUp (96-104)
firefox-ios/firefox-ios-tests/Tests/XCUITests/TabsTests.swift (1)
  • setUp (635-644)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (1)
  • iPad (357-362)
firefox-ios/firefox-ios-tests/Tests/XCUITests/InactiveTabsTest.swift (4)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (2)
  • setUp (112-117)
  • setUp (508-513)
firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift (1)
  • setUp (301-306)
firefox-ios/firefox-ios-tests/Tests/XCUITests/TabsTests.swift (1)
  • setUp (635-644)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ZoomingTests.swift (1)
  • setUp (10-16)
firefox-ios/firefox-ios-tests/Tests/XCUITests/EngagementNotificationTests.swift (3)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (4)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
  • removeApp (72-85)
firefox-ios/firefox-ios-tests/Tests/XCUITests/CookiePersistenceTests.swift (1)
  • setUp (11-20)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DisplaySettingsTests.swift (1)
  • setUp (8-18)
firefox-ios/firefox-ios-tests/Tests/XCUITests/TabsTests.swift (10)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (4)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
  • iPad (357-362)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ActivityStreamTest.swift (1)
  • setUp (31-51)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BrowsingPDFTests.swift (1)
  • setUp (24-32)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift (1)
  • setUp (96-104)
firefox-ios/firefox-ios-tests/Tests/XCUITests/HistoryTests.swift (1)
  • setUp (46-65)
firefox-ios/firefox-ios-tests/Tests/XCUITests/InactiveTabsTest.swift (1)
  • setUp (9-29)
firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift (1)
  • setUp (301-306)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ReadingListTests.swift (1)
  • setUp (13-18)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ToolbarTest.swift (1)
  • setUp (16-19)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ZoomingTests.swift (1)
  • setUp (10-16)
firefox-ios/firefox-ios-tests/Tests/XCUITests/PerformanceTests.swift (10)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (3)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ScreenGraphTest.swift (1)
  • setUp (34-47)
firefox-ios/firefox-ios-tests/Tests/XCUITests/A11yOnboardingTests.swift (1)
  • setUp (14-20)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ActivityStreamTest.swift (1)
  • setUp (31-51)
firefox-ios/firefox-ios-tests/Tests/XCUITests/C_AddressesTests.swift (1)
  • setUp (16-36)
firefox-ios/firefox-ios-tests/Tests/XCUITests/CookiePersistenceTests.swift (1)
  • setUp (11-20)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DatabaseFixtureTest.swift (1)
  • setUp (14-25)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DisplaySettingsTests.swift (1)
  • setUp (8-18)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DomainAutocompleteTests.swift (1)
  • setUp (31-45)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DragAndDropTests.swift (1)
  • setUp (294-308)
firefox-ios/firefox-ios-tests/Tests/XCUITests/OnboardingTests.swift (12)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (4)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
  • tearDown (119-122)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ScreenGraphTest.swift (1)
  • setUp (34-47)
firefox-ios/firefox-ios-tests/Tests/XCUITests/A11yOnboardingTests.swift (2)
  • setUp (14-20)
  • tearDown (22-25)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ActivityStreamTest.swift (2)
  • setUp (31-51)
  • tearDown (53-56)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BrowsingPDFTests.swift (1)
  • setUp (24-32)
firefox-ios/firefox-ios-tests/Tests/XCUITests/CookiePersistenceTests.swift (1)
  • setUp (11-20)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift (1)
  • setUp (96-104)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DisplaySettingsTests.swift (1)
  • setUp (8-18)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ReadingListTests.swift (1)
  • setUp (13-18)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ToolbarTest.swift (1)
  • tearDown (21-24)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ZoomingTests.swift (1)
  • tearDown (18-21)
firefox-ios/firefox-ios-tests/Tests/ClientTests/Coordinators/BrowserCoordinatorTests.swift (1)
  • tearDown (47-60)
firefox-ios/firefox-ios-tests/Tests/XCUITests/A11yOnboardingTests.swift (5)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (4)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
  • tearDown (119-122)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BrowsingPDFTests.swift (1)
  • setUp (24-32)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DisplaySettingsTests.swift (1)
  • setUp (8-18)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DragAndDropTests.swift (3)
  • setUp (294-308)
  • tearDown (28-31)
  • tearDown (310-313)
firefox-ios/firefox-ios-tests/Tests/XCUITests/OnboardingTests.swift (1)
  • tearDown (27-33)
firefox-ios/firefox-ios-tests/Tests/XCUITests/HistoryTests.swift (3)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (3)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BrowsingPDFTests.swift (1)
  • setUp (24-32)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ReadingListTests.swift (1)
  • setUp (13-18)
firefox-ios/firefox-ios-tests/Tests/XCUITests/PhotonActionSheetTests.swift (4)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (3)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
firefox-ios/firefox-ios-tests/Tests/XCUITests/HomePageSettingsUITest.swift (1)
  • setUp (25-39)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ReadingListTests.swift (1)
  • setUp (13-18)
firefox-ios/firefox-ios-tests/Tests/XCUITests/TabsTests.swift (1)
  • setUp (635-644)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ScreenGraphTest.swift (3)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (3)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
firefox-ios/firefox-ios-tests/Tests/XCUITests/CookiePersistenceTests.swift (1)
  • setUp (11-20)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ZoomingTests.swift (1)
  • setUp (10-16)
firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift (4)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (3)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DisplaySettingsTests.swift (1)
  • setUp (8-18)
firefox-ios/firefox-ios-tests/Tests/XCUITests/InactiveTabsTest.swift (1)
  • setUp (9-29)
firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift (1)
  • setUp (301-306)
firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift (1)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (2)
  • waitAndTap (626-629)
  • tap (532-541)
firefox-ios/firefox-ios-tests/Tests/XCUITests/URLValidationTests.swift (6)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (3)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BrowsingPDFTests.swift (1)
  • setUp (24-32)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift (1)
  • setUp (96-104)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DomainAutocompleteTests.swift (1)
  • setUp (31-45)
firefox-ios/firefox-ios-tests/Tests/XCUITests/HomePageSettingsUITest.swift (1)
  • setUp (25-39)
firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift (1)
  • setUp (301-306)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift (3)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (4)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
  • iPad (357-362)
firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift (1)
  • setUp (301-306)
firefox-ios/firefox-ios-tests/Tests/XCUITests/TabsTests.swift (1)
  • setUp (635-644)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift (3)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (4)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
  • tearDown (119-122)
firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift (1)
  • setUp (301-306)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ZoomingTests.swift (1)
  • tearDown (18-21)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DisplaySettingsTests.swift (10)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (3)
  • setUp (112-117)
  • setUp (508-513)
  • setUp (517-522)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ScreenGraphTest.swift (1)
  • setUp (34-47)
firefox-ios/firefox-ios-tests/Tests/XCUITests/A11yOnboardingTests.swift (1)
  • setUp (14-20)
firefox-ios/firefox-ios-tests/Tests/XCUITests/ActivityStreamTest.swift (1)
  • setUp (31-51)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift (1)
  • setUp (21-29)
firefox-ios/firefox-ios-tests/Tests/XCUITests/BrowsingPDFTests.swift (1)
  • setUp (24-32)
firefox-ios/firefox-ios-tests/Tests/XCUITests/C_AddressesTests.swift (1)
  • setUp (16-36)
firefox-ios/firefox-ios-tests/Tests/XCUITests/CookiePersistenceTests.swift (1)
  • setUp (11-20)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift (1)
  • setUp (96-104)
firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift (1)
  • setUp (36-52)
🔇 Additional comments (62)
firefox-ios/firefox-ios-tests/Tests/XCUITests/DesktopModeTests.swift (1)

96-100: LGTM — async/throws migration looks consistent.

No concerns with the async lifecycle or the guarded super.setUp() call.

firefox-ios/firefox-ios-tests/Tests/XCUITests/CookiePersistenceTests.swift (1)

11-20: LGTM!

The setUp() method correctly migrates to the async throwing pattern. The ordering is appropriate—removeApp() executes before super.setUp() to ensure a fresh install state before the base class initialization runs.

firefox-ios/firefox-ios-tests/Tests/XCUITests/EngagementNotificationTests.swift (1)

8-16: LGTM!

The async throwing setUp() migration is correct and follows the established pattern used across other test files in this PR.

firefox-ios/firefox-ios-tests/Tests/XCUITests/A11yUtils.swift (1)

3-4: LGTM!

Adding @MainActor to A11yUtils is appropriate since all its methods interact with XCUIElement and XCTContext, which require main-thread execution. This aligns with Swift 6 concurrency requirements.

firefox-ios/firefox-ios-tests/Tests/XCUITests/URLValidationTests.swift (1)

14-23: LGTM!

The async throwing setUp() migration is correct. The continueAfterFailure = true setting is appropriate here to allow all URL validation cases to execute even if individual assertions fail.

firefox-ios/firefox-ios-tests/Tests/XCUITests/DomainAutocompleteTests.swift (1)

31-45: LGTM!

The async throwing setUp() migration is correct and maintains the existing logic for conditionally setting launchArguments based on the test name before calling super.setUp().

firefox-ios/firefox-ios-tests/Tests/XCUITests/ReadingListTests.swift (1)

13-18: LGTM!

The async throws migration follows the established pattern from BaseTestCase and other test files in the suite. Screen objects are correctly initialized after super.setUp() completes.

firefox-ios/firefox-ios-tests/Tests/XCUITests/DisplaySettingsTests.swift (1)

8-18: LGTM!

The migration correctly preserves the conditional removeApp() logic before the async super.setUp() call, matching the pattern used in similar tests like CookiePersistenceTests and LoginsTests.

firefox-ios/firefox-ios-tests/Tests/XCUITests/HomePageSettingsUITest.swift (1)

25-39: LGTM!

The migration preserves the test-name-based conditional launchArguments setup before super.setUp(), consistent with the pattern in HistoryTests, ActivityStreamTest, and DragAndDropTests.

firefox-ios/firefox-ios-tests/Tests/XCUITests/DatabaseFixtureTest.swift (1)

14-25: LGTM!

The async throws migration is correct and follows the established pattern for fixture-loading tests.

firefox-ios/firefox-ios-tests/Tests/XCUITests/PhotonActionSheetTests.swift (1)

14-20: LGTM!

The migration follows the standard pattern with screen objects correctly initialized after super.setUp() completes.

firefox-ios/firefox-ios-tests/Tests/XCUITests/BrowsingPDFTests.swift (1)

24-32: LGTM!

The async throws migration is correct and follows the established pattern.

firefox-ios/firefox-ios-tests/Tests/XCUITests/TabsTests.swift (1)

635-639: Looks good — async lifecycle migration is consistent.
setUp() now uses async throws and try await super.setUp() as expected.

firefox-ios/firefox-ios-tests/Tests/XCUITests/MicrosurveyTests.swift (1)

9-15: LGTM for async setUp migration.
The lifecycle update matches the rest of the suite.

firefox-ios/firefox-ios-tests/Tests/XCUITests/DragAndDropTests.swift (1)

294-312: Async setUp/tearDown updates look correct.
try await super calls are consistent with Swift 6 migration.

firefox-ios/firefox-ios-tests/Tests/XCUITests/PrivateBrowsingTest.swift (1)

301-305: Async setUp migration looks good.
Consistent with BaseTestCase async lifecycle.

firefox-ios/firefox-ios-tests/Tests/XCUITests/A11yOnboardingTests.swift (1)

14-25: Async lifecycle updates look solid.
setUp/tearDown now align with Swift 6 async/throws expectations.

firefox-ios/firefox-ios-tests/Tests/XCUITests/ToolbarTest.swift (2)

16-18: Async setUp migration looks consistent.


21-23: Async tearDown migration looks consistent.

firefox-ios/firefox-ios-tests/Tests/XCUITests/MultiWindowTests.swift (2)

13-15: Async setUp migration looks consistent.


21-25: Async tearDown migration looks consistent.

firefox-ios/firefox-ios-tests/Tests/XCUITests/C_AddressesTests.swift (2)

16-18: Async setUp migration looks consistent.


38-45: Async tearDown migration looks consistent.

firefox-ios/firefox-ios-tests/Tests/XCUITests/IntegrationTests.swift (1)

23-44: Async setUp migration looks consistent.

firefox-ios/firefox-ios-tests/Tests/XCUITests/ZoomingTests.swift (2)

10-15: Async setUp migration looks consistent.


18-21: Async tearDown migration looks consistent.

firefox-ios/firefox-ios-tests/Tests/XCUITests/OnboardingTests.swift (2)

16-23: Async setUp migration looks consistent.


27-33: Async tearDown migration looks consistent.

firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift (3)

10-26: LGTM!

The @MainActor annotation on createScreenGraph is appropriate since it interacts with XCUIApplication and UI-related code that must run on the main thread under Swift 6 concurrency.


127-130: LGTM!

@MainActor on these top-level XCUIApplication constants ensures thread-safe access under Swift 6 strict concurrency.


153-163: LGTM!

These helper functions correctly use @MainActor for direct UI interactions with XCUIApplication.

firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift (4)

13-16: LGTM!

@MainActor on these XCUIElement references ensures main-thread access under Swift 6 strict concurrency.


112-117: LGTM!

The async throws signature and try await super.setUp() correctly adopt XCTest's async lifecycle for Swift 6.


119-122: LGTM!

The async throws tearDown with try await super.tearDown() is correct.


516-522: LGTM!

IphoneOnlyTestCase.setUp correctly uses try await super.setUp().

firefox-ios/firefox-ios-tests/Tests/XCUITests/InactiveTabsTest.swift (1)

9-29: LGTM!

The async throws signature and try await super.setUp() correctly follow the migration pattern. The double app.launch() appears intentional per the workaround comment on line 24.

firefox-ios/firefox-ios-tests/Tests/XCUITests/LoginsTests.swift (1)

36-52: LGTM!

The async throws lifecycle migration is correct and consistent with the PR-wide pattern.

firefox-ios/firefox-ios-tests/Tests/XCUITests/BookmarksTests.swift (2)

21-29: LGTM!

The async throws setUp correctly calls try await super.setUp() before initializing screen objects.


31-34: LGTM!

The async throws tearDown correctly resets device orientation before calling try await super.tearDown().

firefox-ios/firefox-ios-tests/Tests/XCUITests/ActivityStreamTest.swift (2)

30-51: LGTM!

The async throws setUp correctly follows the migration pattern with try await super.setUp() and subsequent screen object initialization.


53-56: LGTM!

The async throws tearDown correctly resets device orientation and calls try await super.tearDown().

firefox-ios/firefox-ios-tests/Tests/XCUITests/HistoryTests.swift (1)

46-65: Async setUp migration looks good.

The async/throws override with an awaited super call keeps the launch-argument setup in the right place. Please confirm this target builds cleanly with the Swift 6 XCTest async lifecycle enabled.

firefox-ios/firefox-ios-tests/Tests/XCUITests/TodayWidgetTests.swift (2)

15-41: Main-actor isolation for widget globals is appropriate.

These values touch Springboard UI state, so keeping them main-actor bound avoids isolation warnings. Please confirm the test class inherits main-actor isolation (e.g., via BaseTestCase) so accesses don’t require extra await.


49-122: Main-actor isolation on widget helpers looks good.

All helpers interact with Springboard UI and should stay on the main actor. Please verify the Swift 6 build has no remaining actor-isolation errors in this file.

firefox-ios/firefox-ios-tests/Tests/XCUITests/NavigationRegistry.swift (1)

9-10: Main-actor registry function looks consistent.

Keeping navigation registration on the main thread aligns with other UI helpers. Please verify the Swift 6 build remains clean after this isolation change.

firefox-ios/firefox-ios-tests/Tests/XCUITests/ScreenGraphTest.swift (2)

10-35: Main-actor test class + async setUp align with migration.

Awaiting super.setUp in the async override keeps lifecycle consistent. Please confirm XCTest async lifecycle support is enabled for this target under Swift 6.


54-55: Spacing-only change — no review needed.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerTabMenuNavigation.swift (1)

8-9: Main-actor isolation for tab menu registration looks fine.

UI graph setup stays on the main thread; please verify the Swift 6 build has no actor-isolation call-site errors.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerFxAccountNavigation.swift (1)

8-9: Main-actor isolation for FxAccount navigation looks fine.

Keeps UI registrations on the main thread; please verify the Swift 6 build remains clean after this change.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerZoomNavigation.swift (1)

8-9: LGTM: Main-actor isolation is appropriate for UI navigation helpers.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerToolbarNavigation.swift (1)

8-55: LGTM: Consistent @MainActor isolation across toolbar helpers.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerHomePanelNavigation.swift (1)

8-9: LGTM: Main-actor isolation fits UI test navigation.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerLibraryPanelNavigation.swift (1)

8-9: LGTM: Main-actor isolation is appropriate here.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerCommonNavigation.swift (1)

8-9: LGTM: @MainActor fits UI navigation registration.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerOnboardingNavigation.swift (1)

8-9: LGTM: Main-actor isolation is appropriate for onboarding navigation.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerMobileNavigation.swift (1)

8-9: LGTM!

The @MainActor annotation is correctly applied to ensure main-thread execution for this UI navigation helper that interacts with XCUIApplication elements. This aligns with the Swift 6 migration pattern applied consistently across other navigation registration functions in this PR.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerMiscellanousActions.swift (1)

8-9: LGTM!

The @MainActor annotation ensures this function is consistent with other navigation registration helpers in the test suite. This is necessary for Swift 6 compliance when the function is called from @MainActor-isolated contexts like createScreenGraph.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerTabTrayNavigation.swift (1)

9-10: LGTM!

The @MainActor annotation is correctly applied to this UI navigation helper that extensively interacts with XCUIApplication elements for tab tray management. This ensures thread-safe access to UI elements under Swift 6 concurrency rules.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerMiscellanousNavigation.swift (1)

8-9: LGTM!

The @MainActor annotation is necessary here since this function interacts with XCUIApplication UI elements and calls other @MainActor-isolated helpers like cancelBackAction(for:) and navigationControllerBackAction(for:).

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerTrackingProtection.swift (1)

8-9: LGTM!

The @MainActor annotation correctly ensures main-thread execution for this tracking protection navigation helper that interacts with XCUIApplication UI elements.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerUrlBarNavigation.swift (1)

10-11: LGTM!

The @MainActor annotation is correctly applied to this URL bar navigation helper that interacts with XCUIApplication UI elements and UIPasteboard. This ensures proper main-thread confinement under Swift 6 concurrency rules.

firefox-ios/firefox-ios-tests/Tests/XCUITests/registerContextMenuNavigation.swift (1)

8-9: LGTM — main-actor isolation fits UI test helpers.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +508 to 513
override func setUp() async throws {
specificForPlatform = .pad
if iPad() {
super.setUp()
await super.setUp()
}
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Missing try when calling throwing superclass method.

super.setUp() is async throws, but line 511 uses await super.setUp() without try. This will cause a compile error.

🐛 Proposed fix
     override func setUp() async throws {
         specificForPlatform = .pad
         if iPad() {
-            await super.setUp()
+            try await super.setUp()
         }
     }
🤖 Prompt for AI Agents
In `@firefox-ios/firefox-ios-tests/Tests/XCUITests/BaseTestCase.swift` around
lines 508 - 513, The override of setUp() in BaseTestCase calls the throwing
async superclass method without handling errors; change the call inside the
iPad() check to use try await when invoking super.setUp() (i.e., call try await
super.setUp()) so the async throws contract is satisfied and the code compiles.

Comment on lines +46 to 52
override func setUp() async throws {
continueAfterFailure = false
setUpExperimentVariables()
setUpApp()
setUpExperimentVariables()
setUpLaunchArguments()
setUpScreenGraph()
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: setUpExperimentVariables() called after setUpApp() causes nil access.

The setUpApp() method at line 43 calls addLaunchArgument(jsonFileName: jsonFileName, featureName: featureName), which uses jsonFileName and featureName. However, these variables are supposed to be initialized by setUpExperimentVariables(), which is now called after setUpApp() on line 49.

This ordering will cause a crash when jsonFileName! and featureName! are force-unwrapped as nil.

🐛 Proposed fix to restore correct call order
     override func setUp() async throws {
         continueAfterFailure = false
-        setUpApp()
         setUpExperimentVariables()
+        setUpApp()
         setUpLaunchArguments()
         setUpScreenGraph()
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
override func setUp() async throws {
continueAfterFailure = false
setUpExperimentVariables()
setUpApp()
setUpExperimentVariables()
setUpLaunchArguments()
setUpScreenGraph()
}
override func setUp() async throws {
continueAfterFailure = false
setUpExperimentVariables()
setUpApp()
setUpLaunchArguments()
setUpScreenGraph()
}
🤖 Prompt for AI Agents
In `@firefox-ios/firefox-ios-tests/Tests/XCUITests/FeatureFlaggedTestBase.swift`
around lines 46 - 52, The setup order is wrong: setUpApp() calls
addLaunchArgument(jsonFileName:featureName:) which force-unwraps jsonFileName
and featureName before they are initialized; move the call to
setUpExperimentVariables() to run before setUpApp() in override func setUp()
async throws so jsonFileName and featureName are initialized prior to
addLaunchArgument(...) being invoked; verify setUpExperimentVariables(),
setUpApp(), addLaunchArgument(jsonFileName:featureName:), and the variables
jsonFileName/featureName are referenced correctly after the change.

Comment on lines +132 to 151
@MainActor
func navigationControllerBackAction(for app: XCUIApplication) -> () -> Void {
return {
app.navigationBars.element(boundBy: 0).buttons.element(boundBy: 0).waitAndTap()
}
}

@MainActor
func cancelBackAction(for app: XCUIApplication) -> () -> Void {
return {
app.otherElements["PopoverDismissRegion"].waitAndTap()
}
}

@MainActor
func dismissContextMenuAction(app: XCUIApplication) -> () -> Void {
return {
app.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.25)).tap()
}
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

rg -n "backAction" --type swift -C 3

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 32037


🏁 Script executed:

rg -n "var backAction" --type swift -B 2 -A 2

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 72


🏁 Script executed:

rg -n "class.*ScreenState|struct.*ScreenState" --type swift -A 5

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 14542


🏁 Script executed:

rg -n "MMScreenState|import.*Mappamundi" --type swift -A 3

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 2598


🏁 Script executed:

rg -n "\.backAction\(\)|backAction()" --type swift -B 2 -A 2

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 24071


🏁 Script executed:

fd -n "Package.swift|project.pbxproj|build.settings" -type f | head -5

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 320


🏁 Script executed:

fd "Package.swift|project.pbxproj|build.settings" --type f | head -5

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 296


🏁 Script executed:

cat Package.swift | head -50

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 941


🏁 Script executed:

find . -name "*.pbxproj" -type f | grep -E "firefox-ios|firefox" | head -3

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 205


🏁 Script executed:

grep -i "swift.*concurrency\|SWIFT_STRICT\|strict" ./firefox-ios/Client.xcodeproj/project.pbxproj | head -20

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 1173


🏁 Script executed:

rg -n "import.*Mappamundi|backAction\(\)" --type swift | head -20

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 72


🏁 Script executed:

cat firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift | head -160

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 5550


Returned closures from @MainActor functions lack actor isolation.

The functions navigationControllerBackAction, cancelBackAction, and dismissContextMenuAction are marked @MainActor, but return plain () -> Void closures. These closures capture and invoke UI methods on the app parameter (waitAndTap(), tap(), coordinate()). Under Swift 6 with SWIFT_STRICT_CONCURRENCY = complete, if Mappamundi invokes these closures from a non-MainActor context, the code will trigger concurrency warnings.

Annotate the return types as @MainActor () -> Void to ensure the closures inherit main-actor isolation from their parent functions.

🤖 Prompt for AI Agents
In `@firefox-ios/firefox-ios-tests/Tests/XCUITests/FxScreenGraph.swift` around
lines 132 - 151, The three functions navigationControllerBackAction(for:),
cancelBackAction(for:), and dismissContextMenuAction(app:) are `@MainActor` but
return unannotated () -> Void closures that can be invoked off-main and trigger
strict-concurrency warnings; update their signatures to return `@MainActor` () ->
Void so the returned closures inherit main-actor isolation (e.g., change the
return type of navigationControllerBackAction, cancelBackAction, and
dismissContextMenuAction to `@MainActor` () -> Void) and keep the existing closure
bodies that call app.waitAndTap()/tap()/coordinate().

Comment on lines +8 to 9
@MainActor // swiftlint:disable:next function_body_length
func registerSettingsNavigation(in map: MMScreenGraph<FxUserState>, app: XCUIApplication) {
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

SwiftLint "swiftlint:disable:next" trailing comment after attribute @MainActor``

💡 Result:

Short answer: this is a known SwiftLint limitation — a leading attribute (like @MainActor) or intervening comments can stop a preceding // swiftlint:disable:next from applying to the real declaration because SwiftLint matches the “next” token/line against the immediate next source-line/trivia rather than the underlying decl. See the GitHub issue and the SwiftLint docs. [1][2]

Workarounds (pick one):

  • Move the disable so it applies to the declaration itself: put the directive on the same logical line using disable:this or an end-of-line disable after the declaration, e.g. add // swiftlint:disable:this at the end of the declaration line. [2]
  • Place the swiftlint directive immediately before the doc-comment (or remove the trailing comment), so the directive is truly the next comment before the declaration. [1][3]
  • Use a file-level disable/enable around the declaration if acceptable. [2]

References:

  1. SwiftLint GitHub issue discussing // swiftlint:disable:next not working with doc comments. [1]
  2. SwiftLint documentation on inline disable/enable and :next/:this/:previous usage. [2]
  3. Swift Forums discussion about attributes, comments and trivia when inserting @MainActor (explanation of trivia/positioning). [3]

If you want, paste a small code example you have and I’ll show the exact change that will make the disable work.


🏁 Script executed:

# Search for SwiftLint directive patterns in the codebase
rg "swiftlint:disable" --type swift -B 2 -A 2 | head -100

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 10525


🏁 Script executed:

# Look for other `@MainActor` usages to see if there's a pattern
rg "@MainActor" --type swift -B 1 -A 1 | head -80

Repository: qodo-benchmark/firefox-ios-combined-coderabbit

Length of output: 5450


Move the SwiftLint directive to its own line — the trailing comment placement does not work.
SwiftLint does not honor // swiftlint:disable:next when placed as a trailing comment after an attribute like @MainActor. This is a known SwiftLint limitation: the directive matching logic checks the immediate next source-line/trivia, not the underlying declaration. As a result, the function_body_length rule suppression is not being applied. Move the directive to a standalone line between the attribute and function for it to take effect.

Fix
-@MainActor // swiftlint:disable:next function_body_length
-func registerSettingsNavigation(in map: MMScreenGraph<FxUserState>, app: XCUIApplication) {
+@MainActor
+// swiftlint:disable:next function_body_length
+func registerSettingsNavigation(in map: MMScreenGraph<FxUserState>, app: XCUIApplication) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@MainActor // swiftlint:disable:next function_body_length
func registerSettingsNavigation(in map: MMScreenGraph<FxUserState>, app: XCUIApplication) {
`@MainActor`
// swiftlint:disable:next function_body_length
func registerSettingsNavigation(in map: MMScreenGraph<FxUserState>, app: XCUIApplication) {
🤖 Prompt for AI Agents
In
`@firefox-ios/firefox-ios-tests/Tests/XCUITests/registerSettingsNavigation.swift`
around lines 8 - 9, The SwiftLint disable directive is placed as a trailing
comment after the `@MainActor` attribute so it isn't applied to
registerSettingsNavigation; move the directive `// swiftlint:disable:next
function_body_length` onto its own line directly between the `@MainActor`
attribute and the `func registerSettingsNavigation(in map:
MMScreenGraph<FxUserState>, app: XCUIApplication)` declaration so SwiftLint
recognizes and suppresses the function_body_length rule for that function.

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