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-10-15 15:29:48 +02:00
|
|
|
this.fileId = /download\/(\w+)\/\??.*#/.exec(path)[1];
|
2018-10-31 19:31:17 +01:00
|
|
|
this.downloadButton = '#download-btn';
|
|
|
|
this.downloadComplete = '#download-complete';
|
2019-10-15 15:29:48 +02:00
|
|
|
this.passwordInput = '#password-input';
|
|
|
|
this.passwordButton = '#password-btn';
|
2018-10-02 22:15:02 +02:00
|
|
|
}
|
|
|
|
|
2019-10-15 15:29:48 +02:00
|
|
|
downloadUsingPassword(password) {
|
|
|
|
browser.waitForExist(this.passwordInput);
|
|
|
|
browser.setValue(this.passwordInput, password);
|
|
|
|
browser.click(this.passwordButton);
|
|
|
|
return browser.click(this.downloadButton);
|
2018-10-02 22:15:02 +02:00
|
|
|
}
|
|
|
|
|
2018-10-31 19:31:17 +01:00
|
|
|
download() {
|
2019-10-15 15:29:48 +02:00
|
|
|
browser.waitForExist(this.downloadButton);
|
2018-10-31 19:31:17 +01:00
|
|
|
return browser.click(this.downloadButton);
|
2018-10-02 22:15:02 +02:00
|
|
|
}
|
|
|
|
}
|
2018-10-04 02:39:39 +02:00
|
|
|
module.exports = DownloadPage;
|