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

RateFeature_spec.js « UI « tests « Feedback « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 829e6565504a379b788e87b21900707a504df086 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*!
 * Matomo - free/libre analytics platform
 *
 * UsersManager screenshot tests.
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

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

    var url = "?module=CoreHome&action=index&idSite=1&period=day&date=yesterday#?idSite=1&period=day&date=yesterday&segment=&category=General_Visitors&subcategory=General_Overview";

    before(async function() {
        await page.webpage.setViewport({
            width: 1250,
            height: 768
        });
    });

    it('should display the like feature popup', async function () {
        await page.goto(url);
        await page.waitForNetworkIdle();

        const like = await page.$('.like-icon');
        await like.evaluate(b => b.click());

        var modal = await page.waitForSelector('.modal.open', { visible: true });

        await page.waitForTimeout(1000);

        expect(await modal.screenshot()).to.matchImage('rate_feature_like_questions');
    });

    it('should accept like feedback', async function () {

        const useful = await page.$('#useful');
        await useful.evaluate(b => b.click());

        await page.type('#feedbacktext', 'test');

        const submit = await page.$('a.modal-action:nth-child(1)');
        await submit.click();
        await page.waitForNetworkIdle();

        var modal = await page.waitForSelector('.modal.open', { visible: true });
        expect(await modal.screenshot()).to.matchImage('rate_feature_like_submit');
    });

    it('should display the dislike feature popup', async function () {
        await page.goto(url);
        await page.waitForNetworkIdle();

        const like = await page.$('.dislike-icon');
        await like.evaluate(b => b.click());

        var modal = await page.waitForSelector('.modal.open', { visible: true });

        await page.waitForTimeout(1000);

        expect(await modal.screenshot()).to.matchImage('rate_feature_dislike_questions');
    });

    it('should accept dislike feedback', async function () {

        const useful = await page.$('#missingfeatures');
        await useful.evaluate(b => b.click());

        await page.type('#feedbacktext', 'test');

        const submit = await page.$('a.modal-action:nth-child(1)');
        await submit.click();
        await page.waitForNetworkIdle();

        var modal = await page.waitForSelector('.modal.open', { visible: true });
        expect(await modal.screenshot()).to.matchImage('rate_feature_dislike_submit');
    });

    function delay(interval) {
       return it('should delay', done =>
       {
          setTimeout(() => done(), interval)
       }).timeout(interval + 100);
    }


});