Add tests (first try)

This commit is contained in:
RainLoop Team 2016-05-07 15:39:44 +03:00
parent 768ce1d85e
commit 5663f8b1bb
4 changed files with 78 additions and 3 deletions

1
.gitignore vendored
View file

@ -12,6 +12,7 @@
/rainloop/v/0.0.0/static/css/*.css
/rainloop/v/0.0.0/static/js/*.js
/rainloop/v/0.0.0/static/js/**/*.js
/tests/_config.js
/node_modules
/build/local
/build/dist

View file

@ -115,9 +115,7 @@
</div>
</form>
</div>
<div class="e-powered thm-powered" data-bind="visible: logoPowered">
Powered by <a href="http://www.rainloop.net" target="_blank">RainLoop</a>
</div>
<div class="e-powered thm-powered" data-bind="visible: logoPowered">Powered by <a href="http://www.rainloop.net" target="_blank">RainLoop</a></div>
<div class="e-mobile-switcher thm-mobile-switcher">
<span data-bind="visible: !mobile && mobileDevice">
<i class="icon-mobile"></i>

6
tests/_config.js.dist Normal file
View file

@ -0,0 +1,6 @@
module.exports = {
url: 'https://mail.rainloop.net/',
testLogin: 'demo@rainloop.test',
testPassword: '12345'
};

70
tests/login.js Normal file
View file

@ -0,0 +1,70 @@
var cfg = require('./_config.js');
casper.start(cfg.url);
casper.then(function() {
this.echo('testing: ' + cfg.url);
}).wait(100);
casper.then(function() {
casper.test.begin('Login page should contains "Sign In" button', 1, function (test) {
casper.then(function() {
test.assertExists('button.buttonLogin');
});
casper.then(function() {
test.done();
});
});
casper.test.begin('Login page should allow langs selection', 3, function (test) {
casper.then(function() {
test.assertExists('.e-languages .flag-selector .flag-name');
});
casper.then(function() {
this.click('.e-languages .flag-selector .flag-name');
}).wait(300);
casper.then(function() {
test.assertExists('.b-languages-content');
});
casper.then(function() {
this.click('.b-languages-content .lang-item .flag.flag-ru_ru');
}).wait(1000);
casper.then(function() {
test.assertEquals('Войти', this.fetchText('button.buttonLogin'));
});
casper.then(function() {
test.done();
});
});
casper.test.begin('Login page submit', 1, function (test) {
casper.then(function() {
this.fill('form.loginForm', {
'RainLoopEmail': cfg.testLogin,
'RainLoopPassword': cfg.testPassword
}, true);
}).wait(3000);
casper.then(function() {
test.assertEquals(cfg.testLogin, this.fetchText('.accountPlace'));
});
casper.then(function() {
test.done();
});
});
});
casper.run();