diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/website_sale_coupon/static | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/website_sale_coupon/static')
| -rw-r--r-- | addons/website_sale_coupon/static/description/icon.png | bin | 0 -> 8196 bytes | |||
| -rw-r--r-- | addons/website_sale_coupon/static/description/icon.svg | 1 | ||||
| -rw-r--r-- | addons/website_sale_coupon/static/tests/tours/website_sale_coupon.js | 172 |
3 files changed, 173 insertions, 0 deletions
diff --git a/addons/website_sale_coupon/static/description/icon.png b/addons/website_sale_coupon/static/description/icon.png Binary files differnew file mode 100644 index 00000000..f88909cc --- /dev/null +++ b/addons/website_sale_coupon/static/description/icon.png diff --git a/addons/website_sale_coupon/static/description/icon.svg b/addons/website_sale_coupon/static/description/icon.svg new file mode 100644 index 00000000..4bb83071 --- /dev/null +++ b/addons/website_sale_coupon/static/description/icon.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="70" height="70" viewBox="0 0 70 70"><defs><path id="a" d="M4 0h61c4 0 5 1 5 5v60c0 4-1 5-5 5H4c-3 0-4-1-4-5V5c0-4 1-5 4-5z"/><linearGradient id="c" x1="98.162%" x2="0%" y1="1.838%" y2="100%"><stop offset="0%" stop-color="#797DA5"/><stop offset="50.799%" stop-color="#6D7194"/><stop offset="100%" stop-color="#626584"/></linearGradient><path id="d" d="M50 31.035a3.5 3.5 0 1 0 0 6.93v3.06a1.633 1.633 0 0 1-1.588 1.286L26.974 43l.998 4h18.955c.998 0 .998 2 0 2h-20.95L19.99 25h-1.996v1c0 .667-.332 1-.997 1S16 26.667 16 26v-2c.066-.667.398-1 .998-1h3.99c.516 0 .848.333.998 1l.998 3.281 25.428.037c1.045 0 1.588.761 1.588 2.018v1.7zM45.43 55a2.497 2.497 0 0 1-2.493-2.5c0-1.38 1.116-2.5 2.494-2.5a2.497 2.497 0 0 1 2.494 2.5c0 1.38-1.117 2.5-2.494 2.5zm-18.955 0a2.497 2.497 0 0 1-2.494-2.5c0-1.38 1.117-2.5 2.494-2.5a2.497 2.497 0 0 1 2.495 2.5c0 1.38-1.117 2.5-2.495 2.5zm12.7-24.996a.51.51 0 0 0-.409.2l-7.668 9.056c-.233.31.004.738.41.738l.696-.002a.51.51 0 0 0 .409-.2l7.63-9.056c.234-.312-.005-.74-.41-.738l-.658.002zm-5.841 4.371c1.29 0 2.334-.979 2.334-2.188 0-1.208-1.044-2.187-2.334-2.187S31 30.979 31 32.188c0 1.208 1.044 2.187 2.334 2.187zm0-3.125c.552 0 1 .42 1 .938 0 .517-.448.937-1 .937s-1-.42-1-.938c0-.517.448-.937 1-.937zm4.668 4.375c-1.29 0-2.334.979-2.334 2.188 0 1.208 1.044 2.187 2.334 2.187s2.334-.979 2.334-2.188c0-1.208-1.044-2.187-2.334-2.187zm0 3.125c-.553 0-1-.42-1-.938 0-.517.447-.937 1-.937.552 0 1 .42 1 .938 0 .517-.448.937-1 .937z"/><path id="e" d="M50 30a3 3 0 0 0 0 6v3.025a1.633 1.633 0 0 1-1.588 1.286L26.974 41l.998 4h18.955c.998 0 .998 2 0 2h-20.95L19.99 23h-1.996v1c0 .667-.332 1-.997 1S16 24.667 16 24v-2c.066-.667.398-1 .998-1h3.99c.516 0 .848.333.998 1l.998 3.281 25.428.037c1.045 0 1.588.761 1.588 2.018V30zm-4.57 23a2.497 2.497 0 0 1-2.493-2.5c0-1.38 1.116-2.5 2.494-2.5a2.497 2.497 0 0 1 2.494 2.5c0 1.38-1.117 2.5-2.494 2.5zm-18.955 0a2.497 2.497 0 0 1-2.494-2.5c0-1.38 1.117-2.5 2.494-2.5a2.497 2.497 0 0 1 2.495 2.5c0 1.38-1.117 2.5-2.495 2.5zM48 26a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm0 11a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm-8.825-8.996a.51.51 0 0 0-.409.2l-7.668 9.056c-.233.31.004.738.41.738l.696-.002a.51.51 0 0 0 .409-.2l7.63-9.056c.234-.312-.005-.74-.41-.738l-.658.002zm-5.841 4.371c1.29 0 2.334-.979 2.334-2.188 0-1.208-1.044-2.187-2.334-2.187S31 28.979 31 30.188c0 1.208 1.044 2.187 2.334 2.187zm0-3.125c.552 0 1 .42 1 .938 0 .517-.448.937-1 .937s-1-.42-1-.938c0-.517.448-.937 1-.937zm4.668 4.375c-1.29 0-2.334.979-2.334 2.188 0 1.208 1.044 2.187 2.334 2.187s2.334-.979 2.334-2.188c0-1.208-1.044-2.187-2.334-2.187zm0 3.125c-.553 0-1-.42-1-.938 0-.517.447-.937 1-.937.552 0 1 .42 1 .938 0 .517-.448.937-1 .937z"/></defs><g fill="none" fill-rule="evenodd"><mask id="b" fill="#fff"><use xlink:href="#a"/></mask><g mask="url(#b)"><path fill="url(#c)" d="M0 0H70V70H0z"/><path fill="#FFF" fill-opacity=".383" d="M4 1h61c2.667 0 4.333.667 5 2V0H0v3c.667-1.333 2-2 4-2z"/><path fill="#393939" d="M33.317 69H4c-2 0-4-1-4-4V38.29l16.258-16.95L21 21l2 5h26.583l.371 3.987-3.862 4.883 3.764 1.445-.11 3.27L45.076 45H47l.507 1.61-1.993 1.943 1.815 3.434L33.317 69z" opacity=".324"/><path fill="#000" fill-opacity=".383" d="M4 69h61c2.667 0 4.333-1 5-3v4H0v-4c.667 2 2 3 4 3z"/><use fill="#000" fill-rule="nonzero" opacity=".3" xlink:href="#d"/><use fill="#FFF" fill-rule="nonzero" xlink:href="#e"/></g></g></svg>
\ No newline at end of file diff --git a/addons/website_sale_coupon/static/tests/tours/website_sale_coupon.js b/addons/website_sale_coupon/static/tests/tours/website_sale_coupon.js new file mode 100644 index 00000000..9cf1926a --- /dev/null +++ b/addons/website_sale_coupon/static/tests/tours/website_sale_coupon.js @@ -0,0 +1,172 @@ +odoo.define('website_sale_coupon.test', function (require) { +'use strict'; + +require("website_sale.tour"); +var tour = require("web_tour.tour"); +var ajax = require('web.ajax'); + +tour.register('shop_sale_coupon', { + test: true, + url: '/shop?search=Small%20Cabinet', +}, + [ + { + content: "open customize menu", + extra_trigger: '.oe_website_sale .o_wsale_products_searchbar_form', + trigger: '#customize-menu > a', + }, + { + content: "enable 'Show # found' if needed", + trigger: "#customize-menu a:contains(Show # found)", + run: function () { + if (!$('#customize-menu a:contains(Show # found) input').prop('checked')) { + $('#customize-menu a:contains(Show # found)').click(); + } + } + }, + /* 1. Buy 1 Small Cabinet, enable coupon code & insert 10% code */ + { + content: "select Small Cabinet", + extra_trigger: '.oe_search_found', + trigger: '.oe_product_cart a:contains("Small Cabinet")', + }, + { + content: "add 2 Small Cabinet into cart", + trigger: '#product_details input[name="add_qty"]', + run: "text 2", + }, + { + content: "click on 'Add to Cart' button", + trigger: "a:contains(Add to Cart)", + }, + { + content: "open customize menu", + extra_trigger: '.oe_website_sale .oe_cart', + trigger: '#customize-menu > a', + }, + { + content: "enable 'Promo Code' if needed", + trigger: "#customize-menu a:contains(Promo Code)", + run: function () { + if (!$('#customize-menu a:contains(Promo Code) input').prop('checked')) { + $('#customize-menu a:contains(Promo Code)').click(); + } + } + }, + { + content: "click on 'I have a promo code'", + extra_trigger: '.show_coupon', + trigger: '.show_coupon', + }, + { + content: "insert promo code 'testcode'", + extra_trigger: 'form[name="coupon_code"]', + trigger: 'form[name="coupon_code"] input[name="promo"]', + run: "text testcode", + }, + { + content: "validate the coupon", + trigger: 'form[name="coupon_code"] .a-submit', + }, + { + content: "check reward product", + trigger: '.reward_product:contains("10.0% discount on total amount")', + run: function () {}, // it's a check + }, + /* 2. Add some cabinet to get a free one, play with quantity */ + { + content: "go to shop", + trigger: '.reward_product:contains("10.0% discount on total amount")', + run: function () { + ajax.jsonRpc('/web/dataset/call', 'call', { + model: 'account.tax', + method: 'create', + args: [{ + 'name':'15% tax incl ' + _.now(), + 'amount': 15, + }], + }).then(function (tax_id) { + ajax.jsonRpc('/web/dataset/call', 'call', { + model: 'product.template', + method: 'create', + args: [{ + 'name': 'Taxed Product', + 'taxes_id': [([6, false, [tax_id]])], + 'list_price': 100, + 'website_published': true, + }], + }).then(function (data) { + location.href = '/shop'; + }); + }); + }, + }, + { + content: "type Taxed Product in search", + trigger: 'form input[name="search"]', + run: "text Taxed Product", + }, + { + content: "start search", + trigger: 'form:has(input[name="search"]) .oe_search_button', + }, + { + content: "select Taxed Product", + extra_trigger: '.oe_search_found', // Wait to be on search results or it sometimes throws concurent error (sent search form + click on product on /shop) + trigger: '.oe_product_cart a:containsExact("Taxed Product")', + }, + { + content: "click on 'Add to Cart' button", + trigger: "a:contains(Add to Cart)", + }, + { + content: "check reduction amount got recomputed and merged both discount lines into one only", + extra_trigger: '.oe_currency_value:contains("-75.50"):not(#cart_total .oe_currency_value:contains("-75.50"))', + trigger: '.oe_website_sale .oe_cart', + run: function () {}, // it's a check + }, + /* 3. Add some cabinet to get a free one, play with quantity */ + { + content: "add one Small Cabinet", + trigger: '#cart_products input.js_quantity', + run: "text 3", + }, + { + content: "check reduction amount got recomputed when changing qty", + trigger: '.oe_currency_value:contains("-107.50")', + run: function () {}, // it's a check + }, + { + content: "add more Small Cabinet into cart", + trigger: '#cart_products input.js_quantity', + run: "text 4", + }, + { + content: "check free product is added", + trigger: '#wrap:has(.reward_product:contains("Free Product - Small Cabinet"))', + run: function () {}, // it's a check + }, + { + content: "remove one cabinet from cart", + trigger: '#cart_products input.js_quantity[value="4"]', + run: "text 3", + }, + { + content: "check free product is removed", + trigger: '#wrap:not(:has(.reward_product:contains("Free Product - Small Cabinet")))', + run: function () {}, // it's a check + }, + /* 4. Check /shop/payment does not break the `merged discount lines split per tax` (eg: with _compute_tax_id) */ + { + content: "go to checkout", + trigger: 'a[href="/shop/checkout?express=1"]', + }, + { + content: "check total is unchanged once we land on payment page", + extra_trigger: '#payment_method h3:contains("Pay with")', + trigger: 'tr#order_total .oe_currency_value:contains("967.50")', + run: function () {}, // it's a check + }, + ] +); +}); |
