download_page.js 743 B

1234567891011121314151617181920212223242526
  1. /* global browser */
  2. const Page = require('./page');
  3. class DownloadPage extends Page {
  4. constructor(path) {
  5. super(path);
  6. this.fileId = /download\/(\w+)\/\??.*#/.exec(path)[1];
  7. this.downloadButton = '#download-btn';
  8. this.downloadComplete = '#download-complete';
  9. this.passwordInput = '#password-input';
  10. this.passwordButton = '#password-btn';
  11. }
  12. downloadUsingPassword(password) {
  13. browser.waitForExist(this.passwordInput);
  14. browser.setValue(this.passwordInput, password);
  15. browser.click(this.passwordButton);
  16. return browser.click(this.downloadButton);
  17. }
  18. download() {
  19. browser.waitForExist(this.downloadButton);
  20. return browser.click(this.downloadButton);
  21. }
  22. }
  23. module.exports = DownloadPage;