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

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

describe("VisitorMap", function () {
    this.timeout(0);

    var url = "?module=Widgetize&action=iframe&moduleToWidgetize=UserCountryMap&idSite=1&period=year&date=2012-08-09&"
        + "actionToWidgetize=visitorMap&viewDataTable=table&filter_limit=5&isFooterExpandedInDashboard=1",
        urlWithCities = "?module=Widgetize&action=iframe&moduleToWidgetize=UserCountryMap&idSite=3&period=week&date=yesterday&"
            + "actionToWidgetize=visitorMap&viewDataTable=table&filter_limit=5&isFooterExpandedInDashboard=1";

    it("should display the bounce rate metric correctly", function (done) {
        expect.screenshot('bounce_rate').to.be.similar(0.002).to.capture(function (page) {
            page.load(url);
            page.evaluate(function () {
                $('.userCountryMapSelectMetrics').val('bounce_rate').trigger('change');
            });
            page.mouseMove('.UserCountryMap_map.kartograph');
        }, done);
    });

    it("should display the average time on site metric correctly", function (done) {
        expect.screenshot('avg_time_on_site').to.be.similar(0.002).to.capture(function (page) {
            page.evaluate(function () {
                $('.userCountryMapSelectMetrics').val('avg_time_on_site').trigger('change');
            });
            page.mouseMove('.UserCountryMap_map.kartograph');
        }, done);
    });

    it("should display the regions layer correctly", function (done) {
        expect.screenshot('regions').to.be.similar(0.002).to.capture(function (page) {
            page.load(urlWithCities);
            page.evaluate(function () {
                // zoom into USA
                var path = window.visitorMap.map.getLayer('countries').getPaths({iso: "USA"})[0].svgPath[0];
                $(path).click();
            });
            page.evaluate(function () {
                // go to regions view
                var path = window.visitorMap.map.getLayer('countries').getPaths({iso: "USA"})[0].svgPath[0];
                $(path).click();
            });
        }, done);
    });

    it("should display the cities layer correctly", function (done) {
        expect.screenshot('cities').to.be.similar(0.002).to.capture(function (page) {
            page.click('.UserCountryMap-btn-city');
        }, done);
    });
});