| 1 |
import * as ProductScreen from "@point_of_sale/../tests/pos/tours/utils/product_screen_util"; |
| 2 |
import * as PaymentScreen from "@point_of_sale/../tests/pos/tours/utils/payment_screen_util"; |
| 3 |
import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util"; |
| 4 |
import * as Chrome from "@point_of_sale/../tests/pos/tours/utils/chrome_util"; |
| 5 |
|
| 6 |
import { registry } from "@web/core/registry"; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
function isQRDisplayedinDialog() { |
| 13 |
return [ |
| 14 |
Dialog.is({ title: "QR Code" }), |
| 15 |
{ |
| 16 |
content: "Verify QR image is displayed", |
| 17 |
trigger: ".modal-content img[src^='data:image/png;base64,']", |
| 18 |
run: "click", |
| 19 |
}, |
| 20 |
].flat(); |
| 21 |
} |
| 22 |
|
| 23 |
function addProductandPay(isPartialPay = false) { |
| 24 |
return [ |
| 25 |
ProductScreen.addOrderline("Hand Bag", "10"), |
| 26 |
ProductScreen.selectedOrderlineHas("Hand Bag", "10"), |
| 27 |
ProductScreen.clickPayButton(), |
| 28 |
|
| 29 |
PaymentScreen.totalIs("48"), |
| 30 |
...(isPartialPay |
| 31 |
? [ |
| 32 |
PaymentScreen.clickPaymentMethod("QR Code"), |
| 33 |
PaymentScreen.clickNumpad("⌫"), |
| 34 |
PaymentScreen.clickNumpad("+10"), |
| 35 |
] |
| 36 |
: [PaymentScreen.clickPaymentMethod("QR Code", true, { amount: "48" })]), |
| 37 |
{ |
| 38 |
content: "Display QR Code Payment dialog", |
| 39 |
trigger: ".button.send_payment_request.highlight", |
| 40 |
run: "click", |
| 41 |
}, |
| 42 |
].flat(); |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
registry.category("web_tour.tours").add("PaymentScreenWithQRPaymentFailure", { |
| 50 |
steps: () => |
| 51 |
[ |
| 52 |
Chrome.startPoS(), |
| 53 |
Dialog.confirm("Open Register"), |
| 54 |
addProductandPay(), |
| 55 |
Dialog.is({ title: "Failure to generate Payment QR Code" }), |
| 56 |
Dialog.confirm(), |
| 57 |
].flat(), |
| 58 |
}); |
| 59 |
|
| 60 |
registry.category("web_tour.tours").add("PaymentScreenWithQRPayment", { |
| 61 |
steps: () => |
| 62 |
[ |
| 63 |
Chrome.startPoS(), |
| 64 |
Dialog.confirm("Open Register"), |
| 65 |
|
| 66 |
|
| 67 |
addProductandPay(), |
| 68 |
isQRDisplayedinDialog(), |
| 69 |
Dialog.cancel(), |
| 70 |
PaymentScreen.validateButtonIsHighlighted(false), |
| 71 |
{ |
| 72 |
content: "Retry to display QR Code Payment dialog", |
| 73 |
trigger: ".button.send_payment_request.highlight", |
| 74 |
run: "click", |
| 75 |
}, |
| 76 |
isQRDisplayedinDialog(), |
| 77 |
Dialog.confirm(), |
| 78 |
{ |
| 79 |
content: "Immediately at the receipt screen.", |
| 80 |
trigger: '.receipt-screen .button.next.highlight:contains("New Order")', |
| 81 |
run: "click", |
| 82 |
}, |
| 83 |
|
| 84 |
|
| 85 |
addProductandPay(true), |
| 86 |
isQRDisplayedinDialog(), |
| 87 |
Dialog.confirm(), |
| 88 |
{ |
| 89 |
trigger: ".electronic_status:contains('Successful')", |
| 90 |
}, |
| 91 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 92 |
PaymentScreen.clickValidate(), |
| 93 |
].flat(), |
| 94 |
}); |
| 95 |
|
| 96 |
registry.category("web_tour.tours").add("PaymentScreenWithQRPaymentSwiss", { |
| 97 |
steps: () => |
| 98 |
[ |
| 99 |
Chrome.startPoS(), |
| 100 |
Dialog.confirm("Open Register"), |
| 101 |
ProductScreen.addOrderline("Hand Bag", "10"), |
| 102 |
ProductScreen.selectedOrderlineHas("Hand Bag", "10"), |
| 103 |
ProductScreen.clickPartnerButton(), |
| 104 |
ProductScreen.clickCustomer("AAA Partner Swiss"), |
| 105 |
ProductScreen.clickPayButton(), |
| 106 |
PaymentScreen.totalIs("48"), |
| 107 |
PaymentScreen.clickPaymentMethod("QR Code", true, { amount: "48" }), |
| 108 |
{ |
| 109 |
content: "Display QR Code Payment dialog", |
| 110 |
trigger: ".button.send_payment_request.highlight", |
| 111 |
run: "click", |
| 112 |
}, |
| 113 |
PaymentScreen.validateButtonIsHighlighted(false), |
| 114 |
isQRDisplayedinDialog(), |
| 115 |
Dialog.confirm(), |
| 116 |
{ |
| 117 |
content: "Immediately at the receipt screen.", |
| 118 |
trigger: '.receipt-screen .button.next.highlight:contains("New Order")', |
| 119 |
run: "click", |
| 120 |
}, |
| 121 |
].flat(), |
| 122 |
}); |