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

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/TwoFactorAuth/tests/UI/TwoFactorAuth_spec.js')
-rw-r--r--plugins/TwoFactorAuth/tests/UI/TwoFactorAuth_spec.js32
1 files changed, 19 insertions, 13 deletions
diff --git a/plugins/TwoFactorAuth/tests/UI/TwoFactorAuth_spec.js b/plugins/TwoFactorAuth/tests/UI/TwoFactorAuth_spec.js
index 5e216d793d..8b702b230f 100644
--- a/plugins/TwoFactorAuth/tests/UI/TwoFactorAuth_spec.js
+++ b/plugins/TwoFactorAuth/tests/UI/TwoFactorAuth_spec.js
@@ -19,7 +19,7 @@ describe("TwoFactorAuth", function () {
async function selectModalButton(button)
{
- await page.click('.modal.open .modal-footer a:contains('+button+')');
+ await (await page.jQuery('.modal.open .modal-footer a:contains('+button+')')).click();
}
async function loginUser(username, doAuth)
@@ -70,11 +70,13 @@ describe("TwoFactorAuth", function () {
async function confirmPassword()
{
+ await page.waitFor('.confirmPasswordForm');
await page.evaluate(function(){
$('.confirmPasswordForm #login_form_password').val('123abcDk3_l3');
$('.confirmPasswordForm #login_form_submit').click();
});
- await page.waitFor(750);
+ await page.waitForNetworkIdle();
+ await page.waitFor(100);
}
it('a user with 2fa can open the widgetized view by token without needing to verify', async function () {
@@ -86,7 +88,7 @@ describe("TwoFactorAuth", function () {
await loginUser('with2FA', false);
expect(await page.screenshotSelector('.loginSection')).to.matchImage('logme_not_verified');
});
-return;
+
it('when logging in and providing wrong code an error is shown', async function () {
await page.type('.loginTwoFaForm #login_form_authcode', '555555');
await page.evaluate(function(){
@@ -101,14 +103,18 @@ return;
await page.evaluate(function(){
$('.loginTwoFaForm #login_form_submit').click();
});
- await page.waitFor(1500);
- expect(await page.screenshotSelector('#content')).to.matchImage('logme_verified');
+ await page.waitForNetworkIdle();
+ await page.waitFor('.widget');
+ expect(await page.screenshotSelector('.pageWrap')).to.matchImage('logme_verified');
});
it('should show user settings when two-fa enabled', async function () {
await loginUser('with2FA');
await page.goto(userSettings);
- expect(await page.screenshotSelector('.userSettings2FA')).to.matchImage('usersettings_twofa_enabled');
+ await page.waitFor('.userSettings2FA', { visible: true });
+ await page.waitFor(500); // animation
+ const elem = await page.$('.userSettings2FA');
+ expect(await elem.screenshot()).to.matchImage('usersettings_twofa_enabled');
});
it('should be possible to show recovery codes step1 authentication', async function () {
@@ -145,7 +151,9 @@ return;
it('should be possible to disable two factor step 3 verified', async function () {
await confirmPassword();
- expect(await page.screenshotSelector('.userSettings2FA')).to.matchImage('usersettings_twofa_disable_step3');
+ await page.waitFor('.userSettings2FA');
+ const elem = await page.$('.userSettings2FA');
+ expect(await elem.screenshot()).to.matchImage('usersettings_twofa_disable_step3');
});
it('should show setup screen - step 1', async function () {
@@ -157,21 +165,15 @@ return;
});
it('should move to second step in setup - step 2', async function () {
- console.log('start');
await page.evaluate(function(){
$('.setupTwoFactorAuthentication .backupRecoveryCode:first').click();
});
- console.log(0);
await page.waitForNetworkIdle();
- console.log(1);
await page.click('.setupTwoFactorAuthentication .goToStep2');
- console.log(2);
await page.waitForNetworkIdle();
- console.log(3);
await page.evaluate(function () {
$('#qrcode').hide();
});
- console.log(4);
expect(await page.screenshotSelector('#content')).to.matchImage('twofa_setup_step2');
});
@@ -190,6 +192,9 @@ return;
await page.evaluate(function () {
$('.setupConfirmAuthCodeForm .confirmAuthCode').click();
});
+ await page.waitForNetworkIdle();
+ await page.waitFor('.widget', { visible: true });
+ await page.waitForNetworkIdle();
expect(await page.screenshotSelector('#content')).to.matchImage('twofa_setup_step4');
});
@@ -220,6 +225,7 @@ return;
await page.evaluate(function () {
$('.setupConfirmAuthCodeForm .confirmAuthCode').click();
});
+ await page.waitForNetworkIdle();
expect(await page.screenshotSelector('.loginSection,#content,#notificationContainer')).to.matchImage('twofa_forced_step4');
});