Debian Codegraph @

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

raw symbols SCIP
1 /* global posmodel */
2
3 import * as Chrome from "@point_of_sale/../tests/pos/tours/utils/chrome_util";
4 import * as Dialog from "@point_of_sale/../tests/generic_helpers/dialog_util";
5 import * as ReceiptScreen from "@point_of_sale/../tests/pos/tours/utils/receipt_screen_util";
6 import * as ProductScreen from "@point_of_sale/../tests/pos/tours/utils/product_screen_util";
7 import * as PaymentScreen from "@point_of_sale/../tests/pos/tours/utils/payment_screen_util";
8 import { registry } from "@web/core/registry";
9
10 registry.category("web_tour.tours").add("test_sync_from_ui_one_by_one", {
11 steps: () =>
12 [
13 Chrome.startPoS(),
14 Dialog.confirm("Open Register"),
15 {
16 trigger: "body",
17 content: "Create fake orders",
18 run: async () => {
19 // Create 5 orders that will be synced one by one
20 for (let i = 0; i < 5; i++) {
21 const product = posmodel.models["product.template"].find(
22 (p) => p.name === "Desk Pad"
23 );
24 const order = posmodel.createNewOrder();
25 await posmodel.addLineToOrder({ product_tmpl_id: product }, order);
26 posmodel.addPendingOrder([order.id]);
27 }
28 },
29 },
30 // Create one more order to be able to trigger the sync from the UI
31 ProductScreen.clickDisplayedProduct("Desk Pad"),
32 ProductScreen.clickPayButton(),
33 PaymentScreen.clickPaymentMethod("Bank"),
34 PaymentScreen.clickValidate(),
35 ReceiptScreen.isShown(),
36 ].flat(),
37 });