|
| 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" |
0 commit comments