| 1 |
import * as ProductScreen from "@point_of_sale/../tests/pos/tours/utils/product_screen_util"; |
| 2 |
import * as ReceiptScreen from "@point_of_sale/../tests/pos/tours/utils/receipt_screen_util"; |
| 3 |
import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util"; |
| 4 |
import * as CashMoveList from "@point_of_sale/../tests/pos/tours/utils/cash_move_list_util"; |
| 5 |
import * as PaymentScreen from "@point_of_sale/../tests/pos/tours/utils/payment_screen_util"; |
| 6 |
import * as TicketScreen from "@point_of_sale/../tests/pos/tours/utils/ticket_screen_util"; |
| 7 |
import * as Chrome from "@point_of_sale/../tests/pos/tours/utils/chrome_util"; |
| 8 |
import * as Utils from "@point_of_sale/../tests/pos/tours/utils/common"; |
| 9 |
import { refresh } from "@point_of_sale/../tests/generic_helpers/utils"; |
| 10 |
import { registry } from "@web/core/registry"; |
| 11 |
import { inLeftSide } from "@point_of_sale/../tests/pos/tours/utils/common"; |
| 12 |
import * as PartnerList from "@point_of_sale/../tests/pos/tours/utils/partner_list_util"; |
| 13 |
|
| 14 |
registry.category("web_tour.tours").add("ChromeTour", { |
| 15 |
steps: () => |
| 16 |
[ |
| 17 |
Chrome.startPoS(), |
| 18 |
Dialog.confirm("Open Register"), |
| 19 |
Chrome.clickMenuButton(), |
| 20 |
Chrome.clickMenuDropdownOption("Cash In/Out"), |
| 21 |
Chrome.fillTextArea(".cash-reason", "MOBT"), |
| 22 |
Dialog.confirm(), |
| 23 |
Chrome.clickMenuButton(), |
| 24 |
|
| 25 |
|
| 26 |
ProductScreen.addOrderline("Desk Pad", "1", "2", "2.0"), |
| 27 |
Chrome.clickOrders(), |
| 28 |
TicketScreen.checkStatus("001", "Ongoing"), |
| 29 |
|
| 30 |
|
| 31 |
Chrome.createFloatingOrder(), |
| 32 |
ProductScreen.addOrderline("Monitor Stand", "3", "4", "12.0"), |
| 33 |
ProductScreen.clickPayButton(), |
| 34 |
PaymentScreen.isShown(), |
| 35 |
Chrome.clickOrders(), |
| 36 |
TicketScreen.checkStatus("002", "Payment"), |
| 37 |
|
| 38 |
|
| 39 |
Chrome.createFloatingOrder(), |
| 40 |
ProductScreen.addOrderline("Whiteboard Pen", "5", "6", "30.0"), |
| 41 |
ProductScreen.clickPayButton(), |
| 42 |
PaymentScreen.clickPaymentMethod("Bank", true, { remaining: "0.0" }), |
| 43 |
PaymentScreen.validateButtonIsHighlighted(true), |
| 44 |
PaymentScreen.clickValidate(), |
| 45 |
ReceiptScreen.isShown(), |
| 46 |
Chrome.clickOrders(), |
| 47 |
TicketScreen.checkStatus("003", "Receipt"), |
| 48 |
|
| 49 |
|
| 50 |
TicketScreen.selectOrder("001"), |
| 51 |
TicketScreen.loadSelectedOrder(), |
| 52 |
ProductScreen.productIsDisplayed("Desk Pad"), |
| 53 |
inLeftSide([ |
| 54 |
...ProductScreen.clickLine("Desk Pad"), |
| 55 |
...ProductScreen.selectedOrderlineHasDirect("Desk Pad", "1", "2.0"), |
| 56 |
]), |
| 57 |
|
| 58 |
|
| 59 |
Chrome.clickOrders(), |
| 60 |
TicketScreen.selectOrder("002"), |
| 61 |
TicketScreen.loadSelectedOrder(), |
| 62 |
PaymentScreen.emptyPaymentlines("12.0"), |
| 63 |
PaymentScreen.validateButtonIsHighlighted(false), |
| 64 |
|
| 65 |
|
| 66 |
Chrome.clickOrders(), |
| 67 |
TicketScreen.selectOrder("003"), |
| 68 |
TicketScreen.loadSelectedOrder(), |
| 69 |
ReceiptScreen.totalAmountContains("30.0"), |
| 70 |
|
| 71 |
|
| 72 |
Chrome.clickOrders(), |
| 73 |
TicketScreen.selectOrder("001"), |
| 74 |
TicketScreen.loadSelectedOrder(), |
| 75 |
ProductScreen.isShown(), |
| 76 |
ProductScreen.clickPayButton(), |
| 77 |
PaymentScreen.clickPaymentMethod("Cash"), |
| 78 |
PaymentScreen.enterPaymentLineAmount("Cash", "20", true, { change: "18.0" }), |
| 79 |
PaymentScreen.validateButtonIsHighlighted(true), |
| 80 |
PaymentScreen.clickValidate(), |
| 81 |
ReceiptScreen.totalAmountContains("2.0"), |
| 82 |
|
| 83 |
|
| 84 |
Chrome.clickOrders(), |
| 85 |
TicketScreen.checkStatus("001", "Receipt"), |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
TicketScreen.selectOrder("003"), |
| 90 |
TicketScreen.loadSelectedOrder(), |
| 91 |
ReceiptScreen.totalAmountContains("30.0"), |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
ReceiptScreen.clickNextOrder(), |
| 96 |
ProductScreen.orderIsEmpty(), |
| 97 |
Chrome.clickOrders(), |
| 98 |
TicketScreen.deleteOrder("004"), |
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
TicketScreen.nthRowContains(1, "Payment"), |
| 103 |
TicketScreen.deleteOrder("002"), |
| 104 |
Dialog.confirm(), |
| 105 |
Chrome.clickRegister(), |
| 106 |
|
| 107 |
|
| 108 |
ProductScreen.addOrderline("Whiteboard Pen", "5", "6"), |
| 109 |
ProductScreen.clickPartnerButton(), |
| 110 |
ProductScreen.clickCustomer("Partner Test 1"), |
| 111 |
ProductScreen.clickPayButton(), |
| 112 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 113 |
PaymentScreen.clickInvoiceButton(), |
| 114 |
PaymentScreen.clickValidate(), |
| 115 |
ReceiptScreen.isShown(), |
| 116 |
{ trigger: ".receipt-screen .pos-config-name:contains(Shop)" }, |
| 117 |
|
| 118 |
|
| 119 |
ReceiptScreen.clickNextOrder(), |
| 120 |
Chrome.hasFloatingOrder("004"), |
| 121 |
].flat(), |
| 122 |
}); |
| 123 |
|
| 124 |
registry.category("web_tour.tours").add("OrderModificationAfterValidationError", { |
| 125 |
steps: () => |
| 126 |
[ |
| 127 |
Chrome.startPoS(), |
| 128 |
Dialog.confirm("Open Register"), |
| 129 |
ProductScreen.clickDisplayedProduct("Test Product", true, "1"), |
| 130 |
ProductScreen.clickPayButton(), |
| 131 |
PaymentScreen.clickPaymentMethod("Bank", true, { remaining: "0.0" }), |
| 132 |
PaymentScreen.clickValidate(), |
| 133 |
|
| 134 |
|
| 135 |
Dialog.confirm(), |
| 136 |
|
| 137 |
PaymentScreen.clickBack(), |
| 138 |
{ ...ProductScreen.back(), isActive: ["mobile"] }, |
| 139 |
ProductScreen.isShown(), |
| 140 |
|
| 141 |
|
| 142 |
ProductScreen.clickDisplayedProduct("Test Product", true, "2"), |
| 143 |
].flat(), |
| 144 |
}); |
| 145 |
|
| 146 |
registry.category("web_tour.tours").add("test_tracking_number_closing_session", { |
| 147 |
steps: () => |
| 148 |
[ |
| 149 |
Chrome.startPoS(), |
| 150 |
Dialog.confirm("Open Register"), |
| 151 |
ProductScreen.clickDisplayedProduct("Desk Organizer", true, "1.0"), |
| 152 |
ProductScreen.clickPayButton(), |
| 153 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 154 |
PaymentScreen.clickValidate(), |
| 155 |
ReceiptScreen.clickNextOrder(), |
| 156 |
ProductScreen.isShown(), |
| 157 |
Chrome.clickMenuOption("Close Register"), |
| 158 |
{ |
| 159 |
content: `Select button close register`, |
| 160 |
trigger: `button:contains(close register)`, |
| 161 |
run: "click", |
| 162 |
expectUnloadPage: true, |
| 163 |
}, |
| 164 |
Chrome.startPoS(), |
| 165 |
Dialog.confirm("Open Register"), |
| 166 |
ProductScreen.clickDisplayedProduct("Desk Pad", true, "1.0"), |
| 167 |
ProductScreen.clickPayButton(), |
| 168 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 169 |
PaymentScreen.enterPaymentLineAmount("Bank", "20"), |
| 170 |
PaymentScreen.clickValidate(), |
| 171 |
ReceiptScreen.isShown(), |
| 172 |
ReceiptScreen.clickNextOrder(), |
| 173 |
].flat(), |
| 174 |
}); |
| 175 |
|
| 176 |
registry.category("web_tour.tours").add("test_reload_page_before_payment_with_customer_account", { |
| 177 |
steps: () => |
| 178 |
[ |
| 179 |
Chrome.startPoS(), |
| 180 |
Dialog.confirm("Open Register"), |
| 181 |
ProductScreen.clickDisplayedProduct("Desk Organizer", true, "1.0"), |
| 182 |
refresh(), |
| 183 |
ProductScreen.productIsDisplayed("Desk Organizer"), |
| 184 |
ProductScreen.clickPartnerButton(), |
| 185 |
ProductScreen.clickCustomer("Partner Test 1"), |
| 186 |
ProductScreen.clickPayButton(), |
| 187 |
PaymentScreen.clickPaymentMethod("Customer Account"), |
| 188 |
PaymentScreen.clickValidate(), |
| 189 |
ReceiptScreen.clickNextOrder(), |
| 190 |
ProductScreen.isShown(), |
| 191 |
ProductScreen.clickDisplayedProduct("Desk Organizer", true, "1.0"), |
| 192 |
ProductScreen.clickPayButton(), |
| 193 |
PaymentScreen.clickPaymentMethod("Customer Account"), |
| 194 |
PaymentScreen.clickValidate(), |
| 195 |
Dialog.cancel(), |
| 196 |
PaymentScreen.clickValidate(), |
| 197 |
Dialog.confirm("Ok"), |
| 198 |
PaymentScreen.clickCustomer("Partner Test 1"), |
| 199 |
PaymentScreen.clickValidate(), |
| 200 |
].flat(), |
| 201 |
}); |
| 202 |
|
| 203 |
registry.category("web_tour.tours").add("test_cash_in_out", { |
| 204 |
steps: () => |
| 205 |
[ |
| 206 |
Chrome.startPoS(), |
| 207 |
Dialog.confirm("Open Register"), |
| 208 |
Chrome.freezeDateTime(1749965940000), |
| 209 |
Chrome.doCashMove("10", "MOBT in"), |
| 210 |
Chrome.doCashMove("5", "MOBT out"), |
| 211 |
Chrome.clickMenuOption("Close Register"), |
| 212 |
Utils.selectButton("Cash In/Out"), |
| 213 |
Utils.selectButton("Details"), |
| 214 |
CashMoveList.checkNumberOfRows(2), |
| 215 |
CashMoveList.checkCashMoveShown("10"), |
| 216 |
CashMoveList.checkCashMoveShown("5"), |
| 217 |
CashMoveList.checkCashMoveDateTime(), |
| 218 |
CashMoveList.deleteCashMove("10"), |
| 219 |
CashMoveList.checkNumberOfRows(1), |
| 220 |
CashMoveList.checkCashMoveShown("5"), |
| 221 |
].flat(), |
| 222 |
}); |
| 223 |
|
| 224 |
registry.category("web_tour.tours").add("test_zero_decimal_places_currency", { |
| 225 |
steps: () => |
| 226 |
[ |
| 227 |
Chrome.startPoS(), |
| 228 |
Dialog.confirm("Open Register"), |
| 229 |
ProductScreen.clickDisplayedProduct("Test Product", true, "1.00"), |
| 230 |
ProductScreen.clickPayButton(), |
| 231 |
PaymentScreen.clickPaymentMethod("Cash"), |
| 232 |
PaymentScreen.clickValidate(), |
| 233 |
ReceiptScreen.receiptIsThere(), |
| 234 |
ReceiptScreen.totalAmountContains("100"), |
| 235 |
].flat(), |
| 236 |
}); |
| 237 |
|
| 238 |
registry.category("web_tour.tours").add("SessionStatisticsDisplay", { |
| 239 |
steps: () => |
| 240 |
[ |
| 241 |
Chrome.startPoS(), |
| 242 |
ProductScreen.enterOpeningAmount("100.00"), |
| 243 |
Dialog.confirm("Open Register"), |
| 244 |
ProductScreen.addOrderline("Desk Pad", "5", "5"), |
| 245 |
ProductScreen.clickPayButton(), |
| 246 |
PaymentScreen.clickPaymentMethod("Cash"), |
| 247 |
PaymentScreen.validateButtonIsHighlighted(true), |
| 248 |
PaymentScreen.clickValidate(), |
| 249 |
ReceiptScreen.clickNextOrder(), |
| 250 |
ProductScreen.isShown(), |
| 251 |
ProductScreen.addOrderline("Monitor Stand", "2", "10"), |
| 252 |
ProductScreen.clickPayButton(), |
| 253 |
PaymentScreen.clickPaymentMethod("Cash"), |
| 254 |
PaymentScreen.validateButtonIsHighlighted(true), |
| 255 |
PaymentScreen.clickValidate(), |
| 256 |
ReceiptScreen.clickNextOrder(), |
| 257 |
ProductScreen.isShown(), |
| 258 |
Chrome.clickMenuOption("Backend", { expectUnloadPage: true }), |
| 259 |
{ |
| 260 |
trigger: `[name=opening_cash]:contains(100.00)`, |
| 261 |
}, |
| 262 |
{ |
| 263 |
trigger: `[name=paid_orders]:contains(45.00 (2 orders))`, |
| 264 |
}, |
| 265 |
].flat(), |
| 266 |
}); |
| 267 |
|
| 268 |
registry.category("web_tour.tours").add("test_click_all_orders_keep_customer", { |
| 269 |
steps: () => |
| 270 |
[ |
| 271 |
Chrome.startPoS(), |
| 272 |
Dialog.confirm("Open Register"), |
| 273 |
ProductScreen.clickPartnerButton(), |
| 274 |
ProductScreen.clickCustomer("Partner Test 1"), |
| 275 |
ProductScreen.clickPartnerButton(), |
| 276 |
PartnerList.clickPartnerOptions("Partner Test 1"), |
| 277 |
{ |
| 278 |
isActive: ["auto"], |
| 279 |
trigger: "body .dropdown-item:contains('All Orders')", |
| 280 |
content: "Check the popover opened", |
| 281 |
run: "click", |
| 282 |
}, |
| 283 |
Chrome.clickRegister(), |
| 284 |
ProductScreen.isShown(), |
| 285 |
{ |
| 286 |
content: "customer is selected", |
| 287 |
trigger: ".product-screen .set-partner:contains('Partner Test 1')", |
| 288 |
}, |
| 289 |
].flat(), |
| 290 |
}); |
| 291 |
|
| 292 |
registry.category("web_tour.tours").add("test_ctrl_number_ignored", { |
| 293 |
steps: () => |
| 294 |
[ |
| 295 |
Chrome.startPoS(), |
| 296 |
Dialog.confirm("Open Register"), |
| 297 |
ProductScreen.addOrderline("Whiteboard Pen", "1", "6", "6.0"), |
| 298 |
{ |
| 299 |
trigger: "body", |
| 300 |
run: () => { |
| 301 |
window.dispatchEvent(new KeyboardEvent("keyup", { key: "5", ctrlKey: true })); |
| 302 |
}, |
| 303 |
}, |
| 304 |
{ |
| 305 |
trigger: "body", |
| 306 |
run: () => |
| 307 |
new Promise((resolve) => { |
| 308 |
setTimeout(resolve, 300); |
| 309 |
}), |
| 310 |
}, |
| 311 |
inLeftSide([ |
| 312 |
{ ...ProductScreen.clickLine("Whiteboard Pen")[0], isActive: ["mobile"] }, |
| 313 |
...ProductScreen.selectedOrderlineHasDirect("Whiteboard Pen", "1", "6.0"), |
| 314 |
]), |
| 315 |
].flat(), |
| 316 |
}); |