Refactoring common.link and adding home navigation option
parent
49cd34646a
commit
f64ce4f3d2
|
@ -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 () {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue