• Version 7.27.0
  • Published
  • 29.2 kB
  • 6 dependencies
  • MIT license


npm i @wdio/sync
yarn add @wdio/sync
pnpm add @wdio/sync


A WebdriverIO plugin. Helper module to run WebdriverIO commands synchronously



variable defaultRetries

const defaultRetries: { attempts: number; limit: number };


    function executeHooksWithArgs

    executeHooksWithArgs: (
    hookName?: string,
    hooks?: Function | Function[],
    args?: any | undefined
    ) => Promise<unknown[]>;
    • Helper method to execute a row of hooks with certain parameters. It will return with a reject promise due to a design decision to not let hooks/service intefer the actual test process.

      Parameter hooks

      list of hooks

      Parameter args

      list of parameter for hook functions {Promise} promise that gets resolved once all hooks finished running

    function executeSync

    executeSync: (
    this: Browser<'async'>,
    fn: Function,
    retries?: { attempts: number; limit: number },
    args?: any[]
    ) => Promise<any>;
    • execute test or hook synchronously

      Parameter fn

      spec or hook method

      Parameter retries

      Parameter args

      arguments passed to hook {Promise} that gets resolved once test/hook is done or was retried enough

    function runFnInFiberContext

    runFnInFiberContext: (
    fn: Function
    ) => (this: Browser<'async'>, ...args: any[]) => Promise<unknown>;
    • global function to wrap callbacks into Fiber context

      Parameter fn

      function to wrap around {Function} wrapped around function

    function runSync

    runSync: (
    this: any,
    fn: Function,
    repeatTest?: typeof defaultRetries,
    args?: any[]
    ) => (resolve: (value: any) => void, reject: (err: Error) => void) => any;
    • run hook or spec via executeSync

    function sync

    sync: (testFn: Function) => Promise<unknown>;

      function wrapCommand

      wrapCommand: (
      commandName: string,
      fn: Function
      ) => (this: Browser<'async'> | Element<'async'>, ...args: any[]) => any;
      • wraps a function into a Fiber ready context to enable sync execution and hooks

        Parameter fn

        function to be executed

        Parameter commandName

        name of that function

        Parameter beforeCommand

        method to be executed before calling the actual function

        Parameter afterCommand

        method to be executed after calling the actual function {Function} actual wrapped function


      namespace global

      namespace global {}

        variable browser

        var browser: any;

          Package Files (4)

          Dependencies (6)

          Dev Dependencies (0)

          No dev dependencies.

          Peer Dependencies (0)

          No peer dependencies.


          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@wdio/sync.

          • Markdown
          • HTML
            <a href="https://www.jsdocs.io/package/@wdio/sync"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>