CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

Introduce waitWhileSelector

Open sabau opened this issue 9 years ago • 2 comments

What are you trying to achieve?

I would like to be able to wait while an element is present. For example I usually need to wait while a spinner is present to go on.

What do you get instead?

I have to reply a feature I was using in casperJs:

Casper.prototype.waitWhileSelector = function waitWhileSelector(selector, then, onTimeout, timeout) {
    "use strict";
    this.checkStarted();
    timeout = getTimeoutAndCheckNextStepFunction(timeout, then, 'waitWhileSelector', this.options.waitTimeout);
    return this.waitFor(function _check() {
        return !this.exists(selector);
    }, then, onTimeout, timeout, {
        selector: selector,
        waitWhile: true
    });
};

Details

  • CodeceptJS version: 1.0.1
  • NodeJS Version: 6.11.2
  • Operating System: Windows 7 (sadly)
  • Nightmare version: 2.10.1
  • Configuration file:
{
  "output": "logs",
  "helpers": {
    "Nightmare": {
      "url": "http://127.0.0.1:8080",
      "width": 1900,
      "height": 1200,
      "waitTimeout": 20000,
      "waitForAction": 2000,
      "waitForTimeout": 20000
    }
  },
  "include": {
    "I": "./steps_file.js",
    "loginPage": "./pages/Login.js",
    "mainPage": "./pages/Main.js",
    "mainMenuFragment": "./fragments/MainMenu.js",
    "navbarFragment": "./fragments/Navbar.js"
  },
  "mocha": {},
  "bootstrap": false,
  "teardown": null,
  "hooks": [],
  "tests": "tests/*_test.js",
  "timeout": 90000,
  "name": "codecept"
}

sabau avatar Aug 24 '17 16:08 sabau

+1

andreluizbnu avatar Aug 24 '17 17:08 andreluizbnu

Feature introduced under the name waitUntilExists with pull request

sabau avatar Sep 19 '17 07:09 sabau