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

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

describe("QuickAccess", function () {
    var selectorToCapture = "#search,.quick-access";

    this.timeout(0);

    var url = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09";

    function enterSearchTerm(page, searchTermToAdd)
    {
        page.sendKeys("#search input", searchTermToAdd);
    }

    function captureSelector(screenshotName, done, selector, callback)
    {
        expect.screenshot(screenshotName).to.be.captureSelector(selector, callback, done);
    }

    function capture(screenshotName, done, callback)
    {
        captureSelector(screenshotName, done, selectorToCapture, callback);
    }

    it("should be displayed", function (done) {
        capture('initially', done, function (page) {
            page.load(url);
        });
    });

    it("should search for something and update view", function (done) {
        capture('search_1', done, function (page) {
            enterSearchTerm(page, 'b');
        });
    });

    it("should search again when typing another letter", function (done) {
        capture('search_2', done, function (page) {
            enterSearchTerm(page, 'a');
        });
    });

    it("should show message if no results", function (done) {
        capture('search_no_result', done, function (page) {
            enterSearchTerm(page, 'x');
        });
    });

    it("should be possible to activate via shortcut", function (done) {
        capture('shortcut', done, function (page) {
            page.load(url);
            page.sendKeys("body", 'f');
        });
    });

    it("should search for websites", function (done) {
        capture('search_sites', done, function (page) {
            enterSearchTerm(page, 'si');
        });
    });

    it("clicking on a category should show all items that belong to that category", function (done) {
        capture('search_category', done, function (page) {
            page.click('.quick-access-category:first');
        });
    });

});