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

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

describe("PivotByDimension", function () {
    var eventsUrl = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09#?idSite=1&period=year&date=2012-08-09&category=General_Actions&subcategory=Events_Events",
        actionsUrl = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09#?idSite=1&period=year&date=2012-08-09&category=General_Actions&subcategory=General_Pages",
        cvarsUrl = "?module=CoreHome&action=index&idSite=1&period=year&date=2012-08-09#?idSite=1&period=year&date=2012-08-09&category=General_Visitors&subcategory=CustomVariables_CustomVariables"
        ;

    function showDataTableFooter(page) {
        return page.hover('.dataTableFeatures');
    }

    it("should pivot a report correctly when the pivot cog option is selected", async function () {
        await page.goto(eventsUrl);

        let element = await page.jQuery('.dimension:contains(Event Names)');
        await element.click();
        await page.waitForNetworkIdle();

        await showDataTableFooter(page);
        await page.evaluate(function(){
            $('.dropdownConfigureIcon').click();
            $('.dataTablePivotBySubtable').click();
        });
        await page.waitForNetworkIdle();

        await page.mouse.move(-150, -150); // make sure nothing is highlighted

        element = await page.$('.theWidgetContent');
        expect(await element.screenshot()).to.matchImage('pivoted');
    });

    it("should not display the pivot option on actions reports", async function () {
        await page.goto(actionsUrl);

        const element = await page.$('.dataTablePivotBySubtable');
        expect(element).to.be.not.ok;
    });

    it("should display the pivot option on reports that set a custom columns_to_display", async function () {
        await page.goto(cvarsUrl);
        await showDataTableFooter(page);
        await page.click('.dropdownConfigureIcon');
        await page.click('.dataTablePivotBySubtable');
        await page.waitForNetworkIdle();

        await page.mouse.move(-15, -15); // make sure nothing is highlighted
        await page.waitFor(100);

        expect(await page.screenshotSelector('.dataTable,.expandDataTableFooterDrawer')).to.matchImage({
            imageName: 'pivoted_columns_report',
            comparisonThreshold: 0.0003,
        });
    });
});