test email login

This commit is contained in:
Girish Ramakrishnan 2016-04-11 14:58:06 -07:00
parent 9dad7b1878
commit 4ea916b2df
2 changed files with 20 additions and 1 deletions

View file

@ -31,6 +31,6 @@ The e2e tests are located in the `test/` folder and require [nodejs](http://node
cd gogs-app/test
npm install
USERNAME=<cloudron username> PASSWORD=<cloudron password> mocha --bail test.js
USERNAME=<cloudron username> EMAIL=<cloudron email> PASSWORD=<cloudron password> mocha --bail test.js
```

View file

@ -33,10 +33,12 @@ describe('Application life cycle test', function () {
var app, reponame = 'testrepo';
var username = process.env.USERNAME;
var password = process.env.PASSWORD;
var email = process.env.EMAIL;
before(function (done) {
if (!process.env.USERNAME) return done(new Error('USERNAME env var not set'));
if (!process.env.PASSWORD) return done(new Error('PASSWORD env var not set'));
if (!process.env.EMAIL) return done(new Error('EMAIL env var not set'));
var seleniumJar= require('selenium-server-standalone-jar');
var SeleniumServer = require('selenium-webdriver/remote').SeleniumServer;
@ -204,4 +206,21 @@ describe('Application life cycle test', function () {
it('uninstall app', function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
// check if the _first_ login via email succeeds
it('can login via email', function () {
execSync('cloudron install --new --wait --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0];
expect(app).to.be.an('object');
browser.get('https://' + app.fqdn + '/user/login');
browser.findElement(by.id('user_name')).sendKeys(email);
browser.findElement(by.id('password')).sendKeys(password);
browser.findElement(by.tagName('form')).submit();
browser.wait(until.elementLocated(by.linkText('Dashboard')), 4000).then(function () { done(); });
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
});