Skip to content

Commit

Permalink
Fix timeout value in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
schipiga committed Mar 21, 2018
1 parent 9deffeb commit 089ae9d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
1 change: 1 addition & 0 deletions lib/config.js
Expand Up @@ -28,6 +28,7 @@ var args = config.args;
config.webdriver = U.defVal(config.webdriver, {});

config.web = U.defVal(config.web, {});
config.web.uiTimeout = 5;
config.web.use = U.defVal(!!args.web, false);
config.web.url = U.defVal(args.webUrl);
config.web.installDrivers = U.defVal(
Expand Down
25 changes: 13 additions & 12 deletions lib/pom/element.js
Expand Up @@ -14,6 +14,7 @@
var weak = require("weak");
var U = require("glace-utils");

var CONF = require("../config");
var PointerEvents = require("./event");

var Element = function (name, selector, page) {
Expand Down Expand Up @@ -186,13 +187,13 @@ Element.prototype.isExist = function () {
*
* @async
* @method
* @arg {number} [timeout] - Timeout to wait, ms.
* @arg {number} [timeout] - Timeout to wait, sec.
* @return {Promise<void>}
* @throws {TimeoutError} If control doesn't exist after timeout.
*/
Element.prototype.waitForExist = function (timeout) {
var timeout = U.defVal(timeout, CONF.timeouts.uiAction);
var errMsg = this.name + " isn't exist after " + timeout + " ms";
var timeout = U.defVal(timeout, CONF.web.uiTimeout) * 1000;
var errMsg = `${this.name} (${this.selector}) doesn't exist after ${timeout}s`;

return this._getDriver().waitUntil(async () => {
return await this.isExist();
Expand All @@ -203,13 +204,13 @@ Element.prototype.waitForExist = function (timeout) {
*
* @async
* @method
* @arg {number} [timeout] - Timeout to wait, ms.
* @arg {number} [timeout] - Timeout to wait, sec.
* @return {Promise<void>}
* @throws {TimeoutError} If control is still exist after timeout.
*/
Element.prototype.waitForNonExist = function (timeout) {
var timeout = U.defVal(timeout, CONF.timeouts.uiAction);
var errMsg = `${this.name} (${this.selector}) still exists after ${timeout} ms`;
var timeout = U.defVal(timeout, CONF.web.uiTimeout) * 1000;
var errMsg = `${this.name} (${this.selector}) still exists after ${timeout}s`;

return this._getDriver().waitUntil(async () => {
return !(await this.isExist());
Expand All @@ -232,14 +233,14 @@ Element.prototype.isVisible = function () {
*
* @async
* @method
* @arg {number} [timeout] - Timeout to wait, ms.
* @arg {number} [timeout] - Timeout to wait, sec.
* @return {Promise<void>}
* @throws {TimeoutError} If control isn't visible after timeout.
*/
Element.prototype.waitForVisible = function (timeout) {
var timeout = U.defVal(timeout, CONF.timeouts.uiAction);
var timeout = U.defVal(timeout, CONF.web.uiTimeout) * 1000;
var errMsg = `${this.name} (${this.selector}) isn't visible ` +
`after ${timeout} ms`;
`after ${timeout}s`;

return this._getDriver().waitUntil(async () => {
return await this.isVisible();
Expand All @@ -250,13 +251,13 @@ Element.prototype.waitForVisible = function (timeout) {
*
* @async
* @method
* @arg {number} [timeout] - timeout to wait, ms
* @arg {number} [timeout] - Timeout to wait, sec.
* @return {Promise<void>}
* @throws {TimeoutError} If control is still visible after timeout.
*/
Element.prototype.waitForInvisible = function (timeout) {
var timeout = U.defVal(timeout, CONF.timeouts.uiAction);
var errMsg = this.name + " is still visible after " + timeout + " ms";
var timeout = U.defVal(timeout, CONF.web.uiTimeout) * 1000;
var errMsg = `${this.name} (${this.selector}) is still visible after ${timeout}s`;

return this._getDriver().waitUntil(async () => {
return !(await this.isVisible());
Expand Down

0 comments on commit 089ae9d

Please sign in to comment.