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

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

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

    function getImageGraphUrl(apiModule, apiAction, graphType, period, date) {
        return "index.php?module=API&method=ImageGraph.get&idSite=1&width=500&height=250&apiModule=" + apiModule + "&apiAction=" + apiAction
             + "&graphType=" + graphType + "&period=" + period + "&date=" + date;
    }

    it("should render evolution graphs correctly", function (done) {
        expect.screenshot('evolution_graph').to.be.similar(.95).to.capture(function (page) {
            page.load(getImageGraphUrl('VisitsSummary', 'get', 'evolution', 'month', '2011-06-01,2012-06-01'));
        }, done);
    });

    it("should render horizontal bar graphs correctly", function (done) {
        expect.screenshot('horizontal_bar').to.be.similar(.95).to.capture(function (page) {
            page.load(getImageGraphUrl('UserSettings', 'getBrowser', 'horizontalBar', 'year', '2012-01-01'));
        }, done);
    });

    it("should render vertical bar graphs correctly", function (done) {
        expect.screenshot('vertical_bar').to.be.similar(.95).to.capture(function (page) {
            page.load(getImageGraphUrl('UserCountry', 'getCountry', 'verticalBar', 'year', '2012-01-01'));
        }, done);
    });

    it("should render pie graphs correctly", function (done) {
        expect.screenshot('pie').to.be.similar(.95).to.capture(function (page) {
            page.load(getImageGraphUrl('DevicesDetection', 'getOsVersions', 'pie', 'year', '2012-01-01'));
        }, done);
    });
});