| 1 |
import * as PosLoyalty from "@pos_loyalty/../tests/tours/utils/pos_loyalty_util"; |
| 2 |
import * as ProductScreen from "@point_of_sale/../tests/pos/tours/utils/product_screen_util"; |
| 3 |
import * as Chrome from "@point_of_sale/../tests/pos/tours/utils/chrome_util"; |
| 4 |
import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util"; |
| 5 |
import { registry } from "@web/core/registry"; |
| 6 |
import * as TicketScreen from "@point_of_sale/../tests/pos/tours/utils/ticket_screen_util"; |
| 7 |
import * as Order from "@point_of_sale/../tests/generic_helpers/order_widget_util"; |
| 8 |
import * as ReceiptScreen from "@point_of_sale/../tests/pos/tours/utils/receipt_screen_util"; |
| 9 |
import * as PaymentScreen from "@point_of_sale/../tests/pos/tours/utils/payment_screen_util"; |
| 10 |
|
| 11 |
registry.category("web_tour.tours").add("GiftCardProgramTour1", { |
| 12 |
steps: () => |
| 13 |
[ |
| 14 |
Chrome.startPoS(), |
| 15 |
Dialog.confirm("Open Register"), |
| 16 |
ProductScreen.clickDisplayedProduct("Gift Card"), |
| 17 |
PosLoyalty.orderTotalIs("50.00"), |
| 18 |
PosLoyalty.finalizeOrder("Cash", "50"), |
| 19 |
].flat(), |
| 20 |
}); |
| 21 |
|
| 22 |
registry.category("web_tour.tours").add("GiftCardProgramTour2", { |
| 23 |
steps: () => |
| 24 |
[ |
| 25 |
Chrome.startPoS(), |
| 26 |
ProductScreen.clickDisplayedProduct("Whiteboard Pen"), |
| 27 |
PosLoyalty.enterCode("044123456"), |
| 28 |
PosLoyalty.orderTotalIs("0.00"), |
| 29 |
PosLoyalty.finalizeOrder("Cash", "0"), |
| 30 |
].flat(), |
| 31 |
}); |
| 32 |
|
| 33 |
registry.category("web_tour.tours").add("GiftCardWithRefundtTour", { |
| 34 |
steps: () => |
| 35 |
[ |
| 36 |
Chrome.startPoS(), |
| 37 |
Dialog.confirm("Open Register"), |
| 38 |
ProductScreen.addOrderline("Magnetic Board", "1"), // 1.98 |
| 39 |
PosLoyalty.orderTotalIs("1.98"), |
| 40 |
PosLoyalty.finalizeOrder("Cash", "20"), |
| 41 |
...ProductScreen.clickRefund(), |
| 42 |
TicketScreen.selectOrder("001"), |
| 43 |
Order.hasLine({ |
| 44 |
withClass: ".selected", |
| 45 |
productName: "Magnetic Board", |
| 46 |
}), |
| 47 |
ProductScreen.clickNumpad("1"), |
| 48 |
TicketScreen.confirmRefund(), |
| 49 |
PaymentScreen.isShown(), |
| 50 |
PaymentScreen.clickBack(), |
| 51 |
ProductScreen.isShown(), |
| 52 |
ProductScreen.clickLine("Magnetic Board", "-1"), |
| 53 |
ProductScreen.selectedOrderlineHas("Magnetic Board", "-1"), |
| 54 |
ProductScreen.addOrderline("Gift Card", "1"), |
| 55 |
ProductScreen.selectedOrderlineHas("Gift Card", "1"), |
| 56 |
PosLoyalty.orderTotalIs("0.0"), |
| 57 |
].flat(), |
| 58 |
}); |
| 59 |
|
| 60 |
registry.category("web_tour.tours").add("GiftCardProgramPriceNoTaxTour", { |
| 61 |
steps: () => |
| 62 |
[ |
| 63 |
Chrome.startPoS(), |
| 64 |
Dialog.confirm("Open Register"), |
| 65 |
// Use gift card |
| 66 |
ProductScreen.addOrderline("Magnetic Board", "1", "1.98", "1.98"), |
| 67 |
PosLoyalty.enterCode("043123456"), |
| 68 |
Dialog.confirm(), |
| 69 |
ProductScreen.clickOrderline("Gift Card"), |
| 70 |
ProductScreen.selectedOrderlineHas("Gift Card", "1", "-1.00"), |
| 71 |
PosLoyalty.orderTotalIs("0.98"), |
| 72 |
].flat(), |
| 73 |
}); |
| 74 |
|
| 75 |
registry.category("web_tour.tours").add("PosLoyaltyPointsGiftcard", { |
| 76 |
steps: () => |
| 77 |
[ |
| 78 |
Chrome.startPoS(), |
| 79 |
Dialog.confirm("Open Register"), |
| 80 |
ProductScreen.addOrderline("Gift Card", "1", "50", "50"), |
| 81 |
PosLoyalty.createManualGiftCard("044123456", 50), |
| 82 |
PosLoyalty.orderTotalIs("50.00"), |
| 83 |
PosLoyalty.finalizeOrder("Cash", "50"), |
| 84 |
ProductScreen.clickPartnerButton(), |
| 85 |
ProductScreen.clickCustomer("AAAA"), |
| 86 |
ProductScreen.addOrderline("product_a", "1"), |
| 87 |
PosLoyalty.enterCode("044123456"), |
| 88 |
PosLoyalty.orderTotalIs("50.00"), |
| 89 |
PosLoyalty.pointsAwardedAre("100"), |
| 90 |
PosLoyalty.finalizeOrder("Cash", "50"), |
| 91 |
].flat(), |
| 92 |
}); |
| 93 |
|
| 94 |
registry.category("web_tour.tours").add("PosLoyaltyGiftCardTaxes", { |
| 95 |
steps: () => |
| 96 |
[ |
| 97 |
Chrome.startPoS(), |
| 98 |
Dialog.confirm("Open Register"), |
| 99 |
ProductScreen.addOrderline("Gift Card", "1", "50", "50"), |
| 100 |
PosLoyalty.createManualGiftCard("044123456", 50), |
| 101 |
PosLoyalty.orderTotalIs("50.00"), |
| 102 |
PosLoyalty.finalizeOrder("Cash", "50"), |
| 103 |
ProductScreen.clickDisplayedProduct("Test Product A"), |
| 104 |
PosLoyalty.enterCode("044123456"), |
| 105 |
PosLoyalty.orderTotalIs("50.00"), |
| 106 |
ProductScreen.checkTaxAmount("-6.52"), |
| 107 |
].flat(), |
| 108 |
}); |
| 109 |
|
| 110 |
registry.category("web_tour.tours").add("PhysicalGiftCardProgramSaleTour", { |
| 111 |
steps: () => |
| 112 |
[ |
| 113 |
Chrome.startPoS(), |
| 114 |
Dialog.confirm("Open Register"), |
| 115 |
ProductScreen.addOrderline("Gift Card", "1", "50", "50"), |
| 116 |
PosLoyalty.createManualGiftCard("test-card-0000", 125), |
| 117 |
ProductScreen.selectedOrderlineHas("Gift Card", "1", "125"), |
| 118 |
PosLoyalty.orderTotalIs("125"), |
| 119 |
PosLoyalty.finalizeOrder("Cash", "125"), |
| 120 |
ProductScreen.addOrderline("Gift Card", "1", "50", "50"), |
| 121 |
PosLoyalty.createManualGiftCard("test-card-0001", 100), |
| 122 |
PosLoyalty.clickPhysicalGiftCard("test-card-0001"), |
| 123 |
ProductScreen.selectedOrderlineHas("Gift Card", "1", "100"), |
| 124 |
ProductScreen.addOrderline("Gift Card", "1", "50", "50"), |
| 125 |
PosLoyalty.createManualGiftCard("new-card-0001", 250), |
| 126 |
PosLoyalty.clickPhysicalGiftCard("new-card-0001"), |
| 127 |
ProductScreen.selectedOrderlineHas("Gift Card", "1", "250"), |
| 128 |
PosLoyalty.orderTotalIs("350"), |
| 129 |
PosLoyalty.finalizeOrder("Cash", "350"), |
| 130 |
].flat(), |
| 131 |
}); |
| 132 |
|
| 133 |
registry.category("web_tour.tours").add("MultiplePhysicalGiftCardProgramSaleTour", { |
| 134 |
steps: () => |
| 135 |
[ |
| 136 |
Chrome.startPoS(), |
| 137 |
Dialog.confirm("Open Register"), |
| 138 |
ProductScreen.clickDisplayedProduct("Gift Card"), |
| 139 |
PosLoyalty.clickGiftCardProgram("Gift Cards1"), |
| 140 |
PosLoyalty.createManualGiftCard("test-card-0000", 125), |
| 141 |
PosLoyalty.clickGiftCardProgram("Gift Cards"), |
| 142 |
ProductScreen.selectedOrderlineHas("Gift Card", "1.00", "125"), |
| 143 |
PosLoyalty.orderTotalIs("125"), |
| 144 |
PosLoyalty.finalizeOrder("Cash", "125"), |
| 145 |
ProductScreen.clickDisplayedProduct("Gift Card"), |
| 146 |
PosLoyalty.clickGiftCardProgram("Gift Cards2"), |
| 147 |
PosLoyalty.createManualGiftCard("test-card-0001", 125), |
| 148 |
PosLoyalty.clickGiftCardProgram("Gift Cards2"), |
| 149 |
ProductScreen.selectedOrderlineHas("Gift Card", "1.00", "125"), |
| 150 |
PosLoyalty.orderTotalIs("125"), |
| 151 |
PosLoyalty.finalizeOrder("Cash", "125"), |
| 152 |
ProductScreen.clickDisplayedProduct("Gift Card"), |
| 153 |
PosLoyalty.clickGiftCardProgram("Gift Cards3"), |
| 154 |
PosLoyalty.createManualGiftCard("test-card-0002", 125), |
| 155 |
PosLoyalty.clickGiftCardProgram("Gift Cards3"), |
| 156 |
ProductScreen.selectedOrderlineHas("Gift Card", "1.00", "125"), |
| 157 |
PosLoyalty.orderTotalIs("125"), |
| 158 |
PosLoyalty.finalizeOrder("Cash", "125"), |
| 159 |
].flat(), |
| 160 |
}); |
| 161 |
|
| 162 |
registry.category("web_tour.tours").add("GiftCardProgramInvoice", { |
| 163 |
steps: () => |
| 164 |
[ |
| 165 |
Chrome.startPoS(), |
| 166 |
Dialog.confirm("Open Register"), |
| 167 |
ProductScreen.clickDisplayedProduct("Gift Card"), |
| 168 |
ProductScreen.clickPartnerButton(), |
| 169 |
ProductScreen.clickCustomer("A Test Partner"), |
| 170 |
PosLoyalty.orderTotalIs("50.00"), |
| 171 |
ProductScreen.clickPayButton(), |
| 172 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 173 |
PaymentScreen.clickInvoiceButton(), |
| 174 |
PaymentScreen.clickValidate(), |
| 175 |
ReceiptScreen.isShown(), |
| 176 |
].flat(), |
| 177 |
}); |
| 178 |
|
| 179 |
registry.category("web_tour.tours").add("test_gift_card_no_date", { |
| 180 |
steps: () => |
| 181 |
[ |
| 182 |
Chrome.startPoS(), |
| 183 |
Dialog.confirm("Open Register"), |
| 184 |
ProductScreen.clickDisplayedProduct("Gift Card"), |
| 185 |
PosLoyalty.createManualGiftCard("test", "42", ""), |
| 186 |
PosLoyalty.finalizeOrder("Cash", "42"), |
| 187 |
].flat(), |
| 188 |
}); |
| 189 |
|
| 190 |
registry.category("web_tour.tours").add("test_physical_gift_card_invoiced", { |
| 191 |
steps: () => |
| 192 |
[ |
| 193 |
Chrome.startPoS(), |
| 194 |
Dialog.confirm("Open Register"), |
| 195 |
ProductScreen.clickPartnerButton(), |
| 196 |
ProductScreen.clickCustomer("AABBCC Test Partner"), |
| 197 |
ProductScreen.clickDisplayedProduct("Gift Card"), |
| 198 |
PosLoyalty.createManualGiftCard("test-card-1234", 125), |
| 199 |
ProductScreen.selectedOrderlineHas("Gift Card", "1.00", "125"), |
| 200 |
PosLoyalty.orderTotalIs("125"), |
| 201 |
ProductScreen.clickPayButton(), |
| 202 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 203 |
PaymentScreen.clickInvoiceButton(), |
| 204 |
PaymentScreen.clickValidate(), |
| 205 |
ReceiptScreen.isShown(), |
| 206 |
].flat(), |
| 207 |
}); |
| 208 |
|
| 209 |
registry.category("web_tour.tours").add("EmptyProductScreenTour", { |
| 210 |
steps: () => |
| 211 |
[ |
| 212 |
Chrome.startPoS(), |
| 213 |
Dialog.confirm("Open Register"), |
| 214 |
ProductScreen.isEmpty(), |
| 215 |
ProductScreen.loadSampleButtonIsThere(), |
| 216 |
].flat(), |
| 217 |
}); |
| 218 |
|
| 219 |
registry.category("web_tour.tours").add("test_physical_gift_card", { |
| 220 |
steps: () => |
| 221 |
[ |
| 222 |
Chrome.startPoS(), |
| 223 |
Dialog.confirm("Open Register"), |
| 224 |
ProductScreen.clickDisplayedProduct("Gift Card"), |
| 225 |
|
| 226 |
// Gift card cannot be used as it's already linked to a partner |
| 227 |
PosLoyalty.useExistingLoyaltyCard("gift_card_partner", false), |
| 228 |
// Gift card cannot be used as it's expired |
| 229 |
PosLoyalty.useExistingLoyaltyCard("gift_card_expired", false), |
| 230 |
// Gift card is already sold |
| 231 |
PosLoyalty.useExistingLoyaltyCard("gift_card_sold", false), |
| 232 |
|
| 233 |
// Use gift_card_generated_but_not_sold - Warning is triggered |
| 234 |
PosLoyalty.enterCode("gift_card_generated_but_not_sold"), |
| 235 |
Dialog.cancel(), |
| 236 |
|
| 237 |
// Sell the unsold gift card |
| 238 |
PosLoyalty.useExistingLoyaltyCard("gift_card_generated_but_not_sold", true), |
| 239 |
ProductScreen.selectedOrderlineHas("Gift Card", "1", "60.00"), |
| 240 |
ProductScreen.clickNumpad("2"), // Cannot edit a physical gift card |
| 241 |
Dialog.confirm(), // Warning is triggered |
| 242 |
PosLoyalty.orderTotalIs("60.00"), |
| 243 |
PosLoyalty.finalizeOrder("Cash", "60"), |
| 244 |
|
| 245 |
// Use gift_card_valid - No warning should be triggered |
| 246 |
ProductScreen.clickDisplayedProduct("Whiteboard Pen"), |
| 247 |
PosLoyalty.enterCode("gift_card_valid"), |
| 248 |
ProductScreen.clickLine("Gift Card"), |
| 249 |
ProductScreen.selectedOrderlineHas("Gift Card", "1", "-3.20"), |
| 250 |
PosLoyalty.orderTotalIs("0.00"), |
| 251 |
PosLoyalty.finalizeOrder("Cash", "0"), |
| 252 |
|
| 253 |
// Use gift_card_partner - No warning should be triggered |
| 254 |
ProductScreen.clickDisplayedProduct("Whiteboard Pen"), |
| 255 |
PosLoyalty.enterCode("gift_card_partner"), |
| 256 |
ProductScreen.clickLine("Gift Card"), |
| 257 |
ProductScreen.selectedOrderlineHas("Gift Card", "1", "-3.20"), |
| 258 |
PosLoyalty.orderTotalIs("0.00"), |
| 259 |
PosLoyalty.finalizeOrder("Cash", "0"), |
| 260 |
|
| 261 |
// Use gift_card_sold - Warning should be triggered |
| 262 |
ProductScreen.clickDisplayedProduct("Whiteboard Pen"), |
| 263 |
ProductScreen.clickDisplayedProduct("Whiteboard Pen"), |
| 264 |
PosLoyalty.enterCode("gift_card_sold"), |
| 265 |
ProductScreen.clickLine("Gift Card"), |
| 266 |
ProductScreen.selectedOrderlineHas("Gift Card", "1", "-6.40"), |
| 267 |
PosLoyalty.orderTotalIs("0.00"), |
| 268 |
PosLoyalty.finalizeOrder("Cash", "0"), |
| 269 |
|
| 270 |
// Use gift_card_generated_but_not_sold - No warning should be triggered |
| 271 |
ProductScreen.clickDisplayedProduct("Whiteboard Pen"), |
| 272 |
ProductScreen.clickDisplayedProduct("Whiteboard Pen"), |
| 273 |
ProductScreen.clickDisplayedProduct("Whiteboard Pen"), |
| 274 |
ProductScreen.clickDisplayedProduct("Whiteboard Pen"), |
| 275 |
PosLoyalty.enterCode("gift_card_generated_but_not_sold"), |
| 276 |
ProductScreen.clickLine("Gift Card"), |
| 277 |
ProductScreen.selectedOrderlineHas("Gift Card", "1", "-12.80"), |
| 278 |
PosLoyalty.orderTotalIs("0.00"), |
| 279 |
PosLoyalty.finalizeOrder("Cash", "0"), |
| 280 |
|
| 281 |
// Try to use expired gift card |
| 282 |
ProductScreen.clickDisplayedProduct("Whiteboard Pen"), |
| 283 |
ProductScreen.clickDisplayedProduct("Whiteboard Pen"), |
| 284 |
ProductScreen.clickDisplayedProduct("Whiteboard Pen"), |
| 285 |
PosLoyalty.enterCode("gift_card_expired"), |
| 286 |
PosLoyalty.orderTotalIs("9.60"), |
| 287 |
PosLoyalty.finalizeOrder("Cash", "9.60"), |
| 288 |
|
| 289 |
// Sell a new gift card with a partner |
| 290 |
ProductScreen.clickPartnerButton(), |
| 291 |
ProductScreen.clickCustomer("A powerful PoS man!"), |
| 292 |
ProductScreen.clickDisplayedProduct("Gift Card"), |
| 293 |
ProductScreen.clickNumpad("Price", "9", "9", "9"), |
| 294 |
PosLoyalty.orderTotalIs("999.00"), |
| 295 |
PosLoyalty.finalizeOrder("Cash", "999"), |
| 296 |
].flat(), |
| 297 |
}); |