Debian Codegraph @

addons/l10n_in_pos/static/tests/tours/test_hsn_summary.js

raw
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
7 export function addDocument(documentParams) {
8 const steps = [];
9 for (const values of documentParams) {
10 steps.push(...ProductScreen.addOrderline(values.product, values.quantity));
11 if (values.discount) {
12 steps.push(ProductScreen.addDiscount(values.discount));
13 }
14 }
15 steps.push(ProductScreen.clickPayButton());
16 return steps;
17 }
18
19 registry.category("web_tour.tours").add("test_l10n_in_hsn_summary_pos", {
20 steps: () =>
21 [
22 Chrome.startPoS(),
23 Dialog.confirm("Open Register"),
24
25 ...addDocument([
26 { product: "product_1_1", quantity: "2" },
27 { product: "product_1_2", quantity: "1" },
28 { product: "product_1_3", quantity: "5" },
29 { product: "product_1_4", quantity: "2" },
30 { product: "product_1_5", quantity: "1" },
31 { product: "product_1_6", quantity: "5" },
32 ]),
33 PaymentScreen.totalIs("5,129.0"),
34 PaymentScreen.clickPaymentMethod("Bank"),
35 PaymentScreen.remainingIs("0.0"),
36 PaymentScreen.clickValidate(),
37 {
38 isActive: ["desktop"], // not rendered on mobile
39 trigger:
40 '.receipt-screen .l10n_in_hsn_summary_table tr:nth-child(3) td:nth-child(3):contains("57.50")',
41 },
42 {
43 isActive: ["desktop"], // not rendered on mobile
44 trigger:
45 '.receipt-screen .l10n_in_hsn_summary_table tr:nth-child(3) td:nth-child(4):contains("57.50")',
46 },
47 {
48 isActive: ["desktop"], // not rendered on mobile
49 trigger:
50 '.receipt-screen .l10n_in_hsn_summary_table tr:nth-child(4) td:nth-child(3):contains("207.00")',
51 },
52 {
53 isActive: ["desktop"], // not rendered on mobile
54 trigger:
55 '.receipt-screen .l10n_in_hsn_summary_table tr:nth-child(4) td:nth-child(4):contains("207.00")',
56 },
57 ].flat(),
58 });