Debian Codegraph @

addons/point_of_sale/static/tests/pos/tours/shipping_date_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
7 registry.category("web_tour.tours").add("test_pos_order_shipping_date", {
8 steps: () =>
9 [
10 ProductScreen.setTimeZone("America/New_York"),
11 Chrome.startPoS(),
12 Dialog.confirm("Open Register"),
13 ProductScreen.addOrderline("Whiteboard Pen", "1"),
14 ProductScreen.clickPartnerButton(),
15 ProductScreen.clickCustomer("Partner Test with Address"),
16 ProductScreen.clickPayButton(),
17 PaymentScreen.clickPaymentMethod("Cash"),
18 {
19 content: "click ship later button",
20 trigger: ".button:contains('Ship Later')",
21 run: "click",
22 },
23 {
24 content: "pick a date",
25 trigger: '.modal-body input[type="date"]',
26 run: () => {
27 const input = document.querySelector('.modal-body input[type="date"]');
28 const nextYear = new Date().getFullYear() + 1;
29 input.value = `${nextYear}-05-30`;
30 input.dispatchEvent(new Event("input", { bubbles: true }));
31 input.dispatchEvent(new Event("change", { bubbles: true }));
32 },
33 },
34 {
35 content: "click confirm button",
36 trigger: ".btn:contains('Confirm')",
37 run: "click",
38 },
39 {
40 content: "Assert shipping date was set",
41 trigger: ".payment-buttons .d-flex .btn span",
42 run: () => {
43 const spans = [
44 ...document.querySelectorAll(".payment-buttons .d-flex .btn span"),
45 ];
46 const nextYear = new Date().getFullYear() + 1;
47 const expectedDate = `05/30/${nextYear}`;
48 if (!spans.some((span) => span.innerText === expectedDate)) {
49 throw new Error("Expected shipping date is not set");
50 }
51 },
52 },
53 PaymentScreen.clickValidate(),
54 {
55 content: "Assert shipping date in receipt",
56 trigger: ".pos-receipt-order-data",
57 run: () => {
58 const dateDiv = document.querySelector(".pos-receipt-order-data div");
59 const nextYear = new Date().getFullYear() + 1;
60 const expectedDate = `5/30/${nextYear}`;
61 if (dateDiv.innerText !== expectedDate) {
62 throw new Error("Expected shipping date is not set in receipt");
63 }
64 },
65 },
66 ].flat(),
67 });