Debian Codegraph @

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

raw symbols SCIP
1 import { rpc } from "@web/core/network/rpc";
2 import { registry } from "@web/core/registry";
3 import * as tourUtils from "@website_sale/js/tours/tour_utils";
4 import { pay } from "@website_sale/js/tours/tour_utils";
5
6 registry.category("web_tour.tours").add('website_sale_tour_1', {
7 url: '/shop?search=Storage Box Test',
8 steps: () => [
9 // Testing b2c with Tax-Excluded Prices
10 {
11 content: "Open product page",
12 trigger: '.oe_product_cart a:contains("Storage Box Test")',
13 run: "click",
14 expectUnloadPage: true,
15 },
16 {
17 content: "Add one more storage box",
18 trigger: '.js_add_cart_json:eq(1)',
19 run: "click",
20 },
21 {
22 content: "Check b2b Tax-Excluded Prices",
23 trigger: ".product_price .oe_price .oe_currency_value:text(79.00)",
24 },
25 {
26 content: "Click on add to cart",
27 trigger: '#add_to_cart',
28 run: "click",
29 },
30 tourUtils.goToCart({quantity: 2}),
31 {
32 content: "Check for 2 products in cart",
33 trigger:
34 '#cart_products div:has(a>h6:contains("Storage Box Test")) input.js_quantity:value(2)',
35 },
36 ...tourUtils.assertCartAmounts({
37 taxes: '23.70',
38 untaxed: '158.00',
39 total: '181.70',
40 }),
41 tourUtils.goToCheckout(),
42 {
43 content: "Fulfill delivery address form",
44 trigger: 'select[name="country_id"]',
45 run: "selectByLabel Afghanistan",
46 },
47 {
48 trigger: `input[name="name"]`,
49 run: "edit abcd",
50 },
51 {
52 trigger: `input[name="phone"]`,
53 run: "edit 99999999",
54 },
55 {
56 trigger: `input[name="email"]`,
57 run: "edit [email protected]",
58 },
59 {
60 trigger: `input[name="street"]`,
61 run: "edit SO1 Delivery Street, 33",
62 },
63 {
64 trigger: `input[name="city"]`,
65 run: "edit SO1DeliveryCity",
66 },
67 {
68 trigger: `input[name="zip"]`,
69 run: "edit 10000",
70 },
71 {
72 content: "Click on Confirm button",
73 trigger: 'a[name="website_sale_main_button"]',
74 run: "click",
75 expectUnloadPage: true,
76 },
77 tourUtils.waitForInteractionToLoad(),
78 {
79 content: "Billing address is not same as delivery address",
80 trigger: '#use_delivery_as_billing',
81 run: "click",
82 },
83 {
84 content: "Add a billing address",
85 trigger: '#billing_address_list a[href^="/shop/address?address_type=billing"]:contains("Add address")',
86 run: "click",
87 expectUnloadPage: true,
88 },
89 {
90 trigger: 'h4:contains("New address")',
91 },
92 {
93 content: "Fulfill billing address form",
94 trigger: 'select[name="country_id"]',
95 run: "selectByLabel Afghanistan",
96 },
97 {
98 trigger: `input[name="name"]`,
99 run: "edit def",
100 },
101 {
102 trigger: `input[name="phone"]`,
103 run: "edit 8888888888",
104 },
105 {
106 trigger: `input[name="email"]`,
107 run: "edit [email protected]",
108 },
109 {
110 trigger: `input[name="street"]`,
111 run: "edit 17, SO1 Billing Road",
112 },
113 {
114 trigger: `input[name="city"]`,
115 run: "edit SO1BillingCity",
116 },
117 {
118 trigger: `input[name="zip"]`,
119 run: "edit 10000",
120 },
121 {
122 content: "Click on Confirm button to save the address",
123 trigger: 'a[name="website_sale_main_button"]',
124 run: "click",
125 expectUnloadPage: true,
126 },
127 {
128 content: "Check selected delivery address is same as typed in previous step",
129 trigger: '#delivery_address_list:contains(SO1 Delivery Street, 33):contains(SO1DeliveryCity):contains(Afghanistan)',
130 },
131 {
132 content: "Check selected billing address is same as typed in previous step",
133 trigger: '#billing_address_list:contains(17, SO1 Billing Road):contains(SO1BillingCity):contains(Afghanistan)',
134 },
135 {
136 content: "Click for edit billing address",
137 trigger: '#billing_address_list a[href^="/shop/address?address_type=billing"].js_edit_address:first',
138 run: "click",
139 expectUnloadPage: true,
140 },
141 {
142 trigger: 'h4:contains("Edit address")',
143 },
144 {
145 content: "Change billing address form",
146 trigger: 'select[name="country_id"]',
147 },
148 {
149 trigger: `input[name="name"]`,
150 run: "edit abcd",
151 },
152 {
153 trigger: `input[name="phone"]`,
154 run: "edit 11111111",
155 },
156 {
157 trigger: `input[name="street"]`,
158 run: "edit SO1 Billing Street Edited, 33",
159 },
160 {
161 trigger: `input[name="city"]`,
162 run: "edit SO1BillingCityEdited",
163 },
164 {
165 content: "Click on Confirm button to save the address",
166 trigger: 'a[name="website_sale_main_button"]',
167 run: "click",
168 expectUnloadPage: true,
169 },
170 tourUtils.confirmOrder(),
171 {
172 content: "Check selected billing address is same as typed in previous step",
173 trigger: '#delivery_and_billing :contains(Billing):contains(SO1 Billing Street Edited, 33):contains(SO1BillingCityEdited):contains(Afghanistan)',
174 },
175 ...tourUtils.payWithTransfer({
176 redirect: false,
177 expectUnloadPage: true,
178 waitFinalizeYourPayment: true,
179 }),
180 {
181 content: "Sign up",
182 trigger: '.oe_cart a:contains("Sign Up")',
183 run: "click",
184 expectUnloadPage: true,
185 },
186 {
187 trigger: `.oe_signup_form input[name="password"]`,
188 run: "edit 1admin@admin",
189 },
190 {
191 trigger: `.oe_signup_form input[name="confirm_password"]`,
192 run: "edit 1admin@admin",
193 },
194 {
195 content: "Submit login",
196 trigger: `.oe_signup_form button[type="submit"]`,
197 run: "click",
198 expectUnloadPage: true,
199 },
200 {
201 content: "See Quotations",
202 trigger: '.o_portal_docs a:contains("Quotations to review")',
203 run: "click",
204 expectUnloadPage: true,
205 },
206 // Sign in as admin change config auth_signup -> b2b, sale_show_tax -> total and Logout
207 {
208 trigger: ".o_header_standard:not(.o_transitioning)",
209 },
210 {
211 content: "Open Dropdown for logout",
212 trigger: 'header#top li.dropdown:visible a:contains("abcd")',
213 run: "click",
214 },
215 {
216 content: "Logout",
217 trigger: '#o_logout:contains("Logout")',
218 run: "click",
219 expectUnloadPage: true,
220 },
221 {
222 content: "Sign in as admin",
223 trigger: 'header a[href="/web/login"]',
224 run: "click",
225 expectUnloadPage: true,
226 },
227 {
228 trigger: `.oe_login_form input[name="login"]`,
229 run: "edit admin",
230 },
231 {
232 trigger: `.oe_login_form input[name="password"]`,
233 run: "edit admin",
234 },
235 {
236 trigger: `.oe_login_form input[name="redirect"]:not(:visible)`,
237 run(helpers) {
238 this.anchor.value = "/";
239 },
240 },
241 {
242 content: "Submit login",
243 trigger: `.oe_login_form button[type="submit"]`,
244 run: "click",
245 expectUnloadPage: true,
246 },
247 {
248 trigger: ".o_frontend_to_backend_nav", // Check if the user is connected
249 },
250 {
251 content: "Configuration Settings for 'Tax Included' and sign up 'On Invitation'",
252 trigger: '#wrapwrap',
253 run: function () {
254 var def1 = rpc(`/web/dataset/call_kw/res.config.settings/create`, {
255 model: "res.config.settings",
256 method: "create",
257 args: [{
258 'auth_signup_uninvited': 'b2b',
259 'show_line_subtotals_tax_selection': 'tax_included',
260 }],
261 kwargs: {},
262 });
263 var def2 = def1.then(function (resId) {
264 return rpc(`/web/dataset/call_kw/res.config.settings/execute`, {
265 model: "res.config.settings",
266 method: "execute",
267 args: [[resId]],
268 kwargs: {},
269 });
270 });
271 def2.then(function () {
272 window.location.href = '/web/session/logout?redirect=/shop?search=Storage Box Test';
273 });
274 },
275 expectUnloadPage: true,
276 },
277 // Testing b2b with Tax-Included Prices
278 {
279 content: "Open product page",
280 trigger: '.oe_product_cart a:contains("Storage Box Test")',
281 run: "click",
282 expectUnloadPage: true,
283 },
284 {
285 content: "Add one more Storage Box Test",
286 trigger: '.js_add_cart_json:eq(1)',
287 run: "click",
288 },
289 {
290 content: "Check b2c Tax-Included Prices",
291 trigger: ".product_price .oe_price .oe_currency_value:text(90.85)",
292 },
293 {
294 content: "Click on add to cart",
295 trigger: '#add_to_cart',
296 run: "click",
297 },
298 tourUtils.goToCart({quantity: 2}),
299 {
300 content: "Check for 2 products in cart",
301 trigger:
302 '#cart_products div:has(a>h6:contains("Storage Box Test")) input.js_quantity:value(2)',
303 },
304 ...tourUtils.assertCartAmounts({
305 taxes: "23.70",
306 untaxed: "158.00",
307 total: "181.70",
308 }),
309 {
310 content: "Proceed to checkout",
311 trigger: 'a[href*="/shop/checkout"]',
312 run: "click",
313 expectUnloadPage: true,
314 },
315 {
316 content: "Click on Sign in Button",
317 trigger: `.oe_cart a:contains(Sign in)`,
318 run: "click",
319 expectUnloadPage: true,
320 },
321 {
322 trigger: `.oe_login_form input[name="login"]`,
323 run: "edit [email protected]",
324 },
325 {
326 trigger: `.oe_login_form input[name="password"]`,
327 run: "edit 1admin@admin",
328 },
329 {
330 content: "Submit login",
331 trigger: `.oe_login_form button[type="submit"]`,
332 run: "click",
333 expectUnloadPage: true,
334 },
335 {
336 content: "Add new delivery address",
337 trigger: '#delivery_address_list a[href^="/shop/address"]:contains("Add address")',
338 run: "click",
339 expectUnloadPage: true,
340 },
341 {
342 content: "Fulfill delivery address form",
343 trigger: 'select[name="country_id"]',
344 run: "selectByLabel Afghanistan",
345 },
346 {
347 trigger: `input[name="name"]`,
348 run: "edit ghi",
349 },
350 {
351 trigger: `input[name="phone"]`,
352 run: "edit 7777777777",
353 },
354 {
355 trigger: `input[name="street"]`,
356 run: "edit SO2New Delivery Street, 5",
357 },
358 {
359 trigger: `input[name="city"]`,
360 run: "edit SO2NewDelivery",
361 },
362 {
363 trigger: `input[name="zip"]`,
364 run: "edit 1200",
365 },
366 {
367 trigger: `input[name="email"]`,
368 run: "edit [email protected]",
369 },
370 {
371 content: "Click on Confirm button to save the address",
372 trigger: 'a[name="website_sale_main_button"]',
373 run: "click",
374 expectUnloadPage: true,
375 },
376 tourUtils.confirmOrder(),
377 {
378 content: "Select `Wire Transfer` payment method",
379 trigger: 'input[name="o_payment_radio"][data-payment-method-code="wire_transfer"]',
380 run: "click",
381 },
382 {
383 trigger: 'input[name="o_payment_radio"][data-payment-method-code="wire_transfer"]:checked',
384 },
385 ...pay({ expectUnloadPage: true, waitFinalizeYourPayment: true }),
386 {
387 trigger: '.oe_cart [name="order_confirmation"]',
388 },
389 {
390 content: "Open Dropdown for See quotation",
391 trigger: 'header#top li.dropdown:visible a:contains("abc")',
392 run: "click",
393 },
394 {
395 trigger: "header#top li.dropdown .js_usermenu.show",
396 },
397 {
398 content: "My account",
399 trigger: 'header#top .dropdown-menu a[href="/my/home"]:visible',
400 run: "click",
401 expectUnloadPage: true,
402 },
403
404 // enable extra step on website checkout and check extra step on checkout process
405 {
406 trigger: ".o_header_standard:not(.o_transitioning)",
407 },
408 {
409 content: "Open Dropdown for logout",
410 trigger: 'header#top li.dropdown:visible a:contains("abc")',
411 run: "click",
412 },
413 {
414 content: "Logout",
415 trigger: '#o_logout:contains("Logout")',
416 run: "click",
417 expectUnloadPage: true,
418 },
419 {
420 content: "Sign in as admin",
421 trigger: 'header a[href="/web/login"]',
422 run: "click",
423 expectUnloadPage: true,
424 },
425 {
426 trigger: `.oe_login_form input[name="login"]`,
427 run: "edit admin",
428 },
429 {
430 trigger: `.oe_login_form input[name="password"]`,
431 run: "edit admin",
432 },
433 {
434 trigger: `.oe_login_form input[name="redirect"]:not(:visible)`,
435 run(helpers) {
436 this.anchor.value = "/shop/cart";
437 },
438 },
439 {
440 content: "Submit login",
441 trigger: `.oe_login_form button[type="submit"]`,
442 run: "click",
443 expectUnloadPage: true,
444 }]});
445
446 registry.category("web_tour.tours").add('website_sale_tour_2', {
447 url: '/shop/cart',
448 steps: () => [
449 {
450 trigger: '.o_wizard:contains("Extra Info")',
451 },
452 {
453 content: "Open Dropdown for logout",
454 trigger: 'header#top li.dropdown:visible a:contains("Mitchell Admin")',
455 run: "click",
456 },
457 {
458 content: "Logout",
459 trigger: '#o_logout:contains("Logout")',
460 run: "click",
461 expectUnloadPage: true,
462 },
463 {
464 content: "Sign in as abc",
465 trigger: 'header a[href="/web/login"]',
466 run: "click",
467 expectUnloadPage: true,
468 },
469 {
470 trigger: `.oe_login_form input[name="login"]`,
471 run: "edit [email protected]",
472 },
473 {
474 trigger: `.oe_login_form input[name="password"]`,
475 run: "edit 1admin@admin",
476 },
477 {
478 trigger: `.oe_login_form input[name="redirect"]:not(:visible)`,
479 run(helpers) {
480 this.anchor.value = "/shop?search=Storage Box Test";
481 },
482 },
483 {
484 content: "Submit login",
485 trigger: `.oe_login_form button[type="submit"]`,
486 run: "click",
487 expectUnloadPage: true,
488 },
489 {
490 content: "Open product page",
491 trigger: '.oe_product_cart a:contains("Storage Box Test")',
492 run: "click",
493 expectUnloadPage: true,
494 },
495 {
496 content: "Click on add to cart",
497 trigger: '#add_to_cart',
498 run: "click",
499 },
500 tourUtils.goToCart(),
501 tourUtils.goToCheckout(),
502 {
503 content: "Click on 'Confirm' button (redirect to the 'extra info' form)",
504 trigger: 'a[href^="/shop/extra_info"]',
505 run: "click",
506 expectUnloadPage: true,
507 },
508 {
509 content: "Click on Confirm button to save the Extra Info form",
510 trigger: 'a[name="website_sale_main_button"]',
511 run: "click",
512 expectUnloadPage: true,
513 },
514 ...tourUtils.payWithTransfer({ expectUnloadPage: true, waitFinalizeYourPayment: true }),
515 {
516 content: "Check payment status confirmation window",
517 trigger: '[name="order_confirmation"][data-order-tracking-info]',
518 }]});