fix wiki firefox e2e
parent
452cc8e528
commit
fd39f0f643
|
@ -7,7 +7,9 @@ var chaiAsPromised = require('chai-as-promised');
|
|||
chai.use(chaiAsPromised);
|
||||
var expect = chai.expect;
|
||||
|
||||
describe('wiki', function() {
|
||||
describe.only('wiki', function() {
|
||||
let currentWiki = {};
|
||||
|
||||
before(async function(){
|
||||
browser.get('http://localhost:9001/project/project-0/wiki/home');
|
||||
await utils.common.waitLoader();
|
||||
|
@ -17,49 +19,62 @@ describe('wiki', function() {
|
|||
await utils.common.takeScreenshot("wiki", "empty");
|
||||
});
|
||||
|
||||
it('add link, follow it, edit and remove everything', async function(){
|
||||
// creation
|
||||
it('add link', async function(){
|
||||
let timestamp = new Date().getTime();
|
||||
let linkText = "Test link" + timestamp;
|
||||
let slug = "test-link" + timestamp;
|
||||
let newLink = await wikiHelper.links().addLink(linkText);
|
||||
currentWiki.slug = "test-link" + timestamp;
|
||||
|
||||
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.takeScreenshot("wiki", "new-link-created-with-empty-wiki-page");
|
||||
|
||||
//Removing link
|
||||
wikiHelper.links().deleteLink(newLink);
|
||||
await utils.common.takeScreenshot("wiki", "deleting-the-created-link");
|
||||
expect(browser.getCurrentUrl()).to.be.eventually.equal('http://localhost:9001/project/project-0/wiki/' + currentWiki.slug);
|
||||
});
|
||||
|
||||
// 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 lastEditionDatetime = wikiHelper.editor().getLastEditionDateTime();
|
||||
wikiHelper.editor().enabledEditionMode();
|
||||
let settingText = "This is the new text" + new Date().getTime();
|
||||
wikiHelper.editor().setText(settingText);
|
||||
|
||||
// Checking preview
|
||||
//preview
|
||||
wikiHelper.editor().preview();
|
||||
await utils.common.takeScreenshot("wiki", "home-edition-preview");
|
||||
|
||||
// Saving
|
||||
//save
|
||||
wikiHelper.editor().save();
|
||||
let newHtml = await wikiHelper.editor().getInnerHtml();
|
||||
let newTimesEdited = wikiHelper.editor().getTimesEdited();
|
||||
let newLastEditionDatetime = wikiHelper.editor().getLastEditionDateTime();
|
||||
|
||||
expect(newHtml).to.be.equal("<p>" + settingText + "</p>");
|
||||
expect(newTimesEdited).to.be.eventually.equal(timesEdited+1);
|
||||
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();
|
||||
|
||||
expect(browser.getCurrentUrl()).to.be.eventually.equal('http://localhost:9001/project/project-0/wiki/home');
|
||||
})
|
||||
});
|
||||
|
||||
it('Custom keyboard actions', async function(){
|
||||
wikiHelper.editor().enabledEditionMode();
|
||||
|
@ -84,6 +99,4 @@ describe('wiki', function() {
|
|||
text = await wikiHelper.editor().getText();
|
||||
expect(text).to.be.equal("\n- aa");
|
||||
});
|
||||
|
||||
it('attachments', utils.detail.attachmentTesting);
|
||||
});
|
||||
|
|
|
@ -303,8 +303,16 @@ helper.attachment = function() {
|
|||
},
|
||||
|
||||
countDeprecatedAttachments: async function(){
|
||||
let attachmentsJSON = await el.$$('.more-attachments .more-attachments-num').getAttribute('translate-values');
|
||||
return parseInt(eval(attachmentsJSON[0]));
|
||||
let hasDeprecateds = await el.$('.more-attachments .more-attachments-num').isPresent();
|
||||
|
||||
if (hasDeprecateds) {
|
||||
let attachmentsJSON = await el.$('.more-attachments .more-attachments-num').getAttribute('translate-values');
|
||||
|
||||
|
||||
return parseInt(eval(attachmentsJSON));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
|
||||
deprecateLastAttachment: async function() {
|
||||
|
@ -320,8 +328,27 @@ helper.attachment = function() {
|
|||
},
|
||||
|
||||
deleteLastAttachment: async function() {
|
||||
await browser.actions().mouseMove(el.$$('div[tg-attachment]').last()).perform();
|
||||
await el.$$('div[tg-attachment] .attachment-settings .icon-delete').last().click();
|
||||
let attachment = await $$('div[tg-attachment]').last();
|
||||
|
||||
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 browser.waitForAngular();
|
||||
},
|
||||
|
|
|
@ -17,6 +17,10 @@ helper.links = function() {
|
|||
return newLink;
|
||||
},
|
||||
|
||||
get: function() {
|
||||
return el.$$(".wiki-link a");
|
||||
},
|
||||
|
||||
deleteLink: async function(link){
|
||||
link.$(".icon-delete").click();
|
||||
await utils.lightbox.confirm.ok();
|
||||
|
@ -35,7 +39,7 @@ helper.editor = function(){
|
|||
el: el,
|
||||
|
||||
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(){
|
||||
|
|
|
@ -139,7 +139,6 @@ helper.attachmentTesting = async function() {
|
|||
deprecatedAttachmentsLength = await attachmentHelper.countDeprecatedAttachments();
|
||||
await attachmentHelper.showDeprecated();
|
||||
await browser.waitForAngular();
|
||||
await browser.sleep(6000);
|
||||
newAttachmentsLength = await attachmentHelper.countAttachments();
|
||||
expect(newAttachmentsLength).to.be.equal(attachmentsLength + deprecatedAttachmentsLength);
|
||||
|
||||
|
|
Loading…
Reference in New Issue