Skip to content
Merged
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 @@ -15,13 +15,13 @@ let testBLOBFileSize = "35 bytes"
class DownloadsTests: BaseTestCase {
var downloadsScreen: DownloadsScreen!
var browserScreen: BrowserScreen!
override func tearDown() {
defer { super.tearDown() }

guard let navigator = navigator else {
print("⚠️ Navigator is nil in tearDown — skipping cleanup.")
return
}
override func tearDown() async throws {
guard let navigator = navigator else {
print("⚠️ Navigator is nil in tearDown — skipping cleanup.")
return
}

// The downloaded file has to be removed between tests
app.terminate()
app.launch()
Expand All @@ -37,7 +37,7 @@ class DownloadsTests: BaseTestCase {
app.tables["DownloadsTable"].buttons["Delete"].waitAndTap()
}
}
super.tearDown()
try await super.tearDown()
}

private func deleteItem(itemName: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ let websiteWithSearchField = "https://developer.mozilla.org/en-US/"
let tabTrayCollectionView = AccessibilityIdentifiers.TabTray.collectionView

class DragAndDropTests: BaseTestCase {
// Disable test suite since in theory it does not make sense with Chron tabs implementation
override func tearDown() {
// Disable test suite since in theory it does not make sense with Chron tabs implementation
override func tearDown() async throws {
XCUIDevice.shared.orientation = UIDeviceOrientation.portrait
super.tearDown()
try await super.tearDown()
}

// https://mozilla.testrail.io/index.php?/cases/view/2362645
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ extension MMNavigator where T == FxUserState {
performAction(Action.LoadURLByTyping)
}

@MainActor
func mozWaitForElementToExist(_ element: XCUIElement, timeout: TimeInterval? = TIMEOUT) {
let startTime = Date()

Expand All @@ -305,6 +306,7 @@ extension MMNavigator where T == FxUserState {
}

// Opens a URL in a new tab.
@MainActor
func openNewURL(urlString: String) {
let app = XCUIApplication()
mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Toolbar.tabsButton], timeout: 10)
Expand All @@ -314,6 +316,7 @@ extension MMNavigator where T == FxUserState {
}

// Add a new Tab from the New Tab option in Browser Tab Menu
@MainActor
func createNewTab() {
let app = XCUIApplication()
self.goto(TabTray)
Expand All @@ -322,6 +325,7 @@ extension MMNavigator where T == FxUserState {
}

// Add Tab(s) from the Tab Tray
@MainActor
func createSeveralTabsFromTabTray(numberTabs: Int) {
let app = XCUIApplication()
for _ in 1...numberTabs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import XCTest

class HomeButtonTests: BaseTestCase {
override func tearDown() {
override func tearDown() async throws {
XCUIDevice.shared.orientation = .portrait
super.tearDown()
try await super.tearDown()
}

// https://mozilla.testrail.io/index.php?/cases/view/2306925
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,15 @@ private class TestActions {
static let LoadURLByPasting = "LoadURLByPasting"
}

@MainActor
public var isTablet: Bool {
// There is more value in a variable having the same name,
// so it can be used in both predicates and in code
// than avoiding the duplication of one line of code.
return UIDevice.current.userInterfaceIdiom == .pad
}

@MainActor
private func createTestGraph(for test: XCTestCase, with app: XCUIApplication) -> MMScreenGraph<TestUserState> {
let map = MMScreenGraph(for: test, with: TestUserState.self)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ protocol WebsiteDataSelectorsSet {
var EXAMPLE_CONTAINS: Selector { get }
var CIRCLE_IMAGE_ANYWHERE: Selector { get }
var STATIC_TEXT_EXAMPLE_IN_CELL: Selector { get }

@MainActor
func clearAllLabel(in app: XCUIApplication) -> XCUIElement
@MainActor
func circleImageInsideCells(_ app: XCUIApplication) -> XCUIElement
@MainActor
func anyTableButton(_ app: XCUIApplication) -> XCUIElement

var all: [Selector] { get }
}

Expand Down Expand Up @@ -102,14 +107,17 @@ struct WebsiteDataSelectors: WebsiteDataSelectorsSet {
groups: ["settings", "websitedata"]
)

@MainActor
func clearAllLabel(in app: XCUIApplication) -> XCUIElement {
app.tables.cells[IDs.clearAllCell].staticTexts[IDs.clearAllLabel]
}

@MainActor
func circleImageInsideCells(_ app: XCUIApplication) -> XCUIElement {
return app.cells.images.matching(identifier: IDs.circleImageId).firstMatch
}

@MainActor
func anyTableButton(_ app: XCUIApplication) -> XCUIElement {
return app.tables.buttons.firstMatch
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import XCTest
class SettingsTests: FeatureFlaggedTestBase {
var settingsScreen: SettingScreen!

override func tearDown() {
override func tearDown() async throws {
if name.contains("testAutofillPasswordSettingsOptionSubtitles") ||
name.contains("testBrowsingSettingsOptionSubtitles") ||
name.contains("testSettingsOptionSubtitlesDarkMode") ||
name.contains("testSettingsOptionSubtitlesDarkModeLandscape") {
switchThemeToDarkOrLight(theme: "Light")
}
XCUIDevice.shared.orientation = .portrait
super.tearDown()
try await super.tearDown()
}

private func checkShowImages(showImages: Bool = true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import Foundation
import XCTest

class SwipingTabsTests: BaseTestCase {
override func tearDown() {
override func tearDown() async throws {
XCUIDevice.shared.orientation = .portrait
super.tearDown()
try await super.tearDown()
}

let addressBar = XCUIApplication().textFields[AccessibilityIdentifiers.Browser.AddressToolbar.searchTextField]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import Foundation
import XCTest

class ToolbarMenuTests: BaseTestCase {
override func tearDown() {
override func tearDown() async throws {
XCUIDevice.shared.orientation = .portrait
super.tearDown()
try await super.tearDown()
}

// https://mozilla.testrail.io/index.php?/cases/view/2306840
Expand Down