Debian Codegraph @

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

raw symbols SCIP
1 import * as ProductScreen from "@point_of_sale/../tests/pos/tours/utils/product_screen_util";
2 import * as PaymentScreen from "@point_of_sale/../tests/pos/tours/utils/payment_screen_util";
3 import * as ReceiptScreen from "@point_of_sale/../tests/pos/tours/utils/receipt_screen_util";
4 import * as combo from "@point_of_sale/../tests/pos/tours/utils/combo_popup_util";
5 import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util";
6 import * as Order from "@point_of_sale/../tests/generic_helpers/order_widget_util";
7 import { scan_barcode } from "@point_of_sale/../tests/generic_helpers/utils";
8 import { inLeftSide } from "@point_of_sale/../tests/pos/tours/utils/common";
9 import * as Chrome from "@point_of_sale/../tests/pos/tours/utils/chrome_util";
10 import { registry } from "@web/core/registry";
11 import * as Numpad from "@point_of_sale/../tests/generic_helpers/numpad_util";
12 import * as Utils from "@point_of_sale/../tests/generic_helpers/utils";
13
14 registry.category("web_tour.tours").add("ProductComboPriceTaxIncludedTour", {
15 steps: () =>
16 [
17 Chrome.startPoS(),
18 Dialog.confirm("Open Register"),
19 ...ProductScreen.clickDisplayedProduct("Sofa Combo"),
20 combo.select("Combo Product Sofa (L, red)"),
21 Dialog.confirm(),
22 inLeftSide([
23 ...Order.hasLine({
24 productName: "Combo product Sofa",
25 run: "click",
26 quantity: "1",
27 attributeLine: "L, red",
28 }),
29 Numpad.click("⌫"),
30 Numpad.click("⌫"),
31 ...Order.doesNotHaveLine(),
32 ]),
33 scan_barcode("SuperCombo"),
34 combo.select("Combo Product 3"),
35 combo.isConfirmationButtonDisabled(),
36 combo.select("Combo Product 9"),
37 // Check Product Configurator is open
38 Dialog.is("Attribute selection"),
39 {
40 content: "dialog discard",
41 trigger: ".modal-footer .btn:text(Add) + .btn:text(Discard)",
42 run: "click",
43 },
44 combo.select("Combo Product 5"),
45 combo.select("Combo Product 7"),
46 combo.isSelected("Combo Product 7"),
47 combo.select("Combo Product 8"),
48 combo.isSelected("Combo Product 8"),
49 combo.isNotSelected("Combo Product 7"),
50 Dialog.confirm(),
51 inLeftSide([
52 ...ProductScreen.selectedOrderlineHasDirect("Office Combo", "1", "62.1"),
53 ...ProductScreen.clickLine("Combo Product 3"),
54 ...ProductScreen.selectedOrderlineHasDirect("Combo Product 3", "1"),
55 ...ProductScreen.clickLine("Combo Product 5"),
56 ...ProductScreen.selectedOrderlineHasDirect("Combo Product 5", "1"),
57 ...ProductScreen.clickLine("Combo Product 8"),
58 ...ProductScreen.selectedOrderlineHasDirect("Combo Product 8", "1"),
59 ]),
60 // check that you can select a customer which triggers a recomputation of the price
61 ...ProductScreen.clickPartnerButton(),
62 ...ProductScreen.clickCustomer("Partner Test 1"),
63
64 // check that you can change the quantity of a combo product
65 inLeftSide([
66 ...ProductScreen.clickLine("Combo Product 3"),
67 Numpad.click("2"),
68 ...ProductScreen.selectedOrderlineHasDirect("Combo Product 3", "2"),
69 ...ProductScreen.orderLineHas("Combo Product 5", "2"),
70 ...ProductScreen.orderLineHas("Combo Product 8", "2"),
71 ...ProductScreen.orderLineHas("Office Combo", "2", "124.2"),
72 ]),
73
74 // check that removing a combo product removes all the combo products
75 inLeftSide([
76 {
77 ...ProductScreen.clickLine("Combo Product 3", "2")[0],
78 isActive: ["mobile"],
79 },
80 Numpad.click("⌫"),
81 Numpad.click("⌫"),
82 ...Order.doesNotHaveLine(),
83 ]),
84
85 ...ProductScreen.clickDisplayedProduct("Office Combo"),
86 combo.select("Combo Product 3"),
87 combo.select("Combo Product 5"),
88 combo.select("Combo Product 8"),
89 Dialog.confirm(),
90 ...ProductScreen.totalAmountIs("62.10"),
91 ...ProductScreen.clickPayButton(),
92 ...PaymentScreen.clickPaymentMethod("Bank"),
93 ...PaymentScreen.clickValidate(),
94 ...ReceiptScreen.isShown(),
95 ...ReceiptScreen.clickNextOrder(),
96
97 // another order but won't be sent to the backend
98 ...ProductScreen.clickDisplayedProduct("Office Combo"),
99 combo.select("Combo Product 2"),
100 combo.select("Combo Product 4"),
101 combo.select("Combo Product 6"),
102 Dialog.confirm(),
103 {
104 content: "The 'Combo Product 6' card should not display a quantity.",
105 trigger:
106 "article.product .product-content:has(.product-name:contains('Combo Product 6')):not(:has(.product-cart-qty))",
107 },
108 ...ProductScreen.totalAmountIs("59.17"),
109 ...inLeftSide(Order.hasTax("10.56")),
110 // the split screen is tested in `pos_restaurant`
111 ].flat(),
112 });
113
114 registry.category("web_tour.tours").add("ProductComboPriceCheckTour", {
115 steps: () =>
116 [
117 Chrome.startPoS(),
118 Dialog.confirm("Open Register"),
119 ProductScreen.clickDisplayedProduct("Desk Combo"),
120 inLeftSide([
121 ...ProductScreen.selectedOrderlineHasDirect("Desk Combo", "1", "7.00"),
122 ...ProductScreen.orderLineHas("Desk Organizer", "1"),
123 ...ProductScreen.orderLineHas("Desk Pad", "1"),
124 ...ProductScreen.orderLineHas("Whiteboard Pen", "1"),
125 ]),
126 ProductScreen.totalAmountIs("7.00"),
127 ProductScreen.clickPayButton(),
128 PaymentScreen.clickPaymentMethod("Bank"),
129 PaymentScreen.clickValidate(),
130 ReceiptScreen.isShown(),
131 ].flat(),
132 });
133
134 registry.category("web_tour.tours").add("ProductComboChangeFP", {
135 steps: () =>
136 [
137 Chrome.startPoS(),
138 Dialog.confirm("Open Register"),
139
140 ProductScreen.clickDisplayedProduct("Office Combo"),
141 ProductScreen.checkProductExtraPrice("Combo Product 3", "2"),
142 combo.select("Combo Product 2"),
143 combo.select("Combo Product 4"),
144 combo.select("Combo Product 6"),
145 Dialog.confirm(),
146
147 inLeftSide([...ProductScreen.orderLineHas("Office Combo", "1", "50.00")]),
148 ProductScreen.totalAmountIs("50.00"),
149 inLeftSide(Order.hasTax("4.55")),
150
151 // Test than changing the fp, doesn't change the price of the combo
152 ProductScreen.clickFiscalPosition("test fp"),
153 inLeftSide([...ProductScreen.orderLineHas("Office Combo", "1", "50.00")]),
154 ProductScreen.totalAmountIs("50.00"),
155 inLeftSide(Order.hasTax("2.38")),
156 ProductScreen.isShown(),
157 ].flat(),
158 });
159
160 registry.category("web_tour.tours").add("ProductComboMaxFreeQtyTour", {
161 steps: () =>
162 [
163 Chrome.startPoS(),
164 Dialog.confirm("Open Register"),
165
166 // Desk accessories combo
167 ProductScreen.clickDisplayedProduct("Office Combo"),
168 combo.checkTotal("40.00"),
169 combo.select("Combo Product 3"),
170 combo.checkTotal("42.00"),
171
172 // Desks combo
173 combo.select("Combo Product 5"),
174 combo.checkProductQty("Combo Product 5", "1"),
175 combo.select("Combo Product 5"),
176 combo.select("Combo Product 5"),
177 // Check that we cannot exceed the combo 'max_qty' which is 2
178 combo.checkProductQty("Combo Product 5", "2"),
179 combo.checkTotal("46.00"),
180 combo.clickQtyBtnMinus("Combo Product 5"),
181 combo.checkProductQty("Combo Product 5", "1"),
182 combo.select("Combo Product 4"),
183 combo.checkProductQty("Combo Product 4", "1"),
184 combo.checkTotal("44.00"),
185 combo.isConfirmationButtonDisabled(),
186
187 // Chairs combo
188 combo.select("Combo Product 6"),
189 combo.clickQtyBtnAdd("Combo Product 6"),
190 combo.checkProductQty("Combo Product 6", "2"),
191 // Confirmation should be enabled as we have selected the "min" qty for each combo
192 Utils.negateStep(combo.isConfirmationButtonDisabled()),
193 // As for chairs combo : 'qty_max' > 'qty_free', we can still select the product, but we'll pay them as extra (combo 'base_price')
194 combo.checkTotal("44.00"),
195 combo.select("Combo Product 7"),
196 combo.clickQtyBtnAdd("Combo Product 7"),
197 combo.clickQtyBtnAdd("Combo Product 7"),
198 combo.checkProductQty("Combo Product 7", "3"),
199 combo.checkTotal("134.00"),
200
201 Dialog.confirm(),
202 inLeftSide([
203 ...ProductScreen.selectedOrderlineHasDirect("Office Combo", "1", "151.98"),
204 ]),
205 ProductScreen.totalAmountIs("151.98"),
206 ProductScreen.clickPayButton(),
207 PaymentScreen.clickPaymentMethod("Bank"),
208 PaymentScreen.clickValidate(),
209 ReceiptScreen.isShown(),
210 ].flat(),
211 });
212
213 registry.category("web_tour.tours").add("ProductComboChangePricelist", {
214 steps: () =>
215 [
216 Chrome.startPoS(),
217 Dialog.confirm("Open Register"),
218 ProductScreen.clickDisplayedProduct("Office Combo"),
219 combo.select("Combo Product 2"),
220 combo.select("Combo Product 4"),
221 combo.select("Combo Product 6"),
222 Dialog.confirm(),
223 inLeftSide([
224 ...ProductScreen.orderComboLineHas("Combo Product 2", "1.0"),
225 ...ProductScreen.orderComboLineHas("Combo Product 4", "1.0"),
226 ...ProductScreen.orderComboLineHas("Combo Product 6", "1.0"),
227 ]),
228 ProductScreen.totalAmountIs("47.33"),
229 ProductScreen.clickPriceList("sale 10%"),
230 inLeftSide([
231 ...ProductScreen.orderComboLineHas("Combo Product 2", "1.0"),
232 ...ProductScreen.orderComboLineHas("Combo Product 4", "1.0"),
233 ...ProductScreen.orderComboLineHas("Combo Product 6", "1.0"),
234 ]),
235 ProductScreen.totalAmountIs("42.60"),
236 ProductScreen.isShown(),
237 ].flat(),
238 });
239
240 registry.category("web_tour.tours").add("ProductComboDiscountTour", {
241 steps: () =>
242 [
243 Chrome.startPoS(),
244 Dialog.confirm("Open Register"),
245 ProductScreen.clickDisplayedProduct("Office Combo"),
246 ProductScreen.checkProductExtraPrice("Combo Product 3", "2"),
247 combo.select("Combo Product 2"),
248 combo.select("Combo Product 4"),
249 combo.select("Combo Product 6"),
250 Dialog.confirm(),
251 inLeftSide([Numpad.click("%"), Numpad.click("2"), Numpad.click("0")]),
252 ProductScreen.totalAmountIs("80.00"),
253 ProductScreen.isShown(),
254 ].flat(),
255 });
256
257 registry.category("web_tour.tours").add("test_combo_item_image_display", {
258 steps: () =>
259 [
260 Chrome.startPoS(),
261 Dialog.confirm("Open Register"),
262 ProductScreen.clickDisplayedProduct("Office Combo"),
263 combo.checkImgAndSelect("Combo Product 2", true),
264 combo.checkImgAndSelect("Combo Product 4", true),
265 combo.checkImgAndSelect("Combo Product 6", true),
266 Dialog.confirm(),
267 ].flat(),
268 });
269
270 registry.category("web_tour.tours").add("test_combo_item_image_not_display", {
271 steps: () =>
272 [
273 Chrome.startPoS(),
274 ProductScreen.clickDisplayedProduct("Office Combo"),
275 combo.checkImgAndSelect("Combo Product 2", false),
276 combo.checkImgAndSelect("Combo Product 4", false),
277 combo.checkImgAndSelect("Combo Product 6", false),
278 Dialog.confirm(),
279 ].flat(),
280 });