summaryrefslogtreecommitdiff
path: root/addons/pos_hr/static/tests/tours/PosHrTour.js
blob: 99f5057a0d6a14ab68bf348b3f61b87c4598f6fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
odoo.define('point_of_sale.tour.PosHr', function (require) {
    'use strict';

    const { PosHr } = require('pos_hr.tour.PosHrTourMethods');
    const { ProductScreen } = require('point_of_sale.tour.ProductScreenTourMethods');
    const { TicketScreen } = require('point_of_sale.tour.TicketScreenTourMethods');
    const { Chrome } = require('point_of_sale.tour.ChromeTourMethods');
    const { ErrorPopup } = require('point_of_sale.tour.ErrorPopupTourMethods');
    const { NumberPopup } = require('point_of_sale.tour.NumberPopupTourMethods');
    const { SelectionPopup } = require('point_of_sale.tour.SelectionPopupTourMethods');
    const { getSteps, startSteps } = require('point_of_sale.tour.utils');
    const Tour = require('web_tour.tour');

    startSteps();

    PosHr.check.loginScreenIsShown();
    PosHr.do.clickLoginButton();
    SelectionPopup.check.isShown();
    SelectionPopup.check.hasSelectionItem('Pos Employee1');
    SelectionPopup.check.hasSelectionItem('Pos Employee2');
    SelectionPopup.check.hasSelectionItem('Mitchell Admin');
    SelectionPopup.do.clickItem('Pos Employee1');
    NumberPopup.check.isShown();
    NumberPopup.do.pressNumpad('2 5');
    NumberPopup.check.inputShownIs('••');
    NumberPopup.do.pressNumpad('8 1');
    NumberPopup.check.inputShownIs('••••');
    NumberPopup.do.clickConfirm();
    ErrorPopup.check.isShown();
    ErrorPopup.do.clickConfirm();
    PosHr.do.clickLoginButton();
    SelectionPopup.do.clickItem('Pos Employee1');
    NumberPopup.check.isShown();
    NumberPopup.do.pressNumpad('2 5');
    NumberPopup.check.inputShownIs('••');
    NumberPopup.do.pressNumpad('8 0');
    NumberPopup.check.inputShownIs('••••');
    NumberPopup.do.clickConfirm();
    ProductScreen.check.isShown();
    PosHr.check.cashierNameIs('Pos Employee1');
    PosHr.do.clickCashierName();
    SelectionPopup.do.clickItem('Mitchell Admin');
    PosHr.check.cashierNameIs('Mitchell Admin');
    PosHr.do.clickLockButton();
    PosHr.do.clickLoginButton();
    SelectionPopup.do.clickItem('Pos Employee2');
    NumberPopup.do.pressNumpad('1 2');
    NumberPopup.check.inputShownIs('••');
    NumberPopup.do.pressNumpad('3 4');
    NumberPopup.check.inputShownIs('••••');
    NumberPopup.do.clickConfirm();
    ProductScreen.check.isShown();
    ProductScreen.do.clickHomeCategory();

    // Create orders and check if the ticket list has the right employee for each order
    // order for employee 2
    ProductScreen.exec.addOrderline('Desk Pad', '1', '2');
    ProductScreen.check.totalAmountIs('2.0')
    Chrome.do.clickTicketButton();
    TicketScreen.check.nthRowContains(2, 'Pos Employee2');

    // order for employee 1
    PosHr.do.clickLockButton();
    PosHr.exec.login('Pos Employee1', '2580');
    TicketScreen.do.clickNewTicket();
    ProductScreen.exec.addOrderline('Desk Pad', '1', '4');
    ProductScreen.check.totalAmountIs('4.0')
    Chrome.do.clickTicketButton();
    TicketScreen.check.nthRowContains(2, 'Pos Employee2');
    TicketScreen.check.nthRowContains(3, 'Pos Employee1');

    // order for admin
    PosHr.do.clickCashierName();
    SelectionPopup.do.clickItem('Mitchell Admin');
    PosHr.check.cashierNameIs('Mitchell Admin');
    TicketScreen.do.clickNewTicket();
    ProductScreen.exec.addOrderline('Desk Pad', '1', '8');
    ProductScreen.check.totalAmountIs('8.0')
    Chrome.do.clickTicketButton();
    TicketScreen.check.nthRowContains(4, 'Mitchell Admin');

    Tour.register('PosHrTour', { test: true, url: '/pos/ui' }, getSteps());
});