| 1 |
import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util"; |
| 2 |
import * as ChromePos from "@point_of_sale/../tests/pos/tours/utils/chrome_util"; |
| 3 |
import * as ChromeRestaurant from "@pos_restaurant/../tests/tours/utils/chrome"; |
| 4 |
import * as ProductScreenPos from "@point_of_sale/../tests/pos/tours/utils/product_screen_util"; |
| 5 |
import * as ProductScreenResto from "@pos_restaurant/../tests/tours/utils/product_screen_util"; |
| 6 |
import * as FloorScreen from "@pos_restaurant/../tests/tours/utils/floor_screen_util"; |
| 7 |
import * as DeviceSynchronization from "@pos_restaurant/../tests/tours/utils/devices_synchronization"; |
| 8 |
import * as PaymentScreen from "@point_of_sale/../tests/pos/tours/utils/payment_screen_util"; |
| 9 |
import * as ReceiptScreen from "@point_of_sale/../tests/pos/tours/utils/receipt_screen_util"; |
| 10 |
import * as TicketScreen from "@point_of_sale/../tests/pos/tours/utils/ticket_screen_util"; |
| 11 |
import { registry } from "@web/core/registry"; |
| 12 |
|
| 13 |
const ProductScreen = { ...ProductScreenPos, ...ProductScreenResto }; |
| 14 |
const Chrome = { ...ChromePos, ...ChromeRestaurant }; |
| 15 |
|
| 16 |
registry.category("web_tour.tours").add("test_devices_synchronization", { |
| 17 |
steps: () => |
| 18 |
[ |
| 19 |
Chrome.startPoS(), |
| 20 |
Dialog.confirm("Open Register"), |
| 21 |
FloorScreen.clickTable("5"), |
| 22 |
|
| 23 |
// product_screen |
| 24 |
// Check if lines created from another devices |
| 25 |
// correctly appear in the current device |
| 26 |
ProductScreen.orderlineIsToOrder("Coca-Cola"), |
| 27 |
DeviceSynchronization.createNewLine("Water", 2), |
| 28 |
ProductScreen.orderlineIsToOrder("Water"), |
| 29 |
DeviceSynchronization.changeLineQuantity("Water", 44), |
| 30 |
ProductScreen.checkTotalAmount(99.0), |
| 31 |
ProductScreen.clickPartnerButton(), |
| 32 |
ProductScreen.clickCustomer("Acme Corporation"), |
| 33 |
Chrome.clickPlanButton(), |
| 34 |
|
| 35 |
// prpoduct_screen |
| 36 |
// Check if changing partner form another device |
| 37 |
// correctly appear in the current device |
| 38 |
FloorScreen.clickTable("5"), |
| 39 |
DeviceSynchronization.changePartner("Lumber Inc"), |
| 40 |
ProductScreen.customerIs("Lumber Inc"), |
| 41 |
|
| 42 |
// prpoduct_screen |
| 43 |
// Check if paying from another device |
| 44 |
// is correctly synchronized |
| 45 |
DeviceSynchronization.markOrderAsPaid(), |
| 46 |
ProductScreen.orderIsEmpty(), |
| 47 |
|
| 48 |
// floor_screen |
| 49 |
// Check if floor plan is correctly updated |
| 50 |
// when creating a new order from another device |
| 51 |
DeviceSynchronization.createNewOrderOnTable("5", [ |
| 52 |
["Coca-Cola", 1], |
| 53 |
["Water", 2], |
| 54 |
]), |
| 55 |
DeviceSynchronization.createNewOrderOnTable("4", [ |
| 56 |
["Coca-Cola", 50], |
| 57 |
["Water", 30], |
| 58 |
]), |
| 59 |
Chrome.clickPlanButton(), |
| 60 |
FloorScreen.orderCountSyncedInTableIs("5", 3), |
| 61 |
FloorScreen.orderCountSyncedInTableIs("4", 80), |
| 62 |
FloorScreen.clickTable("5"), |
| 63 |
ProductScreen.checkTotalAmount(6.6), |
| 64 |
ProductScreen.clickPayButton(false), |
| 65 |
ProductScreen.discardOrderWarningDialog(), |
| 66 |
PaymentScreen.clickPaymentMethod("Cash"), |
| 67 |
PaymentScreen.clickValidate(), |
| 68 |
ReceiptScreen.clickNextOrder(), |
| 69 |
Chrome.clickPlanButton(), |
| 70 |
FloorScreen.clickTable("4"), |
| 71 |
ProductScreen.checkTotalAmount(176.0), |
| 72 |
ProductScreen.clickPayButton(false), |
| 73 |
ProductScreen.discardOrderWarningDialog(), |
| 74 |
PaymentScreen.clickPaymentMethod("Cash"), |
| 75 |
PaymentScreen.clickValidate(), |
| 76 |
ReceiptScreen.clickNextOrder(), |
| 77 |
|
| 78 |
// product_screen |
| 79 |
// Check if creating an order one same table from two devices |
| 80 |
// is correctly handlded |
| 81 |
FloorScreen.clickTable("5"), |
| 82 |
ProductScreen.clickDisplayedProduct("Coca-Cola"), |
| 83 |
DeviceSynchronization.createNewOrderOnTable( |
| 84 |
"5", |
| 85 |
[ |
| 86 |
["Coca-Cola", 2], |
| 87 |
["Water", 2], |
| 88 |
], |
| 89 |
false |
| 90 |
), |
| 91 |
ProductScreen.orderLineHas("Coca-Cola", "2"), |
| 92 |
ProductScreen.orderLineHas("Water", "2"), |
| 93 |
ProductScreen.clickDisplayedProduct("Water"), |
| 94 |
ProductScreen.clickLine("Coca-Cola", 2), |
| 95 |
ProductScreen.clickLine("Coca-Cola", 1), |
| 96 |
ProductScreen.clickLine("Water", 3), |
| 97 |
].flat(), |
| 98 |
}); |
| 99 |
|
| 100 |
registry.category("web_tour.tours").add("OrderSynchronisationTour", { |
| 101 |
steps: () => |
| 102 |
[ |
| 103 |
Chrome.startPoS(), |
| 104 |
Dialog.confirm("Open Register"), |
| 105 |
DeviceSynchronization.createNewOrderOnTable("4", [ |
| 106 |
["Coca-Cola", 50], |
| 107 |
["Water", 30], |
| 108 |
]), |
| 109 |
FloorScreen.clickTable("4"), |
| 110 |
ProductScreen.orderLineHas("Coca-Cola", "50.0"), |
| 111 |
DeviceSynchronization.markOrderAsPaid(), |
| 112 |
ProductScreen.isShown(), |
| 113 |
Chrome.clickOrders(), |
| 114 |
TicketScreen.selectFilter("Paid"), |
| 115 |
TicketScreen.checkStatus("device_sync", "Paid"), |
| 116 |
TicketScreen.selectOrder("device_sync"), |
| 117 |
TicketScreen.confirmRefund(), |
| 118 |
].flat(), |
| 119 |
}); |