Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@
"OnboardingTests\/testOnboardingSignIn()",
"OnboardingTests\/testSelectBottomPlacement()",
"OnboardingTests\/testSelectTopPlacement()",
"OnboardingTests\/testWhatsNewPage()",
"OpeningScreenTests",
"OpeningScreenTests\/testLastOpenedTab()",
"PerformanceTests",
Expand Down
1 change: 0 additions & 1 deletion firefox-ios/firefox-ios-tests/Tests/Smoketest.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@
"OnboardingTests\/testOnboardingSignIn_TAE()",
"OnboardingTests\/testSelectBottomPlacement()",
"OnboardingTests\/testSelectTopPlacement()",
"OnboardingTests\/testWhatsNewPage()",
"OpeningScreenTests",
"PerformanceTests",
"PhotonActionSheetTests\/testPinToShortcuts_TAE()",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@
"OnboardingTests\/testOnboardingSignIn()",
"OnboardingTests\/testSelectBottomPlacement()",
"OnboardingTests\/testSelectTopPlacement()",
"OnboardingTests\/testWhatsNewPage()",
"OpeningScreenTests",
"OpeningScreenTests\/testLastOpenedTab()",
"PerformanceTests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ class BaseTestCase: XCTestCase {
urlBar.pressWithRetry(duration: 2.0, element: pasteAction)
mozWaitForElementToExist(app.tables["Context Menu"])
pasteAction.waitAndTap()
springboard.buttons["Allow Paste"].tapIfExists(timeout: 0.5)
mozWaitForElementToExist(urlBar)
mozWaitForValueContains(urlBar, value: url)
}
Expand Down
53 changes: 10 additions & 43 deletions firefox-ios/firefox-ios-tests/Tests/XCUITests/OnboardingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ class OnboardingTests: BaseTestCase {

override func tearDown() async throws {
if #available(iOS 17.0, *) {
switchThemeToDarkOrLight(theme: "Light")
if self.name.contains("testSelectBottomPlacement") || iPad() {
// Toolbar option not available for iPad, so the theme is not changed there.
return
} else {
switchThemeToDarkOrLight(theme: "Light")
}
}
Comment on lines 28 to 35
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Avoid early return in tearDown that skips cleanup.

On iOS 17, this returns before app.terminate() and super.tearDown(), which can leak state across tests. Gate only the theme switch, not the full teardown.

Proposed fix
     override func tearDown() async throws {
         if `#available`(iOS 17.0, *) {
-            if self.name.contains("testSelectBottomPlacement") || iPad() {
-                // Toolbar option not available for iPad, so the theme is not changed there.
-                return
-            } else {
-                switchThemeToDarkOrLight(theme: "Light")
-            }
+            if !(self.name.contains("testSelectBottomPlacement") || iPad()) {
+                switchThemeToDarkOrLight(theme: "Light")
+            }
         }
         app.terminate()
         try await super.tearDown()
     }
🤖 Prompt for AI Agents
In `@firefox-ios/firefox-ios-tests/Tests/XCUITests/OnboardingTests.swift` around
lines 28 - 35, The tearDown currently returns early under iOS 17 and skips
essential cleanup; instead of returning, only skip the theme change: inside
tearDown keep the availability check and the condition using
self.name.contains("testSelectBottomPlacement") || iPad() to decide whether to
call switchThemeToDarkOrLight(theme: "Light"), but do not return — always call
app.terminate() and super.tearDown() after that block so cleanup runs regardless
of the theme gate.

app.terminate()
try await super.tearDown()
Expand Down Expand Up @@ -287,44 +292,6 @@ class OnboardingTests: BaseTestCase {
firefoxHomePageScreen.assertTopSitesItemCellExist()
}

// https://mozilla.testrail.io/index.php?/cases/view/2306815
func testWhatsNewPage() throws {
throw XCTSkip("Skipping. The option whats new page is not available on the new menu")
/*
app.buttons["\(AccessibilityIdentifiers.Onboarding.closeButton)"].waitAndTap()
// Dismiss new changes pop up if exists
app.buttons["Close"].tapIfExists()
navigator.goto(BrowserTabMenu)
navigator.performAction(Action.OpenWhatsNewPage)
waitUntilPageLoad()
app.textFields[AccessibilityIdentifiers.Browser.AddressToolbar.searchTextField].waitAndTap()

// Extract version number from url
let url = app.textFields[AccessibilityIdentifiers.Browser.AddressToolbar.searchTextField].value
let textUrl = String(describing: url)
let start = textUrl.index(textUrl.startIndex, offsetBy: 51)
let end = textUrl.index(textUrl.startIndex, offsetBy: 56)
let range = start..<end
let mySubstring = textUrl[range]
let releaseVersion = String(mySubstring)

mozWaitForElementToExist(app.staticTexts[releaseVersion])
mozWaitForValueContains(
app.textFields[AccessibilityIdentifiers.Browser.AddressToolbar.searchTextField],
value: "https://www.mozilla.org/en-US/firefox/ios/" + releaseVersion + "/releasenotes/"
)
app.buttons[AccessibilityIdentifiers.Browser.UrlBar.cancelButton].waitAndTap()
waitForElementsToExist(
[
app.staticTexts["Release Notes"],
app.staticTexts["Firefox for iOS Release"],
app.staticTexts["\(releaseVersion)"],
app.staticTexts["Get the most recent version"]
]
)
*/
}

// TOOLBAR THEME
// https://mozilla.testrail.io/index.php?/cases/view/2575175
func testSelectTopPlacement() {
Expand Down Expand Up @@ -379,12 +346,12 @@ class OnboardingTests: BaseTestCase {

// https://mozilla.testrail.io/index.php?/cases/view/2575176
func testSelectBottomPlacement() throws {
if iPad() {
let shouldSkipTest = true
try XCTSkipIf(shouldSkipTest, "Toolbar option not available for iPad")
}
waitForElementsToExist([app.buttons["TermsOfService.AgreeAndContinueButton"]])
app.buttons["TermsOfService.AgreeAndContinueButton"].tap()

guard !iPad() else {
throw XCTSkip("Toolbar option not available for iPad")
}
let toolbar = app.textFields["url"]

// Wait for the initial title label to appear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ShareLongPressTests: FeatureFlaggedTestBase {
}

// https://mozilla.testrail.io/index.php?/cases/view/2864380
func testBookmarksShareNormalWebsiteReminders() {
func verifyBookmarksShareNormalWebsiteReminders() {
app.launch()
if #available(iOS 17, *) {
longPressBookmarkAndReachShareOptions(option: "Reminders")
Expand Down Expand Up @@ -243,9 +243,10 @@ class ShareLongPressTests: FeatureFlaggedTestBase {
waitForTabsButton()
navigator.goto(LibraryPanel_Bookmarks)
// Long-press on a bookmarked website
app.tables.cells.staticTexts["Example Domain"].press(forDuration: 1.0)
let contextMenu = app.tables["Context Menu"]
app.tables.cells.staticTexts["Example Domain"].pressWithRetry(duration: 0.5, element: contextMenu)
// Tap the Share button in the context menu
app.tables["Context Menu"].buttons["shareLarge"].waitAndTap()
contextMenu.buttons["shareLarge"].waitAndTap()
// Tap the Reminders button in the menu
if #available(iOS 16, *) {
mozWaitForElementToExist(app.collectionViews.cells[option])
Expand Down