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

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

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

    this.fixture = "Piwik\\Tests\\Fixtures\\EmptySiteWithSiteContentDetection";

    var generalParams = 'idSite=1&period=day&date=2017-01-02',
        urlBase = '?module=PrivacyManager&' + generalParams + '&action=';

    before(function () {
        testEnvironment.pluginsToLoad = ['PrivacyManager'];
        testEnvironment.save();
    });

    async function setAnonymizeStartEndDate()
    {
        // make sure tests do not fail every day
        await page.waitForSelector('input.anonymizeStartDate');
        await page.waitForSelector('input.anonymizeEndDate');
        await page.waitForTimeout(100);
        await page.evaluate(function () {
            $('input.anonymizeStartDate').val('2018-03-02').change();
        });
        await page.waitForTimeout(100);
        await page.evaluate(function () {
            $('input.anonymizeEndDate').val('2018-03-02').change();
        });
        await page.waitForTimeout(100);
    }

    async function loadActionPage(action)
    {
        await page.goto('about:blank');
        await page.goto(urlBase + action);
        await page.waitForNetworkIdle();

        if (action === 'privacySettings') {
            await setAnonymizeStartEndDate();
        }
    }

    async function capturePage(screenshotName) {
        await page.waitForNetworkIdle();
        expect(await page.screenshotSelector('.pageWrap,#notificationContainer,.modal.open')).to.matchImage(screenshotName);
    }


    async function captureModal(screenshotName) {
        await page.waitForNetworkIdle();
        const modal = await page.$('.modal.open');
        expect(await modal.screenshot()).to.matchImage(screenshotName);
    }

    it('should load privacy asking for consent page', async function() {
        await loadActionPage('consent');
        await capturePage('consent_default');
    });

});