2018-10-04 02:39:39 +02:00
|
|
|
/* global browser */
|
|
|
|
const Page = require('./page');
|
2018-10-02 22:15:02 +02:00
|
|
|
|
2018-10-04 02:39:39 +02:00
|
|
|
class DownloadPage extends Page {
|
2018-10-31 19:31:17 +01:00
|
|
|
constructor(path) {
|
|
|
|
super(path);
|
2019-01-10 02:25:43 +01:00
|
|
|
this.fileId = /download\/(\w+)\/#/.exec(path)[1];
|
2018-10-31 19:31:17 +01:00
|
|
|
this.downloadButton = '#download-btn';
|
|
|
|
this.downloadComplete = '#download-complete';
|
2018-10-02 22:15:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @function waitForPageToLoad
|
|
|
|
* @returns {Object} An object representing the page.
|
|
|
|
* @throws ElementNotFound
|
|
|
|
*/
|
|
|
|
waitForPageToLoad() {
|
2018-11-20 15:50:59 +01:00
|
|
|
super.waitForPageToLoad();
|
2018-10-31 19:31:17 +01:00
|
|
|
browser.waitForExist(this.downloadButton);
|
2018-10-02 22:15:02 +02:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2018-10-31 19:31:17 +01:00
|
|
|
download() {
|
|
|
|
return browser.click(this.downloadButton);
|
2018-10-02 22:15:02 +02:00
|
|
|
}
|
|
|
|
}
|
2018-10-04 02:39:39 +02:00
|
|
|
module.exports = DownloadPage;
|