@@ -23,6 +23,10 @@ public final class NewOrderScreen: ScreenObject {
2323 $0. staticTexts [ " Add Customer Details " ]
2424 }
2525
26+ private let addShippingButtonGetter : ( XCUIApplication ) -> XCUIElement = {
27+ $0. buttons [ " add-shipping-button " ]
28+ }
29+
2630 private var createButton : XCUIElement { createButtonGetter ( app) }
2731
2832 /// Cancel button in the Navigation bar.
@@ -41,6 +45,10 @@ public final class NewOrderScreen: ScreenObject {
4145 ///
4246 private var addCustomerDetailsButton : XCUIElement { addCustomerDetailsButtonGetter ( app) }
4347
48+ /// Add Shipping button in the Payment section.
49+ ///
50+ private var addShippingButton : XCUIElement { addShippingButtonGetter ( app) }
51+
4452 public init ( app: XCUIApplication = XCUIApplication ( ) ) throws {
4553 try super. init (
4654 expectedElementGetters: [ createButtonGetter ] ,
@@ -74,6 +82,14 @@ public final class NewOrderScreen: ScreenObject {
7482 return try CustomerDetailsScreen ( )
7583 }
7684
85+ /// Opens the Add Shipping screen.
86+ /// - Returns: Add Shipping screen object.
87+ @discardableResult
88+ public func openAddShippingScreen( ) throws -> AddShippingScreen {
89+ addShippingButton. tap ( )
90+ return try AddShippingScreen ( )
91+ }
92+
7793// MARK: - High-level Order Creation actions
7894
7995 /// Creates a remote order with all of the entered order data.
@@ -107,6 +123,18 @@ public final class NewOrderScreen: ScreenObject {
107123 . enterCustomerDetails ( name: name)
108124 }
109125
126+ /// Adds shipping on the Add Shipping screen.
127+ /// - Parameters:
128+ /// - amount: Amount (in the store currency) to add for shipping.
129+ /// - name: Name of the shipping method (e.g. "Free Shipping" or "Flat Rate").
130+ /// - Returns: New Order screen object.
131+ public func addShipping( amount: String , name: String ) throws -> NewOrderScreen {
132+ return try openAddShippingScreen ( )
133+ . enterShippingAmount ( amount)
134+ . enterShippingName ( name)
135+ . confirmShippingDetails ( )
136+ }
137+
110138 /// Cancels Order Creation process
111139 /// - Returns: Orders Screen object.
112140 @discardableResult
0 commit comments