Skip to content

Commit 0803253

Browse files
committed
make test pass
1 parent 75ad416 commit 0803253

File tree

4 files changed

+60
-17
lines changed

4 files changed

+60
-17
lines changed

Modules/Sources/PointOfSale/Presentation/POSFloatingControlView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct POSFloatingControlView: View {
4040
}
4141
.frame(width: Constants.size)
4242
}
43+
.accessibilityIdentifier("pos-menu-button")
4344
.background(backgroundColor)
4445
.cornerRadius(Constants.cornerRadius)
4546
.disabled(posModel.paymentState.card == .processingPayment)
@@ -78,6 +79,7 @@ private extension POSFloatingControlView {
7879
icon: { Image(systemName: "rectangle.portrait.and.arrow.forward") }
7980
)
8081
}
82+
.accessibilityIdentifier("pos-exit-menu-item")
8183
Button {
8284
analytics.track(.pointOfSaleSettingsMenuItemTapped)
8385
showSettings = true

Modules/Sources/PointOfSale/Presentation/PointOfSaleExitPosAlertView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct PointOfSaleExitPosAlertView: View {
1919
Text(Image(systemName: "xmark"))
2020
.font(.posButtonSymbolLarge)
2121
}
22+
.accessibilityIdentifier("pos-exit-modal-close-button")
2223
.foregroundColor(Color.posOnSurfaceVariantLowest)
2324
}
2425
Text(Localization.exitTitle)
@@ -33,6 +34,7 @@ struct PointOfSaleExitPosAlertView: View {
3334
} label: {
3435
Text(Localization.exitButton)
3536
}
37+
.accessibilityIdentifier("pos-exit-confirm-button")
3638
.buttonStyle(POSFilledButtonStyle(size: .normal))
3739
}
3840
.padding(Constants.padding)

Modules/Sources/UITestsFoundation/Screens/POS/POSScreen.swift

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,40 @@ public final class POSScreen: ScreenObject {
122122

123123
return self
124124
}
125+
126+
@discardableResult
127+
public func tapMenuButton() -> Self {
128+
let menuButton = app.buttons["pos-menu-button"]
129+
130+
guard menuButton.waitForExistence(timeout: 3) else {
131+
return self
132+
}
133+
134+
menuButton.tap()
135+
return self
136+
}
137+
138+
@discardableResult
139+
public func tapExitMenuItem() -> Self {
140+
let exitMenuItem = app.buttons["pos-exit-menu-item"]
141+
142+
guard exitMenuItem.waitForExistence(timeout: 3) else {
143+
return self
144+
}
145+
146+
exitMenuItem.tap()
147+
return self
148+
}
149+
150+
@discardableResult
151+
public func confirmExitPOS() throws -> TabNavComponent {
152+
let exitButton = app.buttons["pos-exit-confirm-button"]
153+
154+
guard exitButton.waitForExistence(timeout: 3) else {
155+
return try TabNavComponent()
156+
}
157+
158+
exitButton.tap()
159+
return try TabNavComponent()
160+
}
125161
}

WooCommerce/WooCommerceScreenshots/WooCommerceScreenshots.swift

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,6 @@ class WooCommerceScreenshots: XCTestCase {
5050
// The interruption monitor above only activates when the app receives user interaction.
5151
app.tap()
5252

53-
// POS
54-
try TabNavComponent()
55-
.goToPOSScreen()
56-
.tapAddProduct(productID: 1)
57-
.tapAddProduct(productID: 2)
58-
.thenTakeScreenshot(named: "test-pos-screenshot", orientation: .landscapeLeft)
59-
.tapConnectReader()
60-
.waitForReaderConnected()
61-
.tapCheckout()
62-
.waitForTotalsLoaded()
63-
.waitForCardPaymentReady()
64-
.thenTakeScreenshot(named: "test-pos-screenshot-2", orientation: .landscapeLeft)
65-
.tapCashPayment()
66-
.tapMarkPaymentComplete()
67-
.waitForPaymentSuccess()
68-
.thenTakeScreenshot(named: "test-pos-screenshot-3", orientation: .landscapeLeft)
69-
7053
// My Store
7154
try TabNavComponent()
7255
.goToMyStoreScreen()
@@ -91,6 +74,26 @@ class WooCommerceScreenshots: XCTestCase {
9174
.goBackToOrderScreen()
9275
.goBackToOrdersScreen()
9376

77+
// POS
78+
try TabNavComponent()
79+
.goToPOSScreen()
80+
.tapAddProduct(productID: 1)
81+
.tapAddProduct(productID: 2)
82+
.thenTakeScreenshot(named: "pos-dashboard", orientation: .landscapeLeft)
83+
.tapConnectReader()
84+
.waitForReaderConnected()
85+
.tapCheckout()
86+
.waitForTotalsLoaded()
87+
.waitForCardPaymentReady()
88+
.thenTakeScreenshot(named: "pos-payment", orientation: .landscapeLeft)
89+
.tapCashPayment()
90+
.tapMarkPaymentComplete()
91+
.waitForPaymentSuccess()
92+
.thenTakeScreenshot(named: "pos-success", orientation: .landscapeLeft)
93+
.tapMenuButton()
94+
.tapExitMenuItem()
95+
.confirmExitPOS()
96+
9497
// Products
9598
try TabNavComponent()
9699
.goToProductsScreen()

0 commit comments

Comments
 (0)