fix home e2e tests

stable
Juanfran 2016-01-27 10:22:13 +01:00
parent adf65e7d57
commit 040871c337
2 changed files with 34 additions and 32 deletions

View File

@ -19,45 +19,47 @@ describe('discover', () => {
}); });
describe('most liked', () => { describe('most liked', () => {
it('has projects', () => { it('has projects', async () => {
let projects = discoverHelper.likedProjects(); let projects = discoverHelper.likedProjects();
expect(projects.count()).to.be.eventually.above(0); let projectCount = await projects.count();
expect(projectCount).to.be.above(0);
}); });
it('rearrange', () => { it('rearrange', async () => {
discoverHelper.rearrangeLike(3); discoverHelper.rearrangeLike(3);
let filterText = discoverHelper.getLikeFilterText(); let filterText = await discoverHelper.getLikeFilterText();
let projects = discoverHelper.likedProjects(); let projects = discoverHelper.likedProjects();
expect(filterText).to.be.eventually.equal('All time'); expect(filterText).to.be.equal('All time');
expect(projects.count()).to.be.eventually.equal(5); expect(await projects.count()).to.be.equal(5);
}); });
}); });
describe('most active', () => { describe('most active', () => {
it('has projects', () => { it('has projects', async () => {
let projects = discoverHelper.activeProjects(); let projects = discoverHelper.activeProjects();
expect(projects.count()).to.be.eventually.above(0); expect(await projects.count()).to.be.above(0);
}); });
it('rearrange', () => { it('rearrange', async () => {
discoverHelper.rearrangeActive(3); discoverHelper.rearrangeActive(3);
let filterText = discoverHelper.getActiveFilterText(); let filterText = await discoverHelper.getActiveFilterText();
let projects = discoverHelper.activeProjects(); let projects = discoverHelper.activeProjects();
expect(filterText).to.be.eventually.equal('All time'); expect(filterText).to.be.equal('All time');
expect(projects.count()).to.be.eventually.equal(5); expect(await projects.count()).to.be.equal(5);
}); });
}); });
it('featured projects', () => { it('featured projects', async () => {
let projects = discoverHelper.featuredProjects(); let projects = discoverHelper.featuredProjects();
expect(projects.count()).to.be.eventually.above(0); expect(await projects.count()).to.be.eventually.above(0);
}); });
}); });

View File

@ -14,16 +14,16 @@ describe('home', function() {
utils.common.takeScreenshot("home", "dashboard"); utils.common.takeScreenshot("home", "dashboard");
}); });
it('working on filled', function() { it('working on filled', async function() {
return expect($$('.working-on div[tg-duty]').count()).to.be.eventually.above(0); return expect(await $$('.working-on div[tg-duty]').count()).to.be.above(0);
}); });
it('watching filled', function() { it('watching filled', async function() {
return expect($$('.watching div[tg-duty]').count()).to.be.eventually.above(0); return expect(await $$('.watching div[tg-duty]').count()).to.be.above(0);
}); });
it('project list filled', function() { it('project list filled', async function() {
return expect($$('.home-project-list-single').count()).to.be.eventually.above(0); return expect(await $$('.home-project').count()).to.be.above(0);
}); });
describe('projects list', function() { describe('projects list', function() {
@ -34,16 +34,16 @@ describe('home', function() {
utils.common.takeScreenshot("home", "projects"); utils.common.takeScreenshot("home", "projects");
}); });
it('open create project lightbox', function() { it('open create project lightbox', async function() {
$('.master .create-project-btn').click(); $('.master .create-project-btn').click();
return expect(utils.lightbox.open('div[tg-lb-create-project]')).to.be.eventually.equal(true); return expect(await utils.lightbox.open('div[tg-lb-create-project]')).to.be.equal(true);
}); });
it('close create project lightbox', function() { it('close create project lightbox', async function() {
$('div[tg-lb-create-project] .icon-delete').click(); $('div[tg-lb-create-project] .icon-delete').click();
return expect(utils.lightbox.close('div[tg-lb-create-project]')).to.be.eventually.equal(true); return expect(await utils.lightbox.close('div[tg-lb-create-project]')).to.be.equal(true);
}); });
}); });
@ -55,7 +55,7 @@ describe('home', function() {
let dragableElements = element.all(by.css('.list-itemtype-project')); let dragableElements = element.all(by.css('.list-itemtype-project'));
let dragElement = dragableElements.get(3); let dragElement = dragableElements.get(3);
let dragElementLink = dragElement.element(by.css('a')); let dragElementLink = dragElement.element(by.css('h2 a'));
await utils.common.waitLoader(); await utils.common.waitLoader();
@ -65,23 +65,23 @@ describe('home', function() {
await browser.waitForAngular(); await browser.waitForAngular();
}); });
utils.common.browserSkip('firefox', 'projects list has the new order', function() { utils.common.browserSkip('firefox', 'projects list has the new order', async function() {
var firstElement = $$('.list-itemtype-project a').first().getText(); var firstElement = await $$('.list-itemtype-project h2 a').first().getText();
expect(firstElement).to.be.eventually.equal(draggedElementText); expect(firstElement).to.be.equal(draggedElementText);
}); });
utils.common.browserSkip('firefox', 'projects menu has the new order', function() { utils.common.browserSkip('firefox', 'projects menu has the new order', async function() {
var firstElementText = $$('div[tg-dropdown-project-list] ul a').first().getInnerHtml(); var firstElementText = await $$('div[tg-dropdown-project-list] ul a').first().getInnerHtml();
expect(firstElementText).to.be.eventually.equal(draggedElementText); expect(firstElementText).to.be.equal(draggedElementText);
}); });
after(async function() { after(async function() {
//restore project position //restore project position
let dragableElements = element.all(by.css('.list-itemtype-project')); let dragableElements = element.all(by.css('.list-itemtype-project'));
let dragElement = dragableElements.get(0); let dragElement = dragableElements.get(0);
let dragElementLink = dragElement.element(by.css('a')); let dragElementLink = dragElement.element(by.css('h2 a'));
await utils.common.waitLoader(); await utils.common.waitLoader();