Enhancement #4339: Add e2e tests

stable
David Barragán Merino 2016-06-15 11:45:45 +02:00
parent 0db876c82a
commit 1fe663fb52
2 changed files with 25 additions and 1 deletions

View File

@ -17,10 +17,17 @@ helper.links = function() {
return newLink; return newLink;
}, },
get: function() { get: function(index) {
if(index !== null && index !== undefined)
return el.$$(".wiki-link a.link-title").get(index)
return el.$$(".wiki-link a.link-title"); return el.$$(".wiki-link a.link-title");
}, },
getNameOf: async function(index) {
let item = await obj.get(index)
return item.getText()
},
deleteLink: async function(link){ deleteLink: async function(link){
link.click(); link.click();
await utils.lightbox.confirm.ok(); await utils.lightbox.confirm.ok();
@ -32,6 +39,12 @@ helper.links = function() {
return obj; return obj;
}; };
helper.dragAndDropLinks = async function(indexFrom, indexTo) {
let selectedLink = helper.links().get(indexFrom);
let newPosition = helper.links().get(indexTo);
return utils.common.drag(selectedLink, newPosition);
};
helper.editor = function(){ helper.editor = function(){
let el = $('.main.wiki'); let el = $('.main.wiki');

View File

@ -20,6 +20,17 @@ describe('wiki', function() {
await utils.common.takeScreenshot("wiki", "empty"); await utils.common.takeScreenshot("wiki", "empty");
}); });
it("drag & drop links", async function() {
let nameOld = await wikiHelper.links().getNameOf(0);
await wikiHelper.dragAndDropLinks(0, 1);
let nameNew = await wikiHelper.links().getNameOf(4);
expect(nameNew).to.be.equal(nameOld);
});
it('add link', async function(){ it('add link', async function(){
let timestamp = new Date().getTime(); let timestamp = new Date().getTime();
currentWiki.slug = "test-link" + timestamp; currentWiki.slug = "test-link" + timestamp;