page.js 539 B

123456789101112131415161718192021222324252627
  1. /* global browser window */
  2. class Page {
  3. constructor(path) {
  4. this.path = path;
  5. }
  6. open() {
  7. browser.url(this.path);
  8. this.waitForPageToLoad();
  9. }
  10. /**
  11. * @function waitForPageToLoad
  12. * @returns {Object} An object representing the page.
  13. * @throws ElementNotFound
  14. */
  15. waitForPageToLoad() {
  16. browser.waitUntil(function() {
  17. return browser.execute(function() {
  18. return typeof window.app !== 'undefined';
  19. });
  20. }, 3000);
  21. browser.pause(100);
  22. return this;
  23. }
  24. }
  25. module.exports = Page;