summaryrefslogtreecommitdiff
path: root/addons/pos_restaurant/static/tests/tours/helpers/TipScreenTourMethods.js
blob: 8895d566c31e5eac5efa8570fad6ebea307d473b (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
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);
});