Debian Codegraph @

addons/website_sale_loyalty/static/tests/tours/test_ewallet_tour.js

raw symbols SCIP
1 import { registry } from "@web/core/registry";
2 import * as wsTourUtils from "@website_sale/js/tours/tour_utils";
3
4 registry.category("web_tour.tours").add("shop_sale_ewallet", {
5 url: "/shop",
6 steps: () => [
7 // Add a $50 gift card to the order
8 ...wsTourUtils.addToCart({ productName: "TEST - Gift Card", expectUnloadPage: true }),
9 wsTourUtils.goToCart(),
10 {
11 trigger: 'button[name="o_loyalty_claim"]:contains("Use")',
12 async run(helpers) {
13 const rewards = document.querySelectorAll('form[name="claim_reward"]');
14 if (rewards.length === 1) {
15 await helpers.click();
16 } else {
17 console.error(`Expected 1 claimable reward, got: ${rewards.length}`);
18 }
19 },
20 expectUnloadPage: true,
21 },
22 {
23 content: "Checkout",
24 trigger: 'a[name="website_sale_main_button"]',
25 run: "click",
26 expectUnloadPage: true,
27 },
28 {
29 content: "Confirm Order",
30 trigger: 'button[name="o_payment_submit_button"]',
31 run: "click",
32 expectUnloadPage: true,
33 },
34 {
35 trigger: 'div h3:contains("Thank you for your order.")'
36 },
37 {
38 trigger: 'a[href="/shop/cart"]',
39 run: function () {
40 const cartQuantity = document.querySelector(".my_cart_quantity");
41 if (cartQuantity.textContent !== "0") {
42 console.error(
43 "cart should be empty and reset after an order is paid using ewallet"
44 );
45 }
46 },
47 },
48 ],
49 });