Adding reordering attachments tests

stable
Alejandro Alonso 2015-07-27 13:25:46 +02:00 committed by Juanfran
parent 6d0b008322
commit 073d515f7f
3 changed files with 18 additions and 3 deletions

View File

@ -6,7 +6,7 @@ var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised); chai.use(chaiAsPromised);
var expect = chai.expect; var expect = chai.expect;
describe('Issue detail', async function(){ describe.only('Issue detail', async function(){
let issuesUrl = ""; let issuesUrl = "";
before(async function(){ before(async function(){
utils.common.goHome(); utils.common.goHome();

View File

@ -277,6 +277,11 @@ helper.attachment = function() {
await browser.waitForAngular(); await browser.waitForAngular();
}, },
getFirstAttachmentName: async function () {
let name = await el.$$('div[tg-attachment] .attachment-comments').first().getText();
return name;
},
getLastAttachmentName: async function () { getLastAttachmentName: async function () {
let name = await el.$$('div[tg-attachment] .attachment-comments').last().getText(); let name = await el.$$('div[tg-attachment] .attachment-comments').last().getText();
return name; return name;
@ -310,6 +315,13 @@ helper.attachment = function() {
await utils.lightbox.confirm.ok(); await utils.lightbox.confirm.ok();
await browser.waitForAngular(); await browser.waitForAngular();
}, },
dragLastAttchmentToFirstPosition: async function() {
await browser.actions().mouseMove(el.$$('div[tg-attachment]').last()).perform();
let lastDraggableAttachment = el.$$('div[tg-attachment] .attachment-settings .icon-drag-v').last();
let destination = el.$$('div[tg-attachment] .attachment-settings .icon-drag-v').first();
await utils.common.drag(lastDraggableAttachment, destination);
}
} }
return obj; return obj;

View File

@ -107,15 +107,18 @@ helper.attachmentTesting = async function() {
var fileToUpload = './upload-file-test.txt', var fileToUpload = './upload-file-test.txt',
absolutePath = path.resolve(process.cwd(), 'e2e', fileToUpload); absolutePath = path.resolve(process.cwd(), 'e2e', fileToUpload);
await attachmentHelper.upload(absolutePath, 'This is the testing name ' + date); await attachmentHelper.upload(absolutePath, 'This is the testing name ' + date);
// Check set name // Check set name
let name = await attachmentHelper.getLastAttachmentName(); let name = await attachmentHelper.getLastAttachmentName();
expect(name).to.be.equal('This is the testing name ' + date); expect(name).to.be.equal('This is the testing name ' + date);
// Check new length // Check new length
let newAttachmentsLength = await attachmentHelper.countAttachments(); let newAttachmentsLength = await attachmentHelper.countAttachments();
expect(newAttachmentsLength).to.be.equal(attachmentsLength + 1); expect(newAttachmentsLength).to.be.equal(attachmentsLength + 1);
//Drag'n drop
await attachmentHelper.dragLastAttchmentToFirstPosition();
name = await attachmentHelper.getFirstAttachmentName();
expect(name).to.be.equal('This is the testing name ' + date);
// Renaming // Renaming
await attachmentHelper.renameLastAttchment('This is the new testing name ' + date); await attachmentHelper.renameLastAttchment('This is the new testing name ' + date);
name = await attachmentHelper.getLastAttachmentName(); name = await attachmentHelper.getLastAttachmentName();