Skip to content

Commit

Permalink
[IMP] pos_partner_deselection: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
azimkhankuat committed Oct 2, 2024
1 parent 756df12 commit c6eac5b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 44 deletions.
2 changes: 1 addition & 1 deletion pos_partner_deselection/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"pos_partner_deselection/static/src/js/partner_deselection.js",
],
"web.assets_tests": [
"pos_partner_deselection/static/src/js/test_pos_deselection.js",
"pos_partner_deselection/static/src/js/test_pos_deselection.esm.js",
],
},
"demo": [],
Expand Down
37 changes: 37 additions & 0 deletions pos_partner_deselection/static/src/js/test_pos_deselection.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/** @odoo-module */

import {registry} from "@web/core/registry";
import {_t} from "@web/core/l10n/translation";

function setCustomer(name) {
return [
{
extra_trigger: "body .pos:not(:has(.loader))",
trigger: ".button.set-partner",
content: _t("Open the customer screen"),
},
{
extra_trigger: "body .pos:not(:has(.loader))",
trigger: `td:contains("${name}")`,
content: _t("Click the customer"),
},
];
}

function setCustomerAndCheckDeselection(name) {
return setCustomer(name).concat([
{
extra_trigger: '.button.set-partner:contains("Customer")',
trigger: '.button.set-partner:contains("Customer")',
content: _t("Check that the customer is deselected"),
},
]);
}

const steps = [...setCustomerAndCheckDeselection("Lumber Inc")];

registry.category("web_tour.tours").add("pos_partner_deselection_tour", {
test: true,
url: "/pos/ui",
steps: () => steps,
});
40 changes: 0 additions & 40 deletions pos_partner_deselection/static/src/js/test_pos_deselection.js

This file was deleted.

6 changes: 3 additions & 3 deletions pos_partner_deselection/tests/test_partner_deselection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ class TestUi(TestPointOfSaleHttpCommon):
def test_01_partner_deselection(self):
self.main_pos_config.write({"customer_deselection_interval": 1})

self.main_pos_config.open_ui()
self.main_pos_config.with_user(self.pos_user).open_ui()

self.start_tour(
"/pos/ui?config_id=%d" % self.main_pos_config.id,
"pos_partner_deselection_tour",
500,
login="admin",
timeout=200,
login="pos_user",
timeout=100,
)

0 comments on commit c6eac5b

Please sign in to comment.