Refactoring common.link and adding home navigation option

stable
Alejandro Alonso 2015-10-30 09:12:27 +01:00
parent 49cd34646a
commit f64ce4f3d2
2 changed files with 27 additions and 1 deletions

View File

@ -49,11 +49,29 @@ common.browserSkip = function(browserName, name, fn) {
}; };
common.link = async function(el) { common.link = async function(el) {
return browser let oldUrl = await browser.getCurrentUrl();
browser
.actions()
.mouseMove(el)
.perform();
await browser.wait(async function() {
let href = await el.getAttribute('href');
return href.length > 1 && href !== browser.params.glob.host + "#";
}, 5000);
browser
.actions() .actions()
.mouseMove(el) .mouseMove(el)
.click() .click()
.perform(); .perform();
return browser.wait(async function() {
let newUrl = await browser.getCurrentUrl();
return oldUrl !== newUrl;
}, 5000);
}; };
common.waitLoader = function () { common.waitLoader = function () {

View File

@ -42,6 +42,10 @@ var actions = {
return common.waitLoader(); return common.waitLoader();
}, },
home: function() {
browser.get(browser.params.glob.host);
return common.waitLoader();
},
taskboard: function(index) { taskboard: function(index) {
let link = $$('.sprints .button-gray').get(index); let link = $$('.sprints .button-gray').get(index);
@ -77,6 +81,10 @@ var nav = {
this.actions.push(actions.us.bind(null, index)); this.actions.push(actions.us.bind(null, index));
return this; return this;
}, },
home: function() {
this.actions.push(actions.home.bind(null));
return this;
},
taskboard: function(index) { taskboard: function(index) {
this.actions.push(actions.taskboard.bind(null, index)); this.actions.push(actions.taskboard.bind(null, index));
return this; return this;