Skip to content

Commit b5e1f23

Browse files
committed
Do not force try instantiating TabNavComponent in UI tests
I noticed this code because of the `TODO` flagging it and I was looking through the `TODO`s as part of day 2 task of the Code Quality Challenge "Nuke TODO comments". See https://tuple.app/code-quality-challenge
1 parent 7463829 commit b5e1f23

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

WooCommerce/UITestsFoundation/Screens/Orders/SingleOrderScreen.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import XCTest
33

44
public final class SingleOrderScreen: ScreenObject {
55

6-
// TODO: Remove force `try` once `ScreenObject` migration is completed
7-
let tabBar = try! TabNavComponent()
6+
let tabBar: TabNavComponent
87

98
private let editOrderButtonGetter: (XCUIApplication) -> XCUIElement = {
109
$0.buttons["order-details-edit-button"]
@@ -23,6 +22,8 @@ public final class SingleOrderScreen: ScreenObject {
2322
private var collectPaymentButton: XCUIElement { collectPaymentButtonGetter(app) }
2423

2524
public init(app: XCUIApplication = XCUIApplication()) throws {
25+
tabBar = try TabNavComponent(app: app)
26+
2627
try super.init(
2728
expectedElementGetters: [ summaryCellGetter, editOrderButtonGetter ],
2829
app: app

WooCommerce/UITestsFoundation/Screens/Products/ProductsScreen.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import XCTest
33

44
public final class ProductsScreen: ScreenObject {
55

6-
// TODO: Remove force `try` once `ScreenObject` migration is completed
7-
public let tabBar = try! TabNavComponent()
6+
public let tabBar: TabNavComponent
87

98
static var isVisible: Bool {
109
(try? ProductsScreen().isLoaded) ?? false
1110
}
1211

1312
public init(app: XCUIApplication = XCUIApplication()) throws {
13+
tabBar = try TabNavComponent(app: app)
14+
1415
try super.init(
1516
expectedElementGetters: [
1617
// swiftlint:disable next opening_brace

WooCommerce/UITestsFoundation/Screens/Reviews/ReviewsScreen.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import XCTest
33

44
public final class ReviewsScreen: ScreenObject {
55

6-
// TODO: Remove force `try` once `ScreenObject` migration is completed
7-
public let tabBar = try! TabNavComponent()
6+
public let tabBar: TabNavComponent
87

98
static var isVisible: Bool {
109
(try? ReviewsScreen().isLoaded) ?? false
1110
}
1211

1312
public init(app: XCUIApplication = XCUIApplication()) throws {
13+
tabBar = try TabNavComponent(app: app)
14+
1415
try super.init(
1516
expectedElementGetters: [ { $0.tables["reviews-table"] } ],
1617
app: app

0 commit comments

Comments
 (0)