Skip to content

Commit bf06d95

Browse files
Add POS smoke flow selectors
1 parent 9b9f7e8 commit bf06d95

7 files changed

Lines changed: 545 additions & 2 deletions

File tree

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# Smoke Test: POS - Cash Payment flow (Tablet)
2+
# p2: pos.add-products, pos.pay-cash, pos.email-receipts
3+
# P2 ref: POS > Search products, Add to cart, Pay with Cash
4+
#
5+
# POS exposes Compose test tags as resource IDs (WooPosTheme enables
6+
# testTagsAsResourceId at the root of the Compose tree).
7+
#
8+
# NOTE: This flow requires a tablet device/emulator with POS enabled.
9+
# On phones the POS tab is hidden by the app, so the core POS assertions
10+
# are wrapped in a visibility guard. The flow will still pass on phones
11+
# (smoke purpose: "does login → reach main nav" succeeded) but the POS
12+
# body is skipped. Run on a tablet emulator to exercise the full flow.
13+
#
14+
# Verifies (on tablet):
15+
# - POS screen loads from bottom navigation
16+
# - Products load and can be added to cart
17+
# - Checkout flow works
18+
# - Cash payment can be completed
19+
# - Payment success screen displays
20+
# - "Email receipt" button opens the Email receipt screen with a
21+
# "Send" action (we do NOT actually send — that would email a
22+
# customer on the staging store; we back out to the success
23+
# screen and then start a new order)
24+
appId: com.woocommerce.android.dev
25+
name: "POS - Cash payment flow"
26+
tags:
27+
- pos_tablet
28+
- flaky_quarantine
29+
- destructive
30+
---
31+
# Reuse the logged-in session — login flows run first and leave the
32+
# app authenticated. See subflows/ensure_logged_in.yaml.
33+
- runFlow:
34+
file: ../subflows/ensure_logged_in.yaml
35+
36+
# Navigate to POS tab (only available on tablets with POS enabled).
37+
# Guarded because the tab is hidden on phones by design.
38+
- runFlow:
39+
when:
40+
visible:
41+
id: "point_of_sale"
42+
commands:
43+
- tapOn:
44+
id: "point_of_sale"
45+
label: "Tap POS tab"
46+
47+
# Wait for POS products to load
48+
- extendedWaitUntil:
49+
visible:
50+
id: "woo_pos_product_item"
51+
timeout: 20000
52+
53+
- takeScreenshot: pos_products
54+
55+
# Add first product to cart
56+
- tapOn:
57+
id: "woo_pos_product_item"
58+
index: 0
59+
label: "Add first product to cart"
60+
61+
# Add another product to cart
62+
- tapOn:
63+
id: "woo_pos_product_item"
64+
index: 2
65+
label: "Add third product to cart"
66+
67+
# Validate cart has items via JavaScript
68+
- copyTextFrom:
69+
id: "woo_pos_cart_items_count"
70+
- evalScript: |
71+
if (maestro.copiedText) {
72+
var count = parseInt(maestro.copiedText, 10);
73+
if (isNaN(count) || count < 1) {
74+
throw new Error('Cart should have at least 1 item, found: ' + maestro.copiedText);
75+
}
76+
}
77+
78+
- takeScreenshot: pos_cart
79+
80+
# Proceed to checkout
81+
- extendedWaitUntil:
82+
visible:
83+
id: "woo_pos_checkout_button"
84+
timeout: 10000
85+
- tapOn:
86+
id: "woo_pos_checkout_button"
87+
label: "Tap Checkout"
88+
89+
# Wait for totals/payment screen
90+
- extendedWaitUntil:
91+
visible:
92+
id: "woo_pos_cash_payment_button"
93+
timeout: 15000
94+
95+
- takeScreenshot: pos_totals
96+
97+
# Select cash payment
98+
- tapOn:
99+
id: "woo_pos_cash_payment_button"
100+
label: "Select Cash payment"
101+
102+
# Complete cash payment
103+
- extendedWaitUntil:
104+
visible:
105+
id: "woo_pos_complete_payment_button"
106+
timeout: 10000
107+
- tapOn:
108+
id: "woo_pos_complete_payment_button"
109+
label: "Complete payment"
110+
111+
# Verify payment success
112+
- extendedWaitUntil:
113+
visible:
114+
id: "woo_pos_new_order_button"
115+
timeout: 15000
116+
117+
- assertVisible:
118+
id: "woo_pos_success_checkmark_icon"
119+
label: "Payment success checkmark visible"
120+
121+
- takeScreenshot: pos_payment_success
122+
123+
# Open the Email receipt screen from the success screen. The
124+
# button is a WooPosOutlinedButton whose label is
125+
# R.string.woopos_receipt_button → "Email receipt" (it has no
126+
# test tag, so we match by text).
127+
- tapOn:
128+
text: "Email receipt"
129+
label: "Tap Email receipt"
130+
131+
# Verify the Email receipt screen loaded. The toolbar title is
132+
# R.string.woopos_email_receipt_title and the send button text
133+
# is R.string.woopos_email_receipt_send_button → "Send".
134+
- runFlow:
135+
when:
136+
visible: "Send"
137+
commands:
138+
- assertVisible: "Email receipt"
139+
- takeScreenshot: pos_email_receipt_screen
140+
# Back out without sending — we don't want the staging
141+
# store to actually dispatch a receipt email on every run.
142+
- back
143+
144+
# Start new order from the (now restored) success screen.
145+
- extendedWaitUntil:
146+
visible:
147+
id: "woo_pos_new_order_button"
148+
timeout: 10000
149+
- tapOn:
150+
id: "woo_pos_new_order_button"
151+
label: "Start new order"
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Smoke Test: POS - Search + Coupons tab (Tablet)
2+
# p2: pos.search-products, pos.coupons
3+
# P2 ref: POS > Search products, Use coupons
4+
#
5+
# POS exposes the Products/Coupons tabs as plain Compose text. The shared
6+
# WooPosSearchInput exposes a stable resource ID and the hint strings tell
7+
# which mode it is in:
8+
# - Products tab: hint is R.string.woopos_search_products_and_variations
9+
# → "Search products and variations"
10+
# - Coupons tab: hint is R.string.woopos_search_coupons
11+
# → "Search coupons"
12+
#
13+
# NOTE: POS is tablet-only. On phones the point_of_sale bottom-nav
14+
# item is hidden; this flow guards on that id and skips the body on
15+
# phones — the login+dashboard checks above already exercise the
16+
# main-app paths.
17+
#
18+
# Verifies (on tablet):
19+
# - POS screen loads with Products + Coupons tabs visible
20+
# - Switching to the Coupons tab loads the coupons list
21+
# - The search hint reflects the active tab (products vs coupons)
22+
# - Switching back to Products reloads the product grid
23+
appId: com.woocommerce.android.dev
24+
name: "POS - Search and Coupons tab"
25+
tags:
26+
- pos_tablet
27+
- flaky_quarantine
28+
---
29+
# Reuse the logged-in session — login flows run first and leave the
30+
# app authenticated. See subflows/ensure_logged_in.yaml.
31+
- runFlow:
32+
file: ../subflows/ensure_logged_in.yaml
33+
34+
# Guard on the POS bottom-nav item — it's only present on tablet
35+
# builds with POS enabled.
36+
- runFlow:
37+
when:
38+
visible:
39+
id: "point_of_sale"
40+
commands:
41+
- tapOn:
42+
id: "point_of_sale"
43+
label: "Tap POS tab"
44+
45+
# Wait for product grid.
46+
- extendedWaitUntil:
47+
visible:
48+
id: "woo_pos_product_item"
49+
timeout: 20000
50+
51+
# Both tabs should be visible at the top of the items screen.
52+
- assertVisible: "Products"
53+
- assertVisible: "Coupons"
54+
55+
- takeScreenshot: pos_products_tab
56+
57+
# Products-tab search hint.
58+
- assertVisible:
59+
id: "woo_pos_search_input"
60+
- assertVisible:
61+
text: ".*Search products and variations.*"
62+
63+
# Switch to the Coupons tab.
64+
- tapOn:
65+
text: "Coupons"
66+
retryTapIfNoChange: true
67+
label: "Tap Coupons tab"
68+
69+
# Either the coupons list loads OR the empty state appears —
70+
# accept either so the assertion isn't tied to seed data on the
71+
# staging store. The search hint changes as soon as the tab
72+
# switches, which is our signal that the tab switch worked.
73+
- extendedWaitUntil:
74+
visible: ".*Search coupons.*|.*No coupons found.*|.*Unable to load coupons.*"
75+
timeout: 20000
76+
label: "Wait for Coupons tab content"
77+
78+
- takeScreenshot: pos_coupons_tab
79+
80+
# Coupon add-to-cart action. Optional until the flow owns seeded
81+
# cart prerequisites for coupon application.
82+
- assertVisible:
83+
id: "woo_pos_coupon_add_to_cart_button"
84+
85+
# Switch back to the Products tab to leave POS in the default
86+
# state for any downstream flow that reuses it.
87+
- tapOn:
88+
text: "Products"
89+
retryTapIfNoChange: true
90+
label: "Tap Products tab"
91+
92+
- extendedWaitUntil:
93+
visible:
94+
id: "woo_pos_product_item"
95+
timeout: 15000
96+
label: "Wait for products grid to reload"
97+
98+
- takeScreenshot: pos_products_tab_restored

0 commit comments

Comments
 (0)