diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2020-03-18 06:04:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-18 06:04:12 +0300 |
commit | f0c246cb3a4db3021da7552f6779d56613799414 (patch) | |
tree | 42ddf7a9c2e086df78ffc40dfc23af74f8dd3a39 /plugins/UsersManager/tests/UI | |
parent | e493fee87c983e02001a7d9438cefe58141a38af (diff) |
App specific token_auths (#15410)
* some initial work
* add security page
* backing up some code
* more functionality
* adjust more UI parts
* adjust more code
* more tweaks
* add todo note
* few tweaks
* make sure date is in right format
* fix not existing column
* few fixes
* available hashes
* use different hash algo so tests run on php 5
* fix name of aglorithm
* trying to fix some tests
* another try to fix some tests
* more fixes
* more fixes
* few fixes
* update template
* fix some tests
* fix test
* fixing some tests
* various test fixes
* more fixes
* few more tests
* more tests
* various tweaks
* add translations
* add some ui tests
* fix selector
* tweaks
* trying to fix some ui tests
* fallback to regular authentication if needed
* fix call authenticate on null
* fix user settings
* fix some tests
* few fixes
* fix more ui tests
* update schema
* Update plugins/CoreHome/angularjs/widget-loader/widgetloader.directive.js
Co-Authored-By: Stefan Giehl <stefan@matomo.org>
* fix maps are not showing data
* trying to fix some tests
* set correct token
* trying to fix tracking failure
* minor tweaks and fixes
* fix more tests
* fix screenshot test
* trigger event so brute force logic is executed
* test no fallback to actual authentication
* allow fallback
* apply review feedback
* fix some tests
* fix tests
* make sure location values from query params are limited properly before attempting a db insert
* make sure plugin uninstall migration reloads plugins, make sure 4.0.0-b1 migration removes unique index that is no longer used, use defaults extra file in SqlDump to get test to run on travis
* Fix UI tests.
* update expected screenshot
Co-authored-by: Stefan Giehl <stefan@matomo.org>
Co-authored-by: diosmosis <diosmosis@users.noreply.github.com>
Diffstat (limited to 'plugins/UsersManager/tests/UI')
5 files changed, 43 insertions, 3 deletions
diff --git a/plugins/UsersManager/tests/UI/UserSettings_spec.js b/plugins/UsersManager/tests/UI/UserSettings_spec.js index 190673c6ca..1f4dc719b0 100644 --- a/plugins/UsersManager/tests/UI/UserSettings_spec.js +++ b/plugins/UsersManager/tests/UI/UserSettings_spec.js @@ -11,7 +11,8 @@ describe("UserSettings", function () { this.timeout(0); this.fixture = "Piwik\\Plugins\\UsersManager\\tests\\Fixtures\\ManyUsers"; - var url = "?module=UsersManager&action=userSettings"; + var userSettingsUrl = "?module=UsersManager&action=userSettings"; + var userSecurityUrl = "?module=UsersManager&action=userSecurity"; before(async function() { await page.webpage.setViewport({ @@ -20,8 +21,35 @@ describe("UserSettings", function () { }); }); + it('should show user security page', async function () { + await page.goto(userSecurityUrl); + expect(await page.screenshotSelector('.admin')).to.matchImage('load_security'); + }); + + it('should ask for password when trying to add token', async function () { + await page.click('.addNewToken'); + await page.waitForNetworkIdle(); + await page.waitForSelector('.loginSection'); + expect(await page.screenshotSelector('.loginSection')).to.matchImage('add_token_check_password'); + }); + + it('should accept correct password', async function () { + await page.type('#login_form_password', 'superUserPass'); + await page.click('#login_form_submit'); + await page.waitForNetworkIdle(); + await page.waitForSelector('.addTokenForm'); + expect(await page.screenshotSelector('.admin')).to.matchImage('add_token'); + }); + + it('should create new token', async function () { + await page.type('.addTokenForm input[id=description]', 'test description'); + await page.click('.addTokenForm .btn'); + await page.waitForNetworkIdle(); + expect(await page.screenshotSelector('.admin')).to.matchImage('add_token_success'); + }); + it('should show user settings page', async function () { - await page.goto(url); + await page.goto(userSettingsUrl); expect(await page.screenshotSelector('.admin')).to.matchImage('load'); }); @@ -34,7 +62,7 @@ describe("UserSettings", function () { it('should not prompt user to subscribe to newsletter again', async function () { // Assumes previous test has clicked on the signup button - so we shouldn't see it this time - await page.goto(url); + await page.goto(userSettingsUrl); expect(await page.screenshotSelector('.admin')).to.matchImage('already_signed_up'); }); diff --git a/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_add_token.png b/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_add_token.png new file mode 100644 index 0000000000..8f8b683dac --- /dev/null +++ b/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_add_token.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0a217eaf00dd0e60598067698cdcff92c794433438122b07284c89093d84ae2 +size 30211 diff --git a/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_add_token_check_password.png b/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_add_token_check_password.png new file mode 100644 index 0000000000..d511b3665a --- /dev/null +++ b/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_add_token_check_password.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf4e7b2dd1d68df9db0826eb9051f796bf3c25426659a9e84792ae4879835f17 +size 13422 diff --git a/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_add_token_success.png b/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_add_token_success.png new file mode 100644 index 0000000000..45a8da92a3 --- /dev/null +++ b/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_add_token_success.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2117369cad613d3fccc5848a29ec09212a49a355266db0f57058cd7af639544 +size 19921 diff --git a/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_load_security.png b/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_load_security.png new file mode 100644 index 0000000000..f0312d5958 --- /dev/null +++ b/plugins/UsersManager/tests/UI/expected-screenshots/UserSettings_load_security.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13053d0f3133b73a4f4c9cff719d1c6cd735dfffda162e7e775acb1db6b81162 +size 115909 |