Debian Codegraph @

addons/website_sale/static/tests/tours/website_sale_cart_notification.js

raw symbols SCIP
1 import { registry } from "@web/core/registry";
2 import * as tourUtils from "@website_sale/js/tours/tour_utils";
3
4 registry.category("web_tour.tours").add("website_sale_cart_notification_tax_included", {
5 url: "/shop",
6 steps: () => [
7 ...tourUtils.addToCart({
8 productName: "website_sale_cart_notification_product_1",
9 expectUnloadPage: true,
10 }),
11 {
12 content: "check that 1 website_sale_cart_notification_product_1 was added",
13 trigger: '.toast-body span:contains("website_sale_cart_notification_product_1")',
14 },
15 {
16 content: "check that 1 website_sale_cart_notification_product_1 was added",
17 trigger: '.toast-body span:contains("1")',
18 },
19 {
20 content: "check the price of 1 website_sale_cart_notification_product_1",
21 trigger: '.toast-body div:contains("$ 1,150.00")',
22 },
23 ...tourUtils.searchProduct("website_sale_cart_notification_product_2", { select: true }),
24 {
25 trigger: "#product_detail",
26 },
27 {
28 content: "change quantity",
29 trigger: '#product_detail form input[name=add_qty]',
30 run: "edit 3",
31 },
32 {
33 content: "click on add to cart",
34 trigger: '#product_detail form #add_to_cart',
35 run: "click",
36 },
37 {
38 content: "check that 3 website_sale_cart_notification_product_2 was added",
39 trigger: '.toast-body span:contains("website_sale_cart_notification_product_2")',
40 },
41 {
42 content: "check that 3 website_sale_cart_notification_product_2 was added",
43 trigger: '.toast-body span:contains("3")',
44 },
45 {
46 content: "check that the novariants/custom attributes are displayed.",
47 trigger: '.toast-body span.text-muted.small:contains("Size: S")',
48 },
49 {
50 content: "check the price of 3 website_sale_cart_notification_product_2",
51 trigger: '.toast-body div:contains("$ 17,250.00")',
52 },
53 {
54 content: "Go To Cart",
55 trigger: '.toast-body a:contains("View cart")',
56 run: "click",
57 expectUnloadPage: true,
58 },
59 ...tourUtils.assertCartContains({
60 productName: "website_sale_cart_notification_product_1",
61 backend: false,
62 }),
63 ...tourUtils.assertCartContains({
64 productName: "website_sale_cart_notification_product_2",
65 backend: false,
66 }),
67 ],
68 });
69
70
71 registry.category("web_tour.tours").add("website_sale_cart_notification_tax_excluded", {
72 url: "/shop",
73 steps: () => [
74 ...tourUtils.addToCart({
75 productName: "website_sale_cart_notification_product_1",
76 expectUnloadPage: true,
77 }),
78 {
79 content: "check that 1 website_sale_cart_notification_product_1 was added",
80 trigger: '.toast-body span:contains("website_sale_cart_notification_product_1")',
81 },
82 {
83 content: "check that 1 website_sale_cart_notification_product_1 was added",
84 trigger: '.toast-body span:contains("1")',
85 },
86 {
87 content: "check the price of 1 website_sale_cart_notification_product_1",
88 trigger: '.toast-body div:contains("$ 1,000.00")',
89 },
90 ...tourUtils.searchProduct("website_sale_cart_notification_product_2", { select: true }),
91 {
92 trigger: "#product_detail",
93 },
94 {
95 content: "change quantity",
96 trigger: '#product_detail form input[name=add_qty]',
97 run: "edit 3",
98 },
99 {
100 content: "click on add to cart",
101 trigger: '#product_detail form #add_to_cart',
102 run: "click",
103 },
104 {
105 content: "check that 3 website_sale_cart_notification_product_2 was added",
106 trigger: '.toast-body span:contains("website_sale_cart_notification_product_2")',
107 },
108 {
109 content: "check that 3 website_sale_cart_notification_product_2 was added",
110 trigger: '.toast-body span:contains("3")',
111 },
112 {
113 content: "check that the novariants/custom attributes are displayed.",
114 trigger: '.toast-body span.text-muted.small:contains("Size: S")',
115 },
116 {
117 content: "check the price of 3 website_sale_cart_notification_product_2",
118 trigger: '.toast-body div:contains("$ 15,000.00")',
119 },
120 {
121 content: "Go To Cart",
122 trigger: '.toast-body a:contains("View cart")',
123 run: "click",
124 expectUnloadPage: true,
125 },
126 ...tourUtils.assertCartContains({
127 productName: "website_sale_cart_notification_product_1",
128 backend: false,
129 }),
130 ...tourUtils.assertCartContains({
131 productName: "website_sale_cart_notification_product_2",
132 backend: false,
133 }),
134 ],
135 });
136
137
138 registry.category("web_tour.tours").add("website_sale_cart_notification_qty_and_total", {
139 url: "/shop",
140 steps: () => [
141 ...tourUtils.addToCart({
142 productName: "website_sale_cart_notification_product_1",
143 expectUnloadPage: true,
144 }),
145 {
146 content: "check that 1 website_sale_cart_notification_product_1 was added",
147 trigger: '.toast-body span:contains("website_sale_cart_notification_product_1")',
148 },
149 {
150 content: "check that 1 website_sale_cart_notification_product_1 was added",
151 trigger: '.toast-body span:contains("1")',
152 },
153 {
154 content: "check the price of 1 website_sale_cart_notification_product_1",
155 trigger: '.toast-body div:contains("$ 1,000.00")',
156 },
157 // Again add same product
158 {
159 content: "change quantity",
160 trigger: '#product_detail form input[name=add_qty]',
161 run: "edit 3",
162 },
163 {
164 content: "click on add to cart",
165 trigger: '#product_detail form #add_to_cart',
166 run: "click",
167 },
168 {
169 content: "check that only newly added qty showing in the notification",
170 trigger: '.toast-body span:contains("3")',
171 },
172 {
173 content: "check that price total only showing total of newly added quantity",
174 trigger: '.toast-body div:contains("$ 3,000.00")',
175 },
176 ],
177 });