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

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

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

    before(async function () {
        testEnvironment.testUseMockAuth = 0;
        testEnvironment.overrideConfig('General', 'login_session_not_remembered_idle_timeout', 1)
        testEnvironment.save();

        await page.clearCookies();
    });

    after(async function () {
        testEnvironment.testUseMockAuth = 1;
        testEnvironment.save();

        await page.clearCookies();
    });

    it("should login successfully with user credentials and show error when a site without access is viewed", async function() {
        await page.clearCookies();
        await page.goto("?idSite=2");
        await page.waitForNetworkIdle();
        await page.type("#login_form_login", "oliverqueen");
        await page.type("#login_form_password", "smartypants");
        await page.evaluate(function(){
            $('#login_form_submit').click();
        });

        await page.waitForNetworkIdle();

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

    it("should show session timeout error", async function() {
        await page.clearCookies();
        await page.goto("");
        await page.waitForNetworkIdle();
        await page.type("#login_form_login", "oliverqueen");
        await page.type("#login_form_password", "smartypants");
        await page.evaluate(function(){
            $('#login_form_submit').click();
        });

        await page.waitFor(60500); // wait for session timeout

        await page.click('#topmenu-corehome');
        await page.waitForNetworkIdle();

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

});