add automated registration test

pull/1/head
ansuz 8 years ago
parent 07279c8dc7
commit 8bd9ad8847

@ -2,8 +2,9 @@ define([
'jquery',
'/common/login.js',
'/common/cryptpad-common.js',
'/common/credential.js' // preloaded for login.js
], function ($, Login, Cryptpad) {
'/common/test.js',
'/common/credential.js', // preloaded for login.js
], function ($, Login, Cryptpad, Test) {
var Messages = Cryptpad.Messages;
$(function () {
@ -63,6 +64,11 @@ define([
var $register = $('button#register');
var logMeIn = function (result) {
if (Test.testing) {
Test.passed();
window.alert("Test passed!");
return;
}
localStorage.User_hash = result.userHash;
var proxy = result.proxy;
@ -137,7 +143,6 @@ define([
case 'ALREADY_REGISTERED':
Cryptpad.removeLoadingScreen(function () {
Cryptpad.confirm(Messages.register_alreadyRegistered, function (yes) {
if (!yes) { return; }
proxy.login_name = uname;
if (!proxy[Cryptpad.displayNameKey]) {
@ -153,6 +158,9 @@ define([
}
return;
}
if (Test.testing) { return void logMeIn(result); }
Cryptpad.eraseTempSessionValues();
if (shouldImport) {
sessionStorage.migrateAnonDrive = 1;
@ -176,5 +184,18 @@ define([
$dialog.find('> div').addClass('half');
});
});
Test(function () {
$uname.val('test' + Math.random());
$passwd.val('test');
$confirm.val('test');
$checkImport[0].checked = true;
$checkAcceptTerms[0].checked = true;
$register.click();
window.setTimeout(function () {
Cryptpad.findOKButton().click()
}, 1000);
});
});
});

Loading…
Cancel
Save