| 1 |
import * as PaymentScreen from "@point_of_sale/../tests/pos/tours/utils/payment_screen_util"; |
| 2 |
import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util"; |
| 3 |
import * as ReceiptScreen from "@point_of_sale/../tests/pos/tours/utils/receipt_screen_util"; |
| 4 |
import * as ChromePos from "@point_of_sale/../tests/pos/tours/utils/chrome_util"; |
| 5 |
import * as ChromeRestaurant from "@pos_restaurant/../tests/tours/utils/chrome"; |
| 6 |
const Chrome = { ...ChromePos, ...ChromeRestaurant }; |
| 7 |
import * as FloorScreen from "@pos_restaurant/../tests/tours/utils/floor_screen_util"; |
| 8 |
import * as Order from "@point_of_sale/../tests/generic_helpers/order_widget_util"; |
| 9 |
import * as ProductScreenPos from "@point_of_sale/../tests/pos/tours/utils/product_screen_util"; |
| 10 |
import * as ProductScreenResto from "@pos_restaurant/../tests/tours/utils/product_screen_util"; |
| 11 |
const ProductScreen = { ...ProductScreenPos, ...ProductScreenResto }; |
| 12 |
import * as SplitBillScreen from "@pos_restaurant/../tests/tours/utils/split_bill_screen_util"; |
| 13 |
import * as TicketScreen from "@point_of_sale/../tests/pos/tours/utils/ticket_screen_util"; |
| 14 |
import * as combo from "@point_of_sale/../tests/pos/tours/utils/combo_popup_util"; |
| 15 |
import { registry } from "@web/core/registry"; |
| 16 |
|
| 17 |
registry.category("web_tour.tours").add("SplitBillScreenTour", { |
| 18 |
steps: () => |
| 19 |
[ |
| 20 |
Chrome.startPoS(), |
| 21 |
Dialog.confirm("Open Register"), |
| 22 |
FloorScreen.clickTable("2"), |
| 23 |
ProductScreen.addOrderline("Water", "5", "2", "10.0"), |
| 24 |
ProductScreen.addOrderline("Minute Maid", "3", "2", "6.0"), |
| 25 |
ProductScreen.addOrderline("Coca-Cola", "1", "2", "2.0"), |
| 26 |
ProductScreen.clickControlButton("Split"), |
| 27 |
|
| 28 |
// Check if the screen contains all the orderlines |
| 29 |
SplitBillScreen.orderlineHas("Water", "5", "0"), |
| 30 |
SplitBillScreen.orderlineHas("Minute Maid", "3", "0"), |
| 31 |
SplitBillScreen.orderlineHas("Coca-Cola", "1", "0"), |
| 32 |
|
| 33 |
// split 3 water and 1 coca-cola |
| 34 |
SplitBillScreen.clickOrderline("Water"), |
| 35 |
SplitBillScreen.orderlineHas("Water", "5", "1"), |
| 36 |
SplitBillScreen.clickOrderline("Water"), |
| 37 |
SplitBillScreen.clickOrderline("Water"), |
| 38 |
SplitBillScreen.orderlineHas("Water", "5", "3"), |
| 39 |
SplitBillScreen.subtotalIs("6.0"), |
| 40 |
SplitBillScreen.clickOrderline("Coca-Cola"), |
| 41 |
SplitBillScreen.orderlineHas("Coca-Cola", "1", "1"), |
| 42 |
SplitBillScreen.subtotalIs("8.0"), |
| 43 |
|
| 44 |
// click pay to split, go back to check the lines |
| 45 |
SplitBillScreen.clickButton("Split"), |
| 46 |
ProductScreen.totalAmountIs("8.0"), |
| 47 |
ProductScreen.clickOrderline("Water", "3"), |
| 48 |
ProductScreen.clickOrderline("Coca-Cola", "1"), |
| 49 |
|
| 50 |
// go back to the original order and see if the order is changed |
| 51 |
Chrome.clickOrders(), |
| 52 |
TicketScreen.selectOrder("001"), |
| 53 |
TicketScreen.loadSelectedOrder(), |
| 54 |
ProductScreen.isShown(), |
| 55 |
ProductScreen.clickOrderline("Water", "2"), |
| 56 |
ProductScreen.clickOrderline("Minute Maid", "3"), |
| 57 |
|
| 58 |
// Split the order of table 2 again |
| 59 |
Chrome.clickPlanButton(), |
| 60 |
FloorScreen.clickTable("2"), |
| 61 |
ProductScreen.clickControlButton("Split"), |
| 62 |
|
| 63 |
SplitBillScreen.clickOrderline("Water"), |
| 64 |
SplitBillScreen.orderlineHas("Water", "2", "1"), |
| 65 |
SplitBillScreen.subtotalIs("2.0"), |
| 66 |
SplitBillScreen.clickOrderline("Minute Maid"), |
| 67 |
SplitBillScreen.orderlineHas("Minute Maid", "3", "1"), |
| 68 |
SplitBillScreen.subtotalIs("4.0"), |
| 69 |
|
| 70 |
SplitBillScreen.clickButton("Split"), |
| 71 |
ProductScreen.totalAmountIs("4.0"), |
| 72 |
|
| 73 |
// go back to the original order and see if the order is changed |
| 74 |
Chrome.clickOrders(), |
| 75 |
TicketScreen.selectOrder("001"), |
| 76 |
TicketScreen.loadSelectedOrder(), |
| 77 |
ProductScreen.isShown(), |
| 78 |
ProductScreen.clickOrderline("Water", "1"), |
| 79 |
ProductScreen.clickOrderline("Minute Maid", "2"), |
| 80 |
].flat(), |
| 81 |
}); |
| 82 |
|
| 83 |
registry.category("web_tour.tours").add("SplitBillScreenTourPay", { |
| 84 |
steps: () => |
| 85 |
[ |
| 86 |
Chrome.startPoS(), |
| 87 |
//Split pay by selecting products |
| 88 |
FloorScreen.clickTable("4"), |
| 89 |
ProductScreen.addOrderline("Water"), |
| 90 |
ProductScreen.addOrderline("Minute Maid"), |
| 91 |
ProductScreen.clickControlButton("Split"), |
| 92 |
SplitBillScreen.clickOrderline("Water"), |
| 93 |
SplitBillScreen.clickButton("Pay"), |
| 94 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 95 |
PaymentScreen.clickValidate(), |
| 96 |
ReceiptScreen.clickContinueOrder(), |
| 97 |
SplitBillScreen.clickOrderline("Minute Maid"), |
| 98 |
SplitBillScreen.clickOrderline("Minute Maid"), |
| 99 |
SplitBillScreen.clickButton("Pay"), |
| 100 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 101 |
PaymentScreen.clickValidate(), |
| 102 |
ReceiptScreen.clickNextOrder(), |
| 103 |
].flat(), |
| 104 |
}); |
| 105 |
|
| 106 |
registry.category("web_tour.tours").add("SplitBillScreenTour2", { |
| 107 |
steps: () => |
| 108 |
[ |
| 109 |
Chrome.startPoS(), |
| 110 |
Dialog.confirm("Open Register"), |
| 111 |
FloorScreen.clickTable("2"), |
| 112 |
ProductScreen.addOrderline("Water", "1", "2.0"), |
| 113 |
ProductScreen.addOrderline("Minute Maid", "1", "2.0"), |
| 114 |
ProductScreen.addOrderline("Coca-Cola", "1", "2.0"), |
| 115 |
Chrome.clickPlanButton(), |
| 116 |
FloorScreen.clickTable("2"), |
| 117 |
Chrome.isSynced(), |
| 118 |
ProductScreen.clickControlButton("Split"), |
| 119 |
|
| 120 |
SplitBillScreen.clickOrderline("Water"), |
| 121 |
SplitBillScreen.orderlineHas("Water", "1", "1"), |
| 122 |
SplitBillScreen.clickOrderline("Coca-Cola"), |
| 123 |
SplitBillScreen.orderlineHas("Coca-Cola", "1", "1"), |
| 124 |
SplitBillScreen.clickButton("Split"), |
| 125 |
ProductScreen.totalAmountIs("4.0"), |
| 126 |
Chrome.clickOrders(), |
| 127 |
TicketScreen.selectOrder("2B"), |
| 128 |
TicketScreen.loadSelectedOrder(), |
| 129 |
Order.hasLine({ productName: "Coca-Cola", quantity: "1" }), |
| 130 |
Order.hasLine({ productName: "Water", quantity: "1" }), |
| 131 |
ProductScreen.totalAmountIs("4.00"), |
| 132 |
Chrome.clickOrders(), |
| 133 |
TicketScreen.selectOrder("001"), |
| 134 |
TicketScreen.loadSelectedOrder(), |
| 135 |
Order.hasLine({ productName: "Minute Maid", quantity: "1" }), |
| 136 |
ProductScreen.totalAmountIs("2.00"), |
| 137 |
].flat(), |
| 138 |
}); |
| 139 |
|
| 140 |
registry.category("web_tour.tours").add("SplitBillScreenTour3", { |
| 141 |
steps: () => |
| 142 |
[ |
| 143 |
Chrome.startPoS(), |
| 144 |
Dialog.confirm("Open Register"), |
| 145 |
FloorScreen.clickTable("2"), |
| 146 |
ProductScreen.addOrderline("Water", "2", "2", "4.00"), |
| 147 |
ProductScreen.clickControlButton("Split"), |
| 148 |
|
| 149 |
// Check if the screen contains all the orderlines |
| 150 |
SplitBillScreen.orderlineHas("Water", "2", "0"), |
| 151 |
|
| 152 |
// split 1 water |
| 153 |
SplitBillScreen.clickOrderline("Water"), |
| 154 |
SplitBillScreen.orderlineHas("Water", "2", "1"), |
| 155 |
SplitBillScreen.subtotalIs("2.0"), |
| 156 |
|
| 157 |
// click pay to split, and pay |
| 158 |
SplitBillScreen.clickButton("Split"), |
| 159 |
ProductScreen.totalAmountIs("2.0"), |
| 160 |
ProductScreen.clickPayButton(), |
| 161 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 162 |
PaymentScreen.clickValidate(), |
| 163 |
ReceiptScreen.clickContinueOrder(), |
| 164 |
|
| 165 |
// Check if there is still water in the order |
| 166 |
ProductScreen.isShown(), |
| 167 |
ProductScreen.orderLineHas("Water", "1.0"), |
| 168 |
ProductScreen.clickPayButton(), |
| 169 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 170 |
PaymentScreen.clickValidate(), |
| 171 |
// Check if there is no more order to continue |
| 172 |
ReceiptScreen.clickNextOrder(), |
| 173 |
].flat(), |
| 174 |
}); |
| 175 |
|
| 176 |
registry.category("web_tour.tours").add("SplitBillScreenTour4ProductCombo", { |
| 177 |
steps: () => |
| 178 |
[ |
| 179 |
Chrome.startPoS(), |
| 180 |
Dialog.confirm("Open Register"), |
| 181 |
FloorScreen.clickTable("2"), |
| 182 |
ProductScreen.clickDisplayedProduct("Office Combo"), |
| 183 |
combo.select("Combo Product 3"), |
| 184 |
combo.select("Combo Product 5"), |
| 185 |
combo.select("Combo Product 8"), |
| 186 |
Dialog.confirm(), |
| 187 |
|
| 188 |
...ProductScreen.clickDisplayedProduct("Office Combo"), |
| 189 |
combo.select("Combo Product 2"), |
| 190 |
combo.select("Combo Product 4"), |
| 191 |
combo.select("Combo Product 7"), |
| 192 |
Dialog.confirm(), |
| 193 |
// now we set the qty of this combo combination to 2 |
| 194 |
ProductScreen.clickOrderline("Combo Product 2"), |
| 195 |
ProductScreen.clickNumpad("2"), |
| 196 |
ProductScreen.selectedOrderlineHas("Combo Product 2", "2"), |
| 197 |
|
| 198 |
ProductScreen.addOrderline("Water", "1"), |
| 199 |
ProductScreen.addOrderline("Minute Maid", "1"), |
| 200 |
|
| 201 |
// The water, the first combo, and one out of the two items |
| 202 |
// of the second combo will go in the new splitted order. |
| 203 |
// we will then check if the rest of the items from the selected |
| 204 |
// combos are automatically sent to the new order. |
| 205 |
ProductScreen.clickControlButton("Split"), |
| 206 |
SplitBillScreen.clickOrderline("Water"), |
| 207 |
SplitBillScreen.clickOrderline("Combo Product 3"), |
| 208 |
SplitBillScreen.clickOrderline("Combo Product 2"), |
| 209 |
// we check that all the lines in the combo are splitted together |
| 210 |
SplitBillScreen.orderlineHas("Water", "1", "1"), |
| 211 |
SplitBillScreen.orderlineHas("Office Combo", "1", "1"), |
| 212 |
SplitBillScreen.orderlineHas("Combo Product 3", "1", "1"), |
| 213 |
SplitBillScreen.orderlineHas("Combo Product 5", "1", "1"), |
| 214 |
SplitBillScreen.orderlineHas("Combo Product 8", "1", "1"), |
| 215 |
SplitBillScreen.orderlineHas("Office Combo", "2", "1"), |
| 216 |
SplitBillScreen.orderlineHas("Combo Product 2", "2", "0"), |
| 217 |
SplitBillScreen.orderlineHas("Combo Product 4", "2", "0"), |
| 218 |
SplitBillScreen.orderlineHas("Combo Product 7", "2", "0"), |
| 219 |
|
| 220 |
...SplitBillScreen.subtotalIs("97.15"), |
| 221 |
...SplitBillScreen.clickButton("Split"), |
| 222 |
ProductScreen.totalAmountIs("97.13"), |
| 223 |
ProductScreen.clickPayButton(), |
| 224 |
...PaymentScreen.clickPaymentMethod("Bank"), |
| 225 |
...PaymentScreen.clickValidate(), |
| 226 |
...ReceiptScreen.clickContinueOrder(), |
| 227 |
|
| 228 |
// Check if there is still water in the order |
| 229 |
...ProductScreen.isShown(), |
| 230 |
// now we check that all the lines that remained in the order are correct |
| 231 |
...ProductScreen.orderLineHas("Minute Maid", "1"), |
| 232 |
...ProductScreen.clickOrderline("Office Combo"), |
| 233 |
...ProductScreen.selectedOrderlineHas("Office Combo", "1", "43.33"), |
| 234 |
...ProductScreen.orderLineHas("Combo Product 2", "1"), |
| 235 |
...ProductScreen.orderLineHas("Combo Product 4", "1"), |
| 236 |
...ProductScreen.orderLineHas("Combo Product 7", "1"), |
| 237 |
...ProductScreen.totalAmountIs("45.53"), |
| 238 |
].flat(), |
| 239 |
}); |
| 240 |
|
| 241 |
registry.category("web_tour.tours").add("SplitBillScreenTour5Actions", { |
| 242 |
steps: () => |
| 243 |
[ |
| 244 |
Chrome.startPoS(), |
| 245 |
Dialog.confirm("Open Register"), |
| 246 |
FloorScreen.clickTable("2"), |
| 247 |
ProductScreen.addOrderline("Water", "2", "2", "4.00"), |
| 248 |
ProductScreen.addOrderline("Minute Maid", "1", "3", "3.00"), |
| 249 |
ProductScreen.clickControlButton("Split"), |
| 250 |
|
| 251 |
SplitBillScreen.orderlineHas("Water", "2", "0"), |
| 252 |
SplitBillScreen.clickOrderline("Water"), |
| 253 |
SplitBillScreen.clickOrderline("Minute Maid"), |
| 254 |
SplitBillScreen.subtotalIs("5.0"), |
| 255 |
|
| 256 |
// click transfer button to split and transfer |
| 257 |
SplitBillScreen.clickButton("Transfer"), |
| 258 |
FloorScreen.isShown(), |
| 259 |
FloorScreen.clickTable("5"), |
| 260 |
|
| 261 |
// check table 5 order and pay |
| 262 |
ProductScreen.orderLineHas("Water", "1"), |
| 263 |
ProductScreen.orderLineHas("Minute Maid", "1"), |
| 264 |
ProductScreen.clickPayButton(), |
| 265 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 266 |
PaymentScreen.clickValidate(), |
| 267 |
ReceiptScreen.clickNextOrder(), |
| 268 |
|
| 269 |
// Add products in order |
| 270 |
FloorScreen.clickTable("2"), |
| 271 |
ProductScreen.orderLineHas("Water", "1"), |
| 272 |
ProductScreen.addOrderline("Minute Maid", "2", "3", "6.00"), |
| 273 |
ProductScreen.clickControlButton("Split"), |
| 274 |
|
| 275 |
SplitBillScreen.clickOrderline("Minute Maid"), |
| 276 |
SplitBillScreen.clickOrderline("water"), |
| 277 |
SplitBillScreen.subtotalIs("5.0"), |
| 278 |
|
| 279 |
// click pay to split, and pay |
| 280 |
SplitBillScreen.clickButton("Pay"), |
| 281 |
PaymentScreen.isShown(), |
| 282 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 283 |
PaymentScreen.clickValidate(), |
| 284 |
ReceiptScreen.clickContinueOrder(), |
| 285 |
|
| 286 |
// Check if redirect to split bill screen of original order |
| 287 |
SplitBillScreen.orderlineHas("Minute Maid", "1", "0"), |
| 288 |
SplitBillScreen.clickButton("Pay"), |
| 289 |
PaymentScreen.isShown(), |
| 290 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 291 |
PaymentScreen.clickValidate(), |
| 292 |
ReceiptScreen.clickNextOrder(), |
| 293 |
].flat(), |
| 294 |
}); |
| 295 |
|
| 296 |
registry.category("web_tour.tours").add("SplitBillScreenTourTransfer", { |
| 297 |
steps: () => |
| 298 |
[ |
| 299 |
Chrome.startPoS(), |
| 300 |
Dialog.confirm("Open Register"), |
| 301 |
FloorScreen.clickTable("2"), |
| 302 |
ProductScreen.addOrderline("Water", "5", "2", "10.0"), |
| 303 |
ProductScreen.addOrderline("Minute Maid", "3", "2", "6.0"), |
| 304 |
ProductScreen.addOrderline("Coca-Cola", "1", "2", "2.0"), |
| 305 |
ProductScreen.clickControlButton("Discount"), |
| 306 |
Dialog.confirm(), |
| 307 |
ProductScreen.selectedOrderlineHas("discount", 1, "-1.80"), |
| 308 |
ProductScreen.clickControlButton("Split"), |
| 309 |
|
| 310 |
// Check if the screen contains all the orderlines |
| 311 |
SplitBillScreen.orderlineHas("Water", "5", "0"), |
| 312 |
SplitBillScreen.orderlineHas("Minute Maid", "3", "0"), |
| 313 |
SplitBillScreen.orderlineHas("Coca-Cola", "1", "0"), |
| 314 |
Order.doesNotHaveLine({ productName: "Discount" }), |
| 315 |
|
| 316 |
// split 3 water and 1 coca-cola |
| 317 |
SplitBillScreen.clickOrderline("Water"), |
| 318 |
SplitBillScreen.orderlineHas("Water", "5", "1"), |
| 319 |
SplitBillScreen.clickOrderline("Water"), |
| 320 |
SplitBillScreen.clickOrderline("Water"), |
| 321 |
SplitBillScreen.orderlineHas("Water", "5", "3"), |
| 322 |
SplitBillScreen.subtotalIs("6.0"), |
| 323 |
SplitBillScreen.clickOrderline("Coca-Cola"), |
| 324 |
SplitBillScreen.orderlineHas("Coca-Cola", "1", "1"), |
| 325 |
SplitBillScreen.subtotalIs("8.0"), |
| 326 |
|
| 327 |
// click pay to split, go back to check the lines |
| 328 |
SplitBillScreen.clickButton("Transfer"), |
| 329 |
FloorScreen.clickTable("5"), |
| 330 |
|
| 331 |
Order.doesNotHaveLine({ productName: "Discount" }), |
| 332 |
ProductScreen.totalAmountIs("8.0"), |
| 333 |
ProductScreen.clickOrderline("Water", "3"), |
| 334 |
ProductScreen.clickOrderline("Coca-Cola", "1"), |
| 335 |
|
| 336 |
// go back to the original order and see if the order is changed |
| 337 |
Chrome.clickOrders(), |
| 338 |
TicketScreen.selectOrder("001"), |
| 339 |
TicketScreen.loadSelectedOrder(), |
| 340 |
ProductScreen.isShown(), |
| 341 |
ProductScreen.clickOrderline("Water", "2"), |
| 342 |
ProductScreen.clickOrderline("Minute Maid", "3"), |
| 343 |
].flat(), |
| 344 |
}); |