From 073d515f7f6dd18c2061a5170bcd5a20665b5d9b Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 27 Jul 2015 13:25:46 +0200 Subject: [PATCH] Adding reordering attachments tests --- e2e/full/issues/issue-detail.e2e.js | 2 +- e2e/helpers/detail-helper.js | 12 ++++++++++++ e2e/utils/detail.js | 7 +++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/e2e/full/issues/issue-detail.e2e.js b/e2e/full/issues/issue-detail.e2e.js index 8cd1f86e..863376b1 100644 --- a/e2e/full/issues/issue-detail.e2e.js +++ b/e2e/full/issues/issue-detail.e2e.js @@ -6,7 +6,7 @@ var chaiAsPromised = require('chai-as-promised'); chai.use(chaiAsPromised); var expect = chai.expect; -describe('Issue detail', async function(){ +describe.only('Issue detail', async function(){ let issuesUrl = ""; before(async function(){ utils.common.goHome(); diff --git a/e2e/helpers/detail-helper.js b/e2e/helpers/detail-helper.js index a3525967..e7a23a8c 100644 --- a/e2e/helpers/detail-helper.js +++ b/e2e/helpers/detail-helper.js @@ -277,6 +277,11 @@ helper.attachment = function() { await browser.waitForAngular(); }, + getFirstAttachmentName: async function () { + let name = await el.$$('div[tg-attachment] .attachment-comments').first().getText(); + return name; + }, + getLastAttachmentName: async function () { let name = await el.$$('div[tg-attachment] .attachment-comments').last().getText(); return name; @@ -310,6 +315,13 @@ helper.attachment = function() { await utils.lightbox.confirm.ok(); 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; diff --git a/e2e/utils/detail.js b/e2e/utils/detail.js index c7ea6f04..30189693 100644 --- a/e2e/utils/detail.js +++ b/e2e/utils/detail.js @@ -107,15 +107,18 @@ helper.attachmentTesting = async function() { 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); + //Drag'n drop + await attachmentHelper.dragLastAttchmentToFirstPosition(); + name = await attachmentHelper.getFirstAttachmentName(); + expect(name).to.be.equal('This is the testing name ' + date); + // Renaming await attachmentHelper.renameLastAttchment('This is the new testing name ' + date); name = await attachmentHelper.getLastAttachmentName();