Testing attachments
parent
ef6e4737d7
commit
6d0b008322
|
@ -36,10 +36,13 @@ describe('Issue detail', async function(){
|
||||||
|
|
||||||
it('block', utils.detail.blockTesting);
|
it('block', utils.detail.blockTesting);
|
||||||
|
|
||||||
|
it('attachments', utils.detail.attachmentTesting)
|
||||||
|
|
||||||
it('delete', utils.detail.deleteTesting);
|
it('delete', utils.detail.deleteTesting);
|
||||||
|
|
||||||
it('redirected', async function (){
|
it('redirected', async function (){
|
||||||
let url = await browser.getCurrentUrl();
|
let url = await browser.getCurrentUrl();
|
||||||
expect(url.endsWith(issuesUrl)).to.be.true;
|
expect(url.endsWith(issuesUrl)).to.be.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -37,6 +37,8 @@ describe('Task detail', function(){
|
||||||
|
|
||||||
it('block', utils.detail.blockTesting);
|
it('block', utils.detail.blockTesting);
|
||||||
|
|
||||||
|
it('attachments', utils.detail.attachmentTesting)
|
||||||
|
|
||||||
it('delete', utils.detail.deleteTesting);
|
it('delete', utils.detail.deleteTesting);
|
||||||
|
|
||||||
it('redirected', async function (){
|
it('redirected', async function (){
|
||||||
|
|
|
@ -36,6 +36,8 @@ describe('User story detail', function(){
|
||||||
|
|
||||||
it('block', utils.detail.blockTesting);
|
it('block', utils.detail.blockTesting);
|
||||||
|
|
||||||
|
it('attachments', utils.detail.attachmentTesting)
|
||||||
|
|
||||||
it('delete', utils.detail.deleteTesting);
|
it('delete', utils.detail.deleteTesting);
|
||||||
|
|
||||||
it('redirected', async function (){
|
it('redirected', async function (){
|
||||||
|
|
|
@ -84,5 +84,5 @@ describe('wiki', function() {
|
||||||
expect(text).to.be.equal("\n- aa");
|
expect(text).to.be.equal("\n- aa");
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO attachments
|
it('attachments', utils.detail.attachmentTesting);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
var utils = require('../utils');
|
var utils = require('../utils');
|
||||||
|
|
||||||
var helper = module.exports;
|
var helper = module.exports;
|
||||||
|
|
||||||
helper.title = function() {
|
helper.title = function() {
|
||||||
|
@ -254,3 +253,64 @@ helper.delete = function() {
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
helper.attachment = function() {
|
||||||
|
let el = $('tg-attachments');
|
||||||
|
|
||||||
|
let obj = {
|
||||||
|
el:el,
|
||||||
|
upload: async function(filePath, name) {
|
||||||
|
await el.$('#add-attach').sendKeys(filePath);
|
||||||
|
await browser.waitForAngular();
|
||||||
|
//TODO: ask JF why this is needed
|
||||||
|
await browser.sleep(2000)
|
||||||
|
await el.$$('div[tg-attachment] .editable-attachment-comment input').last().sendKeys(name);
|
||||||
|
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
||||||
|
await browser.waitForAngular();
|
||||||
|
},
|
||||||
|
|
||||||
|
renameLastAttchment: async function (name) {
|
||||||
|
await browser.actions().mouseMove(el.$$('div[tg-attachment]').last()).perform();
|
||||||
|
await el.$$('div[tg-attachment] .attachment-settings .icon-edit').last().click();
|
||||||
|
await el.$$('div[tg-attachment] .editable-attachment-comment input').last().sendKeys(name);
|
||||||
|
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
||||||
|
await browser.waitForAngular();
|
||||||
|
},
|
||||||
|
|
||||||
|
getLastAttachmentName: async function () {
|
||||||
|
let name = await el.$$('div[tg-attachment] .attachment-comments').last().getText();
|
||||||
|
return name;
|
||||||
|
},
|
||||||
|
|
||||||
|
countAttachments: async function(){
|
||||||
|
let attachments = await el.$$('div[tg-attachment] .attachment-comments')
|
||||||
|
return attachments.length;
|
||||||
|
},
|
||||||
|
|
||||||
|
countDeprecatedAttachments: async function(){
|
||||||
|
let attachmentsJSON = await el.$$('.more-attachments .more-attachments-num').getAttribute('translate-values');
|
||||||
|
return parseInt(eval(attachmentsJSON[0]));
|
||||||
|
},
|
||||||
|
|
||||||
|
deprecateLastAttachment: async function() {
|
||||||
|
await browser.actions().mouseMove(el.$$('div[tg-attachment]').last()).perform();
|
||||||
|
await el.$$('div[tg-attachment] .attachment-settings .icon-edit').last().click();
|
||||||
|
await el.$$('div[tg-attachment] .editable-attachment-deprecated input').last().click();
|
||||||
|
await el.$$('div[tg-attachment] .attachment-settings .editable-settings.icon-floppy').last().click();
|
||||||
|
await browser.waitForAngular();
|
||||||
|
},
|
||||||
|
|
||||||
|
showDeprecated: async function(){
|
||||||
|
await el.$('.more-attachments-num').click();
|
||||||
|
},
|
||||||
|
|
||||||
|
deleteLastAttachment: async function() {
|
||||||
|
await browser.actions().mouseMove(el.$$('div[tg-attachment]').last()).perform();
|
||||||
|
await el.$$('div[tg-attachment] .attachment-settings .icon-delete').last().click();
|
||||||
|
await utils.lightbox.confirm.ok();
|
||||||
|
await browser.waitForAngular();
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
This is a testing file
|
|
@ -1,3 +1,4 @@
|
||||||
|
var path = require('path');
|
||||||
var detailHelper = require('../helpers').detail;
|
var detailHelper = require('../helpers').detail;
|
||||||
|
|
||||||
var chai = require('chai');
|
var chai = require('chai');
|
||||||
|
@ -97,6 +98,49 @@ helper.blockTesting = function() {
|
||||||
expect($('.block-description').isDisplayed()).to.be.eventually.false;
|
expect($('.block-description').isDisplayed()).to.be.eventually.false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
helper.attachmentTesting = async function() {
|
||||||
|
let attachmentHelper = detailHelper.attachment();
|
||||||
|
let date = Date.now();
|
||||||
|
|
||||||
|
// Uploading attachment
|
||||||
|
let attachmentsLength = await attachmentHelper.countAttachments();
|
||||||
|
var fileToUpload = './upload-file-test.txt',
|
||||||
|
absolutePath = path.resolve(process.cwd(), 'e2e', fileToUpload);
|
||||||
|
await attachmentHelper.upload(absolutePath, 'This is the testing name ' + date);
|
||||||
|
|
||||||
|
// Check set name
|
||||||
|
let name = await attachmentHelper.getLastAttachmentName();
|
||||||
|
expect(name).to.be.equal('This is the testing name ' + date);
|
||||||
|
|
||||||
|
// Check new length
|
||||||
|
let newAttachmentsLength = await attachmentHelper.countAttachments();
|
||||||
|
expect(newAttachmentsLength).to.be.equal(attachmentsLength + 1);
|
||||||
|
|
||||||
|
// Renaming
|
||||||
|
await attachmentHelper.renameLastAttchment('This is the new testing name ' + date);
|
||||||
|
name = await attachmentHelper.getLastAttachmentName();
|
||||||
|
expect(name).to.be.equal('This is the new testing name ' + date)
|
||||||
|
|
||||||
|
// Deprecating
|
||||||
|
let deprecatedAttachmentsLength = await attachmentHelper.countDeprecatedAttachments();
|
||||||
|
await attachmentHelper.deprecateLastAttachment();
|
||||||
|
let newDeprecatedAttachmentsLength = await attachmentHelper.countDeprecatedAttachments();
|
||||||
|
expect(newDeprecatedAttachmentsLength).to.be.equal(deprecatedAttachmentsLength + 1);
|
||||||
|
|
||||||
|
// Show deprecated
|
||||||
|
attachmentsLength = await attachmentHelper.countAttachments();
|
||||||
|
deprecatedAttachmentsLength = await attachmentHelper.countDeprecatedAttachments();
|
||||||
|
await attachmentHelper.showDeprecated();
|
||||||
|
newAttachmentsLength = await attachmentHelper.countAttachments();
|
||||||
|
expect(newAttachmentsLength).to.be.equal(attachmentsLength + deprecatedAttachmentsLength);
|
||||||
|
|
||||||
|
// Deleting
|
||||||
|
attachmentsLength = await attachmentHelper.countAttachments();
|
||||||
|
await attachmentHelper.deleteLastAttachment();
|
||||||
|
newAttachmentsLength = await attachmentHelper.countAttachments();
|
||||||
|
expect(newAttachmentsLength).to.be.equal(attachmentsLength - 1);
|
||||||
|
}
|
||||||
|
|
||||||
helper.deleteTesting = async function() {
|
helper.deleteTesting = async function() {
|
||||||
let deleteHelper = detailHelper.delete();
|
let deleteHelper = detailHelper.delete();
|
||||||
await deleteHelper.delete();
|
await deleteHelper.delete();
|
||||||
|
|
Loading…
Reference in New Issue