Adding watchers testing

stable
Alejandro Alonso 2015-07-27 14:13:21 +02:00 committed by Juanfran
parent 073d515f7f
commit 051b8c42bd
5 changed files with 80 additions and 1 deletions

View File

@ -6,7 +6,7 @@ var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
var expect = chai.expect;
describe.only('Issue detail', async function(){
describe('Issue detail', async function(){
let issuesUrl = "";
before(async function(){
utils.common.goHome();
@ -28,6 +28,8 @@ describe.only('Issue detail', async function(){
it('assigned to edition', utils.detail.assignedToTesting);
it('watchers edition', utils.detail.watchersTesting);
it('history', utils.detail.historyTesting);
it('screenshot', async function() {

View File

@ -29,6 +29,8 @@ describe('Task detail', function(){
it('assigned to edition', utils.detail.assignedToTesting);
it('watchers edition', utils.detail.watchersTesting);
it('history', utils.detail.historyTesting);
it('screenshot', async function() {

View File

@ -28,6 +28,8 @@ describe('User story detail', function(){
it('assigned to edition', utils.detail.assignedToTesting);
it('watchers edition', utils.detail.watchersTesting);
it('history', utils.detail.historyTesting);
it('screenshot', async function() {

View File

@ -326,3 +326,56 @@ helper.attachment = function() {
return obj;
}
helper.watchers = function() {
let el = $('section[tg-watchers]');
let obj = {
el: el,
addWatcher: function() {
el.$('.add-watcher').click();
},
getWatchersUserNames: function() {
return el.$$('.watcher-name span').getText();
},
removeAllWathchers: async function() {
let deleteIcons = await el.$$('.icon-delete')
let totalWatchers = deleteIcons.length;
while (totalWatchers > 0) {
el.$$('.icon-delete').first().click()
await utils.lightbox.confirm.ok();
await browser.waitForAngular();
totalWatchers --;
}
}
};
return obj;
};
helper.watchersLightbox = function() {
let el = $('div[tg-lb-watchers]');
let obj = {
el: el,
waitOpen: function() {
return utils.lightbox.open(el);
},
waitClose: function() {
return utils.lightbox.close(el);
},
selectFirst: async function() {
el.$$('div[data-user-id]').first().click();
await browser.waitForAngular();
}
};
return obj;
};

View File

@ -148,3 +148,23 @@ helper.deleteTesting = async function() {
let deleteHelper = detailHelper.delete();
await deleteHelper.delete();
}
helper.watchersTesting = async function() {
let watchersHelper = detailHelper.watchers();
let watchersLightboxHelper = detailHelper.watchersLightbox();
let userNames = await watchersHelper.getWatchersUserNames();
//Add watcher
watchersHelper.addWatcher();
watchersLightboxHelper.waitOpen();
watchersLightboxHelper.selectFirst();
watchersLightboxHelper.waitClose();
let newUserNames = await watchersHelper.getWatchersUserNames();
expect(newUserNames.join()).to.be.equal(userNames + ',Administrator');
//Clear watchers
await watchersHelper.removeAllWathchers();
newUserNames = await watchersHelper.getWatchersUserNames();
expect(newUserNames.join()).to.be.equal('');
}