Debian Codegraph @

addons/point_of_sale/static/tests/pos/tours/payment_screen_tour.js

raw symbols SCIP
1 import * as Chrome from "@point_of_sale/../tests/pos/tours/utils/chrome_util";
2 import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util";
3 import * as ProductScreen from "@point_of_sale/../tests/pos/tours/utils/product_screen_util";
4 import * as PaymentScreen from "@point_of_sale/../tests/pos/tours/utils/payment_screen_util";
5 import { registry } from "@web/core/registry";
6 import * as OfflineUtil from "@point_of_sale/../tests/generic_helpers/offline_util";
7 import * as TicketScreen from "@point_of_sale/../tests/pos/tours/utils/ticket_screen_util";
8 import * as Order from "@point_of_sale/../tests/generic_helpers/order_widget_util";
9 import * as Numpad from "@point_of_sale/../tests/generic_helpers/numpad_util";
10 import { inLeftSide } from "./utils/common";
11
12 registry.category("web_tour.tours").add("PaymentScreenTour", {
13 steps: () =>
14 [
15 Chrome.startPoS(),
16 Dialog.confirm("Open Register"),
17 OfflineUtil.setOfflineMode(),
18 ProductScreen.addOrderline("Letter Tray", "10"),
19 ProductScreen.clickPayButton(),
20 PaymentScreen.emptyPaymentlines("52.8"),
21
22 PaymentScreen.clickPaymentMethod("Cash"),
23 PaymentScreen.enterPaymentLineAmount("Cash", "11", true, {
24 amount: "11.00",
25 remaining: "41.8",
26 }),
27 PaymentScreen.validateButtonIsHighlighted(false),
28 // remove the selected paymentline with multiple backspace presses
29 PaymentScreen.clickNumpad("⌫ ⌫"),
30 PaymentScreen.fillPaymentLineAmountMobile("Cash", "0"),
31 PaymentScreen.selectedPaymentlineHas("Cash", "0.00"),
32 PaymentScreen.clickPaymentlineDelButton("Cash", "0", true),
33 PaymentScreen.emptyPaymentlines("52.8"),
34
35 // Pay with bank, the selected line should have full amount
36 PaymentScreen.clickPaymentMethod("Bank", true, { remaining: "0.0" }),
37 PaymentScreen.validateButtonIsHighlighted(true),
38 // remove the line using the delete button
39 PaymentScreen.clickPaymentlineDelButton("Bank", "52.8"),
40
41 // Use +10 and +50 to increment the amount of the paymentline
42 PaymentScreen.clickPaymentMethod("Cash"),
43 PaymentScreen.clickNumpad("⌫"),
44 PaymentScreen.clickNumpad("+10"),
45 PaymentScreen.fillPaymentLineAmountMobile("Cash", "10"),
46 PaymentScreen.remainingIs("42.8"),
47 PaymentScreen.validateButtonIsHighlighted(false),
48 PaymentScreen.clickNumpad("5"),
49 PaymentScreen.fillPaymentLineAmountMobile("Cash", "105"),
50 PaymentScreen.changeIs("52.2"),
51 PaymentScreen.validateButtonIsHighlighted(true),
52 PaymentScreen.clickNumpad("+50"),
53 PaymentScreen.fillPaymentLineAmountMobile("Cash", "155"),
54 PaymentScreen.changeIs("102.2"),
55 PaymentScreen.validateButtonIsHighlighted(true),
56 PaymentScreen.clickPaymentlineDelButton("Cash", "155.0"),
57
58 // Multiple paymentlines
59 PaymentScreen.clickPaymentMethod("Cash"),
60 PaymentScreen.clickNumpad("1"),
61 PaymentScreen.fillPaymentLineAmountMobile("Cash", "1"),
62 PaymentScreen.remainingIs("51.8"),
63 PaymentScreen.validateButtonIsHighlighted(false),
64 PaymentScreen.clickPaymentMethod("Bank"),
65 PaymentScreen.fillPaymentLineAmountMobile("Bank", "5"),
66 PaymentScreen.clickNumpad("5"),
67 PaymentScreen.remainingIs("46.8"),
68 PaymentScreen.validateButtonIsHighlighted(false),
69 PaymentScreen.clickPaymentMethod("Bank", true, { remaining: "0.0" }),
70 PaymentScreen.validateButtonIsHighlighted(true),
71 OfflineUtil.setOnlineMode(),
72 ].flat(),
73 });
74
75 registry.category("web_tour.tours").add("PaymentScreenTour2", {
76 steps: () =>
77 [
78 Chrome.startPoS(),
79 Dialog.confirm("Open Register"),
80 ProductScreen.addOrderline("Letter Tray", "1", "10"),
81 ProductScreen.clickPayButton(),
82
83 // check that ship later button is present
84 { trigger: ".payment-buttons button:contains('Ship Later')" },
85
86 PaymentScreen.enterPaymentLineAmount("Bank", "99"),
87 // trying to put 99 as an amount should throw an error. We thus confirm the dialog.
88 Dialog.confirm(),
89 PaymentScreen.remainingIs("0.0"),
90 ].flat(),
91 });
92
93 registry.category("web_tour.tours").add("PaymentScreenRoundingUp", {
94 steps: () =>
95 [
96 Chrome.startPoS(),
97 Dialog.confirm("Open Register"),
98 ProductScreen.addOrderline("Product Test", "1"),
99 ProductScreen.clickPayButton(),
100
101 PaymentScreen.totalIs("1.96"),
102 PaymentScreen.clickPaymentMethod("Cash", true, { remaining: "0.0", amount: "2.00" }),
103 PaymentScreen.clickValidate(),
104
105 Chrome.clickOrders(),
106 TicketScreen.selectFilter("Paid"),
107 TicketScreen.selectOrder("001"),
108 inLeftSide([
109 ...Order.hasLine({ productName: "Product Test", withClass: ".selected" }),
110 Numpad.click("1"),
111 ]),
112 TicketScreen.confirmRefund(),
113
114 // To get negative of existing quantity just send -
115 PaymentScreen.isShown(),
116 PaymentScreen.totalIs("-1.96"),
117 PaymentScreen.clickPaymentMethod("Cash", true, { remaining: "0.0", amount: "-2.00" }),
118 ].flat(),
119 });
120
121 registry.category("web_tour.tours").add("PaymentScreenRoundingDown", {
122 steps: () =>
123 [
124 Chrome.startPoS(),
125 Dialog.confirm("Open Register"),
126 ProductScreen.addOrderline("Product Test", "1"),
127 ProductScreen.clickPayButton(),
128
129 PaymentScreen.totalIs("1.98"),
130 PaymentScreen.clickPaymentMethod("Cash", true, { remaining: "0.0", amount: "1.95" }),
131 PaymentScreen.clickValidate(),
132
133 Chrome.clickOrders(),
134 TicketScreen.selectFilter("Paid"),
135 TicketScreen.selectOrder("001"),
136 inLeftSide([
137 ...Order.hasLine({ productName: "Product Test", withClass: ".selected" }),
138 Numpad.click("1"),
139 ]),
140 TicketScreen.confirmRefund(),
141
142 // To get negative of existing quantity just send -
143 PaymentScreen.isShown(),
144 PaymentScreen.totalIs("-1.98"),
145 PaymentScreen.clickPaymentMethod("Cash", true, { remaining: "0.0", amount: "-1.95" }),
146 ].flat(),
147 });
148
149 registry.category("web_tour.tours").add("PaymentScreenTotalDueWithOverPayment", {
150 steps: () =>
151 [
152 Chrome.startPoS(),
153 ProductScreen.addOrderline("Product Test", "1"),
154 ProductScreen.clickPayButton(),
155
156 PaymentScreen.totalIs("1.98"),
157 PaymentScreen.clickPaymentMethod("Cash"),
158 PaymentScreen.enterPaymentLineAmount("Cash", "5", true, {
159 change: "3",
160 }),
161 ].flat(),
162 });
163
164 registry.category("web_tour.tours").add("InvoiceShipLaterAccessRight", {
165 steps: () =>
166 [
167 Chrome.startPoS(),
168 ProductScreen.confirmOpeningPopup(),
169 ProductScreen.clickHomeCategory(),
170 ProductScreen.addOrderline("Whiteboard Pen", "1"),
171 ProductScreen.clickPartnerButton(),
172 ProductScreen.clickCustomer("Acme Corporation"),
173 ProductScreen.clickPayButton(),
174
175 PaymentScreen.clickPaymentMethod("Cash"),
176 PaymentScreen.clickShipLaterButton(),
177 PaymentScreen.clickValidate(),
178 ].flat(),
179 });
180
181 registry.category("web_tour.tours").add("PaymentScreenInvoiceOrder", {
182 steps: () =>
183 [
184 Chrome.startPoS(),
185 Dialog.confirm("Open Register"),
186 ProductScreen.addOrderline("Product Test", "1"),
187 ProductScreen.clickPartnerButton(),
188 ProductScreen.clickCustomer("Partner Test 1"),
189 ProductScreen.clickPayButton(),
190
191 PaymentScreen.clickPaymentMethod("Bank"),
192 PaymentScreen.clickInvoiceButton(),
193 PaymentScreen.clickValidate(),
194 ].flat(),
195 });
196
197 registry.category("web_tour.tours").add("test_pos_large_amount_confirmation_dialog", {
198 steps: () =>
199 [
200 Chrome.startPoS(),
201 Dialog.confirm("Open Register"),
202 ProductScreen.clickDisplayedProduct("Overpay Test Product"),
203 ProductScreen.clickPayButton(),
204 PaymentScreen.clickPaymentMethod("Cash"),
205 PaymentScreen.enterPaymentLineAmount("Cash", "1500"),
206 PaymentScreen.clickValidate(),
207 {
208 trigger: ".modal .modal-footer .btn-primary",
209 run: "click",
210 },
211 Chrome.endTour(),
212 ].flat(),
213 });
214
215 registry.category("web_tour.tours").add("test_add_money_button_with_different_decimal_separator", {
216 steps: () =>
217 [
218 Chrome.startPoS(),
219 Dialog.confirm("Open Register"),
220 ProductScreen.addOrderline("Whiteboard Pen", "1"),
221 ProductScreen.clickPayButton(),
222 PaymentScreen.clickPaymentMethod("Bank"),
223 PaymentScreen.clickNumpad("+50"),
224 PaymentScreen.fillPaymentLineAmountMobile("Bank", "53,20"),
225 PaymentScreen.changeIs("50"),
226 ].flat(),
227 });