website/docs/flowcharts/WDIOCommands.md
This flowchart provides a high level overview of the @wdio/cli run, repl, config and install commands.
graph TD
STARTWDIO(Execute wdio or wdio run)-->
PARSECLIARGS[Parse CLI args]
PARSECLIARGS-->HELPSWITCH["wdio command --help"]-->
COMMANDINCLUDED{"Command
included?"}
COMMANDINCLUDED-->|Yes|PRINTCMDHELP[Print command help text]
COMMANDINCLUDED-->|No|PRINTWDIOHELP[Print wdio help]
PARSECLIARGS-->CONFIGCMD[config]-->
RUNCONFIG[Run config
command code]
PARSECLIARGS-->REPL[repl]-->
RUNREPL[Run repl
command code]
PARSECLIARGS-->INSTALL[install]-->
RUNINSTALL[Run install code]
PARSECLIARGS-->RUN[run]-->
LAUNCHRUNNER[Launch test runner]
run commandgraph TD
CALLRUN("Launch test runner by calling the @wdio/cli:index run()")-->
LAUNCHTESTRUNNER2[Test runner is launched]-->
CALLRUNCMDHANDLER("Call @wdio/cli/commands:run launcher()")-->
INSTANTIATELAUNCHER["Creates @wdio/cli:launcher instance
1) Set log level
2) Worker count equals number
of specs * caps array length
3)Create a new runnner instance
using @wdio/utils:initializePlugin
4. Create CLI Interface instance.
5. Setup interface job:start,
job:end event listeners"]-->
CALLLAUNCHERINSTANCERUN["@wdio/cli:launcher run()"]-->
INITLAUNCHERINSTANCE["Create instance of all services
listed in the config services property."] -->
INIT["Call the runner initialize() method"]-->
RUNPRETSTTASKS["Run pre-test tasks for runner plugins"]-->
CONFIGONPREPAREHOOK["wdio.conf.js onPrepare hook"]-->
SERVICESONPREPAREHOOK["Run the services onPrepare hook
e.g. start selenium server."]-->
RUNMODE("Call @wdio/cli:launcher runMode()")-->
RUNMODEPROMISERESOLVED{"runMode() promise resolve?"}
RUNMODEPROMISERESOLVED-->|No|SCHEDULE["In @wdio/cli:launcher runMode()
create a spec execution schedule."]-->
RUNSPECS["Start test execution by calling
@wdio/cli:launcher runSpecs()."]-->
CREATEWORKERS["Create a new test instance (worker process) by
calling @wdio/cli:launcher runSpecs().
Call @wdio/cli:launcher startInstance()
to create a new worker instance.
See Create Worker Process and Test
Execution flowcharts for
more information on this process."]-->
ISNUMBERINSTANCESSPECSZERO{"Is number of worker
processes less than
config maxInstances?"}
ISNUMBERINSTANCESSPECSZERO-->|Yes|CREATEWORKERS
ISNUMBERINSTANCESSPECSZERO-->|No|SCHEDULELOOP["When number of running instances and
number of specs is zero, exit runSpecs()."]-->ENDRUNMODE
RUNMODEPROMISERESOLVED-->|Yes|ENDRUNMODE["Pass control back to
@wdio/cli:launcher run()."]-->
ONCOMPLETEHOOKS[Run service and config onComplete hooks.]-->
INTERFACEFINALISE["Call @wdio/cli interface.js finalise() method. This method prints the test results
and summary using data from the repoter packages."]-->
EXIT(Shutdown runner, end test process.)
repl, install, and config commandsgraph TD
INSTALLCOMMAND[install]-->
TYPENAMESUPPORTED{Is type and name
supported?}
TYPENAMESUPPORTED-->|No|ERROR[Throw error message]
TYPENAMESUPPORTED-->|Yes|INSTALLPACKAGE[Install package]
INSTALLPACKAGE-->ADDSERVICEREPORTER[Add services and
reporters to wdio.conf.js]
CONFIGCOMMAND[config]-->
EXECUTEWIZARD[Execute setup wizard]-->
QUESTIONNAIRE[Run questionaire, store
answers package variables.]-->
SYNCMODE{executionMode
is sync?}
SYNCMODE-->|Yes|INSTALLWDIOSYNC["Install
@wdio/sync"]
INSTALLWDIOSYNC-->YARNCHECK["If --yarn, Install packages using
yarn, otherwise use npm"]
SYNCMODE-->|No|ASYNCMODE["Do not install
@wdio/sync"]
YARNCHECK-->CREATEWDIOCONFIG["Create wdio.conf.js"]
ASYNCMODE-->YARNCHECK
REPLCOMMAND[repl]-->
CREATESESSION[Create a new Webdriver session
using webdriverio remote]-->
ADDGLOBALS["Add browser, $, and $$
to global scope"]-->
LOADREPL[Load the REPL by calling the
WebdriverIO debug command]-->
EXITREPL[Exit when REPL closed]