fix wiki firefox e2e

stable
Juanfran 2015-07-29 09:25:30 +02:00
parent 452cc8e528
commit fd39f0f643
4 changed files with 69 additions and 26 deletions

View File

@ -7,7 +7,9 @@ var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised); chai.use(chaiAsPromised);
var expect = chai.expect; var expect = chai.expect;
describe('wiki', function() { describe.only('wiki', function() {
let currentWiki = {};
before(async function(){ before(async function(){
browser.get('http://localhost:9001/project/project-0/wiki/home'); browser.get('http://localhost:9001/project/project-0/wiki/home');
await utils.common.waitLoader(); await utils.common.waitLoader();
@ -17,49 +19,62 @@ describe('wiki', function() {
await utils.common.takeScreenshot("wiki", "empty"); await utils.common.takeScreenshot("wiki", "empty");
}); });
it('add link, follow it, edit and remove everything', async function(){ it('add link', async function(){
// creation
let timestamp = new Date().getTime(); let timestamp = new Date().getTime();
let linkText = "Test link" + timestamp; currentWiki.slug = "test-link" + timestamp;
let slug = "test-link" + timestamp;
let newLink = await wikiHelper.links().addLink(linkText); let linkText = "Test link" + timestamp;
currentWiki.link = await wikiHelper.links().addLink(linkText);
});
it('follow last link', async function() {
// the click event is not on the <a> :(
let lastLink = wikiHelper.links().get().last().$('.link-title');
utils.common.link(lastLink);
//Following
newLink.click();
expect(browser.getCurrentUrl()).to.be.eventually.equal('http://localhost:9001/project/project-0/wiki/' + slug);
await utils.common.waitLoader(); await utils.common.waitLoader();
await utils.common.takeScreenshot("wiki", "new-link-created-with-empty-wiki-page"); await utils.common.takeScreenshot("wiki", "new-link-created-with-empty-wiki-page");
//Removing link expect(browser.getCurrentUrl()).to.be.eventually.equal('http://localhost:9001/project/project-0/wiki/' + currentWiki.slug);
wikiHelper.links().deleteLink(newLink); });
await utils.common.takeScreenshot("wiki", "deleting-the-created-link");
// Edition it('remove link', async function() {
wikiHelper.links().deleteLink(currentWiki.link);
await utils.common.takeScreenshot("wiki", "deleting-the-created-link");
});
it('edition', async function() {
let timesEdited = wikiHelper.editor().getTimesEdited(); let timesEdited = wikiHelper.editor().getTimesEdited();
let lastEditionDatetime = wikiHelper.editor().getLastEditionDateTime(); let lastEditionDatetime = wikiHelper.editor().getLastEditionDateTime();
wikiHelper.editor().enabledEditionMode(); wikiHelper.editor().enabledEditionMode();
let settingText = "This is the new text" + new Date().getTime(); let settingText = "This is the new text" + new Date().getTime();
wikiHelper.editor().setText(settingText); wikiHelper.editor().setText(settingText);
// Checking preview //preview
wikiHelper.editor().preview(); wikiHelper.editor().preview();
await utils.common.takeScreenshot("wiki", "home-edition-preview"); await utils.common.takeScreenshot("wiki", "home-edition-preview");
// Saving //save
wikiHelper.editor().save(); wikiHelper.editor().save();
let newHtml = await wikiHelper.editor().getInnerHtml(); let newHtml = await wikiHelper.editor().getInnerHtml();
let newTimesEdited = wikiHelper.editor().getTimesEdited(); let newTimesEdited = wikiHelper.editor().getTimesEdited();
let newLastEditionDatetime = wikiHelper.editor().getLastEditionDateTime(); let newLastEditionDatetime = wikiHelper.editor().getLastEditionDateTime();
expect(newHtml).to.be.equal("<p>" + settingText + "</p>"); expect(newHtml).to.be.equal("<p>" + settingText + "</p>");
expect(newTimesEdited).to.be.eventually.equal(timesEdited+1); expect(newTimesEdited).to.be.eventually.equal(timesEdited+1);
expect(newLastEditionDatetime).to.be.not.equal(lastEditionDatetime); expect(newLastEditionDatetime).to.be.not.equal(lastEditionDatetime);
await utils.common.takeScreenshot("wiki", "home-edition");
// Delete await utils.common.takeScreenshot("wiki", "home-edition");
});
it('attachments', utils.detail.attachmentTesting);
it('delete', async function() {
await wikiHelper.editor().delete(); await wikiHelper.editor().delete();
expect(browser.getCurrentUrl()).to.be.eventually.equal('http://localhost:9001/project/project-0/wiki/home'); expect(browser.getCurrentUrl()).to.be.eventually.equal('http://localhost:9001/project/project-0/wiki/home');
}) });
it('Custom keyboard actions', async function(){ it('Custom keyboard actions', async function(){
wikiHelper.editor().enabledEditionMode(); wikiHelper.editor().enabledEditionMode();
@ -84,6 +99,4 @@ describe('wiki', function() {
text = await wikiHelper.editor().getText(); text = await wikiHelper.editor().getText();
expect(text).to.be.equal("\n- aa"); expect(text).to.be.equal("\n- aa");
}); });
it('attachments', utils.detail.attachmentTesting);
}); });

View File

@ -303,8 +303,16 @@ helper.attachment = function() {
}, },
countDeprecatedAttachments: async function(){ countDeprecatedAttachments: async function(){
let attachmentsJSON = await el.$$('.more-attachments .more-attachments-num').getAttribute('translate-values'); let hasDeprecateds = await el.$('.more-attachments .more-attachments-num').isPresent();
return parseInt(eval(attachmentsJSON[0]));
if (hasDeprecateds) {
let attachmentsJSON = await el.$('.more-attachments .more-attachments-num').getAttribute('translate-values');
return parseInt(eval(attachmentsJSON));
} else {
return 0;
}
}, },
deprecateLastAttachment: async function() { deprecateLastAttachment: async function() {
@ -320,8 +328,27 @@ helper.attachment = function() {
}, },
deleteLastAttachment: async function() { deleteLastAttachment: async function() {
await browser.actions().mouseMove(el.$$('div[tg-attachment]').last()).perform(); let attachment = await $$('div[tg-attachment]').last();
await el.$$('div[tg-attachment] .attachment-settings .icon-delete').last().click();
await browser.actions().mouseMove(attachment).perform();
let isEditable = await attachment.$('.editable').isPresent();
// close edit
if(isEditable) {
let iconDelete = await attachment.$('.attachment-settings .icon-delete');
await browser.actions().mouseMove(iconDelete).perform();
iconDelete.click();
await browser.waitForAngular();
}
let iconDelete = await attachment.$('.attachment-settings .icon-delete');
await browser.actions().mouseMove(iconDelete).perform();
iconDelete.click();
await utils.lightbox.confirm.ok(); await utils.lightbox.confirm.ok();
await browser.waitForAngular(); await browser.waitForAngular();
}, },

View File

@ -17,6 +17,10 @@ helper.links = function() {
return newLink; return newLink;
}, },
get: function() {
return el.$$(".wiki-link a");
},
deleteLink: async function(link){ deleteLink: async function(link){
link.$(".icon-delete").click(); link.$(".icon-delete").click();
await utils.lightbox.confirm.ok(); await utils.lightbox.confirm.ok();
@ -35,7 +39,7 @@ helper.editor = function(){
el: el, el: el,
enabledEditionMode: async function(){ enabledEditionMode: async function(){
await el.$("section[tg-editable-wiki-content]").click(); await el.$("section[tg-editable-wiki-content] .view-wiki-content").click();
}, },
getTimesEdited: async function(){ getTimesEdited: async function(){

View File

@ -139,7 +139,6 @@ helper.attachmentTesting = async function() {
deprecatedAttachmentsLength = await attachmentHelper.countDeprecatedAttachments(); deprecatedAttachmentsLength = await attachmentHelper.countDeprecatedAttachments();
await attachmentHelper.showDeprecated(); await attachmentHelper.showDeprecated();
await browser.waitForAngular(); await browser.waitForAngular();
await browser.sleep(6000);
newAttachmentsLength = await attachmentHelper.countAttachments(); newAttachmentsLength = await attachmentHelper.countAttachments();
expect(newAttachmentsLength).to.be.equal(attachmentsLength + deprecatedAttachmentsLength); expect(newAttachmentsLength).to.be.equal(attachmentsLength + deprecatedAttachmentsLength);