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

ViewDataTable_spec.js « specs « UI « tests - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b13944c4124b27d633b500974d08806b94828d3c (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
158
159
160
161
162
163
/*!
 * Piwik - free/libre analytics platform
 *
 * ViewDataTable screenshot tests.
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

describe("ViewDataTableTest", function () { // TODO: should remove Test suffix from images instead of naming suites ...Test
    this.timeout(0);

    // TODO: rename screenshot files, remove numbers
    var url = "?module=Widgetize&action=iframe&moduleToWidgetize=Referrers&idSite=1&period=year&date=2012-08-09&"
            + "actionToWidgetize=getKeywords&viewDataTable=table&filter_limit=5&isFooterExpandedInDashboard=1";

    it("should load correctly", function (done) {
        expect.screenshot("0_initial").to.be.capture(function (page) {
            page.load(url);
        }, done);
    });

    it("should load all columns when all columns clicked", function (done) {
        expect.screenshot("1_all_columns").to.be.capture(function (page) {
            page.click('.activateVisualizationSelection');
            page.click('.tableIcon[data-footer-icon-id=tableAllColumns]');
        }, done);
    });

    it("should sort a column in descending order when column clicked initially", function (done) {
        expect.screenshot("2_column_sorted_desc").to.be.capture(function (page) {
            page.click('th#avg_time_on_site');
        }, done);
    });

    it("should sort a column in ascending order when column clicked second time", function (done) {
        expect.screenshot("3_column_sorted_asc").to.be.capture(function (page) {
            page.click('th#avg_time_on_site');
        }, done);
    });

    it("should show all available visualizations for this report", function (done) {
        expect.screenshot("5_visualizations").to.be.captureSelector('.dataTableFooterIcons', function (page) {
            page.click('.activateVisualizationSelection');
        }, done);
    });

    it("should load goals table when goals footer icon clicked", function (done) {
        expect.screenshot("5_goals").to.be.capture(function (page) {
            page.click('.tableIcon[data-footer-icon-id=tableGoals]');
        }, done);
    });

    it("should load bar graph when bar graph footer icon clicked", function (done) {
        expect.screenshot('6_bar_graph').to.be.capture(function (page) {
            page.click('.activateVisualizationSelection');
            page.click('.tableIcon[data-footer-icon-id=graphVerticalBar]');
        }, done);
    });

    it("should load pie graph when pie graph footer icon clicked", function (done) {
        expect.screenshot('7_pie_graph').to.be.capture(function (page) {
            page.click('.activateVisualizationSelection');
            page.click('.tableIcon[data-footer-icon-id=graphPie]');
        }, done);
    });

    it("should load a tag cloud when tag cloud footer icon clicked", function (done) {
        expect.screenshot('8_tag_cloud').to.be.capture(function (page) {
            page.click('.activateVisualizationSelection');
            page.click('.tableIcon[data-footer-icon-id=cloud]');
        }, done);
    });

    it("should load normal table when normal table footer icon clicked", function (done) {
        expect.screenshot('9_normal_table').to.be.capture(function (page) {
            page.click('.activateVisualizationSelection');
            page.click('.tableIcon[data-footer-icon-id=table]');
            page.mouseMove({x: -10, y: -10}); // mae sure no row is highlighted
        }, done);
    });

    it("should show the limit selector when the limit selector is clicked", function (done) {
        expect.screenshot('limit_selector_open').to.be.capture(function (page) {
            page.click('.limitSelection input');
        }, done);
    });

    it("should change the number of rows when new limit selected", function (done) {
        expect.screenshot('10_change_limit').to.be.capture(function (page) {
            page.evaluate(function () {
                $('.limitSelection ul li:contains(10):first span').click();
            });
        }, done);
    });

    it("should flatten the table when the flatten link is clicked", function (done) {
        expect.screenshot('11_flattened').to.be.capture(function (page) {
            page.click('.dropdownConfigureIcon');
            page.click('.dataTableFlatten');
        }, done);
    });

    it("should show aggregate rows when the aggregate rows option is clicked", function (done) {
        expect.screenshot('12_aggregate_shown').to.be.capture(function (page) {
            page.click('.dropdownConfigureIcon');
            page.click('.dataTableIncludeAggregateRows');
        }, done);
    });

    it("should make the report hierarchical when the flatten link is clicked again", function (done) {
        expect.screenshot('13_make_hierarchical').to.be.capture(function (page) {
            page.click('.dropdownConfigureIcon');
            page.click('.dataTableFlatten');
        }, done);
    });

    it("should show the visits percent when hovering over a column", function (done) {
        expect.screenshot('14_visits_percent').to.be.capture(function (page) {
            page.mouseMove('td.column:not(.label)');
        }, done);
    });

    it("should load subtables correctly when row clicked", function (done) {
        expect.screenshot('subtables_loaded').to.be.capture(function (page) {
            page.click('tr.subDataTable:first');
            page.click('tr.subDataTable:eq(2)');
        }, done);
    });

    it("should search the table when a search string is entered and the search button clicked", function (done) {
        expect.screenshot('15_search').to.be.capture(function (page) {
            page.click('.dataTableAction.searchAction');
            page.sendKeys('.searchAction .dataTableSearchInput', 'term');
            page.click('.searchAction .icon-search');
        }, done);
    });

    it("should display the export options when clicking the export icon", function (done) {
        expect.screenshot('export_options').to.be.capture(function (page) {
            page.click('.activateExportSelection');
        }, done);
    });

    it("should display a related report when related report link is clicked", function (done) {
        expect.screenshot('related_report_click').to.be.capture(function (page) {
            var newReportUrl = url.replace("=Referrers", "=DevicesDetection").replace("=getKeywords", "=getOsFamilies");

            page.load(newReportUrl);
            page.click('.datatableRelatedReports li>span:visible');
        }, done);
    });

    it("should exclude low population rows when low population clicked", function (done) {
        var newUrl = url.replace('moduleToWidgetize=Referrers', 'moduleToWidgetize=Actions').replace('actionToWidgetize=getKeywords', 'actionToWidgetize=getPageUrls');
        expect.screenshot("exclude_low_population").to.be.capture(function (page) {
            page.load(newUrl);
            page.click('.dropdownConfigureIcon');
            page.click('.dataTableExcludeLowPopulation');
        }, done);
    });

});