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

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

describe("JSTracker", function () {
    this.fixture = 'Piwik\\Tests\\Fixtures\\JSTrackingUIFixture';

    before(function () {
        testEnvironment.pluginsToLoad = ['CustomJsTracker', 'ExampleTracker'];
        testEnvironment.save();
    });

    var testWebsiteUrl = 'tests/resources/overlay-test-site-real/index.html';
    var generalParams = 'idSite=1&period=day&date=today',
        widgetizeParams = "module=Widgetize&action=iframe",
        visitorLogUrl = "?" + widgetizeParams + "&" + generalParams + "&moduleToWidgetize=Live&actionToWidgetize=getVisitorLog";

    it("run correctly on a website and correctly track visits in the visitor log", async function () {
        await page.goto(testWebsiteUrl);

        // view another page
        await page.evaluate(() => $('a:contains(Page 3)')[0].click());
        await page.waitForNetworkIdle();
        await page.waitFor(500);
        await page.waitForNetworkIdle();

        // visit visitor log for correct date
        await page.goto(visitorLogUrl);

        await page.evaluate(function () {
            $('.visitor-log-datetime').html('REMOVED');
            var $e = $('.dataTableWrapper>.row>.column>strong');
            $e.text($e.text().replace(/\d+s/, 'Ns'));
        });

        expect(await page.screenshot({ fullPage: true })).to.matchImage('visitor_log');
    });
});