Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Live_spec.js « UI « tests « Live « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9e0ba37874c77f1ebc22fd6e4aa4e5ee6733ef51 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*!
 * Matomo - free/libre analytics platform
 *
 * Screenshot integration tests.
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

describe("Live", function () {
    this.fixture = "Piwik\\Plugins\\Live\\tests\\Fixtures\\VisitsWithAllActionsAndDevices";

    after(function () {
        if (testEnvironment.configOverride.Deletelogs) {
            delete testEnvironment.configOverride.Deletelogs;
            testEnvironment.save();
        }
    });

    it('should show visitor log', async function() {
        await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2010-01-03#?idSite=1&period=year&date=2010-01-03&category=General_Visitors&subcategory=Live_VisitorLog");

        await page.waitForNetworkIdle();
        await page.waitFor('.dataTableVizVisitorLog');

        var report = await page.$('.reporting-page');
        expect(await report.screenshot()).to.matchImage('visitor_log');
    });

    it('should expand grouped actions', async function() {
        await page.click('.dataTableVizVisitorLog .repeat.icon-refresh');
        await page.mouse.move(-10, -10);

        var report = await page.$('.dataTableVizVisitorLog .card.row:first-child');
        expect(await report.screenshot()).to.matchImage('visitor_log_expand_actions');
    });

    it('should expand collapsed pageview actions', async function() {
        const link = await page.jQuery('.dataTableVizVisitorLog .card.row:eq(1) .show-more-actions:visible');
        await link.click();

        await page.mouse.move(-10, -10);

        const report = await page.jQuery('.dataTableVizVisitorLog .card.row:eq(1)');
        expect(await report.screenshot()).to.matchImage('visitor_log_expand_pageview_actions');
    });

    it('should expand collapsed content actions', async function() {
        // collapse previously expanded section
        const prevlink = await page.jQuery('.dataTableVizVisitorLog .card.row:eq(1) .show-less-actions:visible');
        await prevlink.click();

        const link = await page.jQuery('.dataTableVizVisitorLog .card.row:eq(2) .collapsed-contents:visible');
        await link.click();

        await page.mouse.move(-10, -10);

        const report = await page.jQuery('.dataTableVizVisitorLog .card.row:eq(2)');
        expect(await report.screenshot()).to.matchImage('visitor_log_expand_content_actions');
    });

    it('should show visitor profile', async function() {
        // collapse previously expanded section
        const prevlink = await page.jQuery('.dataTableVizVisitorLog .card.row:eq(2) .collapsed-contents:visible');
        await prevlink.click();

        await page.evaluate(function(){
            $('.card:first-child .visitor-log-visitor-profile-link').click();
        });

        await page.waitForSelector('.ui-dialog');
        await page.waitForNetworkIdle();

        var dialog = await page.$('.ui-dialog');
        expect(await dialog.screenshot()).to.matchImage('visitor_profile');
    });

    it('should load additional visits in visitor log', async function() {

        await page.click('.visitor-profile-more-info a');

        await page.waitForNetworkIdle();

        var dialog = await page.$('.ui-dialog');
        expect(await dialog.screenshot()).to.matchImage('visitor_profile_more_visits');
    });

    it('should hide all action details', async function() {
        await page.evaluate(function(){
            $('.visitor-profile-toggle-actions').click();
        });

        await page.mouse.move(0, 0);

        var dialog = await page.$('.ui-dialog');
        expect(await dialog.screenshot()).to.matchImage('visitor_profile_actions_hidden');
    });

    it('should show visit details', async function() {
        await page.evaluate(function(){
            $('.visitor-profile-visit-title')[0].click();
        });

        var dialog = await page.$('.ui-dialog');
        expect(await dialog.screenshot()).to.matchImage('visitor_profile_visit_details');
    });

    it('should show action details', async function() {
        await page.click('.visitor-profile-visits li:first-child .visitor-profile-show-actions');
        await page.waitForNetworkIdle();

        await page.mouse.move(-10, -10);

        var dialog = await page.$('.ui-dialog');
        expect(await dialog.screenshot()).to.matchImage('visitor_profile_action_details');
    });

    it('should show action tooltip', async function() {
        var action = await page.jQuery('.visitor-profile-visits li:first-child .visitor-profile-actions .action:first-child');
        await action.hover();
        await page.waitForSelector('.ui-tooltip');

        const elem = await page.$('.ui-tooltip');
        expect(await elem.screenshot()).to.matchImage('visitor_profile_action_tooltip');
    });

    it('should show limited profile message', async function () {
        // Limit number of shown visits to 5
        testEnvironment.overrideConfig('General', 'live_visitor_profile_max_visits_to_aggregate', 5);
        testEnvironment.save();

        await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2010-01-03#?idSite=1&period=year&date=2010-01-03&category=General_Visitors&subcategory=Live_VisitorLog");
        await page.evaluate(function(){
            $('.card:first-child .visitor-log-visitor-profile-link').click();
        });

        await page.waitForSelector('.ui-dialog');
        await page.waitForNetworkIdle();
        await page.mouse.move(-10, -10);

        var dialog = await page.$('.ui-dialog');
        expect(await dialog.screenshot()).to.matchImage('visitor_profile_limited');
    });

    it('should show visitor log purge message when purged and no data', async function() {
        testEnvironment.overrideConfig('Deletelogs', 'delete_logs_enable', 1);
        testEnvironment.overrideConfig('Deletelogs', 'delete_logs_older_than', 4000);
        testEnvironment.save();

        await page.goto("?module=CoreHome&action=index&idSite=1&period=year&date=2005-01-03#?idSite=1&period=year&date=2005-01-03&category=General_Visitors&subcategory=Live_VisitorLog");

        await page.waitForNetworkIdle();

        var report = await page.$('.reporting-page');
        expect(await report.screenshot()).to.matchImage('visitor_log_purged');
    });
});