Adding tests for history tabs
parent
1f0b7d510e
commit
4f01ceb2f2
|
@ -28,6 +28,8 @@ describe('Issue detail', async function(){
|
|||
|
||||
it('assigned to edition', utils.detail.assignedToTesting);
|
||||
|
||||
it('history', utils.detail.historyTesting);
|
||||
|
||||
it('screenshot', async function() {
|
||||
await utils.common.takeScreenshot("issues", "detail updated");
|
||||
});
|
||||
|
@ -38,4 +40,5 @@ describe('Issue detail', async function(){
|
|||
let url = await browser.getCurrentUrl();
|
||||
expect(url.endsWith(issuesUrl)).to.be.true;
|
||||
});
|
||||
|
||||
})
|
||||
|
|
|
@ -29,6 +29,8 @@ describe('Task detail', function(){
|
|||
|
||||
it('assigned to edition', utils.detail.assignedToTesting);
|
||||
|
||||
it('history', utils.detail.historyTesting);
|
||||
|
||||
it('screenshot', async function() {
|
||||
await utils.common.takeScreenshot("tasks", "detail updated");
|
||||
});
|
||||
|
|
|
@ -28,6 +28,8 @@ describe('User story detail', function(){
|
|||
|
||||
it('assigned to edition', utils.detail.assignedToTesting);
|
||||
|
||||
it('history', utils.detail.historyTesting);
|
||||
|
||||
it('screenshot', async function() {
|
||||
await utils.common.takeScreenshot("user-stories", "detail updated");
|
||||
});
|
||||
|
|
|
@ -133,6 +133,73 @@ helper.assignToLightbox = function() {
|
|||
return obj;
|
||||
};
|
||||
|
||||
helper.history = function() {
|
||||
let el = $('section.history');
|
||||
let obj = {
|
||||
el:el,
|
||||
|
||||
selectCommentsTab: function() {
|
||||
el.$$('.history-tabs li a').first().click();
|
||||
},
|
||||
|
||||
selectActivityTab: function() {
|
||||
el.$$('.history-tabs li a').last().click();
|
||||
},
|
||||
|
||||
addComment: async function(comment) {
|
||||
el.$('textarea[tg-markitup]').sendKeys(comment);
|
||||
el.$('input.save-comment').click();
|
||||
await browser.waitForAngular();
|
||||
},
|
||||
|
||||
countComments: async function() {
|
||||
let moreComments = el.$('.comments-list .show-more-comments')
|
||||
let moreCommentsIsPresent = await moreComments.isPresent();
|
||||
if (moreCommentsIsPresent){
|
||||
moreComments.click();
|
||||
}
|
||||
await browser.waitForAngular();
|
||||
let comments = await el.$$(".activity-single.comment");
|
||||
return comments.length;
|
||||
},
|
||||
|
||||
countActivities: async function() {
|
||||
let moreActivities = el.$('.changes-list .show-more-comments')
|
||||
let selectActivityTabIsPresent = await moreActivities.isPresent();
|
||||
if (selectActivityTabIsPresent){
|
||||
moreActivities.click();
|
||||
}
|
||||
await browser.waitForAngular();
|
||||
let activities = await el.$$(".activity-single.activity");
|
||||
return activities.length;
|
||||
},
|
||||
|
||||
countDeletedComments: async function() {
|
||||
let moreComments = el.$('.comments-list .show-more-comments')
|
||||
let moreCommentsIsPresent = await moreComments.isPresent();
|
||||
if (moreCommentsIsPresent){
|
||||
moreComments.click();
|
||||
}
|
||||
await browser.waitForAngular();
|
||||
let comments = await el.$$(".activity-single.comment.deleted-comment");
|
||||
return comments.length;
|
||||
},
|
||||
|
||||
deleteLastComment: async function() {
|
||||
el.$$(".activity-single.comment .comment-delete").last().click();
|
||||
await browser.waitForAngular();
|
||||
},
|
||||
|
||||
restoreLastComment: async function() {
|
||||
el.$$(".activity-single.comment.deleted-comment .comment-restore").last().click();
|
||||
await browser.waitForAngular();
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
||||
}
|
||||
|
||||
helper.delete = function() {
|
||||
let el = $('tg-delete-button');
|
||||
|
||||
|
|
|
@ -54,6 +54,35 @@ helper.assignedToTesting = async function() {
|
|||
expect(newUserName).to.be.not.equal(userName);
|
||||
}
|
||||
|
||||
helper.historyTesting = async function() {
|
||||
let historyHelper = detailHelper.history();
|
||||
|
||||
//Adding a comment
|
||||
historyHelper.selectCommentsTab();
|
||||
let commentsCounter = await historyHelper.countComments();
|
||||
let date = Date.now()
|
||||
await historyHelper.addComment("New comment " + date);
|
||||
let newCommentsCounter = await historyHelper.countComments();
|
||||
expect(newCommentsCounter).to.be.equal(commentsCounter+1);
|
||||
|
||||
//Deleting last comment
|
||||
let deletedCommentsCounter = await historyHelper.countDeletedComments();
|
||||
await historyHelper.deleteLastComment();
|
||||
let newDeletedCommentsCounter = await historyHelper.countDeletedComments();
|
||||
expect(newDeletedCommentsCounter).to.be.equal(deletedCommentsCounter+1);
|
||||
|
||||
//Restore last coment
|
||||
deletedCommentsCounter = await historyHelper.countDeletedComments();
|
||||
await historyHelper.restoreLastComment();
|
||||
newDeletedCommentsCounter = await historyHelper.countDeletedComments();
|
||||
expect(newDeletedCommentsCounter).to.be.equal(deletedCommentsCounter-1);
|
||||
|
||||
//Check activity
|
||||
historyHelper.selectActivityTab();
|
||||
let activitiesCounter = await historyHelper.countActivities();
|
||||
expect(activitiesCounter).to.be.least(newCommentsCounter);
|
||||
}
|
||||
|
||||
helper.deleteTesting = async function() {
|
||||
let deleteHelper = detailHelper.delete();
|
||||
await deleteHelper.delete();
|
||||
|
|
Loading…
Reference in New Issue