-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure correct no access message is shown (#17445)
* Ensure correct no access message is shown * Add tests for access error messages * fix ui tests
- Loading branch information
Showing
5 changed files
with
81 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); | ||
}); | ||
|
||
}); |
3 changes: 3 additions & 0 deletions
3
plugins/Login/tests/UI/expected-screenshots/NoAccess_login_noaccess.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
plugins/Login/tests/UI/expected-screenshots/NoAccess_login_session_timeout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.