Debian Codegraph @

addons/website_sale_loyalty/static/tests/tours/test_apply_discount_code.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('apply_discount_code_program_multi_rewards', {
5 url: '/shop?search=Super%20Chair',
6 steps: () => [
7 {
8 trigger: ".oe_search_found:not(:visible)",
9 },
10 {
11 content: 'select Super Chair',
12 trigger: '.oe_product_cart a:contains("Super Chair")',
13 run: "click",
14 expectUnloadPage: true,
15 },
16 {
17 content: 'Add Super Chair into cart',
18 trigger: 'a:contains(Add to cart)',
19 run: "click",
20 },
21 tourUtils.goToCart(),
22 {
23 trigger: "h4:contains(order summary)",
24 },
25 {
26 trigger: 'form[name="coupon_code"]',
27 },
28 {
29 content: 'insert discount code',
30 trigger: 'form[name="coupon_code"] input[name="promo"]',
31 run: "edit 12345",
32 },
33 {
34 content: 'validate the promo code',
35 trigger: 'form[name="coupon_code"] button[type="submit"]',
36 run: "click",
37 expectUnloadPage: true,
38 },
39 {
40 content: 'check reward',
41 trigger: '.alert:contains("10% on Super Chair")',
42 },
43 {
44 content: 'claim reward',
45 trigger: '.alert:contains("10% on Super Chair") .btn:contains("Claim")',
46 run: "click",
47 expectUnloadPage: true,
48 },
49 {
50 content: "check claimed reward",
51 trigger:
52 "#cart_products.js_cart_lines .o_cart_product h6:contains(10% on Super Chair)",
53 },
54 // Try to reapply the same promo code
55 {
56 trigger: 'form[name="coupon_code"]',
57 },
58 {
59 content: 'insert discount code',
60 trigger: 'form[name="coupon_code"] input[name="promo"]',
61 run: "edit 12345",
62 },
63 {
64 content: 'validate the promo code',
65 trigger: 'form[name="coupon_code"] button[type="submit"]',
66 run: "click",
67 expectUnloadPage: true,
68 },
69 {
70 content: 'check refused message',
71 trigger: '.alert-danger:contains("This promo code is already applied")',
72 },
73 ],
74 });