add babel in the integration tests
parent
0dee45b2f6
commit
43f1732122
|
@ -1,3 +1,7 @@
|
||||||
|
require("babel/register")({
|
||||||
|
stage: 1
|
||||||
|
});
|
||||||
|
|
||||||
var utils = require('./integration/utils');
|
var utils = require('./integration/utils');
|
||||||
|
|
||||||
exports.config = {
|
exports.config = {
|
||||||
|
|
|
@ -7,34 +7,34 @@ chai.use(chaiAsPromised);
|
||||||
var expect = chai.expect;
|
var expect = chai.expect;
|
||||||
|
|
||||||
describe('auth', function() {
|
describe('auth', function() {
|
||||||
it('login', function() {
|
it('login', async function() {
|
||||||
browser.get('http://localhost:9001/login');
|
browser.get('http://localhost:9001/login');
|
||||||
|
|
||||||
return utils.common.waitLoader().then(function() {
|
await utils.common.waitLoader();
|
||||||
utils.common.takeScreenshot("auth", "login");
|
|
||||||
|
|
||||||
var username = $('input[name="username"]');
|
utils.common.takeScreenshot("auth", "login");
|
||||||
username.sendKeys('admin');
|
|
||||||
|
|
||||||
var password = $('input[name="password"]');
|
var username = $('input[name="username"]');
|
||||||
password.sendKeys('123123');
|
username.sendKeys('admin');
|
||||||
|
|
||||||
$('.submit-button').click();
|
var password = $('input[name="password"]');
|
||||||
|
password.sendKeys('123123');
|
||||||
|
|
||||||
return expect(browser.getCurrentUrl()).to.be.eventually.equal('http://localhost:9001/');
|
$('.submit-button').click();
|
||||||
});
|
|
||||||
|
expect(browser.getCurrentUrl()).to.be.eventually.equal('http://localhost:9001/');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("user", function() {
|
describe("user", function() {
|
||||||
var user = {};
|
var user = {};
|
||||||
|
|
||||||
describe("register", function() {
|
describe("register", function() {
|
||||||
it('screenshot', function() {
|
it('screenshot', async function() {
|
||||||
browser.get('http://localhost:9001/register');
|
browser.get('http://localhost:9001/register');
|
||||||
|
|
||||||
utils.common.waitLoader().then(function() {
|
await utils.common.waitLoader();
|
||||||
utils.common.takeScreenshot("auth", "register");
|
|
||||||
});
|
utils.common.takeScreenshot("auth", "register");
|
||||||
});
|
});
|
||||||
|
|
||||||
it('register validation', function() {
|
it('register validation', function() {
|
||||||
|
@ -44,7 +44,7 @@ describe('auth', function() {
|
||||||
|
|
||||||
utils.common.takeScreenshot("auth", "register-validation");
|
utils.common.takeScreenshot("auth", "register-validation");
|
||||||
|
|
||||||
return expect($$('.checksley-required').count()).to.be.eventually.equal(4);
|
expect($$('.checksley-required').count()).to.be.eventually.equal(4);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('register ok', function() {
|
it('register ok', function() {
|
||||||
|
@ -62,16 +62,15 @@ describe('auth', function() {
|
||||||
|
|
||||||
$('.submit-button').click();
|
$('.submit-button').click();
|
||||||
|
|
||||||
return expect(browser.getCurrentUrl()).to.be.eventually.equal('http://localhost:9001/');
|
expect(browser.getCurrentUrl()).to.be.eventually.equal('http://localhost:9001/');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("change password", function() {
|
describe("change password", function() {
|
||||||
beforeEach(function(done) {
|
beforeEach(async function() {
|
||||||
utils.common.login(user.username, user.password).then(function() {
|
await utils.common.login(user.username, user.password);
|
||||||
browser.get('http://localhost:9001/user-settings/user-change-password');
|
|
||||||
done();
|
browser.get('http://localhost:9001/user-settings/user-change-password');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("error", function() {
|
it("error", function() {
|
||||||
|
@ -81,7 +80,7 @@ describe('auth', function() {
|
||||||
|
|
||||||
$('.submit-button').click();
|
$('.submit-button').click();
|
||||||
|
|
||||||
return expect(utils.notifications.error.open()).to.be.eventually.equal(true);
|
expect(utils.notifications.error.open()).to.be.eventually.equal(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("success", function() {
|
it("success", function() {
|
||||||
|
@ -91,7 +90,7 @@ describe('auth', function() {
|
||||||
|
|
||||||
$('.submit-button').click();
|
$('.submit-button').click();
|
||||||
|
|
||||||
return expect(utils.notifications.success.open()).to.be.eventually.equal(true);
|
expect(utils.notifications.success.open()).to.be.eventually.equal(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -100,61 +99,57 @@ describe('auth', function() {
|
||||||
browser.get('http://localhost:9001/forgot-password');
|
browser.get('http://localhost:9001/forgot-password');
|
||||||
});
|
});
|
||||||
|
|
||||||
it ("screenshot", function() {
|
it ("screenshot", async function() {
|
||||||
utils.common.waitLoader().then(function() {
|
await utils.common.waitLoader();
|
||||||
utils.common.takeScreenshot("auth", "remember-password");
|
|
||||||
});
|
utils.common.takeScreenshot("auth", "remember-password");
|
||||||
});
|
});
|
||||||
|
|
||||||
it ("error", function() {
|
it ("error", function() {
|
||||||
$('input[name="username"]').sendKeys("xxxxxxxx");
|
$('input[name="username"]').sendKeys("xxxxxxxx");
|
||||||
$('.submit-button').click();
|
$('.submit-button').click();
|
||||||
|
|
||||||
return expect(utils.notifications.errorLight.open()).to.be.eventually.equal(true);
|
expect(utils.notifications.errorLight.open()).to.be.eventually.equal(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it ("success", function() {
|
it ("success", async function() {
|
||||||
$('input[name="username"]').sendKeys(user.username);
|
$('input[name="username"]').sendKeys(user.username);
|
||||||
$('.submit-button').click();
|
$('.submit-button').click();
|
||||||
|
|
||||||
return utils.lightbox.open('.lightbox-generic-success').then(function() {
|
await utils.lightbox.open('.lightbox-generic-success');
|
||||||
utils.common.takeScreenshot('auth', 'remember-password-success');
|
|
||||||
|
|
||||||
$('.lightbox-generic-success .button-green').click();
|
utils.common.takeScreenshot('auth', 'remember-password-success');
|
||||||
|
|
||||||
return expect(utils.lightbox.close('.lightbox-generic-success')).to.be.eventually.equal(true);
|
$('.lightbox-generic-success .button-green').click();
|
||||||
});
|
|
||||||
|
expect(utils.lightbox.close('.lightbox-generic-success')).to.be.eventually.equal(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("", function() {
|
describe("", function() {
|
||||||
it("logout", function() {
|
it("logout", async function() {
|
||||||
return utils.common.login(user.username, user.password)
|
await utils.common.login(user.username, user.password);
|
||||||
.then(function() {
|
|
||||||
browser.actions().mouseMove($('div[tg-dropdown-user]')).perform();
|
|
||||||
$$('.dropdown-user li a').last().click();
|
|
||||||
|
|
||||||
return expect(browser.getCurrentUrl()).to.be.eventually.equal('http://localhost:9001/login');
|
browser.actions().mouseMove($('div[tg-dropdown-user]')).perform();
|
||||||
})
|
$$('.dropdown-user li a').last().click();
|
||||||
|
|
||||||
|
expect(browser.getCurrentUrl()).to.be.eventually.equal('http://localhost:9001/login');
|
||||||
});
|
});
|
||||||
|
|
||||||
it("delete account", function() {
|
it("delete account", async function() {
|
||||||
return utils.common.login(user.username, user.password)
|
await utils.common.login(user.username, user.password);
|
||||||
.then(function() {
|
|
||||||
browser.get('http://localhost:9001/user-settings/user-profile');
|
|
||||||
$('.delete-account').click();
|
|
||||||
|
|
||||||
return utils.lightbox.open('.lightbox-delete-account');
|
browser.get('http://localhost:9001/user-settings/user-profile');
|
||||||
})
|
$('.delete-account').click();
|
||||||
.then(function() {
|
|
||||||
utils.common.takeScreenshot("auth", "delete-account");
|
|
||||||
|
|
||||||
$('#unsuscribe').click();
|
await utils.lightbox.open('.lightbox-delete-account');
|
||||||
$('.lightbox-delete-account .button-green').click();
|
|
||||||
|
|
||||||
return expect(browser.getCurrentUrl())
|
utils.common.takeScreenshot("auth", "delete-account");
|
||||||
.to.be.eventually.equal('http://localhost:9001/login');
|
|
||||||
});
|
$('#unsuscribe').click();
|
||||||
|
$('.lightbox-delete-account .button-green').click();
|
||||||
|
|
||||||
|
expect(browser.getCurrentUrl()).to.be.eventually.equal('http://localhost:9001/login');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
var utils = require('../utils');
|
||||||
|
|
||||||
|
var chai = require('chai');
|
||||||
|
var chaiAsPromised = require('chai-as-promised');
|
||||||
|
|
||||||
|
chai.use(chaiAsPromised);
|
||||||
|
var expect = chai.expect;
|
||||||
|
|
||||||
|
describe.skip('backlog', function() {
|
||||||
|
before(function(){
|
||||||
|
browser.get('http://localhost:9001/project/user7-project-example-0/');
|
||||||
|
|
||||||
|
return utils.common.waitLoader().then(function() {
|
||||||
|
return utils.common.takeScreenshot('backlog', 'backlog');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('create US', function() {
|
||||||
|
$('.new-us a').click();
|
||||||
|
|
||||||
|
lightbox.open('div[tg-lb-create-edit-userstory]').then(function() {
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -7,12 +7,11 @@ chai.use(chaiAsPromised);
|
||||||
var expect = chai.expect;
|
var expect = chai.expect;
|
||||||
|
|
||||||
describe('home', function() {
|
describe('home', function() {
|
||||||
before(function(){
|
before(async function(){
|
||||||
browser.get('http://localhost:9001/');
|
browser.get('http://localhost:9001/');
|
||||||
|
|
||||||
return utils.common.waitLoader().then(function() {
|
await utils.common.waitLoader();
|
||||||
return utils.common.takeScreenshot("home", "dashboard");
|
utils.common.takeScreenshot("home", "dashboard");
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('working on filled', function() {
|
it('working on filled', function() {
|
||||||
|
@ -28,12 +27,11 @@ describe('home', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('projects list', function() {
|
describe('projects list', function() {
|
||||||
before(function() {
|
before(async function() {
|
||||||
browser.get('http://localhost:9001/projects/');
|
browser.get('http://localhost:9001/projects/');
|
||||||
|
|
||||||
return utils.common.waitLoader().then(function() {
|
await utils.common.waitLoader();
|
||||||
return utils.common.takeScreenshot("home", "projects");
|
utils.common.takeScreenshot("home", "projects");
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('open create project lightbox', function() {
|
it('open create project lightbox', function() {
|
||||||
|
@ -52,22 +50,19 @@ describe('home', function() {
|
||||||
describe("project drag and drop", function() {
|
describe("project drag and drop", function() {
|
||||||
var draggedElementText;
|
var draggedElementText;
|
||||||
|
|
||||||
before(function() {
|
before(async function() {
|
||||||
browser.get('http://localhost:9001/projects/');
|
browser.get('http://localhost:9001/projects/');
|
||||||
|
|
||||||
var dragableElements = element.all(by.css('.project-list-single'));
|
let dragableElements = element.all(by.css('.project-list-single'));
|
||||||
var dragElement = dragableElements.get(3);
|
let dragElement = dragableElements.get(3);
|
||||||
var dragElementLink = dragElement.element(by.css('a'));
|
let dragElementLink = dragElement.element(by.css('a'));
|
||||||
|
|
||||||
return utils.common.waitLoader()
|
await utils.common.waitLoader();
|
||||||
.then(function() {
|
|
||||||
return dragElementLink.getText()
|
|
||||||
})
|
|
||||||
.then(function(_draggedElementText_) {
|
|
||||||
draggedElementText = _draggedElementText_;
|
|
||||||
|
|
||||||
return utils.common.drag(dragElement, dragableElements.get(0))
|
draggedElementText = await dragElementLink.getText();
|
||||||
});
|
|
||||||
|
await utils.common.drag(dragElement, dragableElements.get(0));
|
||||||
|
await browser.waitForAngular();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('projects list has the new order', function() {
|
it('projects list has the new order', function() {
|
||||||
|
@ -81,5 +76,6 @@ describe('home', function() {
|
||||||
|
|
||||||
expect(firstElementText).to.be.eventually.equal(draggedElementText);
|
expect(firstElementText).to.be.eventually.equal(draggedElementText);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,12 +7,11 @@ chai.use(chaiAsPromised);
|
||||||
var expect = chai.expect;
|
var expect = chai.expect;
|
||||||
|
|
||||||
describe('project home', function() {
|
describe('project home', function() {
|
||||||
before(function(){
|
before(async function(){
|
||||||
browser.get('http://localhost:9001/');
|
browser.get('http://localhost:9001/');
|
||||||
|
|
||||||
return utils.common.waitLoader().then(function() {
|
await utils.common.waitLoader();
|
||||||
return utils.common.takeScreenshot("project", "home");
|
await utils.common.takeScreenshot("project", "home");
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('go to project', function() {
|
it('go to project', function() {
|
||||||
|
@ -24,26 +23,17 @@ describe('project home', function() {
|
||||||
return expect($$('div[tg-user-timeline-item]').count()).to.be.eventually.above(0);
|
return expect($$('div[tg-user-timeline-item]').count()).to.be.eventually.above(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('timeline pagination', function(done) {
|
it('timeline pagination', async function() {
|
||||||
$$('div[tg-user-timeline-item]')
|
let startTotal = await $$('div[tg-user-timeline-item]').count();
|
||||||
.count()
|
|
||||||
.then(function(startTotal) {
|
|
||||||
return browser.executeScript('window.scrollTo(0,document.body.scrollHeight)')
|
|
||||||
.then(function() {
|
|
||||||
return browser.waitForAngular();
|
|
||||||
})
|
|
||||||
.then(function() {
|
|
||||||
return $$('div[tg-user-timeline-item]').count();
|
|
||||||
})
|
|
||||||
.then(function(endTotal) {
|
|
||||||
return startTotal < endTotal;
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.then(function(hasMoreItems) {
|
|
||||||
expect(hasMoreItems).to.be.equal(true);
|
|
||||||
|
|
||||||
done();
|
await browser.executeScript('window.scrollTo(0,document.body.scrollHeight)');
|
||||||
});
|
await browser.waitForAngular();
|
||||||
|
|
||||||
|
let endTotal = await $$('div[tg-user-timeline-item]').count();
|
||||||
|
|
||||||
|
let hasMoreItems = startTotal < endTotal;
|
||||||
|
|
||||||
|
expect(hasMoreItems).to.be.equal(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('team filled', function() {
|
it('team filled', function() {
|
||||||
|
|
|
@ -2,41 +2,41 @@ var common = module.exports;
|
||||||
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
common.hasClass = function (element, cls) {
|
common.hasClass = async function (element, cls) {
|
||||||
return element.getAttribute('class').then(function (classes) {
|
let classes = await element.getAttribute('class');
|
||||||
return classes.split(' ').indexOf(cls) !== -1;
|
|
||||||
});
|
return classes.split(' ').indexOf(cls) !== -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
common.waitLoader = function () {
|
common.waitLoader = function () {
|
||||||
var el = $(".loader");
|
let el = $(".loader");
|
||||||
|
|
||||||
return browser.wait(function() {
|
return browser.wait(async function() {
|
||||||
return common.hasClass(el, 'active').then(function(active) {
|
let active = await common.hasClass(el, 'active');
|
||||||
return !active;
|
|
||||||
});
|
return !active;
|
||||||
}, 5000);
|
}, 5000);
|
||||||
};
|
};
|
||||||
|
|
||||||
common.takeScreenshot = function (section, filename) {
|
common.takeScreenshot = async function (section, filename) {
|
||||||
var screenshotsFolder = __dirname + "/../screenshots/";
|
let screenshotsFolder = __dirname + "/../screenshots/";
|
||||||
var dir = screenshotsFolder + section + "/";
|
let dir = screenshotsFolder + section + "/";
|
||||||
|
|
||||||
if (!fs.existsSync(screenshotsFolder)) {
|
if (!fs.existsSync(screenshotsFolder)) {
|
||||||
fs.mkdirSync(screenshotsFolder);
|
fs.mkdirSync(screenshotsFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
return browser.takeScreenshot().then(function (data) {
|
let data = await browser.takeScreenshot();
|
||||||
if (!fs.existsSync(dir)) {
|
|
||||||
fs.mkdirSync(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
var path = dir + filename + ".png";
|
if (!fs.existsSync(dir)) {
|
||||||
var stream = fs.createWriteStream(path);
|
fs.mkdirSync(dir);
|
||||||
|
}
|
||||||
|
|
||||||
stream.write(new Buffer(data, 'base64'));
|
let path = dir + filename + ".png";
|
||||||
stream.end();
|
let stream = fs.createWriteStream(path);
|
||||||
});
|
|
||||||
|
stream.write(new Buffer(data, 'base64'));
|
||||||
|
stream.end();
|
||||||
};
|
};
|
||||||
|
|
||||||
common.closeCookies = function() {
|
common.closeCookies = function() {
|
||||||
|
@ -45,16 +45,6 @@ common.closeCookies = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// common.waitLoad = function() {
|
|
||||||
// var deferred = protractor.promise.defer();
|
|
||||||
|
|
||||||
// common.waitLoader().then(function() {
|
|
||||||
// deferred.fulfill();
|
|
||||||
// });
|
|
||||||
|
|
||||||
// return deferred.promise;
|
|
||||||
// };
|
|
||||||
|
|
||||||
common.login = function(username, password) {
|
common.login = function(username, password) {
|
||||||
browser.get('http://localhost:9001/login');
|
browser.get('http://localhost:9001/login');
|
||||||
|
|
||||||
|
@ -63,10 +53,10 @@ common.login = function(username, password) {
|
||||||
|
|
||||||
$('.submit-button').click();
|
$('.submit-button').click();
|
||||||
|
|
||||||
return browser.driver.wait(function() {
|
return browser.driver.wait(async function() {
|
||||||
return browser.driver.getCurrentUrl().then(function(url) {
|
let url = await browser.driver.getCurrentUrl();
|
||||||
return url === 'http://localhost:9001/';
|
|
||||||
});
|
return url === 'http://localhost:9001/';
|
||||||
}, 10000);
|
}, 10000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,11 +67,10 @@ common.prepare = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
common.dragEnd = function(elm) {
|
common.dragEnd = function(elm) {
|
||||||
return browser.wait(function() {
|
return browser.wait(async function() {
|
||||||
return element.all(by.css('.ui-sortable-helper')).count()
|
let count = await element.all(by.css('.ui-sortable-helper')).count()
|
||||||
.then(function(count) {
|
|
||||||
return count === 0;
|
return count === 0;
|
||||||
});
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,22 +3,20 @@ var common = require('./common')
|
||||||
var lightbox = module.exports;
|
var lightbox = module.exports;
|
||||||
var transition = 300;
|
var transition = 300;
|
||||||
|
|
||||||
lightbox.open = function(el) {
|
lightbox.open = async function(el) {
|
||||||
var deferred = protractor.promise.defer();
|
var deferred = protractor.promise.defer();
|
||||||
|
|
||||||
browser
|
let open = await browser.wait(function() {
|
||||||
.wait(function() {
|
return common.hasClass($(el), 'open')
|
||||||
return common.hasClass($(el), 'open')
|
}, 2000);
|
||||||
}, 2000)
|
|
||||||
.then(function(open) {
|
await browser.sleep(transition);
|
||||||
return browser.sleep(transition).then(function() {
|
|
||||||
if (open) {
|
if (open) {
|
||||||
deferred.fulfill(true);
|
deferred.fulfill(true);
|
||||||
} else {
|
} else {
|
||||||
deferred.reject(new Error('Lightbox doesn\'t open'));
|
deferred.reject(new Error('Lightbox doesn\'t open'));
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"angular-mocks": "^1.3.15",
|
"angular-mocks": "^1.3.15",
|
||||||
|
"babel": "^5.6.5",
|
||||||
"chai": "^2.2.0",
|
"chai": "^2.2.0",
|
||||||
"chai-as-promised": "^5.1.0",
|
"chai-as-promised": "^5.1.0",
|
||||||
"chai-jquery": "^2.0.0",
|
"chai-jquery": "^2.0.0",
|
||||||
|
|
Loading…
Reference in New Issue