Skip to content

Commit

Permalink
saved
Browse files Browse the repository at this point in the history
  • Loading branch information
em230418 committed Sep 20, 2024
1 parent c524335 commit 13a57c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 48 deletions.
35 changes: 4 additions & 31 deletions pos_partner_deselection/static/src/js/test_pos_deselection.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,6 @@ odoo.define("pos_partner_deselection.tour", function (require) {
var core = require("web.core");
var _t = core._t;

function pos_opening() {
return [
{
trigger:
'.o_app[data-menu-xmlid="point_of_sale.menu_point_root"], .oe_menu_toggler[data-menu-xmlid="point_of_sale.menu_point_root"]',
content: _t(
"Ready to launch your <b>point of sale</b>? <i>Click here</i>."
),
position: "bottom",
},
{
trigger: ".o_pos_kanban button.oe_kanban_action_button",
content: _t(
"<p>Click to start the point of sale interface. It <b>runs on tablets</b>, laptops, or industrial hardware.</p><p>Once the session launched, the system continues to run without an internet connection.</p>"
),
position: "bottom",
},
{
content: "Switch to table or make dummy action",
trigger: ".table, .ticket-button",
position: "bottom",
timeout: 30000,
},
];
}

function set_customer(name) {
return [
{
Expand All @@ -49,11 +23,11 @@ odoo.define("pos_partner_deselection.tour", function (require) {
];
}

function set_customer_and_check_deselection(nam) {
function set_customer_and_check_deselection(name) {
return set_customer(name).concat([
{
trigger: ".ticket-button",
content: _t("Dummy Ation"),
content: _t("Dummy Action"),
},
{
extra_trigger: '.button.set-customer:contains("Customer")',
Expand All @@ -64,8 +38,7 @@ odoo.define("pos_partner_deselection.tour", function (require) {
}

var steps = [];
steps = steps.concat(pos_opening());
steps = steps.concat(set_customer_and_check_deselection("Agrolait"));
steps = steps.concat(set_customer_and_check_deselection("Lumber Inc"));

tour.register("pos_partner_deselection_tour", {test: true, url: "/web"}, steps);
tour.register("pos_partner_deselection_tour", {test: true, url: "/pos/ui"}, steps);
});
24 changes: 7 additions & 17 deletions pos_partner_deselection/tests/test_partner_deselection.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
import odoo.tests
from odoo.api import Environment
from odoo.tests import tagged
from odoo.addons.point_of_sale.tests.test_frontend import TestPointOfSaleHttpCommon


@tagged("at_install", "post_install")
class TestUi(odoo.tests.HttpCase):
class TestUi(TestPointOfSaleHttpCommon):
def test_01_partner_deselection(self):
# needed because tests are run before the module is marked as
# installed. In js web will only load qweb coming from modules
# that are returned by the backend in module_boot. Without
# this you end up with js, css but no qweb.
cr = self.registry.cursor()
env = Environment(cr, self.uid, {})
self.main_pos_config.write({"customer_deselection_interval": 1})

env["pos.config"].search([]).write({"customer_deselection_interval": 1})

self.browser_js(
"/web",
"odoo.__DEBUG__.services['web_tour.tour'].run('pos_partner_deselection_tour'), 500",
"odoo.__DEBUG__.services['web_tour.tour'].tours.pos_partner_deselection_tour.ready",
self.start_tour(
"/pos/ui?config_id=%d" % self.main_pos_config.id,
"pos_partner_deselection_tour",
500,
login="admin",
timeout=100,
)

0 comments on commit 13a57c4

Please sign in to comment.