Fix tests

This commit is contained in:
Girish Ramakrishnan 2020-03-08 18:59:04 -07:00
parent 2885c388e8
commit 076dd3946b
3 changed files with 404 additions and 513 deletions

885
test/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -9,11 +9,12 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"selenium-webdriver": "^3.6.0", "chromedriver": "^80.0.1",
"chromedriver": "^76.0.1",
"expect.js": "^0.3.1", "expect.js": "^0.3.1",
"mocha": "^6.2.2", "mocha": "^7.1.0",
"rimraf": "^3.0.0", "rimraf": "^3.0.2",
"superagent": "^5.1.0" "selenium-server-standalone-jar": "^3.141.59",
"selenium-webdriver": "^3.6.0",
"superagent": "^5.2.2"
} }
} }

View file

@ -9,6 +9,8 @@
'use strict'; 'use strict';
require('chromedriver');
var execSync = require('child_process').execSync, var execSync = require('child_process').execSync,
expect = require('expect.js'), expect = require('expect.js'),
fs = require('fs'), fs = require('fs'),
@ -31,10 +33,10 @@ describe('Application life cycle test', function () {
var LOCATION = 'test'; var LOCATION = 'test';
var SSH_PORT = 29420; var SSH_PORT = 29420;
var browser;
var app; var app;
var token; var token;
var server, browser = new Builder().forBrowser('chrome').build();
var repodir = '/tmp/testrepo'; var repodir = '/tmp/testrepo';
var reponame = 'testrepo'; var reponame = 'testrepo';
@ -43,7 +45,10 @@ describe('Application life cycle test', function () {
var email = process.env.EMAIL; var email = process.env.EMAIL;
before(function () { before(function () {
browser = new Builder().forBrowser('chrome').setChromeOptions(new Options().windowSize({ width: 1280, height: 1024 })).build(); var seleniumJar= require('selenium-server-standalone-jar');
var SeleniumServer = require('selenium-webdriver/remote').SeleniumServer;
server = new SeleniumServer(seleniumJar.path, { port: 4444 });
server.start();
}); });
after(function (done) { after(function (done) {
@ -151,8 +156,14 @@ return done();
} }
function logout(done) { function logout(done) {
browser.get('https://' + app.fqdn + '/user/logout').then(function () { browser.get('https://' + app.fqdn).then(function () {
return waitForUrl('https://' + app.fqdn + '/explore/repos'); return browser.findElement(By.xpath('//img[contains(@class, "avatar")]')).click();
}).then(function () {
browser.sleep(2000);
}).then(function () {
return browser.findElement(By.xpath('//a[@data-url="/user/logout"]')).click();
}).then(function () {
browser.sleep(2000);
}).then(function () { }).then(function () {
done(); done();
}); });