diff options
author | Stefan Giehl <stefan@matomo.org> | 2021-04-14 12:55:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-14 12:55:44 +0300 |
commit | ea561b54613897b26d04cd25aafda92b66843b4b (patch) | |
tree | 1e3f2ad689c66f2312991a84ab1a9264e96b9b42 /plugins/Login | |
parent | 086874bb001f22381916bee51de87ec41452782e (diff) |
Ensure correct no access message is shown (#17445)
* Ensure correct no access message is shown
* Add tests for access error messages
* fix ui tests
Diffstat (limited to 'plugins/Login')
3 files changed, 67 insertions, 0 deletions
diff --git a/plugins/Login/tests/UI/NoAccess_spec.js b/plugins/Login/tests/UI/NoAccess_spec.js new file mode 100644 index 0000000000..d829962daa --- /dev/null +++ b/plugins/Login/tests/UI/NoAccess_spec.js @@ -0,0 +1,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'); + }); + +});
\ No newline at end of file diff --git a/plugins/Login/tests/UI/expected-screenshots/NoAccess_login_noaccess.png b/plugins/Login/tests/UI/expected-screenshots/NoAccess_login_noaccess.png new file mode 100644 index 0000000000..2391c68a79 --- /dev/null +++ b/plugins/Login/tests/UI/expected-screenshots/NoAccess_login_noaccess.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c2bf876689974ba0e3bbd46b1dd309877f1838809344d37e28633cd4b8c0bc9 +size 31939 diff --git a/plugins/Login/tests/UI/expected-screenshots/NoAccess_login_session_timeout.png b/plugins/Login/tests/UI/expected-screenshots/NoAccess_login_session_timeout.png new file mode 100644 index 0000000000..cc31f29313 --- /dev/null +++ b/plugins/Login/tests/UI/expected-screenshots/NoAccess_login_session_timeout.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8c62cd426bd1fc44e9456bd1d7b65a424e52bb01cc919ddff6f07442abb50e1 +size 34146 |