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

Menus_spec.js « specs « UI « tests - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3124766e799ca7036a4bc82b2a7453729157ff74 (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
/*!
 * Piwik - free/libre analytics platform
 *
 * Screenshot tests for main, top and admin menus.
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

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

    var generalParams = 'idSite=1&period=year&date=2012-08-09',
        urlBase = 'module=CoreHome&action=index&' + generalParams
        ;

    function openMenuItem(page, menuItem)
    {
        page.click('#secondNavBar .navbar a:contains('+ menuItem + ')');
    }

    // main menu tests
    it('should load the main reporting menu correctly', function (done) {
        expect.screenshot('mainmenu_loaded').to.be.captureSelector('#secondNavBar', function (page) {
            page.load("?" + urlBase + "#" + generalParams + "&module=Actions&action=menuGetPageUrls");
        }, done);
    });

    it('should change the menu when a upper menu item is clicked in the main menu', function (done) {
        expect.screenshot('mainmenu_upper_clicked').to.be.captureSelector('#secondNavBar', function (page) {
            page.click('#secondNavBar .navbar > li:eq(1) > a');
        }, done);
    });

    it('should change the menu when a lower menu item is clicked in the main menu', function (done) {
        expect.screenshot('mainmenu_lower_clicked').to.be.captureSelector('#secondNavBar', function (page) {
            page.click('#secondNavBar .navbar > li:eq(1) > ul > li:eq(1) > a');
        }, done);
    });

    // user menu tests
    it('should load the user reporting menu correctly', function (done) {
        expect.screenshot('user_loaded').to.be.captureSelector('#secondNavBar', function (page) {
            page.load("?" + generalParams + "&module=UsersManager&action=userSettings");
        }, done);
    });

    it('should change the user page correctly when a user menu item is clicked', function (done) {
        expect.screenshot('user_changed').to.be.captureSelector('#secondNavBar', function (page) {
            openMenuItem(page, 'Platform');
            openMenuItem(page, 'API');
        }, done);
    });

    // admin menu tests
    it('should load the admin reporting menu correctly', function (done) {
        expect.screenshot('admin_loaded').to.be.captureSelector('#secondNavBar', function (page) {
            page.load("?" + generalParams + "&module=CoreAdminHome&action=generalSettings");
        }, done);
    });

    it('should change the admin page correctly when an admin menu item is clicked', function (done) {
        expect.screenshot('admin_changed').to.be.captureSelector('#secondNavBar', function (page) {
            openMenuItem(page, 'Administration');
            openMenuItem(page, 'Websites');
        }, done);
    });
});