Debian Codegraph @

addons/pos_restaurant/static/tests/tours/control_buttons_tour.js

raw
1 import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util";
2 import * as NumberPopup from "@point_of_sale/../tests/generic_helpers/number_popup_util";
3 import * as FloorScreen from "@pos_restaurant/../tests/tours/utils/floor_screen_util";
4 import * as ProductScreenPos from "@point_of_sale/../tests/pos/tours/utils/product_screen_util";
5 import * as ProductScreenResto from "@pos_restaurant/../tests/tours/utils/product_screen_util";
6 const ProductScreen = { ...ProductScreenPos, ...ProductScreenResto };
7 import * as SplitBillScreen from "@pos_restaurant/../tests/tours/utils/split_bill_screen_util";
8 import * as Order from "@point_of_sale/../tests/generic_helpers/order_widget_util";
9 import * as ChromePos from "@point_of_sale/../tests/pos/tours/utils/chrome_util";
10 import * as ChromeRestaurant from "@pos_restaurant/../tests/tours/utils/chrome";
11 const Chrome = { ...ChromePos, ...ChromeRestaurant };
12 import { registry } from "@web/core/registry";
13 import { delay } from "@web/core/utils/concurrency";
14
15 registry.category("web_tour.tours").add("ControlButtonsTour", {
16 steps: () =>
17 [
18 // Test merging table, transfer is already tested in pos_restaurant_sync_second_login.
19 Chrome.startPoS(),
20 Dialog.confirm("Open Register"),
21 FloorScreen.clickTable("2"),
22 ProductScreen.addOrderline("Water", "5", "2", "10.0"),
23 Chrome.clickPlanButton(),
24 FloorScreen.clickTable("4"),
25 ProductScreen.addOrderline("Minute Maid", "3", "2", "6.0"),
26 // Extra line is added to test merging table.
27 // Merging this order to another should also include this extra line.
28 ProductScreen.clickDisplayedProduct("Coca-Cola"),
29 ProductScreen.selectedOrderlineHas("Coca-Cola", "1"),
30
31 ProductScreen.clickControlButton("Transfer"),
32 {
33 trigger: ".table:contains(2)",
34 async run(helpers) {
35 await delay(500);
36 await helpers.click();
37 },
38 },
39 Order.hasLine({ productName: "Water", quantity: "5" }),
40 Order.hasLine({ productName: "Minute Maid", quantity: "3" }),
41 Order.hasLine({ productName: "Coca-Cola", quantity: "1" }),
42
43 // Test SplitBillButton
44 ProductScreen.clickControlButton("Split"),
45 SplitBillScreen.clickBack(),
46 ProductScreen.clickLine("Water", "5"),
47 ProductScreen.addInternalNote("test note", "Note"),
48 Order.hasLine({
49 productName: "Water",
50 quantity: "5",
51 price: "10.0",
52 internalNote: "test note",
53 withClass: ".selected",
54 }),
55 // Check that note is imported if come back to the table
56 Chrome.clickPlanButton(),
57 FloorScreen.clickTable("2"),
58 Order.hasLine({
59 productName: "Water",
60 quantity: "5",
61 price: "10.0",
62 internalNote: "test note",
63 }),
64
65 ProductScreen.addOrderline("Water", "8", "1", "8.0"),
66
67 // Test GuestButton
68 ProductScreen.clickControlButton("Guests"),
69 {
70 content: `click numpad button: 1`,
71 trigger: ".modal div.numpad button:text(1)",
72 run: "click",
73 },
74 {
75 content: `click numpad button: 5`,
76 trigger: ".modal div.numpad button:text(5)",
77 run: "click",
78 },
79 NumberPopup.isShown("15"),
80 Dialog.confirm(),
81 ProductScreen.guestNumberIs("15"),
82 {
83 content: `click guests 15 button`,
84 trigger: `.modal .control-buttons button:contains(15Guests)`,
85 run: "click",
86 },
87 {
88 content: `click numpad button: 5`,
89 trigger: ".modal div.numpad button:text(5)",
90 run: "click",
91 },
92 NumberPopup.isShown("5"),
93 Dialog.confirm(),
94 ProductScreen.guestNumberIs("5"),
95
96 // Test Cancel Order Button
97 Dialog.cancel(),
98 Order.hasLine({ productName: "Water", quantity: "5" }),
99 ProductScreen.clickControlButton("Cancel Order"),
100 Dialog.confirm(),
101 Order.doesNotHaveLine(),
102 FloorScreen.isShown(),
103
104 // Test moving order to a table on a different floor
105 FloorScreen.clickTable("5"),
106 ProductScreen.addOrderline("Water", "5", "2", "10.0"),
107 ProductScreen.clickControlButton("Transfer"),
108 FloorScreen.clickFloor("Second Floor"),
109 FloorScreen.clickTable("1"),
110 Order.hasLine({ productName: "Water", quantity: "5" }),
111 ].flat(),
112 });