2018-11-20 15:50:59 +01:00
|
|
|
/* global browser window */
|
2018-10-04 02:39:39 +02:00
|
|
|
class Page {
|
2018-10-31 19:31:17 +01:00
|
|
|
constructor(path) {
|
|
|
|
this.path = path;
|
|
|
|
}
|
2018-10-02 22:15:02 +02:00
|
|
|
|
2018-10-31 19:31:17 +01:00
|
|
|
open() {
|
|
|
|
browser.url(this.path);
|
2018-10-02 22:15:02 +02:00
|
|
|
this.waitForPageToLoad();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @function waitForPageToLoad
|
|
|
|
* @returns {Object} An object representing the page.
|
|
|
|
* @throws ElementNotFound
|
|
|
|
*/
|
2018-10-31 19:31:17 +01:00
|
|
|
waitForPageToLoad() {
|
2018-11-20 15:50:59 +01:00
|
|
|
browser.waitUntil(function() {
|
|
|
|
return browser.execute(function() {
|
|
|
|
return typeof window.appState !== 'undefined';
|
|
|
|
});
|
|
|
|
}, 3000);
|
|
|
|
browser.pause(100);
|
2018-10-31 19:31:17 +01:00
|
|
|
return this;
|
|
|
|
}
|
2018-10-02 22:15:02 +02:00
|
|
|
}
|
2018-10-04 02:39:39 +02:00
|
|
|
module.exports = Page;
|