How to use the @qawolf/config.CONFIG.findTimeoutMs 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 / browser / src / actions.ts View on Github external
export const select = async (
  elementHandle: ElementHandle,
  value: string | null,
  timeoutMs?: number
): Promise => {
  logger.verbose("actions.select");
  const findTimeoutMs = (isNil(timeoutMs) ? CONFIG.findTimeoutMs : timeoutMs)!;

  // ensure option with desired value is loaded before selecting
  await elementHandle.evaluate(
    (element: HTMLSelectElement, value: string | null, timeoutMs: number) => {
      const qawolf: QAWolfWeb = (window as any).qawolf;
      return qawolf.select.waitForOption(element, value, timeoutMs);
    },
    value,
    findTimeoutMs
  );

  await elementHandle.select(value || "");
};
github qawolf / qawolf / packages / jest-environment / src / RunnerEnvironment.ts View on Github external
this.global.waitUntil = (
      booleanFn: () => boolean,
      timeoutMs?: number,
      sleepMs?: number
    ) =>
      waitUntil(
        booleanFn,
        // default timeoutMs to CONFIG.findTimeoutMs
        (isNil(timeoutMs) ? CONFIG.findTimeoutMs : timeoutMs)!,
        sleepMs
      );
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,
github qawolf / qawolf / packages / runner / src / Runner.ts View on Github external
await retryExecutionError(async () => {
      const element = await this.beforeAction(selectorOrStep, "scroll");
      await scroll(
        element!,
        this.getValue((selectorOrStep as Step).index, value),
        CONFIG.findTimeoutMs
      );
    });
  }