diff --git a/e2e/full/project-home.e2e.js b/e2e/full/project-home.e2e.js index 83892cc7..72884731 100644 --- a/e2e/full/project-home.e2e.js +++ b/e2e/full/project-home.e2e.js @@ -40,4 +40,89 @@ describe('project home', function() { it('team filled', function() { expect($$('ul.involved-team a').count()).to.be.eventually.above(0); }); + + it('like', async function() { + let link = $('tg-like-button a'); + let likesCounterOld = parseInt(await link.$('.track-button-counter').getText(), 10); + + link.click(); + + await browser.waitForAngular(); + await utils.common.takeScreenshot("project", "home-like"); + + let likeActive = utils.common.hasClass(link, 'active'); + let likesCounter = parseInt(await link.$('.track-button-counter').getText(), 10); + + expect(likeActive).to.be.eventually.true; + expect(likesCounter).to.be.equal(likesCounterOld + 1); + }); + + it('unlike', async function() { + let link = $('tg-like-button a'); + let likesCounterOld = parseInt(await link.$('.track-button-counter').getText(), 10); + + link.click(); + + await browser.waitForAngular(); + + let likeActive = utils.common.hasClass(link, 'active'); + let likesCounter = parseInt(await link.$('.track-button-counter').getText(), 10); + + expect(likeActive).to.be.eventually.false; + expect(likesCounter).to.be.equal(likesCounterOld - 1); + }); + + it('watch', async function() { + let link = $('tg-watch-button > a'); + let watchOptions = $('tg-watch-button .watch-options'); + let watchCounterOld = parseInt(await link.$('.track-button-counter').getText(), 10); + + link.click(); + + await browser.waitForAngular(); + + await browser.wait(async () => { + return !await utils.common.hasClass(watchOptions, 'hidden'); + }, 4000); + + watchOptions.$$('a').first().click(); + + await browser.wait(async () => { + return await utils.common.hasClass(watchOptions, 'hidden'); + }, 4000); + + let watchActive = utils.common.hasClass(link, 'active'); + let watchCounter = parseInt(await link.$('.track-button-counter').getText(), 10); + + await utils.common.takeScreenshot("project", "home-watch"); + + expect(watchActive).to.be.eventually.true; + expect(watchCounter).to.be.equal(watchCounterOld + 1); + }); + + it('unwatch', async function() { + let link = $('tg-watch-button > a'); + let watchOptions = $('tg-watch-button .watch-options'); + let watchCounterOld = parseInt(await link.$('.track-button-counter').getText(), 10); + + link.click(); + + await browser.waitForAngular(); + + await browser.wait(async () => { + return !await utils.common.hasClass(watchOptions, 'hidden'); + }, 4000); + + watchOptions.$$('a').last().click(); + + await browser.wait(async () => { + return await utils.common.hasClass(watchOptions, 'hidden'); + }, 4000); + + let watchActive = utils.common.hasClass(link, 'active'); + let watchCounter = parseInt(await link.$('.track-button-counter').getText(), 10); + + expect(watchActive).to.be.eventually.false; + expect(watchCounter).to.be.equal(watchCounterOld - 1); + }); }); diff --git a/e2e/full/user-profile/user-profile.e2e.js b/e2e/full/user-profile/user-profile-activity.e2e.js similarity index 73% rename from e2e/full/user-profile/user-profile.e2e.js rename to e2e/full/user-profile/user-profile-activity.e2e.js index 0f881716..8f92304e 100644 --- a/e2e/full/user-profile/user-profile.e2e.js +++ b/e2e/full/user-profile/user-profile-activity.e2e.js @@ -6,7 +6,7 @@ var chaiAsPromised = require('chai-as-promised'); chai.use(chaiAsPromised); var expect = chai.expect; -describe('user profile', function() { +describe('user profile - activity', function() { describe('current user', function() { before(async function(){ browser.get(browser.params.glob.host + 'profile'); @@ -16,11 +16,12 @@ describe('user profile', function() { utils.common.takeScreenshot('user-profile', 'current-user-activity'); }); - it('activity tab pagination', async function() { + it('activity tab - pagination', async function() { let startTotal = await $$('div[tg-user-timeline-item]').count(); + let htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); await browser.executeScript('window.scrollTo(0,document.body.scrollHeight)'); - await browser.waitForAngular(); + await htmlChanges(); let endTotal = await $$('div[tg-user-timeline-item]').count(); @@ -68,8 +69,9 @@ describe('user profile', function() { it('activity tab pagination', async function() { let startTotal = await $$('div[tg-user-timeline-item]').count(); + let htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); await browser.executeScript('window.scrollTo(0,document.body.scrollHeight)'); - await browser.waitForAngular(); + await htmlChanges(); let endTotal = await $$('div[tg-user-timeline-item]').count(); @@ -77,29 +79,5 @@ describe('user profile', function() { expect(hasMoreItems).to.be.equal(true); }); - - it('projects tab', async function() { - $$('.tab').get(1).click(); - - browser.waitForAngular(); - - utils.common.takeScreenshot('user-profile', 'other-user-projects'); - - let projectsCount = await $$('.project-list-single').count(); - - expect(projectsCount).to.be.above(0); - }); - - it('conctacts tab', async function() { - $$('.tab').get(2).click(); - - browser.waitForAngular(); - - utils.common.takeScreenshot('user-profile', 'other-user-contacts'); - - let contactsCount = await $$('.profile-contact-single').count(); - - expect(contactsCount).to.be.above(0); - }); }); }); diff --git a/e2e/full/user-profile/user-profile-contacts.e2e.js b/e2e/full/user-profile/user-profile-contacts.e2e.js new file mode 100644 index 00000000..9dd3e58b --- /dev/null +++ b/e2e/full/user-profile/user-profile-contacts.e2e.js @@ -0,0 +1,49 @@ +var utils = require('../../utils'); + +var chai = require('chai'); +var chaiAsPromised = require('chai-as-promised'); + +chai.use(chaiAsPromised); +var expect = chai.expect; + +describe('user profile - contacts', function() { + describe('current user', function() { + before(async function(){ + browser.get('http://localhost:9001/profile'); + + await utils.common.waitLoader(); + + $$('.tab').get(4).click(); + + browser.waitForAngular(); + + utils.common.takeScreenshot('user-profile', 'current-user-contacts'); + }); + + it('conctacts tab', async function() { + let contactsCount = await $$('.profile-contact-single').count(); + + expect(contactsCount).to.be.above(0); + }); + }); + + describe('other user', function() { + before(async function(){ + browser.get('http://localhost:9001/profile/user7'); + + await utils.common.waitLoader(); + + $$('.tab').get(5).click(); + + browser.waitForAngular(); + + utils.common.takeScreenshot('user-profile', 'other-user-contacts'); + }); + + it('conctacts tab', async function() { + let contactsCount = await $$('.profile-contact-single').count(); + + expect(contactsCount).to.be.above(0); + }); + }); +}); diff --git a/e2e/full/user-profile/user-profile-likes.e2e.js b/e2e/full/user-profile/user-profile-likes.e2e.js new file mode 100644 index 00000000..2ba31512 --- /dev/null +++ b/e2e/full/user-profile/user-profile-likes.e2e.js @@ -0,0 +1,90 @@ +var utils = require('../../utils'); + +var chai = require('chai'); +var chaiAsPromised = require('chai-as-promised'); + +chai.use(chaiAsPromised); +var expect = chai.expect; + +describe('user profile - likes', function() { + describe('current user', function() { + before(async function(){ + browser.get('http://localhost:9001/profile'); + + await utils.common.waitLoader(); + + $$('.tab').get(1).click(); + + browser.waitForAngular(); + + utils.common.takeScreenshot('user-profile', 'current-user-likes'); + }); + + it('likes tab', async function() { + let likesCount = await $$('div[infinite-scroll] > div').count(); + + expect(likesCount).to.be.above(0); + }); + + it('likes tab - filter by query', async function() { + let allItems = await $$('div[infinite-scroll] > div').count(); + + let htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + $('div.searchbox > input').sendKeys('proj 2'); + await htmlChanges(); + + let filteredItems = await $$('div[infinite-scroll] > div').count(); + + expect(allItems).to.be.not.equal(filteredItems); + + htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + await utils.common.clear($('div.searchbox > input')); + await htmlChanges(); + + filteredItems = await $$('div[infinite-scroll] > div').count(); + + expect(allItems).to.be.equal(filteredItems); + }); + }); + + describe('other user', function() { + before(async function(){ + browser.get('http://localhost:9001/profile/user7'); + + await utils.common.waitLoader(); + + $$('.tab').get(2).click(); + + browser.waitForAngular(); + + utils.common.takeScreenshot('user-profile', 'other-user-likes'); + }); + + it('likes tab', async function() { + let likesCount = await $$('div[infinite-scroll] > div').count(); + + expect(likesCount).to.be.above(0); + }); + + it('likes tab - filter by query', async function() { + let allItems = await $$('div[infinite-scroll] > div').count(); + + let htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + $('div.searchbox > input').sendKeys('proj 2'); + await htmlChanges(); + + let filteredItems = await $$('div[infinite-scroll] > div').count(); + + expect(allItems).to.be.not.equal(filteredItems); + + htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + await utils.common.clear($('div.searchbox > input')); + await htmlChanges(); + + filteredItems = await $$('div[infinite-scroll] > div').count(); + + expect(allItems).to.be.equal(filteredItems); + }); + + }); +}); diff --git a/e2e/full/user-profile/user-profile-projects.e2e.js b/e2e/full/user-profile/user-profile-projects.e2e.js new file mode 100644 index 00000000..949cd969 --- /dev/null +++ b/e2e/full/user-profile/user-profile-projects.e2e.js @@ -0,0 +1,29 @@ +var utils = require('../../utils'); + +var chai = require('chai'); +var chaiAsPromised = require('chai-as-promised'); + +chai.use(chaiAsPromised); +var expect = chai.expect; + +describe('user profilei - projects', function() { + describe('other user', function() { + before(async function(){ + browser.get('http://localhost:9001/profile/user7'); + + await utils.common.waitLoader(); + + $$('.tab').get(1).click(); + + browser.waitForAngular(); + + utils.common.takeScreenshot('user-profile', 'other-user-projects'); + }); + + it('projects tab', async function() { + let projectsCount = await $$('.project-list-single').count(); + + expect(projectsCount).to.be.above(0); + }); + }); +}); diff --git a/e2e/full/user-profile/user-profile-votes.e2e.js b/e2e/full/user-profile/user-profile-votes.e2e.js new file mode 100644 index 00000000..98fb0690 --- /dev/null +++ b/e2e/full/user-profile/user-profile-votes.e2e.js @@ -0,0 +1,190 @@ +var utils = require('../../utils'); + +var chai = require('chai'); +var chaiAsPromised = require('chai-as-promised'); + +chai.use(chaiAsPromised); +var expect = chai.expect; + +describe('user profile - votes', function() { + describe('current user', function() { + before(async function(){ + browser.get('http://localhost:9001/profile'); + + await utils.common.waitLoader(); + + $$('.tab').get(2).click(); + + browser.waitForAngular(); + + utils.common.takeScreenshot('user-profile', 'current-user-votes'); + }); + + it('votes tab', async function() { + let votesCount = await $$('div[infinite-scroll] > div').count(); + + expect(votesCount).to.be.above(0); + }); + + it('votes tab - pagination', async function() { + let startTotal = await $$('div[infinite-scroll] > div').count(); + + let htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + await browser.executeScript('window.scrollTo(0,document.body.scrollHeight)'); + await htmlChanges(); + + let endTotal = await $$('div[infinite-scroll] > div').count(); + + let hasMoreItems = startTotal < endTotal; + + expect(hasMoreItems).to.be.equal(true); + }); + + it('votes tab - filter user stories', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(1).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('votes tab - filter tasks', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(2).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('votes tab - filter issues', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(3).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('votes tab - filter by query', async function() { + let allItems = await $$('div[infinite-scroll] > div').count(); + + let htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + $('div.searchbox > input').sendKeys('test'); + await htmlChanges(); + + let filteredItems = await $$('div[infinite-scroll] > div').count(); + + expect(allItems).to.be.not.equal(filteredItems); + + htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + await utils.common.clear($('div.searchbox > input')); + await htmlChanges(); + + filteredItems = await $$('div[infinite-scroll] > div').count(); + + expect(allItems).to.be.equal(filteredItems); + }); + }); + + describe('other user', function() { + before(async function(){ + browser.get('http://localhost:9001/profile/user7'); + + await utils.common.waitLoader(); + + $$('.tab').get(3).click(); + + browser.waitForAngular(); + + utils.common.takeScreenshot('user-profile', 'other-user-votes'); + }); + + it('votes tab', async function() { + let votesCount = await $$('div[infinite-scroll] > div').count(); + + expect(votesCount).to.be.above(0); + }); + + it('votes tab - pagination', async function() { + let startTotal = await $$('div[infinite-scroll] > div').count(); + + let htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + await browser.executeScript('window.scrollTo(0,document.body.scrollHeight)'); + await htmlChanges(); + + let endTotal = await $$('div[infinite-scroll] > div').count(); + + let hasMoreItems = startTotal < endTotal; + + expect(hasMoreItems).to.be.equal(true); + }); + + it('votes tab - filter user stories', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(1).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('votes tab - filter tasks', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(2).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('votes tab - filter issues', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(3).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('votes tab - filter by query', async function() { + let allItems = await $$('div[infinite-scroll] > div').count(); + + let htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + $('div.searchbox > input').sendKeys('test'); + await htmlChanges(); + + let filteredItems = await $$('div[infinite-scroll] > div').count(); + + expect(allItems).to.be.not.equal(filteredItems); + + htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + await utils.common.clear($('div.searchbox > input')); + await htmlChanges(); + + filteredItems = await $$('div[infinite-scroll] > div').count(); + + expect(allItems).to.be.equal(filteredItems); + }); + + }); +}); diff --git a/e2e/full/user-profile/user-profile-watched.e2e.js b/e2e/full/user-profile/user-profile-watched.e2e.js new file mode 100644 index 00000000..3234544a --- /dev/null +++ b/e2e/full/user-profile/user-profile-watched.e2e.js @@ -0,0 +1,213 @@ +var utils = require('../../utils'); + +var chai = require('chai'); +var chaiAsPromised = require('chai-as-promised'); + +chai.use(chaiAsPromised); +var expect = chai.expect; + +describe('user profile - watched', function() { + describe('current user', function() { + before(async function(){ + browser.get('http://localhost:9001/profile'); + + await utils.common.waitLoader(); + + $$('.tab').get(3).click(); + + browser.waitForAngular(); + + utils.common.takeScreenshot('user-profile', 'current-user-watched'); + }); + + it('watched tab', async function() { + let watchedCount = await $$('div[infinite-scroll] > div').count(); + + expect(watchedCount).to.be.above(0); + }); + + it('watched tab - pagination', async function() { + let startTotal = await $$('div[infinite-scroll] > div').count(); + + let htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + await browser.executeScript('window.scrollTo(0,document.body.scrollHeight)'); + await htmlChanges(); + + let endTotal = await $$('div[infinite-scroll] > div').count(); + + let hasMoreItems = startTotal < endTotal; + + expect(hasMoreItems).to.be.equal(true); + }); + + it('watched tab - filter projects', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(1).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('watched tab - filter user stories', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(2).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('watched tab - filter tasks', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(3).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('watched tab - filter issues', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(4).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('watched tab - filter by query', async function() { + let allItems = await $$('div[infinite-scroll] > div').count(); + + let htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + $('div.searchbox > input').sendKeys('test'); + await htmlChanges(); + + let filteredItems = await $$('div[infinite-scroll] > div').count(); + + expect(allItems).to.be.not.equal(filteredItems); + + htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + await utils.common.clear($('div.searchbox > input')); + await htmlChanges(); + + filteredItems = await $$('div[infinite-scroll] > div').count(); + + expect(allItems).to.be.equal(filteredItems); + }); + }); + + describe('other user', function() { + before(async function(){ + browser.get('http://localhost:9001/profile/user7'); + + await utils.common.waitLoader(); + + $$('.tab').get(4).click(); + + browser.waitForAngular(); + + utils.common.takeScreenshot('user-profile', 'other-user-watched'); + }); + + it('watched tab', async function() { + let watchedCount = await $$('div[infinite-scroll] > div').count(); + + expect(watchedCount).to.be.above(0); + }); + + it('watched tab - pagination', async function() { + let startTotal = await $$('div[infinite-scroll] > div').count(); + + let htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + await browser.executeScript('window.scrollTo(0,document.body.scrollHeight)'); + await htmlChanges(); + + let endTotal = await $$('div[infinite-scroll] > div').count(); + + let hasMoreItems = startTotal < endTotal; + + expect(hasMoreItems).to.be.equal(true); + }); + + it('watched tab - filter projects', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(1).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('watched tab - filter user stories', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(2).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('watched tab - filter tasks', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(3).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('watched tab - filter issues', async function() { + let allItems = await $('div[infinite-scroll]').getInnerHtml(); + + await $$('div.filters > a').get(4).click(); + + await browser.waitForAngular(); + + let filteredItems = await $('div[infinite-scroll]').getInnerHtml(); + + expect(allItems).to.be.not.equal(filteredItems); + }); + + it('watched tab - filter by query', async function() { + let allItems = await $$('div[infinite-scroll] > div').count(); + + let htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + $('div.searchbox > input').sendKeys('test'); + await htmlChanges(); + + let filteredItems = await $$('div[infinite-scroll] > div').count(); + + expect(allItems).to.be.not.equal(filteredItems); + + htmlChanges = await utils.common.outerHtmlChanges('div[infinite-scroll]'); + await utils.common.clear($('div.searchbox > input')); + await htmlChanges(); + + filteredItems = await $$('div[infinite-scroll] > div').count(); + + expect(allItems).to.be.equal(filteredItems); + }); + }); +}); diff --git a/karma.conf.js b/karma.conf.js index 1dbc8720..f60b812e 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -24,6 +24,9 @@ module.exports = function(config) { 'node_modules/angular-mocks/angular-mocks.js', 'vendor/bluebird/js/browser/bluebird.js', 'node_modules/chai-jquery/chai-jquery.js', + 'node_modules/chai-jquery/chai-jquery.js', + 'vendor/lodash/dist/lodash.js', + 'vendor/underscore.string/lib/underscore.string.js', 'test-utils.js', 'dist/js/app.js', 'dist/js/templates.js',