mirror of
https://git.cloudron.io/cloudron/gitea-app.git
synced 2024-12-22 15:16:31 +00:00
test email login
This commit is contained in:
parent
9dad7b1878
commit
4ea916b2df
2 changed files with 20 additions and 1 deletions
|
@ -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
|
||||
```
|
||||
|
||||
|
|
19
test/test.js
19
test/test.js
|
@ -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' });
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue