| 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 PaymentScreen from "@point_of_sale/../tests/pos/tours/utils/payment_screen_util"; |
| 4 |
import * as TicketScreen from "@point_of_sale/../tests/pos/tours/utils/ticket_screen_util"; |
| 5 |
import * as Order from "@point_of_sale/../tests/generic_helpers/order_widget_util"; |
| 6 |
import * as Chrome from "@point_of_sale/../tests/pos/tours/utils/chrome_util"; |
| 7 |
import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util"; |
| 8 |
import { registry } from "@web/core/registry"; |
| 9 |
|
| 10 |
registry.category("web_tour.tours").add("test_pos_global_discount_sell_and_refund", { |
| 11 |
steps: () => |
| 12 |
[ |
| 13 |
Chrome.startPoS(), |
| 14 |
Dialog.confirm("Open Register"), |
| 15 |
ProductScreen.addOrderline("Desk Pad", "1", "3"), |
| 16 |
Chrome.clickOrders(), |
| 17 |
Order.hasLine({ |
| 18 |
withoutClass: ".selected", |
| 19 |
run: "click", |
| 20 |
productName: "Desk Pad", |
| 21 |
quantity: "1", |
| 22 |
}), |
| 23 |
// Check that the draft order's order line is not selected and not causing issues while |
| 24 |
// comparing the line to the discount line |
| 25 |
{ |
| 26 |
content: "Manually trigger keyup event", |
| 27 |
trigger: ".ticket-screen", |
| 28 |
run: function () { |
| 29 |
window.dispatchEvent(new KeyboardEvent("keyup", { key: "9" })); |
| 30 |
}, |
| 31 |
}, |
| 32 |
TicketScreen.loadSelectedOrder(), |
| 33 |
ProductScreen.clickControlButton("Discount"), |
| 34 |
{ |
| 35 |
content: `click discount numpad button: 5`, |
| 36 |
trigger: `.o_dialog div.numpad button:contains(5)`, |
| 37 |
run: "click", |
| 38 |
}, |
| 39 |
Dialog.confirm(), |
| 40 |
ProductScreen.selectedOrderlineHas("discount", 1, "-0.15"), |
| 41 |
ProductScreen.totalAmountIs("2.85"), |
| 42 |
ProductScreen.clickPayButton(), |
| 43 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 44 |
PaymentScreen.clickValidate(), |
| 45 |
ReceiptScreen.isShown(), |
| 46 |
ReceiptScreen.clickNextOrder(), |
| 47 |
...ProductScreen.clickRefund(), |
| 48 |
TicketScreen.selectOrder("001"), |
| 49 |
ProductScreen.clickNumpad("1"), |
| 50 |
TicketScreen.toRefundTextContains("To Refund: 1"), |
| 51 |
ProductScreen.clickLine("discount"), |
| 52 |
ProductScreen.clickNumpad("1"), |
| 53 |
Dialog.confirm(), |
| 54 |
TicketScreen.confirmRefund(), |
| 55 |
PaymentScreen.isShown(), |
| 56 |
PaymentScreen.clickBack(), |
| 57 |
ProductScreen.clickLine("discount"), |
| 58 |
ProductScreen.clickNumpad("1"), |
| 59 |
Dialog.is({ title: "price update not allowed" }), |
| 60 |
Dialog.confirm(), |
| 61 |
ProductScreen.clickPayButton(), |
| 62 |
PaymentScreen.clickPaymentMethod("Bank"), |
| 63 |
PaymentScreen.clickValidate(), |
| 64 |
ReceiptScreen.isShown(), |
| 65 |
].flat(), |
| 66 |
}); |