download_page.js 632 B

123456789101112131415161718192021222324252627
  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. }
  10. /**
  11. * @function waitForPageToLoad
  12. * @returns {Object} An object representing the page.
  13. * @throws ElementNotFound
  14. */
  15. waitForPageToLoad() {
  16. super.waitForPageToLoad();
  17. browser.waitForExist(this.downloadButton);
  18. return this;
  19. }
  20. download() {
  21. return browser.click(this.downloadButton);
  22. }
  23. }
  24. module.exports = DownloadPage;