2018-10-04 00:39:39 +00:00
|
|
|
/* global browser */
|
|
|
|
const Page = require('./page');
|
2018-10-02 20:15:02 +00:00
|
|
|
|
2018-10-04 00:39:39 +00:00
|
|
|
class DownloadPage extends Page {
|
2018-10-02 20:15:02 +00:00
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.downloadBtnLocator = '.btn--download';
|
|
|
|
this.downloadCompletedLocator = '.btn--complete';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @function waitForPageToLoad
|
|
|
|
* @returns {Object} An object representing the page.
|
|
|
|
* @throws ElementNotFound
|
|
|
|
*/
|
|
|
|
waitForPageToLoad() {
|
|
|
|
browser.waitUntil(() => {
|
|
|
|
browser.waitForExist(this.downloadBtnLocator);
|
2018-10-04 00:39:39 +00:00
|
|
|
const el = browser.element(this.downloadBtnLocator);
|
2018-10-02 20:15:02 +00:00
|
|
|
return browser.elementIdDisplayed(el.value.ELEMENT);
|
|
|
|
});
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
downloadBtn() {
|
|
|
|
this.waitForPageToLoad();
|
|
|
|
return browser.click(this.downloadBtnLocator);
|
|
|
|
}
|
|
|
|
|
|
|
|
get downloadComplete() {
|
|
|
|
return this.downloadCompletedLocator;
|
|
|
|
}
|
|
|
|
}
|
2018-10-04 00:39:39 +00:00
|
|
|
module.exports = DownloadPage;
|