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

IntranetMeasurable_spec.js « UI « tests « IntranetMeasurable « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 46063f91088a9de251f093c2b5c410a263035f3b (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
/*!
 * Matomo - free/libre analytics platform
 *
 * Site selector screenshot tests.
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */
describe("IntranetMeasurable", function () {
    this.timeout(0);
    this.fixture = "Piwik\\Plugins\\SitesManager\\tests\\Fixtures\\ManySites";

    var url = "?module=SitesManager&action=index&idSite=1&period=day&date=yesterday&showaddsite=false";

    before(function () {
        testEnvironment.pluginsToLoad = ['IntranetMeasurable'];

        testEnvironment.save();
    });

    after(async function () {
        // ensure the newly created site is removed afterwards, so other tests reusing the fixture won't change results
        await testEnvironment.callApi('SitesManager.deleteSite', { idSite: 64 });
    });

    it("should show intranet selection", async function () {
        await page.goto(url);
        await (await page.jQuery('.SitesManager .addSite:first')).click();
        await page.waitForTimeout(500);

        const elem = await page.$('.modal.open');
        expect(await elem.screenshot()).to.matchImage('add_new_dialog');
    });

    it("should load intranet specific fields", async function () {
        await (await page.jQuery('.modal.open .btn:contains(Intranet)')).click();
        await page.waitForNetworkIdle();
        await page.waitForTimeout(250);

        await page.evaluate(function () {
            $('.form-help:contains(UTC time is)').hide();
        });

        pageWrap = await page.$('.editingSite');
        expect(await pageWrap.screenshot()).to.matchImage('intranet_create');
    });

    it("should load intranet specific fields", async function () {
        await page.type('.editingSite [placeholder="Name"]', 'My intranet');
        await page.type('.editingSite [name="urls"]', 'https://www.example.com');
        await page.click('.editingSiteFooter input.btn');
        await page.waitForNetworkIdle();

        pageWrap = await page.$('.site[type=intranet]');
        expect(await pageWrap.screenshot()).to.matchImage('intranet_created');
    });

});