[IMP] point_of_sale, pos_loyalty: make pos tours run on mobile
The previous commit highlighted the fact that the pos is not really tested on mobile. This commit creates a new class that extends the TestUi class from point_of_sale, which runs most of the pos tours, and runs all the same tours on mobile. In order for these tours to run to completion correctly, a bunch of tour utils have been adapted to add mobile-only steps or fork a step into two mutually exclusive steps that run only on desktop or only on mobile. A tour in pos_loyalty has been adapted to the change in the pricelist selection utility function. closes odoo/odoo#120791 Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
<t t-name="ReceiptScreen" owl="1">
|
||||
<div class="receipt-screen screen">
|
||||
<div class="screen-content">
|
||||
<div class="top-content">
|
||||
<div class="top-content" t-if="!env.isMobile">
|
||||
<div class="top-content-center">
|
||||
<h1 t-if="!env.isMobile">
|
||||
<h1>
|
||||
<t t-esc="orderAmountPlusTip" />
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { Chrome } from "@point_of_sale/../tests/tours/helpers/ChromeTourMethods";
|
||||
import { ProductScreen } from "@point_of_sale/../tests/tours/helpers/ProductScreenTourMethods";
|
||||
import { PaymentScreen } from "@point_of_sale/../tests/tours/helpers/PaymentScreenTourMethods";
|
||||
import { TicketScreen} from "@point_of_sale/../tests/tours/helpers/TicketScreenTourMethods";
|
||||
import { TicketScreen } from "@point_of_sale/../tests/tours/helpers/TicketScreenTourMethods";
|
||||
import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils";
|
||||
import { registry } from "@web/core/registry";
|
||||
|
||||
@@ -67,7 +67,9 @@ PaymentScreen.check.remainingIs("0.0");
|
||||
PaymentScreen.check.changeIs("0.0");
|
||||
PaymentScreen.check.validateButtonIsHighlighted(true);
|
||||
|
||||
registry.category("web_tour.tours").add("PaymentScreenTour", { test: true, url: "/pos/ui", steps: getSteps() });
|
||||
registry
|
||||
.category("web_tour.tours")
|
||||
.add("PaymentScreenTour", { test: true, url: "/pos/ui", steps: getSteps() });
|
||||
|
||||
startSteps();
|
||||
|
||||
@@ -81,115 +83,125 @@ PaymentScreen.do.pressNumpad("1 0 0 0");
|
||||
PaymentScreen.check.remainingIs("0.0");
|
||||
PaymentScreen.check.changeIs("0.0");
|
||||
|
||||
registry.category("web_tour.tours").add("PaymentScreenTour2", { test: true, url: "/pos/ui", steps: getSteps() });
|
||||
registry
|
||||
.category("web_tour.tours")
|
||||
.add("PaymentScreenTour2", { test: true, url: "/pos/ui", steps: getSteps() });
|
||||
|
||||
startSteps();
|
||||
|
||||
ProductScreen.do.clickHomeCategory();
|
||||
ProductScreen.exec.addOrderline('Product Test', '1');
|
||||
ProductScreen.exec.addOrderline("Product Test", "1");
|
||||
ProductScreen.do.clickPayButton();
|
||||
|
||||
PaymentScreen.check.totalIs('2.00');
|
||||
PaymentScreen.do.clickPaymentMethod('Cash');
|
||||
PaymentScreen.check.totalIs("2.00");
|
||||
PaymentScreen.do.clickPaymentMethod("Cash");
|
||||
|
||||
PaymentScreen.check.remainingIs('0.0');
|
||||
PaymentScreen.check.changeIs('0.0');
|
||||
PaymentScreen.check.remainingIs("0.0");
|
||||
PaymentScreen.check.changeIs("0.0");
|
||||
|
||||
Chrome.do.clickMenuButton();
|
||||
Chrome.do.clickTicketButton();
|
||||
TicketScreen.do.clickNewTicket();
|
||||
|
||||
ProductScreen.exec.addOrderline('Product Test', '-1');
|
||||
ProductScreen.exec.addOrderline("Product Test", "-1");
|
||||
ProductScreen.do.clickPayButton();
|
||||
|
||||
PaymentScreen.check.totalIs('-2.00');
|
||||
PaymentScreen.do.clickPaymentMethod('Cash');
|
||||
PaymentScreen.check.totalIs("-2.00");
|
||||
PaymentScreen.do.clickPaymentMethod("Cash");
|
||||
|
||||
PaymentScreen.check.remainingIs('0.0');
|
||||
PaymentScreen.check.changeIs('0.0');
|
||||
PaymentScreen.check.remainingIs("0.0");
|
||||
PaymentScreen.check.changeIs("0.0");
|
||||
|
||||
registry.category("web_tour.tours").add('PaymentScreenRoundingUp', { test: true, url: '/pos/ui', steps: getSteps() });
|
||||
registry
|
||||
.category("web_tour.tours")
|
||||
.add("PaymentScreenRoundingUp", { test: true, url: "/pos/ui", steps: getSteps() });
|
||||
|
||||
startSteps();
|
||||
|
||||
ProductScreen.do.clickHomeCategory();
|
||||
ProductScreen.exec.addOrderline('Product Test', '1');
|
||||
ProductScreen.exec.addOrderline("Product Test", "1");
|
||||
ProductScreen.do.clickPayButton();
|
||||
|
||||
PaymentScreen.check.totalIs('1.95');
|
||||
PaymentScreen.do.clickPaymentMethod('Cash');
|
||||
PaymentScreen.check.totalIs("1.95");
|
||||
PaymentScreen.do.clickPaymentMethod("Cash");
|
||||
|
||||
PaymentScreen.check.remainingIs('0.0');
|
||||
PaymentScreen.check.changeIs('0.0');
|
||||
PaymentScreen.check.remainingIs("0.0");
|
||||
PaymentScreen.check.changeIs("0.0");
|
||||
|
||||
Chrome.do.clickMenuButton();
|
||||
Chrome.do.clickTicketButton();
|
||||
TicketScreen.do.clickNewTicket();
|
||||
|
||||
ProductScreen.exec.addOrderline('Product Test', '-1');
|
||||
ProductScreen.exec.addOrderline("Product Test", "-1");
|
||||
ProductScreen.do.clickPayButton();
|
||||
|
||||
PaymentScreen.check.totalIs('-1.95');
|
||||
PaymentScreen.do.clickPaymentMethod('Cash');
|
||||
PaymentScreen.check.totalIs("-1.95");
|
||||
PaymentScreen.do.clickPaymentMethod("Cash");
|
||||
|
||||
PaymentScreen.check.remainingIs('0.0');
|
||||
PaymentScreen.check.changeIs('0.0');
|
||||
PaymentScreen.check.remainingIs("0.0");
|
||||
PaymentScreen.check.changeIs("0.0");
|
||||
|
||||
registry.category("web_tour.tours").add('PaymentScreenRoundingDown', { test: true, url: '/pos/ui', steps: getSteps() });
|
||||
registry
|
||||
.category("web_tour.tours")
|
||||
.add("PaymentScreenRoundingDown", { test: true, url: "/pos/ui", steps: getSteps() });
|
||||
|
||||
startSteps();
|
||||
|
||||
ProductScreen.do.clickHomeCategory();
|
||||
ProductScreen.exec.addOrderline('Product Test 1.2', '1');
|
||||
ProductScreen.exec.addOrderline("Product Test 1.2", "1");
|
||||
ProductScreen.do.clickPayButton();
|
||||
|
||||
PaymentScreen.check.totalIs('1.00');
|
||||
PaymentScreen.do.clickPaymentMethod('Cash');
|
||||
PaymentScreen.check.totalIs("1.00");
|
||||
PaymentScreen.do.clickPaymentMethod("Cash");
|
||||
|
||||
PaymentScreen.check.remainingIs('0.0');
|
||||
PaymentScreen.check.changeIs('0.0');
|
||||
PaymentScreen.check.remainingIs("0.0");
|
||||
PaymentScreen.check.changeIs("0.0");
|
||||
|
||||
Chrome.do.clickMenuButton();
|
||||
Chrome.do.clickTicketButton();
|
||||
TicketScreen.do.clickNewTicket();
|
||||
|
||||
ProductScreen.exec.addOrderline('Product Test 1.25', '1');
|
||||
ProductScreen.exec.addOrderline("Product Test 1.25", "1");
|
||||
ProductScreen.do.clickPayButton();
|
||||
|
||||
PaymentScreen.check.totalIs('1.5');
|
||||
PaymentScreen.do.clickPaymentMethod('Cash');
|
||||
PaymentScreen.check.totalIs("1.5");
|
||||
PaymentScreen.do.clickPaymentMethod("Cash");
|
||||
|
||||
PaymentScreen.check.remainingIs('0.0');
|
||||
PaymentScreen.check.changeIs('0.0');
|
||||
PaymentScreen.check.remainingIs("0.0");
|
||||
PaymentScreen.check.changeIs("0.0");
|
||||
|
||||
Chrome.do.clickMenuButton();
|
||||
Chrome.do.clickTicketButton();
|
||||
TicketScreen.do.clickNewTicket();
|
||||
|
||||
ProductScreen.exec.addOrderline('Product Test 1.4', '1');
|
||||
ProductScreen.exec.addOrderline("Product Test 1.4", "1");
|
||||
ProductScreen.do.clickPayButton();
|
||||
|
||||
PaymentScreen.check.totalIs('1.5');
|
||||
PaymentScreen.do.clickPaymentMethod('Cash');
|
||||
PaymentScreen.check.totalIs("1.5");
|
||||
PaymentScreen.do.clickPaymentMethod("Cash");
|
||||
|
||||
PaymentScreen.check.remainingIs('0.0');
|
||||
PaymentScreen.check.changeIs('0.0');
|
||||
PaymentScreen.check.remainingIs("0.0");
|
||||
PaymentScreen.check.changeIs("0.0");
|
||||
|
||||
registry.category("web_tour.tours").add('PaymentScreenRoundingHalfUp', { test: true, url: '/pos/ui', steps: getSteps() });
|
||||
registry
|
||||
.category("web_tour.tours")
|
||||
.add("PaymentScreenRoundingHalfUp", { test: true, url: "/pos/ui", steps: getSteps() });
|
||||
|
||||
startSteps();
|
||||
|
||||
ProductScreen.do.confirmOpeningPopup();
|
||||
ProductScreen.do.clickHomeCategory();
|
||||
ProductScreen.exec.addOrderline('Product Test', '1');
|
||||
ProductScreen.exec.addOrderline("Product Test", "1");
|
||||
ProductScreen.do.clickPayButton();
|
||||
|
||||
PaymentScreen.check.totalIs('1.95');
|
||||
PaymentScreen.do.clickPaymentMethod('Cash');
|
||||
PaymentScreen.do.pressNumpad('5');
|
||||
PaymentScreen.check.totalIs("1.95");
|
||||
PaymentScreen.do.clickPaymentMethod("Cash");
|
||||
PaymentScreen.do.pressNumpad("5");
|
||||
|
||||
PaymentScreen.check.remainingIs('0.0');
|
||||
PaymentScreen.check.changeIs('3.05');
|
||||
PaymentScreen.check.totalDueIs('1.95');
|
||||
PaymentScreen.check.remainingIs("0.0");
|
||||
PaymentScreen.check.changeIs("3.05");
|
||||
PaymentScreen.check.totalDueIs("1.95");
|
||||
|
||||
registry.category("web_tour.tours").add('PaymentScreenTotalDueWithOverPayment', { test: true, url: '/pos/ui', steps: getSteps() });
|
||||
registry
|
||||
.category("web_tour.tours")
|
||||
.add("PaymentScreenTotalDueWithOverPayment", { test: true, url: "/pos/ui", steps: getSteps() });
|
||||
|
||||
@@ -74,7 +74,6 @@ startSteps();
|
||||
|
||||
ProductScreen.do.clickHomeCategory();
|
||||
ProductScreen.exec.addOrderline("Test Product", "1");
|
||||
ProductScreen.do.clickPricelistButton();
|
||||
ProductScreen.do.selectPriceList("special_pricelist");
|
||||
ProductScreen.check.discountOriginalPriceIs("7.0");
|
||||
ProductScreen.do.clickPayButton();
|
||||
|
||||
@@ -8,16 +8,36 @@ function add_product_to_order(product_name) {
|
||||
content: "buy " + product_name,
|
||||
trigger: '.product-list .product-name:contains("' + product_name + '")',
|
||||
},
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "the " + product_name + " have been added to the order",
|
||||
trigger: '.order .product-name:contains("' + product_name + '")',
|
||||
run: function () {},
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
function set_fiscal_position_on_order(fp_name) {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click more button",
|
||||
trigger: ".control-button:contains('More')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "set fiscal position",
|
||||
trigger: ".control-button.o_fiscal_position_button",
|
||||
@@ -26,11 +46,21 @@ function set_fiscal_position_on_order(fp_name) {
|
||||
content: "choose fiscal position " + fp_name + " to add to the order",
|
||||
trigger: '.popups .popup .selection .selection-item:contains("' + fp_name + '")',
|
||||
},
|
||||
{
|
||||
content: "click more button",
|
||||
trigger: ".control-button:contains('More')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "the fiscal position " + fp_name + " has been set to the order",
|
||||
trigger: '.control-button.o_fiscal_position_button:contains("' + fp_name + '")',
|
||||
run: function () {},
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -45,10 +75,20 @@ function press_payment_numpad(val) {
|
||||
|
||||
function press_product_numpad(val) {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: `press ${val} on product screen numpad`,
|
||||
trigger: `.numpad .input-button:contains("${val}"):visible`,
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -64,7 +104,13 @@ function selected_payment_has(name, val) {
|
||||
}
|
||||
|
||||
function selected_orderline_has({ product, price = null, quantity = null }) {
|
||||
const result = [];
|
||||
const result = [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
if (price !== null) {
|
||||
result.push({
|
||||
content: `Selected line has product '${product}' and price '${price}'`,
|
||||
@@ -79,16 +125,31 @@ function selected_orderline_has({ product, price = null, quantity = null }) {
|
||||
run: function () {},
|
||||
});
|
||||
}
|
||||
result.push({
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function verify_order_total(total_str) {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "order total contains " + total_str,
|
||||
trigger: '.order .total .value:contains("' + total_str + '")',
|
||||
run: function () {}, // it's a check
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -97,6 +158,12 @@ function goto_payment_screen_and_select_payment_method() {
|
||||
{
|
||||
content: "go to payment screen",
|
||||
trigger: ".button.pay",
|
||||
mobile: false,
|
||||
},
|
||||
{
|
||||
content: "go to payment screen",
|
||||
trigger: ".btn-switchpane:contains('Pay')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "pay with cash",
|
||||
@@ -110,6 +177,12 @@ function finish_order() {
|
||||
{
|
||||
content: "validate the order",
|
||||
trigger: ".payment-screen .button.next.highlight:visible",
|
||||
mobile: false,
|
||||
},
|
||||
{
|
||||
content: "validate the order",
|
||||
trigger: ".payment-screen .btn-switchpane:contains('Validate')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "verify that the order has been successfully sent to the backend",
|
||||
|
||||
@@ -44,6 +44,12 @@ class Do {
|
||||
{
|
||||
content: "validate payment",
|
||||
trigger: `.payment-screen .button.next.highlight`,
|
||||
mobile: false,
|
||||
},
|
||||
{
|
||||
content: "validate payment",
|
||||
trigger: `.payment-screen .btn-switchpane:contains('Validate')`,
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -143,6 +149,15 @@ class Check {
|
||||
? `.payment-screen .button.next.highlight`
|
||||
: `.payment-screen .button.next:not(:has(.highlight))`,
|
||||
run: () => {},
|
||||
mobile: false,
|
||||
},
|
||||
{
|
||||
content: `validate button is ${isHighlighted ? "highlighted" : "not highligted"}`,
|
||||
trigger: isHighlighted
|
||||
? `.payment-screen .btn-switchpane:not(.secondary):contains('Validate')`
|
||||
: `.payment-screen .btn-switchpane.secondary:contains('Validate')`,
|
||||
run: () => {},
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -15,6 +15,11 @@ class Do {
|
||||
|
||||
clickOrderline(name, quantity) {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: `selecting orderline with product '${name}' and quantity '${quantity}'`,
|
||||
trigger: `.order .orderline:not(:has(.selected)) .product-name:contains("${name}") ~ .info-list em:contains("${quantity}")`,
|
||||
@@ -24,6 +29,11 @@ class Do {
|
||||
trigger: `.order .orderline.selected .product-name:contains("${name}") ~ .info-list em:contains("${quantity}")`,
|
||||
run: () => {},
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -76,12 +86,33 @@ class Do {
|
||||
trigger,
|
||||
};
|
||||
}
|
||||
return keys.split(" ").map(generateStep);
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
...keys.split(" ").map(generateStep),
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
clickPayButton(shouldCheck = true) {
|
||||
const steps = [
|
||||
{ content: "click pay button", trigger: ".product-screen .pay-order-button" },
|
||||
{
|
||||
content: "click pay button",
|
||||
trigger: ".product-screen .pay-order-button",
|
||||
mobile: false,
|
||||
},
|
||||
{
|
||||
content: "click pay button",
|
||||
trigger: ".btn-switchpane:contains('Pay')",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
if (shouldCheck) {
|
||||
steps.push({
|
||||
@@ -95,6 +126,11 @@ class Do {
|
||||
|
||||
clickPartnerButton() {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{ content: "click customer button", trigger: ".actionpad .button.set-partner" },
|
||||
{
|
||||
content: "partner screen is shown",
|
||||
@@ -110,11 +146,26 @@ class Do {
|
||||
content: `select customer '${name}'`,
|
||||
trigger: `.partnerlist-screen .partner-line td:contains("${name}")`,
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
clickOrderlineCustomerNoteButton() {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click more button",
|
||||
trigger: ".control-button:contains('More')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click customer note button",
|
||||
trigger: '.control-buttons .control-button span:contains("Customer Note")',
|
||||
@@ -123,6 +174,16 @@ class Do {
|
||||
}
|
||||
clickRefund() {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click more button",
|
||||
trigger: ".control-button:contains('More')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
trigger: '.control-button:contains("Refund")',
|
||||
},
|
||||
@@ -131,15 +192,28 @@ class Do {
|
||||
confirmOpeningPopup() {
|
||||
return [{ trigger: '.opening-cash-control .button:contains("Open session")' }];
|
||||
}
|
||||
clickPricelistButton() {
|
||||
return [{ trigger: ".o_pricelist_button" }];
|
||||
}
|
||||
selectPriceList(name) {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click more button",
|
||||
trigger: ".control-button:contains('More')",
|
||||
mobile: true,
|
||||
},
|
||||
{ trigger: ".o_pricelist_button" },
|
||||
{
|
||||
content: `select price list '${name}'`,
|
||||
trigger: `.selection-item:contains("${name}")`,
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
enterOpeningAmount(amount) {
|
||||
@@ -153,6 +227,16 @@ class Do {
|
||||
}
|
||||
changeFiscalPosition(name) {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click more button",
|
||||
trigger: ".control-button:contains('More')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click fiscal position button",
|
||||
trigger: ".o_fiscal_position_button",
|
||||
@@ -161,6 +245,11 @@ class Do {
|
||||
content: "fiscal position screen is shown",
|
||||
trigger: `.selection-item:contains("${name}")`,
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
clickCloseButton() {
|
||||
@@ -199,6 +288,11 @@ class Check {
|
||||
}
|
||||
selectedOrderlineHas(name, quantity, price) {
|
||||
const res = [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
// check first if the order widget is there and has orderlines
|
||||
content: "order widget has orderlines",
|
||||
@@ -225,15 +319,30 @@ class Check {
|
||||
run: function () {}, // it's a check
|
||||
});
|
||||
}
|
||||
res.push({
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
});
|
||||
return res;
|
||||
}
|
||||
orderIsEmpty() {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: `order is empty`,
|
||||
trigger: `.order .order-empty`,
|
||||
run: () => {},
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -248,20 +357,40 @@ class Check {
|
||||
}
|
||||
totalAmountIs(amount) {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: `order total amount is '${amount}'`,
|
||||
trigger: `.order-container .order .summary .value:contains("${amount}")`,
|
||||
run: () => {},
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
modeIsActive(mode) {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: `'${mode}' is active`,
|
||||
trigger: `.numpad button.selected-mode:contains('${mode}')`,
|
||||
run: function () {},
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
orderlineHasCustomerNote(name, quantity, note) {
|
||||
@@ -302,19 +431,39 @@ class Check {
|
||||
}
|
||||
noDiscountApplied(originalPrice) {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "no discount is applied",
|
||||
trigger: `.info:not(:contains(${originalPrice}))`,
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
discountOriginalPriceIs(original_price) {
|
||||
return [
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: `discount original price is shown`,
|
||||
trigger: `s:contains('${original_price}')`,
|
||||
run: function () {},
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
cashDifferenceIs(val) {
|
||||
@@ -386,6 +535,11 @@ class Execute {
|
||||
res.push(...this._do.clickOrderlineCustomerNoteButton());
|
||||
res.push(...TextAreaPopup._do.inputText(note));
|
||||
res.push(...TextAreaPopup._do.clickConfirm());
|
||||
res.push({
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
});
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,12 @@ class Check {
|
||||
{
|
||||
trigger: `.receipt-screen .top-content h1:contains("${value}")`,
|
||||
run: () => {},
|
||||
mobile: false, // not rendered on mobile
|
||||
},
|
||||
{
|
||||
trigger: `.receipt-screen`,
|
||||
run: () => {},
|
||||
mobile: true, // On mobile, at least wait for the receipt screen to show
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -95,7 +101,7 @@ class Check {
|
||||
return [
|
||||
{
|
||||
trigger: `.orderlines:not(:contains('->'))`,
|
||||
run: () => { },
|
||||
run: () => {},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@ class Do {
|
||||
}
|
||||
selectFilter(name) {
|
||||
return [
|
||||
{
|
||||
content: "open search bar",
|
||||
trigger: "button.search",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
trigger: `.pos-search-bar .filter`,
|
||||
},
|
||||
@@ -35,10 +40,20 @@ class Do {
|
||||
{
|
||||
trigger: `.pos-search-bar .filter ul li:contains("${name}")`,
|
||||
},
|
||||
{
|
||||
content: "close search bar",
|
||||
trigger: "button.arrow-left",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
search(field, searchWord) {
|
||||
return [
|
||||
{
|
||||
content: "open search bar",
|
||||
trigger: "button.search",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
trigger: ".pos-search-bar input",
|
||||
run: `text ${searchWord}`,
|
||||
@@ -58,6 +73,11 @@ class Do {
|
||||
{
|
||||
trigger: `.pos-search-bar .search ul li:contains("${field}")`,
|
||||
},
|
||||
{
|
||||
content: "close search bar",
|
||||
trigger: "button.arrow-left",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
settleTips() {
|
||||
@@ -130,7 +150,7 @@ class Check {
|
||||
},
|
||||
];
|
||||
}
|
||||
contains( string) {
|
||||
contains(string) {
|
||||
return [
|
||||
{
|
||||
trigger: `.ticket-screen .orders:contains("${string}")`,
|
||||
@@ -156,10 +176,20 @@ class Check {
|
||||
}
|
||||
filterIs(name) {
|
||||
return [
|
||||
{
|
||||
content: "open search bar",
|
||||
trigger: "button.search",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
trigger: `.ticket-screen .pos-search-bar .filter span:contains("${name}")`,
|
||||
run: () => {},
|
||||
},
|
||||
{
|
||||
content: "close search bar",
|
||||
trigger: "button.arrow-left",
|
||||
mobile: true,
|
||||
},
|
||||
];
|
||||
}
|
||||
partnerIs(name) {
|
||||
|
||||
@@ -105,6 +105,16 @@ steps = steps.concat([
|
||||
trigger: ".breadcrumb-home",
|
||||
run: "click",
|
||||
},
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click more button",
|
||||
trigger: ".control-button:contains('More')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click pricelist button",
|
||||
trigger: ".control-button.o_pricelist_button",
|
||||
@@ -126,6 +136,11 @@ steps = steps.concat([
|
||||
content: "select Deco Addict",
|
||||
trigger: ".partner-line:contains('Deco Addict')",
|
||||
},
|
||||
{
|
||||
content: "click more button",
|
||||
trigger: ".control-button:contains('More')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click pricelist button",
|
||||
trigger: ".control-button.o_pricelist_button",
|
||||
@@ -147,6 +162,11 @@ steps = steps.concat([
|
||||
content: "select Lumber Inc",
|
||||
trigger: ".partner-line:contains('Lumber Inc')",
|
||||
},
|
||||
{
|
||||
content: "click more button",
|
||||
trigger: ".control-button:contains('More')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click pricelist button",
|
||||
trigger: ".control-button.o_pricelist_button",
|
||||
@@ -160,10 +180,20 @@ steps = steps.concat([
|
||||
content: "cancel pricelist dialog",
|
||||
trigger: ".button.cancel:visible",
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "order 1 kg shelf",
|
||||
trigger: ".product:contains('Wall Shelf')",
|
||||
},
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
trigger:
|
||||
".order-container .orderlines .orderline.selected .product-name:contains('Wall Shelf')",
|
||||
@@ -171,6 +201,11 @@ steps = steps.concat([
|
||||
".order-container .orderlines .orderline.selected .product-name:contains('Wall Shelf') ~ .info-list .info em:contains('1.0')",
|
||||
run: function () {},
|
||||
},
|
||||
{
|
||||
content: "click more button",
|
||||
trigger: ".control-button:contains('More')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click pricelist button",
|
||||
trigger: ".control-button.o_pricelist_button",
|
||||
@@ -196,10 +231,20 @@ steps = steps.concat([
|
||||
trigger: `.total > .value:contains('$${nbsp}2.00')`,
|
||||
run: function () {},
|
||||
},
|
||||
{
|
||||
content: "go back to the products",
|
||||
trigger: ".back-button",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "order different shelf",
|
||||
trigger: ".product:contains('Small Shelf')",
|
||||
},
|
||||
{
|
||||
content: "click review button",
|
||||
trigger: ".btn-switchpane:contains('Review')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "Small Shelf line should be selected with quantity 1",
|
||||
trigger:
|
||||
@@ -237,6 +282,11 @@ steps = steps.concat([
|
||||
trigger: ".numpad button.selected-mode:contains('Qty')",
|
||||
run: function () {},
|
||||
},
|
||||
{
|
||||
content: "click more button",
|
||||
trigger: ".control-button:contains('More')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click pricelist button",
|
||||
trigger: ".control-button.o_pricelist_button",
|
||||
@@ -250,6 +300,11 @@ steps = steps.concat([
|
||||
"verify that the boni shelf have been recomputed and the shelf have not (their price was manually overridden)",
|
||||
trigger: `.total > .value:contains('$${nbsp}8.96')`,
|
||||
},
|
||||
{
|
||||
content: "click more button",
|
||||
trigger: ".control-button:contains('More')",
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "click pricelist button",
|
||||
trigger: ".control-button.o_pricelist_button",
|
||||
|
||||
@@ -777,3 +777,8 @@ class TestUi(TestPointOfSaleHttpCommon):
|
||||
|
||||
self.main_pos_config.open_ui()
|
||||
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'ReceiptScreenDiscountWithPricelistTour', login="accountman")
|
||||
|
||||
# This class just runs the same tests as above but with mobile emulation
|
||||
class MobileTestUi(TestUi):
|
||||
browser_size = '375x667'
|
||||
touch_enabled = True
|
||||
|
||||
@@ -72,7 +72,9 @@ PosLoyalty.check.hasRewardLine("50% on specific products", "-16.66"); // 17.55 -
|
||||
PosLoyalty.check.orderTotalIs("37.78");
|
||||
PosLoyalty.exec.finalizeOrder("Cash", "50");
|
||||
|
||||
registry.category("web_tour.tours").add("PosLoyaltyTour1", { test: true, url: "/pos/web", steps: getSteps() });
|
||||
registry
|
||||
.category("web_tour.tours")
|
||||
.add("PosLoyaltyTour1", { test: true, url: "/pos/web", steps: getSteps() });
|
||||
|
||||
// --- PoS Loyalty Tour Basic Part 2 ---
|
||||
// Using the coupons generated from PosLoyaltyTour1.
|
||||
@@ -156,7 +158,9 @@ PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-2.87");
|
||||
PosLoyalty.check.orderTotalIs("16.27");
|
||||
PosLoyalty.exec.finalizeOrder("Cash", "20");
|
||||
|
||||
registry.category("web_tour.tours").add("PosLoyaltyTour2", { test: true, url: "/pos/web", steps: getSteps() });
|
||||
registry
|
||||
.category("web_tour.tours")
|
||||
.add("PosLoyaltyTour2", { test: true, url: "/pos/web", steps: getSteps() });
|
||||
|
||||
// --- PoS Loyalty Tour Basic Part 3 ---
|
||||
|
||||
@@ -177,7 +181,9 @@ PosLoyalty.check.hasRewardLine("100% on specific products", "21.82");
|
||||
PosLoyalty.check.hasRewardLine("100% on specific products", "18.18");
|
||||
PosLoyalty.check.orderTotalIs("49.50");
|
||||
|
||||
registry.category("web_tour.tours").add("PosLoyaltyTour3", { test: true, url: "/pos/web", steps: getSteps() });
|
||||
registry
|
||||
.category("web_tour.tours")
|
||||
.add("PosLoyaltyTour3", { test: true, url: "/pos/web", steps: getSteps() });
|
||||
|
||||
startSteps();
|
||||
|
||||
@@ -186,23 +192,25 @@ ProductScreen.do.clickHomeCategory();
|
||||
|
||||
ProductScreen.exec.addOrderline("Test Product 1", "1");
|
||||
ProductScreen.exec.addOrderline("Test Product 2", "1");
|
||||
ProductScreen.do.clickPricelistButton();
|
||||
ProductScreen.do.selectPriceList("Public Pricelist");
|
||||
PosLoyalty.do.enterCode("abcda");
|
||||
PosLoyalty.check.orderTotalIs("0.00");
|
||||
ProductScreen.do.clickPricelistButton();
|
||||
ProductScreen.do.selectPriceList("Test multi-currency");
|
||||
PosLoyalty.check.orderTotalIs("0.00");
|
||||
|
||||
registry.category("web_tour.tours").add("PosLoyaltyTour4", { test: true, url: "/pos/web", steps: getSteps() });
|
||||
registry
|
||||
.category("web_tour.tours")
|
||||
.add("PosLoyaltyTour4", { test: true, url: "/pos/web", steps: getSteps() });
|
||||
|
||||
startSteps();
|
||||
|
||||
ProductScreen.do.clickHomeCategory();
|
||||
|
||||
ProductScreen.exec.addOrderline('Test Product 1', '1.00', '100');
|
||||
ProductScreen.exec.addOrderline("Test Product 1", "1.00", "100");
|
||||
PosLoyalty.do.clickDiscountButton();
|
||||
PosLoyalty.do.clickConfirmButton();
|
||||
ProductScreen.check.totalAmountIs('92.00');
|
||||
ProductScreen.check.totalAmountIs("92.00");
|
||||
|
||||
registry.category("web_tour.tours").add('PosCouponTour5', { test: true, url: '/pos/web', steps: getSteps() });
|
||||
registry
|
||||
.category("web_tour.tours")
|
||||
.add("PosCouponTour5", { test: true, url: "/pos/web", steps: getSteps() });
|
||||
|
||||
Reference in New Issue
Block a user