How to use the @qawolf/config.CONFIG.sleepMs function in @qawolf/config

To help you get started, we’ve selected a few @qawolf/config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qawolf / qawolf / packages / runner / src / Runner.ts View on Github external
private async beforeAction(
    selectorOrStep: Selector | Step | null,
    action: Action
  ) {
    logger.verbose("Runner: beforeAction");

    let element = selectorOrStep
      ? await this._browser.find(selectorOrStep, {
          action,
          timeoutMs: CONFIG.findTimeoutMs
        })
      : null;

    if (CONFIG.sleepMs) {
      logger.verbose(`Runner: beforeAction sleep ${CONFIG.sleepMs} ms`);
      await sleep(CONFIG.sleepMs);

      // reload the element in case it changed since the sleep
      if (selectorOrStep) {
        logger.verbose("Runner: beforeAction reload element after sleep");

        try {
          // try to find it immediately
          element = await this._browser.find(selectorOrStep, {
            action,
            timeoutMs: 0,
            waitForRequests: false
          });
        } catch (e) {
          // if it cannot be found immediately wait longer
          element = await this._browser.find(selectorOrStep, {
github qawolf / qawolf / packages / runner / src / Runner.ts View on Github external
private async beforeAction(
    selectorOrStep: Selector | Step | null,
    action: Action
  ) {
    logger.verbose("Runner: beforeAction");

    let element = selectorOrStep
      ? await this._browser.find(selectorOrStep, {
          action,
          timeoutMs: CONFIG.findTimeoutMs
        })
      : null;

    if (CONFIG.sleepMs) {
      logger.verbose(`Runner: beforeAction sleep ${CONFIG.sleepMs} ms`);
      await sleep(CONFIG.sleepMs);

      // reload the element in case it changed since the sleep
      if (selectorOrStep) {
        logger.verbose("Runner: beforeAction reload element after sleep");

        try {
          // try to find it immediately
          element = await this._browser.find(selectorOrStep, {
            action,
            timeoutMs: 0,
            waitForRequests: false
          });
        } catch (e) {
          // if it cannot be found immediately wait longer
github qawolf / qawolf / packages / browser / src / find / getFindElementOptions.ts View on Github external
export const getFindElementOptions = (
  options: T
) => {
  const findOptions = { ...options };

  if (isNil(options.sleepMs)) {
    findOptions.sleepMs = CONFIG.sleepMs;
  }

  if (isNil(options.timeoutMs)) {
    findOptions.timeoutMs = CONFIG.timeoutMs;
  }

  return findOptions;
};
github qawolf / qawolf / packages / jest-environment / src / RunnerEnvironment.ts View on Github external
    await new Promise(resolve => setTimeout(resolve, CONFIG.sleepMs));