Skip to content

Commit 21bb297

Browse files
Add UI test method to navigate to order status screen
Co-authored-by: thehenrybyrd <[email protected]>
1 parent 9e2742a commit 21bb297

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Creation/StatusSection/OrderStatusSection.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct OrderStatusSection: View {
3535
.fixedSize(horizontal: true, vertical: true)
3636
.padding(.trailing, -Layout.linkButtonTrailingPadding) // remove trailing padding to align button title to the side
3737
.accessibilityLabel(Text(Localization.editButtonAccessibilityLabel))
38+
.accessibilityIdentifier("order-status-section-edit-button")
3839
.sheet(isPresented: $viewModel.shouldShowOrderStatusList) {
3940
OrderStatusList(siteID: viewModel.siteID, status: viewModel.currentOrderStatus) { newStatus in
4041
viewModel.updateOrderStatus(newStatus: newStatus)

WooCommerce/UITestsFoundation/Screens/Orders/NewOrderScreen.swift

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,36 @@ public final class NewOrderScreen: ScreenObject {
77
$0.buttons["new-order-create-button"]
88
}
99

10+
private let orderStatusEditButtonGetter: (XCUIApplication) -> XCUIElement = {
11+
$0.buttons["order-status-section-edit-button"]
12+
}
13+
1014
private var createButton: XCUIElement { createButtonGetter(app) }
1115

12-
init(app: XCUIApplication = XCUIApplication()) throws {
16+
/// Edit button in the Order Status section.
17+
///
18+
private var orderStatusEditButton: XCUIElement { orderStatusEditButtonGetter(app) }
19+
20+
public init(app: XCUIApplication = XCUIApplication()) throws {
1321
try super.init(
1422
expectedElementGetters: [ createButtonGetter ],
1523
app: app
1624
)
1725
}
1826

27+
/// Creates a remote order with all of the entered order data.
28+
/// - Returns: Single Order Detail screen object.
1929
@discardableResult
2030
public func createOrder() throws -> SingleOrderScreen {
2131
createButton.tap()
2232
return try SingleOrderScreen()
2333
}
34+
35+
/// Opens the Order Status screen (to set a new order status).
36+
/// - Returns: Order Status screen object.
37+
@discardableResult
38+
public func openOrderStatusScreen() throws -> OrderStatusScreen {
39+
orderStatusEditButton.tap()
40+
return try OrderStatusScreen()
41+
}
2442
}

0 commit comments

Comments
 (0)