From 5663f8b1bb9ec1a2356571bd09a9f584973a7af2 Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Sat, 7 May 2016 15:39:44 +0300 Subject: [PATCH] Add tests (first try) --- .gitignore | 1 + .../0.0.0/app/templates/Views/User/Login.html | 4 +- tests/_config.js.dist | 6 ++ tests/login.js | 70 +++++++++++++++++++ 4 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 tests/_config.js.dist create mode 100644 tests/login.js diff --git a/.gitignore b/.gitignore index 5346ce025..6b1842b57 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/rainloop/v/0.0.0/app/templates/Views/User/Login.html b/rainloop/v/0.0.0/app/templates/Views/User/Login.html index f9b5c05a3..baa62ce1b 100644 --- a/rainloop/v/0.0.0/app/templates/Views/User/Login.html +++ b/rainloop/v/0.0.0/app/templates/Views/User/Login.html @@ -115,9 +115,7 @@ -
- Powered by RainLoop -
+
Powered by RainLoop
diff --git a/tests/_config.js.dist b/tests/_config.js.dist new file mode 100644 index 000000000..d2cdfaec3 --- /dev/null +++ b/tests/_config.js.dist @@ -0,0 +1,6 @@ + +module.exports = { + url: 'https://mail.rainloop.net/', + testLogin: 'demo@rainloop.test', + testPassword: '12345' +}; diff --git a/tests/login.js b/tests/login.js new file mode 100644 index 000000000..0be0b6fc5 --- /dev/null +++ b/tests/login.js @@ -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();