Skip to content
Permalink
Browse files

🛡 JS-tour for connect-disconnect keyboard

  • Loading branch information...
fedoranvar committed Aug 19, 2019
1 parent b30d0a5 commit a92e261b3594e357b9fd14b76f6bab777330ad23
Showing with 28 additions and 4 deletions.
  1. +27 −3 pos_keyboard/static/src/js/test_pos_keyboard.js
  2. +1 −1 pos_keyboard/tests/test_pos_keyboard.py
@@ -1,4 +1,5 @@
/* Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/kolushovalexandr>
Copyright 2019 Anvar Kildebekov <https://it-projects.info/team/fedoranvar>
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */
odoo.define('pos_keyboard.tour', function (require) {
"use strict";
@@ -20,7 +21,7 @@ odoo.define('pos_keyboard.tour', function (require) {
content: "Switch to table or make dummy action",
trigger: '.table:not(.oe_invisible .neworder-button), .order-button.selected',
position: "bottom",
timeout: 20000,
timeout: 30000,
}, {
content: 'waiting for loading to finish',
trigger: '.order-button.neworder-button',
@@ -57,13 +58,33 @@ odoo.define('pos_keyboard.tour', function (require) {
}];
}

function connect_disconnect_keyboard() {
var stps = [{
content: "Open Payment-Screen",
trigger: '.pay-circle',
}];

if (odoo._modules.indexOf('pos_cashier_select') !== -1) {
stps = stps.concat([{
trigger: '.modal-dialog.cashier .selection-item:contains("Admin")',
content: 'select first cashier',
}]);
}

stps = stps.concat([{
content: 'Close Payment-Screen',
trigger: '.button:contains(Back)',
}]);
return stps;
}

function open_cashier_popup_and_close_it() {
return [{
content: "Open cashier selection popup",
trigger: '.username',
}, {
content: "Make dummy action and simulate escape button clicking",
trigger: '.modal-dialog:not(".oe_hidden") p.title',
trigger: '.modal-dialog:not(".oe_hidden")',
run: function(){
simulate_keyup_event(27);
setTimeout(function () {
@@ -81,9 +102,12 @@ odoo.define('pos_keyboard.tour', function (require) {
}

var steps = [];
var quantity = 3;
steps = steps.concat(open_pos_neworder());
steps = steps.concat(add_product_to_order('Miscellaneous'));
steps = steps.concat(update_qty_for_product(3));
steps = steps.concat(update_qty_for_product(quantity));
steps = steps.concat(connect_disconnect_keyboard());
steps = steps.concat(update_qty_for_product(quantity+1));
steps = steps.concat(open_cashier_popup_and_close_it());

tour.register('pos_keyboard_tour', { test: true, url: '/web' }, steps);
@@ -13,6 +13,6 @@ def test_pos_keyboard(self):
# without a delay there might be problems on the steps whilst opening a POS
# caused by a not yet loaded button's action
self.phantom_js("/web",
"odoo.__DEBUG__.services['web_tour.tour'].run('pos_keyboard_tour', 100)",
"odoo.__DEBUG__.services['web_tour.tour'].run('pos_keyboard_tour', 500)",
"odoo.__DEBUG__.services['web_tour.tour'].tours.pos_keyboard_tour.ready",
login="admin")

0 comments on commit a92e261

Please sign in to comment.
You can’t perform that action at this time.