diff options
Diffstat (limited to 'addons/pos_restaurant/static/tests/tours/helpers')
8 files changed, 493 insertions, 0 deletions
diff --git a/addons/pos_restaurant/static/tests/tours/helpers/BillScreenTourMethods.js b/addons/pos_restaurant/static/tests/tours/helpers/BillScreenTourMethods.js new file mode 100644 index 00000000..9f831367 --- /dev/null +++ b/addons/pos_restaurant/static/tests/tours/helpers/BillScreenTourMethods.js @@ -0,0 +1,30 @@ +odoo.define('pos_restaurant.tour.BillScreenTourMethods', function (require) { + 'use strict'; + + const { createTourMethods } = require('point_of_sale.tour.utils'); + + class Do { + clickBack() { + return [ + { + content: `go back`, + trigger: `.receipt-screen .back`, + }, + ]; + } + } + + class Check { + isShown() { + return [ + { + content: 'Bill screen is shown', + trigger: '.receipt-screen h1:contains("Bill Printing")', + run: () => {}, + }, + ]; + } + } + + return createTourMethods('BillScreen', Do, Check); +}); diff --git a/addons/pos_restaurant/static/tests/tours/helpers/ChromeTourMethods.js b/addons/pos_restaurant/static/tests/tours/helpers/ChromeTourMethods.js new file mode 100644 index 00000000..d60e3986 --- /dev/null +++ b/addons/pos_restaurant/static/tests/tours/helpers/ChromeTourMethods.js @@ -0,0 +1,33 @@ +odoo.define('pos_restaurant.tour.ChromeTourMethods', function (require) { + 'use strict'; + + const { createTourMethods } = require('point_of_sale.tour.utils'); + const { Do } = require('point_of_sale.tour.ChromeTourMethods'); + + class DoExt extends Do { + backToFloor() { + return [ + { + content: 'back to floor', + trigger: '.floor-button', + }, + ]; + } + } + + class Check { + backToFloorTextIs(floor, table) { + return [ + { + content: `back to floor text is '${floor} ( ${table} )'`, + trigger: `.floor-button span:contains("${floor}") ~ .table-name:contains("${table}")`, + run: () => {}, + }, + ]; + } + } + + class Execute {} + + return createTourMethods('Chrome', DoExt, Check, Execute); +}); diff --git a/addons/pos_restaurant/static/tests/tours/helpers/FloorScreenTourMethods.js b/addons/pos_restaurant/static/tests/tours/helpers/FloorScreenTourMethods.js new file mode 100644 index 00000000..733fd26d --- /dev/null +++ b/addons/pos_restaurant/static/tests/tours/helpers/FloorScreenTourMethods.js @@ -0,0 +1,157 @@ +odoo.define('pos_restaurant.tour.FloorScreenTourMethods', function (require) { + 'use strict'; + + const { createTourMethods } = require('point_of_sale.tour.utils'); + + class Do { + clickTable(name) { + return [ + { + content: `click table '${name}'`, + trigger: `.floor-map .table .label:contains("${name}")`, + }, + ]; + } + clickFloor(name) { + return [ + { + content: `click '${name}' floor`, + trigger: `.floor-selector .button-floor:contains("${name}")`, + }, + ]; + } + clickEdit() { + return [ + { + content: `click edit button`, + trigger: `.floor-map .edit-button`, + }, + ]; + } + clickAddTable() { + return [ + { + content: 'add table', + trigger: `.floor-map .edit-button i[aria-label=Add]`, + }, + ]; + } + clickDuplicate() { + return [ + { + content: 'duplicate table', + trigger: `.floor-map .edit-button i[aria-label=Duplicate]`, + }, + ]; + } + clickRename() { + return [ + { + content: 'rename table', + trigger: `.floor-map .edit-button i[aria-label=Rename]`, + }, + ]; + } + clickSeats() { + return [ + { + content: 'change number of seats', + trigger: `.floor-map .edit-button i[aria-label=Seats]`, + }, + ]; + } + clickTrash() { + return [ + { + content: 'trash table', + trigger: `.floor-map .edit-button.trash`, + }, + ]; + } + changeShapeTo(shape) { + return [ + { + content: `change shape to '${shape}'`, + trigger: `.edit-button .button-option${shape === 'round' ? '.square' : '.round'}`, + }, + ]; + } + } + + class Check { + selectedFloorIs(name) { + return [ + { + content: `selected floor is '${name}'`, + trigger: `.floor-selector .button-floor.active:contains("${name}")`, + run: () => {}, + }, + ]; + } + selectedTableIs(name) { + return [ + { + content: `selected table is '${name}'`, + trigger: `.floor-map .table.selected .label:contains("${name}")`, + run: () => {}, + }, + ]; + } + hasTable(name) { + return [ + { + content: `selected floor has '${name}' table`, + trigger: `.floor-map .tables .table .label:contains("${name}")`, + run: () => {}, + }, + ]; + } + editModeIsActive(flag) { + return [ + { + content: `check if edit mode is ${flag ? 'active' : 'inactive'}`, + trigger: `.floor-map .edit-button${flag ? '.active' : ':not(:has(.active))'}`, + run: () => {}, + }, + ]; + } + tableSeatIs(table, val) { + return [ + { + content: `number of seats in table '${table}' is '${val}'`, + trigger: `.floor-map .tables .table .label:contains("${table}") ~ .table-seats:contains("${val}")`, + run: function () {}, + }, + ]; + } + orderCountSyncedInTableIs(table, count) { + return [ + { + trigger: `.floor-map .table .order-count:contains("${count}") ~ .label:contains("${table}")`, + run: function () {}, + }, + ]; + } + isShown() { + return [ + { + trigger: '.floor-map', + run: function () {}, + }, + ]; + } + tableIsNotSelected(name) { + return [ + { + content: `table '${name}' is not selected`, + trigger: `.floor-map .table:not(.selected) .label:contains("${name}")`, + run: function () {}, + }, + ]; + } + } + + class Execute {} + + return createTourMethods('FloorScreen', Do, Check, Execute); +}); diff --git a/addons/pos_restaurant/static/tests/tours/helpers/ProductScreenTourMethods.js b/addons/pos_restaurant/static/tests/tours/helpers/ProductScreenTourMethods.js new file mode 100644 index 00000000..decd30c4 --- /dev/null +++ b/addons/pos_restaurant/static/tests/tours/helpers/ProductScreenTourMethods.js @@ -0,0 +1,70 @@ +odoo.define('pos_restaurant.tour.ProductScreenTourMethods', function (require) { + 'use strict'; + + const { createTourMethods } = require('point_of_sale.tour.utils'); + const { Do, Check, Execute } = require('point_of_sale.tour.ProductScreenTourMethods'); + + class DoExt extends Do { + clickSplitBillButton() { + return [ + { + content: 'click split bill button', + trigger: '.control-buttons .control-button.order-split', + }, + ]; + } + clickTransferButton() { + return [ + { + content: 'click transfer button', + trigger: '.control-buttons .control-button span:contains("Transfer")', + }, + ]; + } + clickNoteButton() { + return [ + { + content: 'click note button', + trigger: '.control-buttons .control-button span:contains("Note")', + }, + ]; + } + clickPrintBillButton() { + return [ + { + content: 'click print bill button', + trigger: '.control-buttons .control-button.order-printbill', + }, + ]; + } + clickSubmitButton() { + return [ + { + content: 'click print bill button', + trigger: '.control-buttons .control-button span:contains("Order")', + }, + ]; + } + } + + class CheckExt extends Check { + orderlineHasNote(name, quantity, note) { + return [ + { + content: `line has ${quantity} quantity`, + trigger: `.order .orderline .product-name:contains("${name}") ~ .info-list em:contains("${quantity}")`, + run: function () {}, // it's a check + }, + { + content: `line has '${note}' note`, + trigger: `.order .orderline .info-list .orderline-note:contains("${note}")`, + run: function () {}, // it's a check + }, + ]; + } + } + + class ExecuteExt extends Execute {} + + return createTourMethods('ProductScreen', DoExt, CheckExt, ExecuteExt); +}); diff --git a/addons/pos_restaurant/static/tests/tours/helpers/SplitBillScreenTourMethods.js b/addons/pos_restaurant/static/tests/tours/helpers/SplitBillScreenTourMethods.js new file mode 100644 index 00000000..7f58a1fc --- /dev/null +++ b/addons/pos_restaurant/static/tests/tours/helpers/SplitBillScreenTourMethods.js @@ -0,0 +1,65 @@ +odoo.define('pos_restaurant.tour.SplitBillScreenTourMethods', function (require) { + 'use strict'; + + const { createTourMethods } = require('point_of_sale.tour.utils'); + + class Do { + clickOrderline(name, totalQuantity) { + let trigger = `li.orderline .product-name:contains("${name}")`; + if (totalQuantity) { + trigger += ` ~ .info-list .info:contains("${totalQuantity}")`; + } + return [ + { + content: `click '${name}' orderline with total quantity of '${totalQuantity}'`, + trigger, + }, + ]; + } + clickBack() { + return [ + { + content: 'click back button', + trigger: `.splitbill-screen .button.back`, + }, + ]; + } + clickPay() { + return [ + { + content: 'click pay button', + trigger: `.splitbill-screen .pay-button .button` + } + ] + } + } + + class Check { + orderlineHas(name, totalQuantity, splitQuantity) { + return [ + { + content: `'${name}' orderline has total quantity of '${totalQuantity}'`, + trigger: `li.orderline .product-name:contains("${name}") ~ .info-list .info:contains("${totalQuantity}")`, + run: () => {}, + }, + { + content: `'${name}' orderline has '${splitQuantity}' quantity to split`, + trigger: `li.orderline .product-name:contains("${name}") ~ .info-list .info em:contains("${splitQuantity}")`, + run: () => {}, + }, + ]; + } + subtotalIs(amount) { + return [ + { + content: `total amount of split is '${amount}'`, + trigger: `.splitbill-screen .order-info .subtotal:contains("${amount}")`, + }, + ]; + } + } + + class Execute {} + + return createTourMethods('SplitBillScreen', Do, Check, Execute); +}); diff --git a/addons/pos_restaurant/static/tests/tours/helpers/TextAreaPopupTourMethods.js b/addons/pos_restaurant/static/tests/tours/helpers/TextAreaPopupTourMethods.js new file mode 100644 index 00000000..8f833370 --- /dev/null +++ b/addons/pos_restaurant/static/tests/tours/helpers/TextAreaPopupTourMethods.js @@ -0,0 +1,39 @@ +odoo.define('pos_restaurant.tour.TextAreaPopupTourMethods', function (require) { + 'use strict'; + + const { createTourMethods } = require('point_of_sale.tour.utils'); + + class Do { + inputText(val) { + return [ + { + content: `input text '${val}'`, + trigger: `.modal-dialog .popup-textarea textarea`, + run: `text ${val}`, + }, + ]; + } + clickConfirm() { + return [ + { + content: 'confirm text input popup', + trigger: '.modal-dialog .confirm', + }, + ]; + } + } + + class Check { + isShown() { + return [ + { + content: 'text input popup is shown', + trigger: '.modal-dialog .popup-textarea', + run: () => {}, + }, + ]; + } + } + + return createTourMethods('TextAreaPopup', Do, Check); +}); diff --git a/addons/pos_restaurant/static/tests/tours/helpers/TextInputPopupTourMethods.js b/addons/pos_restaurant/static/tests/tours/helpers/TextInputPopupTourMethods.js new file mode 100644 index 00000000..b46841c6 --- /dev/null +++ b/addons/pos_restaurant/static/tests/tours/helpers/TextInputPopupTourMethods.js @@ -0,0 +1,39 @@ +odoo.define('pos_restaurant.tour.TextInputPopupTourMethods', function (require) { + 'use strict'; + + const { createTourMethods } = require('point_of_sale.tour.utils'); + + class Do { + inputText(val) { + return [ + { + content: `input text '${val}'`, + trigger: `.modal-dialog .popup-textinput input`, + run: `text ${val}`, + }, + ]; + } + clickConfirm() { + return [ + { + content: 'confirm text input popup', + trigger: '.modal-dialog .confirm', + }, + ]; + } + } + + class Check { + isShown() { + return [ + { + content: 'text input popup is shown', + trigger: '.modal-dialog .popup-textinput', + run: () => {}, + }, + ]; + } + } + + return createTourMethods('TextInputPopup', Do, Check); +}); diff --git a/addons/pos_restaurant/static/tests/tours/helpers/TipScreenTourMethods.js b/addons/pos_restaurant/static/tests/tours/helpers/TipScreenTourMethods.js new file mode 100644 index 00000000..8895d566 --- /dev/null +++ b/addons/pos_restaurant/static/tests/tours/helpers/TipScreenTourMethods.js @@ -0,0 +1,60 @@ +odoo.define('pos_restaurant.tour.TipScreenTourMethods', function (require) { + 'use strict'; + + const { createTourMethods } = require('point_of_sale.tour.utils'); + + class Do { + clickPercentTip(percent) { + return [ + { + trigger: `.tip-screen .percentage:contains("${percent}")`, + }, + ]; + } + setCustomTip(amount) { + return [ + { + trigger: `.tip-screen .custom-amount-form input`, + run: `text ${amount}`, + }, + ]; + } + } + + class Check { + isShown() { + return [ + { + trigger: '.pos .tip-screen', + run: () => {}, + }, + ]; + } + totalAmountIs(amount) { + return [ + { + trigger: `.tip-screen .total-amount:contains("${amount}")`, + run: () => {}, + }, + ]; + } + percentAmountIs(percent, amount) { + return [ + { + trigger: `.tip-screen .percentage:contains("${percent}") ~ .amount:contains("${amount}")`, + run: () => {}, + }, + ]; + } + inputAmountIs(amount) { + return [ + { + trigger: `.tip-screen .custom-amount-form input[data-amount="${amount}"]`, + run: () => {}, + } + ] + } + } + + return createTourMethods('TipScreen', Do, Check); +}); |
