Docusaurus v2 (#6239)

Co-authored-by: Piotr Mikosz <mikosz.piotr@gmail.com>
This commit is contained in:
Christian Bromann 2021-01-26 14:05:20 +01:00 committed by GitHub
parent 99f0afe622
commit 8ed14f70d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
217 changed files with 17058 additions and 9992 deletions

8
.gitignore vendored
View file

@ -73,15 +73,15 @@ packages/**/package-lock.json
website/.sass-cache/
website/translated_docs
website/static/css
website/build/
website/sidebars.json
website/yarn.lock
website/sidebars.json
website/node_modules
website/i18n/*
docs/api/**/*.md
docs/docs/**/*.md
docs/_*.md
website/docs/api/**/*.md
website/docs/docs/**/*.md
website/docs/_*.md
# Editor files
.idea

View file

@ -1,522 +0,0 @@
---
id: boilerplate
title: Boilerplate Projects
---
Over time, our community has developed several boilerplate projects that you can use as inspiration to set up your own test suite.
## v6 Boilerplate Projects
### [webdriverio/appium-boilerplate](https://github.com/webdriverio/appium-boilerplate/)
Boilerplate project to run Appium tests with WebdriverIO for:
- iOS/Android Native Apps
- iOS/Android Hybrid Apps
- Android Chrome and iOS Safari browser
This boilerplate includes the following:
- Framework: Jasmine
- Features:
- Configs for:
- iOS and Android app
- iOS and Android browsers
- Helpers for:
- WebView
- Gestures
- Native alerts
- Pickers
- Tests examples for:
- WebView
- Login
- Forms
- Swipe
- Browsers
### [webdriverio/cucumber-boilerplate](https://github.com/webdriverio/cucumber-boilerplate)
Our very own boilerplate for Cucumber test suites. We created over 150 predefined step definitions for you, so you can start writing feature files in your project right away.
- Framework: Cucumber
- Features:
- Over 150 predefined steps that cover almost everything you need
- Integrates WebdriverIO’s Multiremote functionality
- Own demo app
### [webdriverio/jasmine-boilerplate](https://github.com/webdriverio/jasmine-boilerplate)
Boilerplate project to run WebdriverIO tests with Jasmine using Babel features and the page objects pattern.
- Frameworks
- WebdriverIO (v6)
- Jasmine (v3)
- Features
- Page Object Pattern
- Sauce Labs integration
### [amiya-pattnaik/webdriverIO-with-cucumberBDD](https://github.com/amiya-pattnaik/webdriverIO-with-cucumberBDD)
- Framework: Cucumber (v5.x)
- Features:
- Page Objects Model uses with ES6 style class base approach and fully ES6 - ES8 support through Babel
- Examples of multi selector option to query element with more than one selector at a time
- Examples of multi browser and headless browser execution using - Chrome and Firefox
- Integration with BrowserStack, Sauce Labs
- Support of read/write data from MS-Excel for easy test data management from external data sources with examples
- Database support to any RDBMS (Oracle, MySql, TeraData, Vertica etc.), executing any queries / fetching result set etc. with examples for E2E testing
- Multiple reporting (Spec, Junit, Allure, JSON), plus local view of Junit report(.html) format
- Task manage through Grunt
- Examples with demo app https://search.yahoo.com/ and http://the-internet.herokuapp.com, Chai assertion liberary (expect, assert, should)
- `Appium specific .config file for playback on mobile device.` For one click Appium setup refer [appium-setup-made-easy-OSX](https://github.com/amiya-pattnaik/appium-setup-made-easy-OSX)
### [amiya-pattnaik/webdriverIO-with-mochaBDD](https://github.com/amiya-pattnaik/webdriverIO-with-mochaBDD)
- Framework: Mocha (v5.x)
- Features:
- Page Objects Model uses with ES6 style class base approach and fully ES6 - ES8 support through Babel
- Task manage through Grunt
- Examples with demo app https://search.yahoo.com and http://the-internet.herokuapp.com
- Examples of multi browser and headless browser execution using - Chrome and Firefox
- Examples of Multiple reporting (Spec, Junit, Allure), plus local view of Junit report (.html) format
- Examples of read/write data from MS-Excel for easy test data management from external data sources with examples
- Examples of DB connect to any RDBMS (Oracle, MySql, TeraData, Vertica etc.), any query execution / fetching result set etc. with examples for E2E testing
- `Appium specific .config file for playback on mobile device.` For one click Appium setup refer [appium-setup-made-easy-OSX](https://github.com/amiya-pattnaik/appium-setup-made-easy-OSX)
### [amiya-pattnaik/webdriverIO-with-jasmineBDD](https://github.com/amiya-pattnaik/webdriverIO-with-jasmineBDD)
- Framework: Jasmine (v3.x)
- Features:
- Page Objects Model uses with ES6 style class base approach and fully ES6 - ES8 support through Babel
- Task manage through Grunt
- Examples with demo app https://search.yahoo.com and http://the-internet.herokuapp.com
- Examples of multi browser and headless browser execution using - Chrome and Firefox
- Examples of Multiple reporting (Spec, Junit, Allure), plus local view of Junit report (.html) format
- Examples of read/write data from MS-Excel for easy test data management from external data sources with examples
- Examples of DB connect to any RDBMS (Oracle, MySql, TeraData, Vertica etc.), any query execution / fetching result set etc. with examples for E2E testing
- `Appium specific .config file for playback on mobile device.` For one click Appium setup refer [appium-setup-made-easy-OSX](https://github.com/amiya-pattnaik/appium-setup-made-easy-OSX)
### [serhatbolsu/webdriverio-mocha-uiautomation-boiler](https://github.com/serhatbolsu/webdriverio-mocha-uiautomation-boiler)
ATDD WEB tests with Mocha, WebdriverIO v6 with PageObject
- Frameworks
- WebdriverIO (v6)
- Mocha
- Features
- [Page Object](PageObjects.md) Model
- Sauce Labs integration with [Sauce Service](https://github.com/webdriverio/webdriverio/blob/main/packages/wdio-sauce-service/README.md)
- Allure Report
- Automatic screenshots capture for failing tests
- CircleCI example
- ESLint
### [migalons/angular-wdio6-builder-demo](https://github.com/migalons/angular-wdio6-builder-demo)
Build your angular e2e test with wdio. This project uses a new angular cli builder for replacing protractor with wdio.
- Frameworks:
- Webdriverio (v6)
- Angular (v9)
- Features:
- Replaces protractor with wdio as e2e runner
- Completely integrated into angular workspace (angular.json)
- Allows execution through angular cli (`ng e2e ...`). This allows to build, serve and run wdio test synchronously.
### [WarleyGabriel/demo-webdriverio-cucumber](https://github.com/WarleyGabriel/demo-webdriverio-cucumber)
Boilerplate project to run E2E tests with Cucumber.
- Frameworks:
- WebdriverIO (v6)
- Cucumber
- Features:
- TypeScript
- [Expect-webdriverio](https://github.com/webdriverio/expect-webdriverio)
- [Page Object](PageObjects.md) Pattern
- [Gherkin lint](https://github.com/vsiakka/gherkin-lint)
- Scripts to check undefined and unused steps on step/feature files
- [Commit lint](https://github.com/conventional-changelog/commitlint) and [Commitizen](https://github.com/commitizen/cz-cli#making-your-repo-commitizen-friendly)
- ESlint
- Prettier
- Husky
- Github Actions example
- Allure report (screenshots on failure) and Timeline report
### [WarleyGabriel/demo-webdriverio-mocha](https://github.com/WarleyGabriel/demo-webdriverio-mocha)
Boilerplate project to run E2E tests with Mocha.
- Frameworks:
- WebdriverIO (v6)
- Mocha
- Features:
- TypeScript
- [Expect-webdriverio](https://github.com/webdriverio/expect-webdriverio)
- [Visual regression tests](https://github.com/wswebcreation/wdio-image-comparison-service)
- Page Object Pattern
- [Commit lint](https://github.com/conventional-changelog/commitlint) and [Commitizen](https://github.com/commitizen/cz-cli#making-your-repo-commitizen-friendly)
- ESlint
- Prettier
- Husky
- Github Actions example
- Allure report (screenshots on failure)
### [SimitTomar/webdriverio-cucumber-pom-boilerplate](https://github.com/SimitTomar/webdriverio-cucumber-pom-boilerplate)
A WebdriverIO & Cucumber Boilerplate based on Page Object Model!
- Frameworks:
- webdriverIO (v6)
- cucumber (v6)
- Features:
- Supports Page Object Model
- Compatible with Nodejs Versions 8.x to 13.x
- Contains sample Scenarios written in Declarative style of BDD
- Supports Data externalisation
- Integrated with [eslint](https://www.npmjs.com/package/eslint) for identifying and reporting on code patterns.
- Integrated with [cucumber-html-reporter](https://www.npmjs.com/package/cucumber-html-reporter) for intuitive & detailed HTML reporting
- Embeds screenshots on failure
- Integrated with [wdio-cucumber-parallel-execution](https://www.npmjs.com/package/wdio-cucumber-parallel-execution) module for parallel execution
### [tamil777selvan/wdioV6-Perfecto-Boilerplate](https://github.com/tamil777selvan/wdioV6-Perfecto-Boilerplate.git)
Boilerplate project to run WebdriverIO tests in Perfecto Cloud ([https://www.perfecto.io/]()) using Cucumber features, and the page objects pattern.
- Frameworks:
- webdriverIO (v6)
- cucumber (v6)
- Features:
- Cloud integration with [Perfecto](https://www.perfecto.io/)
- Supports Page Object Model
- Contains sample Scenarios written in Declarative style of BDD
### [pako88/wdio-mocha-typescript](https://github.com/pako88/wdio-mocha-typescript)
Boilerplate with WebdriverIO v6, Mocha, TypeScript, ESLint
- Frameworks
- WebdriverIO (v6)
- Mocha
- Features
- Page Object Pattern
- TypeScript
- ESLint
- VSCode
- GitHub Actions
- Sauce Labs integration
- Chromedriver Config
- Devtools Config
- many example tests
### [Arjun-Ar91/WebdriverIO-V6-appium-cucumber-boilerplate](https://github.com/Arjun-Ar91/WebdriverIO-V6-appium-cucumber-boilerplate.git)
Boilerplate project to run appium tests for native and mobile browser using cucumber v6 and webdriverIO v6 with page object pattern.
- Frameworks
- WebdriverIO v6
- Cucumber v6
- Appium
- Features
- Native Android and iOS apps
- Android Chrome browser
- iOS Safari browser
- Page Object Model
- Contains sample test scenarios in cucumber
- Integrated with multiple cucumber html reports
### [AdarshKumarGM/WebDriverIO-with-CucumberJS](https://github.com/AdarshKumarGM/WebDriverIO-with-CucumberJS)
Boilerplate for bulding cucumberJS with webdriverIO framework.
- Framework:
- WebdriverIO (v6.x)
- CucumberJS (v6.x)
- Node (v12.x)
- Features:
- Capability for desktop browser
- Multiple cucumber html reporting
- Eslint
- Folder structure containing support files to kick start
### [Arjun-Ar91/WebdriverIO-V6-appium-mocha-boilerplate](https://github.com/Arjun-Ar91/WebdriverIO-V6-appium-mocha-boilerplate.git)
Boilerplate project to run appium tests for native and mobile browser using mocha v6 and webdriverIO v6 with page object pattern.
- Frameworks
- WebdriverIO v6
- Mocha v6
- Appium
- Features
- Native Android and iOS apps
- Android Chrome browser
- iOS Safari browser
- Page Object Model
- Contains sample test scenarios in mocha
- Integrated with eslint and allure reporting
### [17thSep/Mock-and-Spies](https://github.com/17thSep/MonitorNetworkLogs/)
Boiler plate project for:
- Capture Network Logs
- Capture all GET/POST calls or a specific REST API
- Assert Request parametes
- Assert Response parameters
- Store all the response in a seperate file
You can watch it created [on this video](https://www.youtube.com/watch?v=Be9IPyxHmLs).
## v5 Boilerplate Projects
### [labs42io/web-automation](https://github.com/labs42io/web-automation)
BDD tests with Cucumber, WebdriverIO and Docker Selenium.
- Frameworks
- WebdriverIO (v5.x)
- docker-selenium (v3.x)
- TypeScript (v3.x)
- Cucumber
- Features
- Dockerized selenium grid and browsers
- Configurable selenium and browser versions
- Over 150 predefined snippets for [Cucumber Gherkin Syntax](https://cucumber.io/docs/gherkin/)
- Write custom snippets with TypeScript
- Visually debug tests with *VNC viewier*
- Detailed report generation
- Automatic screenshots attached for failing tests
- CI integration samples
- ESLint
### [davidnguyen179/storybook-wdio](https://github.com/davidnguyen179/storybook-wdio)
The project creates the powerful component base boilerplate using Storybook, React, Typescript, Mocha, WebdriverIO and Selenium.
- Frameworks:
- Storybook (v5.x)
- React (v16.x)
- WebdriverIO (v5.x)
- TypeScript(v3.x)
- @Types/Mocha (v5.x)
- Features:
- Generate the stories of component via configurations
- TypeScript [Page Object](PageObjects.md) Models
- TypesScript Models
- Code Prettier
- Eslint
- Git hook using `husky` and `lint-staged`
- Support TravisCI, CircleCI and Github Actions
- Allow running visual regression test in single component or all components
- Support `Dockerfile` to deploy the `storybook`
- Support `docker-compose.yml` to start the selenium chrome, firefox
### [amiya-pattnaik/webdriverIO-with-cucumberBDD](https://github.com/amiya-pattnaik/webdriverIO-with-cucumberBDD)
- Framework: Cucumber (v5.x)
- Features:
- [Page Object](PageObjects.md) Models used with ES6 style class-based approach, and full ES6–ES8 support through Babel
- Examples of multi-selector option to query elements with more than one selector at a time
- Examples of headless browser execution, using PhantomJS and Chrome
- Integration with BrowserStack, Sauce Labs
- Support of reading and writing from MS-Excel documents for easy test data management from external data sources with examples
- Database support for any RDBMS (Oracle, MySql, TeraData, Vertica etc.), executing queries, fetching result sets, and so on. Includes examples of E2E testing.
- Multiple reporting (Spec, Junit, Allure, JSON), plus local view of JUnit report(`.html`) format
- Task manage through Grunt
- Examples with demo app https://search.yahoo.com and http://www.phptravels.net, Chai assertion library (`expect`, `assert`, `should`)
- Appium-specific `.config` file for playback on mobile device. For one-click Appium setup, refer to: [appium-setup-made-easy-OSX](https://github.com/amiya-pattnaik/appium-setup-made-easy-OSX)
### [amiya-pattnaik/webdriverIO-with-jasmineBDD](https://github.com/amiya-pattnaik/webdriverIO-with-jasmineBDD)
- Framework: Jasmine (v3.x)
- Features:
- [Page Object](PageObjects.md)s Model used with ES6 style class-based approach, and full ES6–ES8 support through Babel
- Task manage through Grunt
- Multiple reporting (Spec, Junit, Allure), plus local view of JUnit report (`.html`) format
- Jasmine Spec examples with assert module and Jasmine-specific assertions using demo app http://www.phptravels.net
- Examples of headless browser execution using Chrome and Firefox and Integration with BrowserStack and Sauce Labs
- Examples of reading and writing from MS-Excel documents for easy test data management from external data sources
- Examples of DB connect to any RDBMS (Oracle, MySql, TeraData, Vertica etc.), query execution, and fetching result sets
### [amiya-pattnaik/webdriverIO-with-mochaBDD](https://github.com/amiya-pattnaik/webdriverIO-with-mochaBDD)
- Framework: Mocha (v5.x)
- Features:
- [Page Object](PageObjects.md)s Model used with ES6 style class-based approach, and full ES6–ES8 support through Babel
- Task management through Grunt
- Multiple reporting (Spec, Junit, Allure), plus local view of Junit report (`.html`) format
- Mocha Spec examples with `assert` module and Mocha-specific assertions using demo app http://www.phptravels.net
- Examples of headless browser execution using Chrome and Firefox and Integration with BrowserStack & Sauce Labs
- Examples of reading and writing from MS-Excel documents for easy test data management from external data sources
- Examples of DB connect to any RDBMS (Oracle, MySql, TeraData, Vertica, etc.), query execution, and fetching result sets
### [jpolley/WebdriverIO_v5_TypeScript](https://github.com/jpolley/WebdriverIO_v5_TypeScript)
This boilerplate uses the following:
- Framework: Mocha
- Features:
- TypeScript Setup
- [Page Object](PageObjects.md) Pattern
- Chai integration
- CI examples (CircleCI, Travis CI, Jenkins)
- Allure reporter
### [DaleNguyen/WebdriverIO-TypeScript-Boilerplate](https://github.com/dalenguyen/WebdriverIO-TypeScript-Boilerplate)
This project creates a powerful boilerplate for UI Automation Testing with WebdriverIO, TypeScript, Mocha, Chai, and Allure reporting.
- Frameworks:
- WebdriverIO (v5.x)
- TypeScript(v3.x)
- @Types/Mocha (v5.x)
- Chai (v5.x)
- @Wdio/Allure (v5.x)
- Axe-core(v3.x)
- Features:
- Accessibility testing with Axe-core
- TypeScript [Page Object](PageObjects.md) Models
- TypesScript Models
- Code Prettier
- HTML report with Allure
- Single test case for development purposes
### [ssehmi/WebdriverIO-TypeScript-Cucumber-Boilerplate](https://github.com/ssehmi/e2e)
This is a boilerplate project to run E2E tests with CucumberJS tests with chai assertions written in typescript.
- Frameworks:
- WebdriverIO (v5.x)
- TypeScript(v3.x)
- Chai (v5.x)
- @Wdio/Allure (v5.x)
- Features:
- TypeScript decorators for cucumber steps
- Prettier
- Allure Reporting
### [luuizeduardo/wdio-automation](https://github.com/luuizeduardo/wdio-automation)
A boilerplate to run E2E tests with Mocha and generate test reports gracefully.
- Framework: Mocha(v5.x)
- Features:
- [Page Object](PageObjects.md) Pattern with Closure Functions (Factory Pattern)
- Fake data generator (Faker.js)
- Multiple Reports (Allure, Report Portal)
- Docker compose to run your test suite on Selenium Grid
- Dotenv module to hide your personal information
- ESLint
### [WarleyGabriel/demo-webdriverio-mocha](https://github.com/WarleyGabriel/demo-webdriverio-mocha)
A powerful boilerplate to run E2E and visual regression tests with Mocha.
- Framework: Mocha (v5.x)
- Features:
- [Page Object](PageObjects.md) Pattern
- ES6 style class-based approach, and full ES6–ES8 support through Babel
- Chai
- Multiple reports (Spec, Dot, Allure, Timeline)
- Visual regression tests (Image comparison service)
- Code formatter (ESlint, Prettier)
- Husky
### [Schveitzer/webdriverio-appium-cucumber-boilerplate](https://github.com/Schveitzer/webdriverio-appium-cucumber-boilerplate)
Boilerplate project to run Appium tests together with WebdriverIO and BDD with Cucumber for:
- iOS/Android Native Apps
- iOS/Android Hybrid Apps
This boilerplate includes the following:
- Frameworks:
- WebdriverIO (v5.x)
- Chai (v5.x)
- @Wdio/Allure (v5.x)
- Appium (1.16.x)
- Cucumber (v5.x)
- Features:
- Configs for:
- iOS and Android app
- Tests examples in english and portuguese for:
- WebView
- Login
- Forms
- Swipe
- [Page Object](PageObjects.md) Pattern
- ES6 style class-based approach, and full ES6–ES8 support through Babel
- Chai
- Reports with Allure (Print screen on fail)
- Code formatter (ESlint, Prettier)
- Git hook using `husky`
### [blueimp/wdio](https://github.com/blueimp/wdio)
Docker setup for WebdriverIO with automatic screenshots, image diffing, and screen recording support for containerized versions of Chrome and Firefox. Also includes macOS host configs to test an app running in Docker with Safari Desktop, as well as Safari Mobile and Chrome Mobile via Appium.
Sample app demonstrates a simple email application (with email test automation support via [MailHog](https://github.com/mailhog/MailHog)).
The only project requirement is Docker. (Since WebdriverIO is also containerized, not even NodeJS is required.)
- Framework: Mocha (v5.x)
- Features:
- Configs for:
- Dockerized Google Chrome
- Dockerized Mozilla Firefox
- Safari Desktop
- Safari Mobile via Appium
- Chrome Mobile via Appium
- Helpers for:
- Automatic screenshots based on test failure/success (part of [`wdio-screen-commands`](https://github.com/blueimp/wdio-screen-commands))
- Screenshot image diffing via [`node-ffmpeg-image-diff`](https://github.com/blueimp/node-ffmpeg-image-diff)
- Screen recording support for Chrome and Firefox via [`record-screen`](https://github.com/blueimp/record-screen)
- Email test automation support via [`mailhog-node`](https://github.com/blueimp/mailhog-node)
- Test examples for:
- Email form submission
- Email reception success
### [jonyet/webdriverio-boilerplate](https://github.com/jonyet/webdriverio-boilerplate)
Designed to be quick to get you started without getting terribly complex.
- Framework: Mocha
- Features:
- Cloud integration with [BrowserStack](https://www.browserstack.com)
- Uses [Page Objects](PageObjects.md)
- An alternative component-specific (rather than page-specific) approach, allowing for a split E2E and integration test writing approach
- Introduces config file extensions for readability and flexibility, in the event that you have multiple teams/projects working out of the same project repository
### [PerfectoMobileSA/webdriverio5-cucumber-perfecto-sample](https://github.com/PerfectoMobileSA/webdriverio5-cucumber-perfecto-sample)
This project is useful not only as an example of WebdriverIO v5 and integration with perfecto cloud (https://www.perfecto.io/), but it includes examples of the PageObject pattern, different locators files to run the same script on Android and iOS devices, and some practical examples for using WebdriverIO to build an automated test suite with Cucumber (v 5.x) BDD framework.
- Framework: Cucumber (v5.x)
- Features:
- Cloud integration with [Perfecto](https://www.perfecto.io/)
- Uses [Page Objects](PageObjects.md)
- Examples of using Page Locators to run same script on Multiple Mobile Devices
### [saucelabs-sample-test-frameworks/JS-Mocha-WebdriverIO-Selenium](https://github.com/saucelabs-sample-test-frameworks/JS-Mocha-WebdriverIO-Selenium)
Simple boilerplate project that runs multiple browsers on [Sauce Labs](https://saucelabs.com) in parallel.
- Framework: Mocha
- Features:
- [Page Object](PageObjects.md) usage
- Integration with [Sauce Labs](https://saucelabs.com)
### [migalons/angular-wdio-builder-demo](https://github.com/migalons/angular-wdio-builder-demo)
Build your angular e2e test with wdio. This project uses a new angular cli builder for replacing protractor with wdio.
- Frameworks:
- Webdriverio (v5)
- Angular (v9)
- Features:
- Replaces protractor with wdio as e2e runner
- Completely integrated into angular workspace (angular.json)
- Allows execution through angular cli (`ng e2e ...`). This allows to build, serve and run wdio test synchronously.

View file

@ -1,77 +0,0 @@
---
id: driverbinaries
title: Driver Binaries
---
WebdriverIO allows using driver binaries directly instead of services.
Here’s an example with `geckodriver`.
### Download Geckodriver
**Note: You must have [Firefox](https://www.mozilla.org/en-US/firefox/new/) installed to use Geckodriver.**
Download the latest version of `geckodriver` for your environment and unpack it in your project directory:
<!--DOCUSAURUS_CODE_TABS-->
<!--Linux (64 bit)-->
```sh
$ curl -L https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz | tar xz
```
<!--MacOS (curl)-->
```sh
$ curl -L https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-macos.tar.gz | tar xz
```
<!--MacOS (brew)-->
```sh
$ brew install geckodriver
```
<!--Windows (64 bit / Chocolatey)-->
```sh
$ choco install selenium-gecko-driver
```
<!--Windows (64 bit / Powershell)-->
```sh
# Run as privileged session. Right-click and set 'Run as Administrator'
# Use geckodriver-v0.24.0-win32.zip for 32 bit Windows
$url = "https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-win64.zip"
$output = "geckodriver.zip" # will drop into current directory unless defined otherwise
$unzipped_file = "geckodriver" # will unzip to this folder name
# By default, Powershell uses TLS 1.0 the site security requires TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Downloads Geckodriver
Invoke-WebRequest -Uri $url -OutFile $output
# Unzip Geckodriver
Expand-Archive $output -DestinationPath $unzipped_file
cd $unzipped_file
# Globally Set Geckodriver to PATH
[System.Environment]::SetEnvironmentVariable("PATH", "$Env:Path;$pwd\geckodriver.exe", [System.EnvironmentVariableTarget]::Machine)
```
<!--END_DOCUSAURUS_CODE_TABS-->
**Note:** Other `geckodriver` releases are available [here](https://github.com/mozilla/geckodriver/releases). In order to automate other browsers, you need different drivers. You can find a list with all drivers in the [`awesome-selenium`](https://github.com/christian-bromann/awesome-selenium#driver) README.
### Start Browser Driver
Start Geckodriver by running:
```sh
/path/to/binary/geckodriver --port 4444
```
For example, if you ran the `curl` command from above, you should have a `geckodriver` binary available in the current folder.
Start it like this:
```sh
./geckodriver --port 4444
```
This will start Geckodriver on `localhost:4444` with the WebDriver endpoint set to `/`.
Keep this running in the background and open a new terminal window. Next step is to download WebdriverIO via NPM:

View file

@ -1,127 +0,0 @@
---
id: gettingstarted
title: Getting Started
---
Welcome to the WebdriverIO documentation. It will help you to get started fast. If you run into problems, you can find help and answers on our [Gitter Channel](https://gitter.im/webdriverio/webdriverio) or you can hit me on [Twitter](https://twitter.com/webdriverio).
> __Note:__ These are the docs for the latest version (>=6.x) of WebdriverIO. If you are still using an older version, please visit the [old documentation websites](versions.html)!
The following short step-by-step introduction will help you get your first WebdriverIO script up and running:
<iframe width="660" height="440" src="https://www.youtube.com/embed/gaTPBkg4WEI" frameborder="0" allowfullscreen></iframe>
## Taking the first step
You’ll need [Node.js](http://nodejs.org) installed.
- Install at least v12.16.1 or higher as this is the oldest active LTS version
- Only releases that are or will become an LTS release are officially supported
If you don't have Node installed, we recommend installing [NVM](https://github.com/creationix/nvm) to assist managing multiple active Node.js versions. If you are using the [WDIO Testrunner](/docs/setuptypes.html#the-wdio-testrunner) in [sync mode](https://webdriver.io/docs/sync-vs-async.html#sync-mode) you also need Python v3 or higher installed.
### Setup your project
Before installing dependencies, you’ll need to initialize a new NPM project. This will allow you to use the CLI to install dependencies in your project.
To do this, run:
```sh
$ mkdir webdriverio-test && cd webdriverio-test
$ npm init -y
```
The `-y` will answer 'yes' to all the prompts, giving you a standard NPM project. Feel free to omit the `-y` if you'd like to specify your own project details.
### Install WebdriverIO CLI
If you want to use WebdriverIO in your project for integration testing, we recommend using the test runner. It comes with lots of useful features that makes your life easier.
Since WebdriverIO version 5, the testrunner is in the [`@wdio/cli`](https://www.npmjs.com/package/@wdio/cli) NPM package.
Now, install the CLI:
```sh
$ npm i --save-dev @wdio/cli
```
### Generate Configuration File
Next, you’ll generate a configuration file to store your WebdriverIO settings.
To do that, just run the configuration utility:
```sh
$ npx wdio config -y
```
That's it! The configurator will install all required packages for you and create a config file called `wdio.conf.js`.
### Create Spec Files
Now it's time to create your test file. You’re going to store all of your test files in a new folder.
Create the test folder like this:
<!--DOCUSAURUS_CODE_TABS-->
<!--Linux/Mac-->
```sh
$ mkdir -p ./test/specs
```
<!--Windows-->
```sh
$ mkdir .\test\specs
```
<!--END_DOCUSAURUS_CODE_TABS-->
Create a new file in that folder (we'll call it `basic.js`):
```sh
$ touch ./test/specs/basic.js
```
On Windows, `touch` will not work so you can simply go to the folder and create a plain text file and name is as 'basic.js'
Open that file, and write the following code in it:
<!--DOCUSAURUS_CODE_TABS-->
<!--Sync Mode-->
```js
describe('webdriver.io page', () => {
it('should have the right title', () => {
browser.url('https://webdriver.io')
expect(browser).toHaveTitle('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js');
})
})
```
<!--Async Mode-->
```js
describe('webdriver.io page', () => {
it('should have the right title', async () => {
await browser.url('https://webdriver.io')
await expect(browser).toHaveTitle('WebdriverIO · Next-gen browser and mobile automation test framework for Node.js');
})
})
```
<!--END_DOCUSAURUS_CODE_TABS-->
Now save the file and return to your terminal. Learn more about [the differences between Sync and Async Mode](sync-vs-async.html).
### Start the Testrunner
Now, time to run your tests!
To do so, just run:
```sh
$ npx wdio wdio.conf.js
```
Hurray! The test should pass, and you can start writing integration tests with WebdriverIO.
If you ran into any issues, reach out in our [Gitter Channel](https://gitter.im/webdriverio/webdriverio) and post the error you're seeing, and which of the above steps you’re stuck on.
If you are interested in more in depth video on-boarding tutorials, feel free to check out our very own course called [learn.webdriver.io](https://learn.webdriver.io/?coupon=wdio).
Our community has also collected a lot of [boilerplate projects](BoilerplateProjects.md) that may help you to get started.

View file

@ -1,41 +0,0 @@
---
id: githubactions
title: Github Actions
---
If your repository is hosted on Github, you can use [Github Actions](https://docs.github.com/en/actions/getting-started-with-github-actions/about-github-actions#about-github-actions) to run your tests on Github's infrastructure.
1. everytime you push changes
2. on every pull request creation
3. on scheduled time
4. by manual trigger
In the root of your repository, create a .github/workflows directory. Add a .yml file, for example .github/workflows/ci.yaml. In here you will configure how to run tests.
See [jasmine-boilerplate](https://github.com/webdriverio/jasmine-boilerplate/blob/master/.github/workflows/ci.yaml) for reference implementation, and [sample test runs](https://github.com/webdriverio/jasmine-boilerplate/actions?query=workflow%3ACI).
```yaml
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install
uses: ianwalter/puppeteer@main
with:
args: npm install
- name: Test
uses: ianwalter/puppeteer@main
with:
args: npm run test:local
- uses: actions/upload-artifact@v1
if: failure()
with:
name: logs
path: logs
```
Refer [Github](https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#creating-a-workflow-file) to know more about creating workflow files.

View file

@ -1,52 +0,0 @@
---
id: runprogrammatically
title: Running Programmatically
---
WebdriverIO allows running tests without built-in test runner.
Before starting, you have to setup either [driver binaries](DriverBinaries.md) or selenium-standalone/selenium-grid/Appium/etc.
Let's start with installing `webdriverio` by calling:
```sh
npm install webdriverio
```
Create a test file (e.g. `test.js`) with the following content:
```js
const { remote } = require('webdriverio')
;(async () => {
const browser = await remote({
logLevel: 'error',
path: '/', // remove `path` if you decided using something different from driver binaries.
capabilities: {
browserName: 'firefox'
}
})
await browser.url('https://webdriver.io')
const title = await browser.getTitle()
console.log('Title was: ' + title)
await browser.deleteSession()
})().catch((e) => console.error(e))
```
### Run your test file
```sh
node test.js
```
This should output the following:
```sh
Title was: WebdriverIO · Next-gen browser and mobile automation test framework for Node.js
```
Yay, Congratulations! You’ve just run your automation script with WebdriverIO.

View file

@ -1,93 +0,0 @@
---
id: setuptypes
title: How to setup WebdriverIO
---
WebdriverIO can be used for various purposes. It implements the Webdriver protocol API and can run a browser in an automated way. The framework is designed to work in any arbitrary environment and for any kind of task. It is independent from any 3rd party frameworks and only requires Node.js to run.
## Standalone Mode
Probably the simplest form to run WebdriverIO is in standalone mode. This has nothing to do with the Selenium server file (which is usually called `selenium-server-standalone`). It basically just means that you require the `webdriverio` package in your project and use its API to run your automation.
Here is a simple example:
```js
const { remote } = require('webdriverio');
(async () => {
const browser = await remote({
logLevel: 'trace',
capabilities: {
browserName: 'chrome'
}
})
await browser.url('https://duckduckgo.com')
const inputElem = await browser.$('#search_form_input_homepage')
await inputElem.setValue('WebdriverIO')
const submitBtn = await browser.$('#search_button_homepage')
await submitBtn.click()
console.log(await browser.getTitle()) // outputs: "Title is: WebdriverIO (Software) at DuckDuckGo"
await browser.deleteSession()
})().catch((e) => console.error(e))
```
Using WebdriverIO in standalone mode allows you to integrate this automation tool in your own (test) project to create a new automation library. Popular examples include [Chimp](https://chimp.readme.io) or [CodeceptJS](http://codecept.io). You can also write plain Node scripts to scrape the web for content (or anything else that requires a running browser).
You can use the `@wdio/sync` package to transform all commands so they run synchronously. This especially simplifies your test as you don't have to deal with `async/await` anymore. Here is an example how you can run synchronous commands with WebdriverIO in a standalone script:
```js
// standalone.js
const { remote } = require('webdriverio')
const sync = require('@wdio/sync').default
remote({
runner: 'local',
outputDir: __dirname,
capabilities: {
browserName: 'chrome'
}
}).then((browser) => sync(() => {
browser.url('https://webdriver.io')
console.log(browser.getTitle())
browser.deleteSession()
}))
```
If you now run the file, it will return the title:
```sh
$ node standalone.js
WebdriverIO · Next-gen browser and mobile automation test framework for Node.js
```
## The WDIO Testrunner
The main purpose of WebdriverIO, though, is end-to-end testing on a big scale. We therefore implemented a test runner that helps you to build a reliable test suite that is easy to read and maintain.
The test runner takes care of many problems that are common when working with plain automation libraries. For one, it organizes your test runs and splits up test specs so your tests can be executed with maximum concurrency. It also handles session management and provides lots of features to help you to debug problems and find errors in your tests.
Here is the same example from above, written as a test spec and executed by WDIO:
```js
describe('DuckDuckGo search', () => {
it('searches for WebdriverIO', () => {
browser.url('https://duckduckgo.com/')
$('#search_form_input_homepage').setValue('WebdriverIO')
$('#search_button_homepage').click()
const title = browser.getTitle()
console.log('Title is: ' + title)
// outputs: "Title is: WebdriverIO (Software) at DuckDuckGo"
})
})
```
The test runner is an abstraction of popular test frameworks like Mocha, Jasmine, or Cucumber. A key difference when compared with standalone mode is that all commands that executed by the WDIO test runner are synchronous. That means that you don't need promises anymore to handle async code.
To run your tests using the WDIO test runner, check out the [Getting Started](GettingStarted.md) section for more information.

View file

@ -1,95 +0,0 @@
---
id: sync-vs-async
title: Sync mode vs async
---
## How to enable/disable sync mode
To enable sync mode it's only required to install `@wdio/sync` package, to disable sync mode uninstall `@wdio/sync`.
## Async mode
Every browser/element function call returns a Promise and needs to be awaited to get result.
Example
```js
describe('suite async', () => {
it('test', async () => { // pay attention to `async` keyword
const el = await $('body') // note `await` keyword
await el.click()
await browser.pause(500)
console.log(browser.capabilities) // static properties should not be awaited
await $('body').click() // WON'T WORK! You can't chain functions like this.
})
})
```
### Common issues in async mode
`await $('body').click()` throws `$(...).click is not a function` because the element was not awaited. To fix this, first await element then trigger the click, like so:
```js
const el = await $('body')
await el.click()
```
- previous command was not awaited:
```js
const el = await $('body')
el.waitForExist() // ERROR: await is missing here, you'll get `Unhandled promise rejection`.
await el.click()
```
## Sync mode
If you're using [`@wdio/sync`](https://www.npmjs.com/package/@wdio/sync) then you can avoid awaiting for browser/element calls. It is still required to deal with Promises from 3rd-party libraries, you should use [browser.call](api/browser/call.html) for this.
Example
```js
// 3rd-party library example
// https://www.npmjs.com/package/got#gotgeturl-options
const { get } = require('got')
describe('suite sync', () => {
it('test sync',
// make sure to remove `async` keyword otherwise function treated as async
// and you have to await every browser call.
// The same is applicable to hooks in `wdio.conf.js` as well.
() => {
browser.pause(500)
// wrap 3rd-party library calls with `browser.call`
const response = browser.call(() => get('https://cat-fact.herokuapp.com/facts/'))
$('body').click() // You can chain functions in sync mode
})
it('using async function in sync mode',
// If you have `@wdio/sync` installed and configured, it is still possible to use async functions.
// However, in such case you have to await every browser/element call like in async mode, and this can
// be confusing when other tests are sync, so we discourage mixing modes, but it is possible to do so.
// The best practice in sync mode is to wrap anything async with `browser.call`.
async () => {
await browser.pause(500)
const response = await get('https://cat-fact.herokuapp.com/facts/')
const el = await $('body')
await el.click()
})
})
```
### How does sync mode work?
Every browser/element command is wrapped with [fibers](https://github.com/laverdet/node-fibers) while in sync mode.
### Common issues in sync mode
- declaring test function as `async` and not awaiting browser/element functions
- not awaiting 3rd-party library promises with `browser.call`
- using sync mode while `@wdio/sync` package is not installed
- `fibers` failed to install properly. There might be some issues with `node-gyp` or you have unsupported NodeJS version. See `npm install` errors for more details

View file

@ -1,27 +0,0 @@
---
id: createlocalworkerprocess
title: Create worker process
---
This flowchart explains how a worker process is created.
<div id="flowChartGraphDivContainer"></div>
<script src="https://unpkg.com/mermaid@8.5.1/dist/mermaid.min.js"></script>
<script src="/js/flowchart.js"></script>
<script>
var startTestInstance = `
graph TD
STARTINSTANCE[["@wdio/cli:launcher startInstance()"]]-->
CALLRUNNERRUNMETHOD["Call @wdio/local-runner:index.js run()<br>return @wdio/local-runner:worker instance"]-->
ADDLISTENERS["Add message, error, exit event<br>listeners to worker instance."]-->
CALLPOSTMESSAGE["Call @wdio/local-runner:worker postMessage().<br>If an instance is not created, call startProcess()<br>and fork a child process."]-->
FORKCHILDPROCESS["@wdio/local-runner:worker startProcess() forks a<br>child process using the child_process fork() method."]-->
CREATERUNNERINSTANCE["The args passed to child_process fork execute the code in the<br>@wdio-local-runner run.js.This action creates a new instance<br>of @wdio/runner index.js. "]-->
ADDHANDLERS["Add message, error and exit listeners to the forked process.<br>These listeners will process commands."]-->
RUNWDIORUNNERINDEXJS["@wdio/local-runner postMessage() instructs the child process to<br>run the code @wdio/runner index.js."]-->
POSTMESSAGE["@wdio/local-runner postMessage() sends child process a message that<br>contains the capability id,'run' command, config file, CLI args,<br>capabilties, config details about automation backend, number of retries.<br>When the child process receives this message, all services, reports and<br>services are setup. The tests are them executed."]-->
CONTROLPASSEDTORUNNERINDEXJS["Control passed to @wdio/runner:index"]-->
TESTINITCOMPLETE("All services, reports and services are setup. The tests are them executed.<br>See Test Execution flow chart for more information.")
`;
(function(){
createFlowChart(startTestInstance);
})();
</script>

View file

@ -1,30 +0,0 @@
---
id: highleveloverview
title: High level overview
---
Flow chart provides a high level overview of how the WebdriverIO ecosystem interacts with the core packages.
<div id="flowChartGraphDivContainer"></div>
<script src="https://unpkg.com/mermaid@8.5.1/dist/mermaid.min.js"></script>
<script src="/js/flowchart.js"></script>
<script>
var graphData = `
graph LR
START("Start wdio in the CLI<br> @wdio/cli index / run.js")-->
LAUNCHER["@wdio/cli launcher.js"]-->
LOCALRUNNER["@wdio/local-runner"]-->
RUNNER["@wdio/runner"]
LISTOFSERVICES["Any package that ends with -service<br>@wdio/appium-service<br>@wdio/applitools-service<br>@wdio/browserstack-service<br>@wdio/crossbrowsertesting-service<br>wdio-lambdatest-service<br>@wdio/devtools-service<br>@wdio/firefox-profile-service<br>@wdio/sauce-service<br>@wdio/selenium-standalone-service<br>@wdio/static-server-service<br>@wdio/testingbot-service<br>wdio-chromedriver-service<br>wdio-intercept-service<br>wdio-zafira-listener-service<br>wdio-reportportal-service<br>wdio-docker-service"]-->
LAUNCHER
LISTOFSERVICES-->LOCALRUNNER
LISTOFSERVICES-->RUNNER
REPORTER["Any package that ends with -reporter<br>@wdio-allure-reporter<br>@wdio-concise-reporter<br>@wdio-dot-reporter<br>@wdio-junit-reporter<br>@wdio-reporter<br>@wdio-spec-reporter<br>@wdio-sumologic-reporter<br>wdio-reportportal-reporter<br>wdio-video-reporter<br>@rpii/wdio-html-reporter<br>wdio-json-reporter<br>wdio-mochawesome-reporter<br>wdio-timeline-reporter<br>wdio-cucumberjs-json-reporter"]-->RUNNER
FRAMEWORK["Any package that ends with -framework<br>@wdio-jasmine-framework<br>@wdio-mocha-framework<br>@wdio/cucumber-framework<br>"]-->
RUNNER
WEBDRIVER["webdriverio<br>webdriver"]-->
RUNNER
GLOBAL["GLOBALS<br>@wdio/sync<br>@wdio/config<br>@wdio/logger<br>@wdio/utils"]
`;
(function(){
createFlowChart(graphData);
})();
</script>

View file

@ -1,36 +0,0 @@
---
id: testexecution
title: Test Execution
---
This flowchart explains the test execution process and the interaction between @wdio/runner and the most of the other WebdriverIO packages.
<div id="flowChartGraphDivContainer"></div>
<script src="https://unpkg.com/mermaid@8.5.1/dist/mermaid.min.js"></script>
<script src="/js/flowchart.js"></script>
<script>
var setupTest = `
graph TD
START("@wdio/runner:index called from<br>child process via a run message.")-->
EXECUTERUN[["@wdio/runner:index run()"]]-->
SETUPREPORTER["Initialise BaseReporter object which creates a new<br>@wdio/runner reporter instance.All reporters listed<br>in the wdio.conf.js reporters property are initialised."]-->
INITTESTFRAMEWORK["Test framework from the wdio.conf. js property is<br>initialised usingthe @wdio/utils initialisePlugin method.<br> <br>Supported frameworks include @wdio/mocha-framework,<br>@wdio/cucumber-framework and @wdio/jasmine-framework."]-->
INITSERVICES["Initialise services"]-->
RUNEFORESESSIONHOOK[Run wdio.conf.js beforeSession hook.]-->
INITSESSION["Call @wdio/runner:index _initSession.<br>@wdio/runner:utils initialiseInstance<br>calls webdriverio:index.js remote()."]-->
ISPROTOCOLWEBDRIVER{"Is protocol<br>webdriver?"}
ISPROTOCOLWEBDRIVER-->|Yes|WEBDRIVER
ISPROTOCOLWEBDRIVER-->|No|DEVTOOLS
WEBDRIVER["Call webdriver:index newSession<br>1. Start Webdriver session.<br>2. Get protocol commands.<br>3. Create webdriver monad with<br>protocol arguments.<br>4. Return monad session<br>instance to caller."]-->RUNNERRUN
DEVTOOLS["Create puppeteer instance.<br>Return session instance to caller."]-->RUNNERRUN
RUNNERRUN["Store instance in<br>global browser variable."]-->
SETWATCHMODEFLAG["Set watch mode flag"]-->
INITCOMPLETE[Initialisation successful, send runner:start message to reporter.]-->
KICKOFFTESTS["Kick off tests in framework by calling the framework's run<br>method, e.g. @wdio/mocha-framework:index run()."]-->
WAITFORTESTTOFINISH[Wait for test to finish. If watch mode keep session open.]-->
SENDRESULTS[Send results to reporter instance<br>for processing.]-->
INTERFACE["@wdio/cli:interface printSummary() called<br>Test results printed to terminal"]-->
KILLWORKERSESSION[Kill worker session.]
`;
(function(){
createFlowChart(setupTest);
})();
</script>

View file

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

221
package-lock.json generated
View file

@ -3175,18 +3175,18 @@
}
},
"@octokit/auth-token": {
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.4.tgz",
"integrity": "sha512-LNfGu3Ro9uFAYh10MUZVaT7X2CnNm2C8IDQmabx+3DygYIQjs9FwzFAHN/0t6mu5HEPhxcb1XOuxdpY82vCg2Q==",
"version": "2.4.5",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.5.tgz",
"integrity": "sha512-BpGYsPgJt05M7/L/5FoE1PiAbdxXFZkX/3kDYcsvd1v6UhlnE5e96dTDr0ezX/EFwciQxf3cNV0loipsURU+WA==",
"dev": true,
"requires": {
"@octokit/types": "^6.0.0"
"@octokit/types": "^6.0.3"
}
},
"@octokit/core": {
"version": "3.2.4",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.2.4.tgz",
"integrity": "sha512-d9dTsqdePBqOn7aGkyRFe7pQpCXdibSJ5SFnrTr0axevObZrpz3qkWm7t/NjYv5a66z6vhfteriaq4FRz3e0Qg==",
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.2.5.tgz",
"integrity": "sha512-+DCtPykGnvXKWWQI0E1XD+CCeWSBhB6kwItXqfFmNBlIlhczuDPbg+P6BtLnVBaRJDAjv+1mrUJuRsFSjktopg==",
"dev": true,
"requires": {
"@octokit/auth-token": "^2.4.4",
@ -3198,31 +3198,31 @@
}
},
"@octokit/endpoint": {
"version": "6.0.10",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.10.tgz",
"integrity": "sha512-9+Xef8nT7OKZglfkOMm7IL6VwxXUQyR7DUSU0LH/F7VNqs8vyd7es5pTfz9E7DwUIx7R3pGscxu1EBhYljyu7Q==",
"version": "6.0.11",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.11.tgz",
"integrity": "sha512-fUIPpx+pZyoLW4GCs3yMnlj2LfoXTWDUVPTC4V3MUEKZm48W+XYpeWSZCv+vYF1ZABUm2CqnDVf1sFtIYrj7KQ==",
"dev": true,
"requires": {
"@octokit/types": "^6.0.0",
"@octokit/types": "^6.0.3",
"is-plain-object": "^5.0.0",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/graphql": {
"version": "4.5.8",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.8.tgz",
"integrity": "sha512-WnCtNXWOrupfPJgXe+vSmprZJUr0VIu14G58PMlkWGj3cH+KLZEfKMmbUQ6C3Wwx6fdhzVW1CD5RTnBdUHxhhA==",
"version": "4.5.9",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.9.tgz",
"integrity": "sha512-c+0yofIugUNqo+ktrLaBlWSbjSq/UF8ChAyxQzbD3X74k1vAuyLKdDJmPwVExUFSp6+U1FzWe+3OkeRsIqV0vg==",
"dev": true,
"requires": {
"@octokit/request": "^5.3.0",
"@octokit/types": "^6.0.0",
"@octokit/types": "^6.0.3",
"universal-user-agent": "^6.0.0"
}
},
"@octokit/openapi-types": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-2.3.1.tgz",
"integrity": "sha512-KTzpRDT07euvbBYbPs121YDqq5DT94nBDFIyogsDhOnWL8yDCHev6myeiPTgS+VLmyUbdNCYu6L/gVj+Bd1q8Q==",
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-3.2.1.tgz",
"integrity": "sha512-OOXW6e+vSIpA63Zp5Q+hio3tnQsWFnn9xx1xco0arjTOBcKW/NwFsmhpmj4Yt5IddUS1V7PVGSfRRDO5qZhEqQ==",
"dev": true
},
"@octokit/plugin-enterprise-rest": {
@ -3259,9 +3259,9 @@
}
},
"@octokit/plugin-request-log": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.2.tgz",
"integrity": "sha512-oTJSNAmBqyDR41uSMunLQKMX0jmEXbwD1fpz8FG27lScV3RhtGfBa1/BBLym+PxcC16IBlF7KH9vP1BUYxA+Eg==",
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.3.tgz",
"integrity": "sha512-4RFU4li238jMJAzLgAwkBAw+4Loile5haQMQr+uhFq27BmyJXcXSKvoQKqh0agsZEiUlW6iSv3FAgvmGkur7OQ==",
"dev": true
},
"@octokit/plugin-rest-endpoint-methods": {
@ -3293,9 +3293,9 @@
}
},
"@octokit/request": {
"version": "5.4.12",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.12.tgz",
"integrity": "sha512-MvWYdxengUWTGFpfpefBBpVmmEYfkwMoxonIB3sUGp5rhdgwjXL1ejo6JbgzG/QD9B/NYt/9cJX1pxXeSIUCkg==",
"version": "5.4.13",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.13.tgz",
"integrity": "sha512-WcNRH5XPPtg7i1g9Da5U9dvZ6YbTffw9BN2rVezYiE7couoSyaRsw0e+Tl8uk1fArHE7Dn14U7YqUDy59WaqEw==",
"dev": true,
"requires": {
"@octokit/endpoint": "^6.0.1",
@ -3309,20 +3309,20 @@
}
},
"@octokit/request-error": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.4.tgz",
"integrity": "sha512-LjkSiTbsxIErBiRh5wSZvpZqT4t0/c9+4dOe0PII+6jXR+oj/h66s7E4a/MghV7iT8W9ffoQ5Skoxzs96+gBPA==",
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.5.tgz",
"integrity": "sha512-T/2wcCFyM7SkXzNoyVNWjyVlUwBvW3igM3Btr/eKYiPmucXTtkxt2RBsf6gn3LTzaLSLTQtNmvg+dGsOxQrjZg==",
"dev": true,
"requires": {
"@octokit/types": "^6.0.0",
"@octokit/types": "^6.0.3",
"deprecation": "^2.0.0",
"once": "^1.4.0"
}
},
"@octokit/rest": {
"version": "18.0.14",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.0.14.tgz",
"integrity": "sha512-62mKIaBb/XD2Z2KCBmAPydEk/d0IBMOnwk6DJVo36ICTnxlRPTdQwFE2LzlpBPDR52xOKPlGqb3Bnhh99atltA==",
"version": "18.0.15",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.0.15.tgz",
"integrity": "sha512-MBlZl0KeuvFMJ3210hG5xhh/jtYmMDLd5WmO49Wg4Rfg0odeivntWAyq3KofJDP2G8jskCaaOaZBKo0TeO9tFA==",
"dev": true,
"requires": {
"@octokit/core": "^3.2.3",
@ -3332,12 +3332,12 @@
}
},
"@octokit/types": {
"version": "6.3.2",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.3.2.tgz",
"integrity": "sha512-H6cbnDumWOQJneyNKCBWgnktRqTWcEm6gq2cIS3frtVgpCqB8zguromnjIWJW375btjnxwmbYBTEAEouruZ2Yw==",
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.5.1.tgz",
"integrity": "sha512-meP0U3ker/Nkzfif/q7JAK2LSOnuV+72F8mgfruwVX4iTQBgkShh5LSrdI9F7aC2hF3a/8AePfYh4SLzu1RuxA==",
"dev": true,
"requires": {
"@octokit/openapi-types": "^2.3.1",
"@octokit/openapi-types": "^3.2.0",
"@types/node": ">= 8"
}
},
@ -3746,13 +3746,13 @@
"dev": true
},
"@typescript-eslint/eslint-plugin": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.0.tgz",
"integrity": "sha512-IJ5e2W7uFNfg4qh9eHkHRUCbgZ8VKtGwD07kannJvM5t/GU8P8+24NX8gi3Hf5jST5oWPY8kyV1s/WtfiZ4+Ww==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.1.tgz",
"integrity": "sha512-5JriGbYhtqMS1kRcZTQxndz1lKMwwEXKbwZbkUZNnp6MJX0+OVXnG0kOlBZP4LUAxEyzu3cs+EXd/97MJXsGfw==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "4.14.0",
"@typescript-eslint/scope-manager": "4.14.0",
"@typescript-eslint/experimental-utils": "4.14.1",
"@typescript-eslint/scope-manager": "4.14.1",
"debug": "^4.1.1",
"functional-red-black-tree": "^1.0.1",
"lodash": "^4.17.15",
@ -3762,55 +3762,55 @@
}
},
"@typescript-eslint/experimental-utils": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.0.tgz",
"integrity": "sha512-6i6eAoiPlXMKRbXzvoQD5Yn9L7k9ezzGRvzC/x1V3650rUk3c3AOjQyGYyF9BDxQQDK2ElmKOZRD0CbtdkMzQQ==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.1.tgz",
"integrity": "sha512-2CuHWOJwvpw0LofbyG5gvYjEyoJeSvVH2PnfUQSn0KQr4v8Dql2pr43ohmx4fdPQ/eVoTSFjTi/bsGEXl/zUUQ==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/scope-manager": "4.14.0",
"@typescript-eslint/types": "4.14.0",
"@typescript-eslint/typescript-estree": "4.14.0",
"@typescript-eslint/scope-manager": "4.14.1",
"@typescript-eslint/types": "4.14.1",
"@typescript-eslint/typescript-estree": "4.14.1",
"eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0"
}
},
"@typescript-eslint/parser": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.0.tgz",
"integrity": "sha512-sUDeuCjBU+ZF3Lzw0hphTyScmDDJ5QVkyE21pRoBo8iDl7WBtVFS+WDN3blY1CH3SBt7EmYCw6wfmJjF0l/uYg==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.1.tgz",
"integrity": "sha512-mL3+gU18g9JPsHZuKMZ8Z0Ss9YP1S5xYZ7n68Z98GnPq02pYNQuRXL85b9GYhl6jpdvUc45Km7hAl71vybjUmw==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "4.14.0",
"@typescript-eslint/types": "4.14.0",
"@typescript-eslint/typescript-estree": "4.14.0",
"@typescript-eslint/scope-manager": "4.14.1",
"@typescript-eslint/types": "4.14.1",
"@typescript-eslint/typescript-estree": "4.14.1",
"debug": "^4.1.1"
}
},
"@typescript-eslint/scope-manager": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.0.tgz",
"integrity": "sha512-/J+LlRMdbPh4RdL4hfP1eCwHN5bAhFAGOTsvE6SxsrM/47XQiPSgF5MDgLyp/i9kbZV9Lx80DW0OpPkzL+uf8Q==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.1.tgz",
"integrity": "sha512-F4bjJcSqXqHnC9JGUlnqSa3fC2YH5zTtmACS1Hk+WX/nFB0guuynVK5ev35D4XZbdKjulXBAQMyRr216kmxghw==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.14.0",
"@typescript-eslint/visitor-keys": "4.14.0"
"@typescript-eslint/types": "4.14.1",
"@typescript-eslint/visitor-keys": "4.14.1"
}
},
"@typescript-eslint/types": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.0.tgz",
"integrity": "sha512-VsQE4VvpldHrTFuVPY1ZnHn/Txw6cZGjL48e+iBxTi2ksa9DmebKjAeFmTVAYoSkTk7gjA7UqJ7pIsyifTsI4A==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.1.tgz",
"integrity": "sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.0.tgz",
"integrity": "sha512-wRjZ5qLao+bvS2F7pX4qi2oLcOONIB+ru8RGBieDptq/SudYwshveORwCVU4/yMAd4GK7Fsf8Uq1tjV838erag==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz",
"integrity": "sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.14.0",
"@typescript-eslint/visitor-keys": "4.14.0",
"@typescript-eslint/types": "4.14.1",
"@typescript-eslint/visitor-keys": "4.14.1",
"debug": "^4.1.1",
"globby": "^11.0.1",
"is-glob": "^4.0.1",
@ -3820,12 +3820,12 @@
}
},
"@typescript-eslint/visitor-keys": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.0.tgz",
"integrity": "sha512-MeHHzUyRI50DuiPgV9+LxcM52FCJFYjJiWHtXlbyC27b80mfOwKeiKI+MHOTEpcpfmoPFm/vvQS88bYIx6PZTA==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz",
"integrity": "sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.14.0",
"@typescript-eslint/types": "4.14.1",
"eslint-visitor-keys": "^2.0.0"
}
},
@ -6339,9 +6339,9 @@
}
},
"entities": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz",
"integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==",
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz",
"integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==",
"dev": true
}
}
@ -6410,24 +6410,20 @@
}
},
"dox": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/dox/-/dox-0.9.0.tgz",
"integrity": "sha1-vpewhcufSgt+gINdVH53uGh9Cgw=",
"version": "https://github.com/visionmedia/dox/tarball/master",
"integrity": "sha512-TnE75lfmhjDxzgi4KycsDxBuy9ueGwJuBHXN4sEJYeOve8h34Y5TKMPynE7GqZcpW+H1YslXLYVobv5cCSocyQ==",
"dev": true,
"requires": {
"commander": "~2.9.0",
"commander": "~2.20.0",
"jsdoctypeparser": "^1.2.0",
"markdown-it": "~7.0.0"
"markdown-it": "~9.0.1"
},
"dependencies": {
"commander": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz",
"integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=",
"dev": true,
"requires": {
"graceful-readlink": ">= 1.0.0"
}
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
}
}
},
@ -8400,12 +8396,6 @@
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
"dev": true
},
"graceful-readlink": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
"integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=",
"dev": true
},
"growly": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz",
@ -8597,9 +8587,9 @@
},
"dependencies": {
"entities": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz",
"integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==",
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz",
"integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==",
"dev": true
}
}
@ -11510,16 +11500,16 @@
}
},
"markdown-it": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-7.0.1.tgz",
"integrity": "sha1-8S2LiKk+ZCVDSN/Rg71wv2BWekI=",
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-9.0.1.tgz",
"integrity": "sha512-XC9dMBHg28Xi7y5dPuLjM61upIGPJG8AiHNHYqIaXER2KNnn7eKnM5/sF0ImNnyoV224Ogn9b1Pck8VH4k0bxw==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
"entities": "~1.1.1",
"linkify-it": "^2.0.0",
"mdurl": "^1.0.1",
"uc.micro": "^1.0.1"
"uc.micro": "^1.0.5"
}
},
"markdox": {
@ -11537,42 +11527,11 @@
"underscore": ">= 1.3.3"
},
"dependencies": {
"dox": {
"version": "https://github.com/visionmedia/dox/tarball/master",
"integrity": "sha512-TnE75lfmhjDxzgi4KycsDxBuy9ueGwJuBHXN4sEJYeOve8h34Y5TKMPynE7GqZcpW+H1YslXLYVobv5cCSocyQ==",
"dev": true,
"requires": {
"commander": "~2.20.0",
"jsdoctypeparser": "^1.2.0",
"markdown-it": "~9.0.1"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
}
}
},
"ejs": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-1.0.0.tgz",
"integrity": "sha1-ycYKSKRu5FL7MqccMXuV5aofyz0=",
"dev": true
},
"markdown-it": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-9.0.1.tgz",
"integrity": "sha512-XC9dMBHg28Xi7y5dPuLjM61upIGPJG8AiHNHYqIaXER2KNnn7eKnM5/sF0ImNnyoV224Ogn9b1Pck8VH4k0bxw==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
"entities": "~1.1.1",
"linkify-it": "^2.0.0",
"mdurl": "^1.0.1",
"uc.micro": "^1.0.5"
}
}
}
},
@ -15225,9 +15184,9 @@
"dev": true
},
"tsutils": {
"version": "3.19.1",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.19.1.tgz",
"integrity": "sha512-GEdoBf5XI324lu7ycad7s6laADfnAqCw6wLGI+knxvw9vsIYBaJfYdmeCEG3FMMUiSm3OGgNb+m6utsWf5h9Vw==",
"version": "3.20.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.20.0.tgz",
"integrity": "sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg==",
"dev": true,
"requires": {
"tslib": "^1.8.1"

View file

@ -14,7 +14,7 @@
"clean:pkglock": "rimraf ./packages/*/package-lock.json",
"clean:tgz": "rimraf ./packages/*/*.tgz",
"clean:node_modules": "rimraf ./packages/node_modules",
"clean:website": "rimraf docs/_*.md docs/api/_*.md docs/api/**/_*.md website/sidebars.json",
"clean:website": "rimraf website/docs/_*.md website/docs/api/_*.md website/docs/api/**/_*.md website/sidebars.json",
"clean:tests": "rimraf tests/typings/**/node_modules tests/typings/**/dist ./coverage",
"clean:cache": "rimraf .eslintcache",
"clean-full:package_modules": "rimraf ./packages/*/node_modules",
@ -48,6 +48,7 @@
"ts:cucumber": "cd tests/typings/cucumber && npx tsc",
"ts:sync": "cd tests/typings/sync && npx tsc",
"watch": "node ./scripts/build --watch",
"watch:docs": "npm run docs:generate && cd website && npm i && npm start",
"version": "npm run changelog && git add CHANGELOG.md"
},
"devDependencies": {
@ -77,7 +78,6 @@
"@cucumber/cucumber": "^7.0.0",
"del": "^5.1.0",
"depcheck": "^1.0.0",
"dox": "^0.9.0",
"ejs": "^3.0.2",
"eslint": "^7.10.0",
"husky": "^4.2.3",

View file

@ -13,7 +13,7 @@ $ npm i webdriverio
## Example
The following example demonstrates how WebdriverIO can be used with the `devtools` package as automation binding using the [`automationProtocol`](https://webdriver.io/docs/options.html#automationProtocol) option:
The following example demonstrates how WebdriverIO can be used with the `devtools` package as automation binding using the [`automationProtocol`](https://webdriver.io/docs/options#automationProtocol) option:
```js
const { remote } = require('webdriverio')

View file

@ -119,7 +119,7 @@ You can also autogenerate the report by using the Allure command line tool progr
$ npm i allure-commandline
```
Then add or extend your `onComplete` hook or create a [custom service](/docs/customservices.html) for this:
Then add or extend your `onComplete` hook or create a [custom service](/docs/customservices) for this:
```js
onComplete: function() {

View file

@ -1,7 +1,7 @@
WebdriverIO Appium Service
==========================
Handling the Appium server is out of scope of the actual WebdriverIO project. This service helps you to run the Appium server seamlessly when running tests with the [WDIO testrunner](https://webdriver.io/guide/testrunner/gettingstarted.html). It starts the [Appium Server](http://appium.io/docs/en/about-appium/getting-started/index.html#starting-appium) in a child process.
Handling the Appium server is out of scope of the actual WebdriverIO project. This service helps you to run the Appium server seamlessly when running tests with the [WDIO testrunner](https://webdriver.io/docs/clioptions). It starts the [Appium Server](http://appium.io/docs/en/about-appium/getting-started/index.html#starting-appium) in a child process.
## Installation
@ -21,7 +21,7 @@ You can simple do it by:
npm install @wdio/appium-service --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted.html)
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)
## Configuration

View file

@ -21,7 +21,7 @@ You can simple do it by:
npm install @wdio/applitools-service --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted.html)
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)
## Configuration
@ -57,7 +57,7 @@ export.config = {
## Usage
Once the service is added you just need to call either the `browser.takeSnapshot` command or the `browser.takeRegionSnapshot` command to compare images within the badge. The `browser.takeRegionSnapshot` command takes two additional parameters: 1) `region` which must be of type `Region|webdriver.WebElement|EyesRemoteWebElement|webdriver.By`, and 2) `frame` of type `webdriver.WebElement|EyesRemoteWebElement|string`; see further details [here](https://applitools.com/docs/api/eyes-sdk/classes-gen/class_target/method-target-region-selenium-javascript.html). The command takes a screenshot name so Applitools can compare it always with the correct image from the baseline, e.g.
Once the service is added you just need to call either the `browser.takeSnapshot` command or the `browser.takeRegionSnapshot` command to compare images within the badge. The `browser.takeRegionSnapshot` command takes two additional parameters: 1) `region` which must be of type `Region|webdriver.WebElement|EyesRemoteWebElement|webdriver.By`, and 2) `frame` of type `webdriver.WebElement|EyesRemoteWebElement|string`; see further details [here](https://applitools.com/docs/api/eyes-sdk/classes-gen/class_target/method-target-region-selenium-javascript). The command takes a screenshot name so Applitools can compare it always with the correct image from the baseline, e.g.
```js
describe('My Google Search', () => {
@ -102,14 +102,14 @@ Applitools server URL to be used
Viewport with which the screenshots should be taken.
- Optional
- Type: `object`<br>
- Type: `object`<br />
- Default: `{'width': 1440, 'height': 900}`
### proxy
Use proxy for http/https connections with Applitools.
- Optional
- Type: `object`<br>
- Type: `object`<br />
- Example:
```js
{

View file

@ -22,7 +22,7 @@ You can simple do it by:
npm install @wdio/browserstack-service --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted.html)
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)
## Configuration
@ -47,30 +47,30 @@ export.config = {
## Options
In order to authorize to the BrowserStack service your config needs to contain a [`user`](https://webdriver.io/docs/options.html#user) and [`key`](https://webdriver.io/docs/options.html#key) option.
In order to authorize to the BrowserStack service your config needs to contain a [`user`](https://webdriver.io/docs/options#user) and [`key`](https://webdriver.io/docs/options#key) option.
### browserstackLocal
Set this to true to enable routing connections from Browserstack cloud through your computer. You will also need to set `browserstack.local` to true in browser capabilities.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### preferScenarioName
Cucumber only. Set this to true to enable updating the session name to the Scenario name if only a single Scenario was ran. Useful when running in parallel with [wdio-cucumber-parallel-execution](https://github.com/SimitTomar/wdio-cucumber-parallel-execution).
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### forcedStop
Set this to true to kill the browserstack process on complete, without waiting for the browserstack stop callback to be called. This is experimental and should not be used by all. Mostly necessary as a workaraound for [this issue](https://github.com/browserstack/browserstack-local-nodejs/issues/41).
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### opts
Specified optional will be passed down to BrowserstackLocal. See [this list](https://www.browserstack.com/local-testing#modifiers) for details.
Type: `Object`<br>
Type: `Object`<br />
Default: `{}`
## Known Issues

View file

@ -54,7 +54,7 @@ export const TS_COMPILER_INSTRUCTIONS = `To have TypeScript support please add t
}
}
For for information on TypeScript integration check out: https://webdriver.io/docs/typescript.html
For for information on TypeScript integration check out: https://webdriver.io/docs/typescript
`
/**

View file

@ -18,7 +18,7 @@ const DESCRIPTION = [
'is the same as:',
'$ wdio run wdio.conf.js',
'',
'For more information, visit: https://webdriver.io/docs/clioptions.html'
'For more information, visit: https://webdriver.io/docs/clioptions'
]
export const run = async () => {

View file

@ -1,6 +1,6 @@
// Test reporter for stdout.
// The only one supported by default is 'dot'
// see also: https://webdriver.io/docs/dot-reporter.html<%
// see also: https://webdriver.io/docs/dot-reporter<%
if (reporters.length) { %>
reporters: [<%- reporters.map(reporter => {
if (reporter === 'allure') {

View file

@ -159,7 +159,7 @@ exports.config = {
//<% } %>
// Framework you want to run your specs with.
// The following are supported: Mocha, Jasmine, and Cucumber
// see also: https://webdriver.io/docs/frameworks.html
// see also: https://webdriver.io/docs/frameworks
//
// Make sure you have the wdio adapter package for the specific framework installed
// before running any tests.

View file

@ -31,7 +31,7 @@ Packages installed successfully, creating configuration file...",
}
}
For for information on TypeScript integration check out: https://webdriver.io/docs/typescript.html
For for information on TypeScript integration check out: https://webdriver.io/docs/typescript
",
],
Array [
@ -77,7 +77,7 @@ Packages installed successfully, creating configuration file...",
}
}
For for information on TypeScript integration check out: https://webdriver.io/docs/typescript.html
For for information on TypeScript integration check out: https://webdriver.io/docs/typescript
",
],
Array [

View file

@ -21,7 +21,7 @@ You can simple do it by:
$ npm install @wdio/concise-reporter --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here](https://webdriver.io/docs/gettingstarted.html).
Instructions on how to install `WebdriverIO` can be found [here](https://webdriver.io/docs/gettingstarted).
## Configuration

View file

@ -23,7 +23,7 @@ npm install @wdio/crossbrowsertesting-service --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted.html)
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)
## Configuration
@ -50,18 +50,18 @@ export.config = {
## Options
In order to authorize to the CrossBrowserTesting service your config needs to contain a [`user`](https://webdriver.io/docs/options.html#user) and [`key`](https://webdriver.io/docs/options.html#key) option.
In order to authorize to the CrossBrowserTesting service your config needs to contain a [`user`](https://webdriver.io/docs/options#user) and [`key`](https://webdriver.io/docs/options#key) option.
### cbtTunnel
If true secure CBT local connection is started.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### cbtTunnelOpts
Any additional options to pass along to the `start()` function of [cbt_tunnels](https://www.npmjs.com/package/cbt_tunnels)
Type: `Object`<br>
Type: `Object`<br />
Default: `{}`
---

View file

@ -21,7 +21,7 @@ You can simple do it by:
npm install @wdio/cucumber-framework --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here.](http://webdriver.io/guide/getstarted/install.html)
Instructions on how to install `WebdriverIO` can be found [here.](http://webdriver.io/docs/gettingstarted)
## Configuration
@ -44,77 +44,77 @@ module.exports = {
### backtrace
Show full backtrace for errors.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### requireModule
Require modules prior to requiring any support files.
Type: `String[]`<br>
Default: `[]`<br>
Type: `String[]`<br />
Default: `[]`<br />
Example: `['@babel/register']` or `[['@babel/register', { rootMode: 'upward', ignore: ['node_modules'] }]]`
### failAmbiguousDefinitions
**Please note that this is a @wdio/cucumber-framework specific option and not recognized by cucumber-js itself**
Treat ambiguous definitions as errors.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### failFast
Abort the run on first failure.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### ignoreUndefinedDefinitions
**Please note that this is a @wdio/cucumber-framework specific option and not recognized by cucumber-js itself**
Treat undefined definitions as warnings.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### name
Only execute the scenarios with name matching the expression (repeatable).
Type: `REGEXP[]`<br>
Type: `REGEXP[]`<br />
Default: `[]`
### profile
Specify the profile to use.
Type: `String[]`<br>
Type: `String[]`<br />
Default: `[]`
### require
Require files containing your step definitions before executing features. You can also specify a glob to your step definitions.
Type: `String[]`<br>
Default: `[]`<br>
Type: `String[]`<br />
Default: `[]`<br />
Example: `[path.join(__dirname, 'step-definitions', 'my-steps.js')]`
### snippetSyntax
Specify a custom snippet syntax.
Type: `String`<br>
Type: `String`<br />
Default: `undefined`
### snippets
Hide step definition snippets for pending steps.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `true`
### source
Hide source uris.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `true`
### strict
Fail if there are any undefined or pending steps
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### tagExpression
@ -125,25 +125,25 @@ If passing as a command-line argument, compound expressions may need to be enclo
E.g.: `npx wdio wdio.config.js --cucumberOpts.tagExpression """@Smoke and not @Pending"""`
Type: `String`<br>
Type: `String`<br />
Default: ``
### tagsInTitle
Add cucumber tags to feature or scenario name
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### timeout
Timeout in milliseconds for step definitions.
Type: `Number`<br>
Type: `Number`<br />
Default: `30000`
### retry
Specify the number of times to retry failing test cases.
Type: `Number`<br>
Type: `Number`<br />
Default: `0`
### retryTagFilter

View file

@ -25,7 +25,7 @@ You can simple do it by:
npm install @wdio/devtools-service --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted.html)
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)
## Configuration
@ -342,7 +342,7 @@ browser.cdp('Page', 'setDownloadBehavior', {
### Access Puppeteer Instance
The service uses Puppeteer for its automation under the hood. You can get access to the used instance by calling the [`getPuppeteer`](/docs/api/browser/getPuppeteer.html) command. __Note:__ Puppeteer commands are async and either needs to be called within the `call` command or handled via `async/await`:
The service uses Puppeteer for its automation under the hood. You can get access to the used instance by calling the [`getPuppeteer`](https://webdriver.io/docs/api/browser/getPuppeteer) command. __Note:__ Puppeteer commands are async and either needs to be called within the `call` command or handled via `async/await`:
```js
describe('use Puppeteer', () => {

View file

@ -23,9 +23,9 @@ You can simple do it by:
npm install @wdio/dot-reporter --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here](/docs/gettingstarted.html).
Instructions on how to install `WebdriverIO` can be found [here](/docs/gettingstarted).
Dot reporter does not currently support test failure output. You can track progress on this feature [here](https://github.com/webdriverio/webdriverio/pull/3589). [Spec Reporter](/docs/spec-reporter.html) can be used in the meantime.
Dot reporter does not currently support test failure output. You can track progress on this feature [here](https://github.com/webdriverio/webdriverio/pull/3589). [Spec Reporter](https://webdriver.io/docs/spec-reporter) can be used in the meantime.
## Configuration

View file

@ -1,7 +1,7 @@
WDIO Firefox Profile Service
============================
You want to run your Firefox browser with a specific extension or need to set couple preferences? Selenium allows you to use a profile for the Firefox browser by passing this profile as `base64` string to the `firefox_profile` property in your desired capabilities. This requires to build that profile and convert it into `base64`. This service for the [wdio testrunner](https://webdriver.io/guide/testrunner/gettingstarted.html) takes the work of compiling the profile out of your hand and let's you define your desired options comfortable from the `wdio.conf.js` file.
You want to run your Firefox browser with a specific extension or need to set couple preferences? Selenium allows you to use a profile for the Firefox browser by passing this profile as `base64` string to the `firefox_profile` property in your desired capabilities. This requires to build that profile and convert it into `base64`. This service for the [wdio testrunner](https://webdriver.io/docs/clioptions) takes the work of compiling the profile out of your hand and let's you define your desired options comfortable from the `wdio.conf.js` file.
To find all possible options just open [about:config](about:config) in your Firefox browser or go to [mozillaZine](http://kb.mozillazine.org/About:config_entries) website to find the whole documentation about each setting. In Addition to that you can define compiled (as `*.xpi`) Firefox extensions that should get installed before the test starts.
@ -23,7 +23,7 @@ You can simple do it by:
npm install @wdio/firefox-profile-service --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted.html)
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)
## Configuration
@ -60,14 +60,14 @@ Contains all settings as key value pair. You can find all available settings on
Add one or multiple extensions to the browser session. All entries can be either an absolute path to the `.xpi` file or the path to an unpacked Firefox extension directory.
Type: `String[]`<br>
Type: `String[]`<br />
Default: `[]`
### profileDirectory
Create Firefox profile based on an existing one by setting an absolute path to that profile.
Type: `String`<br>
Type: `String`<br />
Default: `null`
### proxy
@ -79,8 +79,8 @@ Set network proxy settings. The parameter `proxy` is a hash which structure depe
* `pac` - use automatic proxy configuration set based on the value of `autoconfigUrl` key
* `manual` - manual proxy settings defined separately for different protocols using values from following keys: `ftpProxy`, `httpProxy`, `sslProxy`, `socksProxy`
Type: `Object`<br>
Default: `null`<br>
Type: `Object`<br />
Default: `null`<br />
Example:
- Automatic Proxy:
@ -139,7 +139,7 @@ Example:
Please set this flag to `true` if you use Firefox v55 or lower.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
----

View file

@ -21,7 +21,7 @@ You can simple do it by:
npm install @wdio/jasmine-framework --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted.html)
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)
## Configuration
@ -44,7 +44,7 @@ module.exports = {
### defaultTimeoutInterval
Timeout until specs will be marked as failed.
Type: `Number`<br>
Type: `Number`<br />
Default: 10000
### expectationResultHandler
@ -52,55 +52,55 @@ The Jasmine framework allows it to intercept each assertion in order to log the
or website depending on the result. For example it is pretty handy to take a screenshot every time
an assertion fails.
Type: `Function`<br>
Type: `Function`<br />
Default: null
### grep
Optional pattern to selectively select it/describe cases to run from spec files.
Type: `RegExp | string`<br>
Type: `RegExp | string`<br />
Default: undefined
### invertGrep
Inverts 'grep' matches.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: false
### cleanStack
Clean up stack trace and remove all traces of node module packages.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: true
### random
Run specs in semi-random order.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### stopOnSpecFailure
Stops test suite (`describe`) execution on first spec (`it`) failure (other suites continue running)
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### stopSpecOnExpectationFailure
Stops a spec (`it`) execution on a first expectation failure (other specs continue running)
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### requires
Require modules prior to requiring any helper or spec files.
Type: `String[]`<br>
Type: `String[]`<br />
Default: `[]`
### helpers
Require helper files prior to requiring any spec files.
Type: `String[]`<br>
Type: `String[]`<br />
Default: `[]`
----

View file

@ -21,7 +21,7 @@ You can simple do it by:
npm install @wdio/junit-reporter --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here](https://webdriver.io/docs/gettingstarted.html).
Instructions on how to install `WebdriverIO` can be found [here](https://webdriver.io/docs/gettingstarted).
## Output
@ -167,13 +167,13 @@ The following options are supported:
### outputDir
Define a directory where your xml files should get stored.
Type: `String`<br>
Type: `String`<br />
Required
### outputFileFormat
Define the xml files created after the test execution.
Type: `Object`<br>
Type: `Object`<br />
Default: ``function(opts){return `wdio-${this.cid}-${name}-reporter.log`}``
```
@ -187,14 +187,14 @@ outputFileFormat: function (options) {
Gives the ability to provide custom regex for formatting test suite name (e.g. in output xml ).
Type: `Regex`,<br>
Type: `Regex`,<br />
Default: `/[^a-z0-9]+/`
### addFileAttribute
Adds a file attribute to each testcase. This config is primarily for CircleCI. This setting provides richer details but may break on other CI platforms.
Type: `Boolean`,<br>
Type: `Boolean`,<br />
Default: `false`
@ -202,7 +202,7 @@ Default: `false`
You can break out packages by an additional level by setting `'packageName'`. For example, if you wanted to iterate over a test suite with different environment variable set:
Type: `String`<br>
Type: `String`<br />
Example:
```js
@ -222,7 +222,7 @@ module.exports = {
### errorOptions
Allows to set various combinations of error notifications inside xml.<br>
Allows to set various combinations of error notifications inside xml.<br />
Given a Jasmine test like `expect(true).toBe(false, 'my custom message')` you will get this test error:
```
@ -238,8 +238,8 @@ Given a Jasmine test like `expect(true).toBe(false, 'my custom message')` you wi
Therefore you can choose *which* key will be used *where*, see the example below.
Type: `Object`,<br>
Default: `errorOptions: { error: "message" }`<br>
Type: `Object`,<br />
Default: `errorOptions: { error: "message" }`<br />
Example:
```js

View file

@ -21,7 +21,7 @@ You can simple do it by:
npm install @wdio/mocha-framework --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted.html)
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)
## Configuration

View file

@ -24,5 +24,5 @@ export const NOOP = /* istanbul ignore next */ function () { }
export const MOCHA_TIMEOUT_MESSAGE = 'For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.'
export const MOCHA_TIMEOUT_MESSAGE_REPLACEMENT = [
'The execution in the test "%s %s" took too long. Try to reduce the run time or',
'increase your timeout for test specs (https://webdriver.io/docs/timeouts.html).'
'increase your timeout for test specs (https://webdriver.io/docs/timeouts).'
].join(' ')

View file

@ -25,7 +25,7 @@ Object {
"error": Object {
"actual": undefined,
"expected": undefined,
"message": "The execution in the test \\"parentfoo barfoo\\" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts.html).",
"message": "The execution in the test \\"parentfoo barfoo\\" took too long. Try to reduce the run time or increase your timeout for test specs (https://webdriver.io/docs/timeouts).",
"name": "Error",
"type": "Error",
},

View file

@ -214,7 +214,7 @@
"/session/:sessionId/chromium/send_command": {
"POST": {
"command": "sendCommand",
"description": "Send a command to the DevTools debugger.<br>For a list of available commands and their parameters refer to the [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).",
"description": "Send a command to the DevTools debugger.<br />For a list of available commands and their parameters refer to the [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L1290-L1304",
"parameters": [{
"name": "cmd",
@ -232,7 +232,7 @@
"/session/:sessionId/chromium/send_command_and_get_result": {
"POST": {
"command": "sendCommandAndGetResult",
"description": "Send a command to the DevTools debugger and wait for the result.<br>For a list of available commands and their parameters refer to the [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).",
"description": "Send a command to the DevTools debugger and wait for the result.<br />For a list of available commands and their parameters refer to the [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/).",
"ref": "https://github.com/bayandin/chromedriver/blob/v2.45/window_commands.cc#L1306-L1320",
"parameters": [{
"name": "cmd",

View file

@ -549,7 +549,7 @@
"/session/:sessionId/element/:elementId/location_in_view": {
"GET": {
"command": "getElementLocationInView",
"description": "Determine an element's location on the screen once it has been scrolled into view.<br><br>__Note:__ This is considered an internal command and should only be used to determine an element's location for correctly generating native events.",
"description": "Determine an element's location on the screen once it has been scrolled into view.<br /><br />__Note:__ This is considered an internal command and should only be used to determine an element's location for correctly generating native events.",
"ref": "https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidelementidlocation_in_view",
"variables": [{
"name": "elementId",

View file

@ -673,7 +673,7 @@
"/session/:sessionId/element/:elementId/value": {
"POST": {
"command": "elementSendKeys",
"description": "The Element Send Keys command scrolls into view the form control element and then sends the provided keys to the element. In case the element is not keyboard-interactable, an element not interactable error is returned.<br><br>The key input state used for input may be cleared mid-way through \"typing\" by sending the null key, which is U+E000 (NULL).",
"description": "The Element Send Keys command scrolls into view the form control element and then sends the provided keys to the element. In case the element is not keyboard-interactable, an element not interactable error is returned.<br /><br />The key input state used for input may be cleared mid-way through \"typing\" by sending the null key, which is U+E000 (NULL).",
"ref": "https://w3c.github.io/webdriver/#dfn-element-send-keys",
"variables": [{
"name": "elementId",

View file

@ -13,7 +13,7 @@
* you are using (e.g. Mocha or Jasmine) in order to prevent test termination due to a test timeout.
* Also avoid executing the command with multiple capabilities running at the same time.
*
* <iframe width="560" height="315" src="https://www.youtube.com/embed/xWwP-3B_YyE" frameborder="0" allowfullscreen></iframe>
* <iframe width="560" height="315" src="https://www.youtube.com/embed/xWwP-3B_YyE" frameBorder="0" allowFullScreen></iframe>
*
* <example>
:debug.js

View file

@ -27,7 +27,7 @@ You can simply do it by:
npm install @wdio/sauce-service --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted.html)
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)
## Configuration
@ -128,13 +128,13 @@ capabilities = [
## Sauce Service Options
In order to authorize to the Sauce Labs service your config needs to contain a [`user`](https://webdriver.io/docs/options.html#user) and [`key`](https://webdriver.io/docs/options.html#key) option.
In order to authorize to the Sauce Labs service your config needs to contain a [`user`](https://webdriver.io/docs/options#user) and [`key`](https://webdriver.io/docs/options#key) option.
### maxErrorStackLength
This service will automatically push the error stack to Sauce Labs when a test fails. By default it will only push the first 5
lines, but if needed this can be changed. Be aware that more lines will result in more WebDriver calls which might slow down the execution.
Type: `number`<br>
Type: `number`<br />
Default: `5`
*(only for vm and or em/simulators)*
@ -142,7 +142,7 @@ Default: `5`
### sauceConnect
If true it runs Sauce Connect and opens a secure connection between a Sauce Labs virtual machine running your browser tests.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
*(only for vm and or em/simulators)*
@ -150,7 +150,7 @@ Default: `false`
### sauceConnectOpts
Apply Sauce Connect options (e.g. to change port number or logFile settings). See [this list](https://github.com/bermi/sauce-connect-launcher#advanced-usage) for more information. Per default the service disables SC proxy auto-detection as via `noAutodetect` as this can be unreliable for some machines.
Type: `Object`<br>
Type: `Object`<br />
Default: `{ noAutodetect: true }`
*(only for vm and or em/simulators)*

View file

@ -1,7 +1,7 @@
WebdriverIO Selenium Standalone Service
=======================================
Handling the Selenium server is out of scope of the actual WebdriverIO project. This service helps you to run Selenium seamlessly when running tests with the [WDIO testrunner](https://webdriver.io/guide/testrunner/gettingstarted.html). It uses the well known [selenium-standalone](https://www.npmjs.com/package/selenium-standalone) NPM package that automatically sets up the standalone server and all required driver for you.
Handling the Selenium server is out of scope of the actual WebdriverIO project. This service helps you to run Selenium seamlessly when running tests with the [WDIO testrunner](https://webdriver.io/guide/testrunner/gettingstarted). It uses the well known [selenium-standalone](https://www.npmjs.com/package/selenium-standalone) NPM package that automatically sets up the standalone server and all required driver for you.
__Note:__ If you use this service you don't need any other driver services (e.g. [wdio-chromedriver-service](https://www.npmjs.com/package/wdio-chromedriver-service)) anymore. All local browser can be started using this service.
@ -25,7 +25,7 @@ You can simple do it by:
npm install @wdio/selenium-standalone-service --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted.html)
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)
## Configuration

View file

@ -21,7 +21,7 @@ You can simple do it by:
npm install @wdio/shared-store-service --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted.html)
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)
## Usage

View file

@ -23,7 +23,7 @@ You can simple do it by:
$ npm install @wdio/spec-reporter --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here](https://webdriver.io/docs/gettingstarted.html).
Instructions on how to install `WebdriverIO` can be found [here](https://webdriver.io/docs/gettingstarted).
## Configuration
@ -48,4 +48,4 @@ module.exports = {
// skipped set to default '-'
}
]
```
```

View file

@ -21,7 +21,7 @@ After that, your `package.json` should include the following:
}
```
Instructions on how to install `WebdriverIO` can be found [here](https://webdriver.io/docs/gettingstarted.html).
Instructions on how to install `WebdriverIO` can be found [here](https://webdriver.io/docs/gettingstarted).
## Configuration

View file

@ -23,7 +23,7 @@ You can simple do it by:
$ npm install @wdio/sumologic-reporter --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here](https://webdriver.io/docs/gettingstarted.html).
Instructions on how to install `WebdriverIO` can be found [here](https://webdriver.io/docs/gettingstarted).
## Configuration

1427
packages/wdio-sync/webdriverio-core.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -21,7 +21,7 @@ You can simple do it by:
npm install @wdio/testingbot-service --save-dev
```
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted.html)
Instructions on how to install `WebdriverIO` can be found [here.](https://webdriver.io/docs/gettingstarted)
## Configuration
@ -45,16 +45,16 @@ export.config = {
## Options
In order to authorize to the TestingBot service your config needs to contain a [`user`](https://webdriver.io/docs/options.html#user) and [`key`](https://webdriver.io/docs/options.html#key) option.
In order to authorize to the TestingBot service your config needs to contain a [`user`](https://webdriver.io/docs/options#user) and [`key`](https://webdriver.io/docs/options#key) option.
### tbTunnel
If true it runs the TestingBot Tunnel and opens a secure connection between a TestingBot Virtual Machine running your browser tests.
Type: `Boolean`<br>
Type: `Boolean`<br />
Default: `false`
### tbTunnelOpts
Apply TestingBot Tunnel options (e.g. to change port number or logFile settings). See [this list](https://github.com/testingbot/testingbot-tunnel-launcher) for more information.
Type: `Object`<br>
Type: `Object`<br />
Default: `{}`

View file

@ -54,39 +54,39 @@ The following options are available:
### capabilities
Defines the [capabilities](https://w3c.github.io/webdriver/webdriver-spec.html#capabilities) you want to run in your Selenium session.
Type: `Object`<br>
Type: `Object`<br />
Required: `true`
### logLevel
Level of logging verbosity.
Type: `String`<br>
Default: *info*<br>
Type: `String`<br />
Default: *info*<br />
Options: *trace* | *debug* | *info* | *warn* | *error* | *silent*
### protocol
Protocol to use when communicating with the Selenium standalone server (or driver).
Type: `String`<br>
Type: `String`<br />
Default: *http*
Options: *http* | *https*
### hostname
Host of your WebDriver server.
Type: `String`<br>
Type: `String`<br />
Default: *localhost*
### port
Port your WebDriver server is on.
Type: `Number`<br>
Type: `Number`<br />
Default: *4444*
### path
Path to WebDriver endpoint or grid server.
Type: `String`<br>
Type: `String`<br />
Default: */*
### queryParams
@ -98,20 +98,20 @@ Default: `null`
### connectionRetryTimeout
Timeout for any WebDriver request to a driver or grid.
Type: `Number`<br>
Type: `Number`<br />
Default: *120000*
### connectionRetryCount
Count of request retries to the Selenium server.
Type: `Number`<br>
Type: `Number`<br />
Default: *2*
### agent
Allows you to use a custom` http`/`https`/`http2` [agent](https://www.npmjs.com/package/got#agent) to make requests.
Type: `Object`<br>
Type: `Object`<br />
Default:
```js
@ -124,11 +124,11 @@ Default:
### transformRequest
Function intercepting [HTTP request options](https://github.com/sindresorhus/got#options) before a WebDriver request is made
Type: `(RequestOptions) => RequestOptions`<br>
Type: `(RequestOptions) => RequestOptions`<br />
Default: *none*
### transformResponse
Function intercepting HTTP response objects after a WebDriver response has arrived
Type: `(Response, RequestOptions) => Response`<br>
Type: `(Response, RequestOptions) => Response`<br />
Default: *none*

View file

@ -3,7 +3,7 @@ WebdriverIO
> Next-gen browser and mobile automation test framework for Node.js
This package provides an easy to manage API and a lot of syntactical sugar on top of the WebDriver specification. You can use WebdriverIO as a standalone package or via a testrunner using [`@wdio/cli`](https://webdriver.io/docs/clioptions.html). WebdriverIO allows to run tests locally using the WebDriver or Chrome DevTools protocol as well as remote user agents using cloud providers like [Sauce Labs](https://saucelabs.com/).
This package provides an easy to manage API and a lot of syntactical sugar on top of the WebDriver specification. You can use WebdriverIO as a standalone package or via a testrunner using [`@wdio/cli`](https://webdriver.io/docs/clioptions). WebdriverIO allows to run tests locally using the WebDriver or Chrome DevTools protocol as well as remote user agents using cloud providers like [Sauce Labs](https://saucelabs.com/).
## Installation
@ -46,4 +46,4 @@ let browser
See the raw [protocol example](https://www.npmjs.com/package/webdriver#example) using the `webdriver` package to get a glance on the differences.
For more information on [options](https://webdriver.io/docs/options.html#webdriver-options), [multiremote usage](https://webdriver.io/docs/multiremote.html) or integration into [cloud services](https://webdriver.io/docs/cloudservices.html) please check out the [docs](https://webdriver.io/docs/gettingstarted.html). If you want to use WebdriverIO for testing purposes, it is recommended to use the [WebdriverIO Testrunner](https://webdriver.io/docs/clioptions.html).
For more information on [options](https://webdriver.io/docs/options#webdriver-options), [multiremote usage](https://webdriver.io/docs/multiremote) or integration into [cloud services](https://webdriver.io/docs/cloudservices) please check out the [docs](https://webdriver.io/docs/gettingstarted).

View file

@ -3,15 +3,20 @@ import { getElements } from '../../utils/getElementObject'
import type { Selector, ElementArray } from '../../types'
/**
* The `$$` command is a short way to call the [`findElements`](/docs/api/webdriver.html#findelements) command in order
* The `$$` command is a short way to call the [`findElements`](/docs/api/webdriver#findelements) command in order
* to fetch multiple elements on the page. It returns an array with element results that will have an
* extended prototype to call action commands without passing in a selector. However if you still pass
* in a selector it will look for that element first and call the action on that element.
*
* Using the wdio testrunner this command is a global variable else it will be located on the browser object instead.
*
* You can chain `$` or `$$` together in order to walk down the DOM tree. For more information on how
* to select specific elements, see [`Selectors`](/docs/selectors.html).
* You can chain `$` or `$$` together in order to walk down the DOM tree.
*
* :::info
*
* For more information on how to select specific elements, check out the [Selectors](/docs/selectors) guide.
*
* :::
*
* <example>
:index.html

View file

@ -4,7 +4,7 @@ import { ELEMENT_KEY } from '../../constants'
import type { Selector } from '../../types'
/**
* The `$` command is a short way to call the [`findElement`](/docs/api/webdriver.html#findelement) command in order
* The `$` command is a short way to call the [`findElement`](/docs/api/webdriver#findelement) command in order
* to fetch a single element on the page. It returns an object that with an extended prototype to call
* action commands without passing in a selector. However if you still pass in a selector it will look
* for that element first and call the action on that element. You can also pass in an object as selector
@ -13,8 +13,13 @@ import type { Selector } from '../../types'
*
* Using the wdio testrunner this command is a global variable else it will be located on the browser object instead.
*
* You can chain `$` or `$$` together in order to walk down the DOM tree. For more information on how
* to select specific elements, see [`Selectors`](/docs/selectors.html).
* You can chain `$` or `$$` together in order to walk down the DOM tree.
*
* :::info
*
* For more information on how to select specific elements, check out the [Selectors](/docs/selectors) guide.
*
* :::
*
* <example>
:index.html

View file

@ -1,11 +1,16 @@
/**
* The browser method `addCommand` helps you to write your own set of commands. You can write your command in a synchronous way or in an asynchronous way.
*
* > That's interesting, right? You can view more info on `addCommand` [here](https://webdriver.io/docs/customcommands.html#adding-custom-commands)
* :::info
*
* You can find more information on adding custom commands in the [custom command](/docs/customcommands#adding-custom-commands) guide.
*
* :::
*
* <example>
:execute.js
browser.addCommand('getUrlAndTitle', function (customParam) {
// `this` refers to the `browser` scope
// `this` refers to the `browser` scope
return {
url: this.getUrl(),
title: this.getTitle(),

View file

@ -15,7 +15,7 @@ import WDIORepl from '@wdio/repl'
* you are using (e.g. Mocha or Jasmine) in order to prevent test termination due to a test timeout.
* Also avoid executing the command with multiple capabilities running at the same time.
*
* <iframe width="560" height="315" src="https://www.youtube.com/embed/xWwP-3B_YyE" frameborder="0" allowfullscreen></iframe>
* <iframe width="560" height="315" src="https://www.youtube.com/embed/xWwP-3B_YyE" frameborder="0" allowFullScreen></iframe>
*
* <example>
:debug.js

View file

@ -52,7 +52,7 @@ export default function deleteCookies(
const namesList = Array.isArray(names) ? names : [names]
if (namesList.every(obj => typeof obj !== 'string')) {
return Promise.reject(new Error('Invalid input (see https://webdriver.io/docs/api/browser/deleteCookies.html for documentation.'))
return Promise.reject(new Error('Invalid input (see https://webdriver.io/docs/api/browser/deleteCookies for documentation)'))
}
return Promise.all(namesList.map(name => this.deleteCookie(name)))

View file

@ -41,7 +41,7 @@ export default async function getCookies(
const namesList = Array.isArray(names) ? names : [names]
if (namesList.every(obj => typeof obj !== 'string')) {
throw new Error('Invalid input (see https://webdriver.io/docs/api/browser/getCookies.html for documentation.')
throw new Error('Invalid input (see https://webdriver.io/docs/api/browser/getCookies for documentation)')
}
const allCookies = await this.getAllCookies()

View file

@ -11,6 +11,32 @@ import { FF_REMOTE_DEBUG_ARG } from '../../constants'
* execution make sure to wrap your Puppeteer calls within a `browser.call`
* commands as shown in the example.
*
* :::info
*
* Note that using Puppeteer requires support for Chrome DevTools protocol and e.g.
* can not be used when running automated tests in the cloud. Find out more in the
* [Automation Protocols](/docs/automationProtocols) section.
*
* :::
*
* <example>
:getPuppeteer.test.js
it('should allow me to use Puppeteer', () => {
// WebDriver command
browser.url('https://webdriver.io')
const puppeteerBrowser = browser.getPuppeteer()
// switch to Puppeteer
const metrics = browser.call(async () => {
await pages = await puppeteerBrowser.pages()
pages[0].setGeolocation({ latitude: 59.95, longitude: 30.31667 })
return pages[0].metrics()
})
console.log(metrics.LayoutCount) // returns 42
})
* </example>
*
* @return {PuppeteerBrowser} initiated puppeteer instance connected to the browser
*/
export default async function getPuppeteer (this: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser) {

View file

@ -10,7 +10,7 @@ interface BrowserSize {
* Returns browser window size.
*
* <example>
* :getWindowSize.js
:getWindowSize.js
it('should return browser window size', function () {
const windowSize = browser.getWindowSize();
console.log(windowSize);

View file

@ -9,7 +9,7 @@ import { UNICODE_CHARACTERS } from '../../constants'
* To do that, the value has to correspond to a key from the table.
*
* Modifier like Ctrl, Shift, Alt and Meta will stay pressed so you need to trigger them again to release them.
* Modifiying a click however requires you to use the Webdriver Actions API through the [performActions](https://webdriver.io/docs/api/webdriver.html#performactions) method.
* Modifiying a click however requires you to use the WebDriver Actions API through the [performActions](https://webdriver.io/docs/api/webdriver#performactions) method.
*
* <example>
:keys.js

View file

@ -13,8 +13,6 @@ const SESSION_MOCKS: Record<string, Set<Interception>> = {}
* returns a stub object that you can use to modify the response of the
* web resource.
*
* > This is a __beta__ feature. Please give us feedback and file [an issue](https://github.com/webdriverio/webdriverio/issues/new/choose) if certain scenarios don't work as expected!
*
* With the stub object you can then either return a custom response or
* have the request fail.
*
@ -23,6 +21,14 @@ const SESSION_MOCKS: Record<string, Set<Interception>> = {}
* - replace web resource with a local file (service a modified JavaScript file) or
* - redirect resource to a different url
*
* :::info
*
* Note that using the `mock` command requires support for Chrome DevTools protocol and e.g.
* can not be used when running automated tests in the cloud. Find out more in the
* [Automation Protocols](/docs/automationProtocols) section.
*
* :::
*
* <example>
:mock.js
it('should mock network resources', () => {

View file

@ -1,21 +1,25 @@
/**
* The browser method `overwriteCommand` helps you to overwrite the browser's and element's native commands like `pause` and `click`.
*
* > You can view more info on `overwriteCommand` [here](https://webdriver.io/docs/customcommands.html#overwriting-native-commands)
* :::info
*
* You can view more information on this in the [custom command](/docs/customcommands#overwriting-native-commands) section.
*
* :::
*
* <example>
:execute.js
//print milliseconds before pause and return its value.
//pause - name of command to be overwritten
//origPauseFunction - original pause function
// print milliseconds before pause and return its value.
browser.overwriteCommand('pause', function (origPauseFunction, ms) {
console.log(`Sleeping for ${ms}`)
origPauseFunction(ms)
return ms
})
//usage
// usage
it('should use my overwrite command', () => {
browser.url('https://webdriver.io')
browser.pause(1000) //outputs "Sleeping for 1000"
browser.pause(1000) // outputs "Sleeping for 1000"
})
* </example>
* @alias browser.overwriteCommand

View file

@ -2,7 +2,7 @@
*
* Pauses execution for a specific amount of time. It is recommended to not use this command to wait for an
* element to show up. In order to avoid flaky test results it is better to use commands like
* [`waitForExist`](/docs/api/element/waitForExist.html) or other waitFor* commands.
* [`waitForExist`](/docs/api/element/waitForExist) or other waitFor* commands.
*
* <example>
:pause.js

View file

@ -13,7 +13,12 @@ const resqScript = fs.readFileSync(require.resolve('resq'))
* The `react$$` command is a useful command to query multiple React Components
* by their actual name and filter them by props and state.
*
* **NOTE:** the command only works with applications using React v16.x
* :::info
*
* The command only works with applications using React v16.x. Read more about React
* selectors in the [Selectors](/docs/selectors#react-selectors) guide.
*
* :::
*
* <example>
:pause.js

View file

@ -12,7 +12,12 @@ const resqScript = fs.readFileSync(require.resolve('resq'))
* The `react$` command is a useful command to query React Components by their
* actual name and filter them by props and state.
*
* **NOTE:** the command only works with applications using React v16.x
* :::info
*
* The command only works with applications using React v16.x. Read more about React
* selectors in the [Selectors](/docs/selectors#react-selectors) guide.
*
* :::
*
* <example>
:pause.js

View file

@ -3,8 +3,13 @@ import { getAbsoluteFilepath, assertDirectoryExists } from '../../utils'
/**
*
* Appium only. Save a video started by startRecordingScreen command to file.
* See [Appium docs](http://appium.io/docs/en/commands/device/recording-screen/start-recording-screen/)
* Save a video started by [`startRecordingScreen`](/docs/api/appium#startrecordingscreen) command to file.
*
* :::info
*
* This command is only supported for mobile sessions running on [Appium](http://appium.io/docs/en/commands/device/recording-screen/start-recording-screen/).
*
* :::
*
* <example>
:saveRecordingScreen.js

View file

@ -61,7 +61,7 @@ export default async function setCookies(
const cookieObjsList = !Array.isArray(cookieObjs) ? [cookieObjs] : cookieObjs
if (cookieObjsList.some(obj => (typeof obj !== 'object'))) {
throw new Error('Invalid input (see https://webdriver.io/docs/api/browser/setCookies.html for documentation.')
throw new Error('Invalid input (see https://webdriver.io/docs/api/browser/setCookies for documentation)')
}
await Promise.all(cookieObjsList

View file

@ -4,7 +4,7 @@ import type { Timeouts } from '@wdio/protocols'
*
* Sets the timeouts associated with the current session, timeout durations control such
* behaviour as timeouts on script injection, document navigation, and element retrieval.
* For more information and examples, see [timeouts guide](https://webdriver.io/docs/timeouts.html#selenium-timeouts).
* For more information and examples, see [timeouts guide](https://webdriver.io/docs/timeouts#selenium-timeouts).
*
* <example>
:setTimeout.js
@ -24,7 +24,7 @@ import type { Timeouts } from '@wdio/protocols'
* @param {Timeouts} timeouts Object containing session timeout values
* @param {Number=} timeouts.implicit Time in milliseconds to retry the element location strategy when finding an element.
* @param {Number=} timeouts.pageLoad Time in milliseconds to wait for the document to finish loading.
* @param {Number=} timeouts.script Scripts injected with [`execute`](https://webdriver.io/docs/api/browser/execute.html) or [`executeAsync`](https://webdriver.io/docs/api/browser/executeAsync.html) will run until they hit the script timeout duration, which is also given in milliseconds.
* @param {Number=} timeouts.script Scripts injected with [`execute`](https://webdriver.io/docs/api/browser/execute) or [`executeAsync`](https://webdriver.io/docs/api/browser/executeAsync) will run until they hit the script timeout duration, which is also given in milliseconds.
* @see https://w3c.github.io/webdriver/#set-timeouts
*
*/
@ -43,7 +43,7 @@ export default async function setTimeout(
*/
const timeoutValues = Object.values(timeouts)
if (timeoutValues.length && timeoutValues.every(timeout => typeof timeout !== 'number' || timeout < 0 || timeout > Number.MAX_SAFE_INTEGER)) {
throw new Error('Specified timeout values are not valid integer (see https://webdriver.io/docs/api/browser/setTimeout.html for documentation).')
throw new Error('Specified timeout values are not valid integer (see https://webdriver.io/docs/api/browser/setTimeout for documentation).')
}
const implicit = timeouts.implicit as number

View file

@ -1,3 +1,47 @@
/**
* Throttle the network capabilities of the browser. This can help to
* emulate certain scenarios where a user loses their internet connection
* and your app needs to address that.
*
* There are many presets available with default configurations for ease of use.
* They are `offline`, `GPRS`, `Regular2G`, `Good2G`, `Regular3G`, `Good3G`,
* `Regular4G`, `DSL`, `WiFi`, `online`.
*
* You can see the values for these presets [in the source code](https://github.com/webdriverio/webdriverio/blob/6824e4eb118a8d20685f12f4bc42f13fd56f8a25/packages/webdriverio/src/commands/browser/throttle.js#L29).
*
* :::info
*
* Note that using the `throttle` command requires support for Chrome DevTools protocol and e.g.
* can not be used when running automated tests in the cloud. Find out more in the
* [Automation Protocols](/docs/automationProtocols) section.
*
* :::
*
* <example>
:throttle.js
it('should throttle the network', () => {
// via static string preset
browser.throttle('Regular 3G')
// via custom values
browser.throttle({
'offline': false,
'downloadThroughput': 200 * 1024 / 8,
'uploadThroughput': 200 * 1024 / 8,
'latency': 20
})
});
* </example>
*
* @alias browser.throttle
* @param {ThrottleOptions} params parameters for throttling
* @param {Boolean} params.offline True to emulate internet disconnection.
* @param {Number} params.latency Minimum latency from request sent to response headers received (ms).
* @param {Number} params.downloadThroughput Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
* @param {Number} params.uploadThroughput Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling.
* @type utility
*
*/
import { getBrowserObject } from '../../utils'
import type { ThrottleOptions } from '../../utils/interception/types'
@ -66,42 +110,6 @@ const NETWORK_PRESETS = {
const NETWORK_PRESET_TYPES = Object.keys(NETWORK_PRESETS)
/**
* Throttle the network capabilities of the browser. This can help to
* emulate certain scenarios where a user loses their internet connection
* and your app needs to address that.
*
* There are many presets available with default configurations for ease of use.
* They are `offline`, `GPRS`, `Regular2G`, `Good2G`, `Regular3G`, `Good3G`,
* `Regular4G`, `DSL`, `WiFi`, `online`.
*
* You can see the values for these presets [in the source code](https://github.com/webdriverio/webdriverio/blob/6824e4eb118a8d20685f12f4bc42f13fd56f8a25/packages/webdriverio/src/commands/browser/throttle.js#L29).
*
* <example>
:throttle.js
it('should throttle the network', () => {
// via static string preset
browser.throttle('Regular 3G')
// via custom values
browser.throttle({
'offline': false,
'downloadThroughput': 200 * 1024 / 8,
'uploadThroughput': 200 * 1024 / 8,
'latency': 20
})
});
* </example>
*
* @alias browser.throttle
* @param {ThrottleOptions} params parameters for throttling
* @param {Boolean} params.offline True to emulate internet disconnection.
* @param {Number} params.latency Minimum latency from request sent to response headers received (ms).
* @param {Number} params.downloadThroughput Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
* @param {Number} params.uploadThroughput Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling.
* @type utility
*
*/
export default async function throttle (
this: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser,
params: ThrottleOptions

View file

@ -8,11 +8,11 @@ import { TouchAction } from '../../types'
* At its core is the ability to chain together _ad hoc_ individual actions, which will then be
* applied to an element in the application on the device. The basic actions that can be used are:
*
* - press (pass element or (x,y) or both)
* - longPress (pass element or (x,y) or both)
* - tap (pass element or (x,y) or both)
* - moveTo (pass absolute x,y coordinates)
* - wait (pass ms (as milliseconds))
* - press (pass element or (`x`, `y`) or both)
* - longPress (pass element or (`x`, `y`) or both)
* - tap (pass element or (`x`, `y`) or both)
* - moveTo (pass absolute `x`, `y` coordinates)
* - wait (pass `ms` (as milliseconds))
* - release (no arguments)
*
* <example>

View file

@ -5,7 +5,7 @@ import type { Capabilities } from '@wdio/types'
/**
* Uploads a file to the Selenium Standalone server or other browser driver
* (e.g. Chromedriver) by using the [`file`](/docs/api/selenium.html#file) command.
* (e.g. Chromedriver) by using the [`file`](https://webdriver.io/docs/api/selenium#file) command.
* _Note:_ that this command is only supported if you use a Selenium Hub or
* Chromedriver directly.
*

View file

@ -1,9 +1,13 @@
/**
* The `$$` command is a short way to call the [`findElements`](/docs/api/webdriver.html#findelements) command in order
* The `$$` command is a short way to call the [`findElements`](/docs/api/webdriver#findelements) command in order
* to fetch multiple elements on the page similar to the `$$` command from the browser scope. The difference when calling
* it from an element scope is that the driver will look within the children of that element.
*
* For more information on how to select specific elements, see [`Selectors`](/docs/selectors.html).
* :::info
*
* For more information on how to select specific elements, check out the [Selectors](/docs/selectors) guide.
*
* :::
*
* <example>
:index.html

View file

@ -6,7 +6,7 @@ import { ELEMENT_KEY } from '../../constants'
import type { Selector } from '../../types'
/**
* The `$` command is a short way to call the [`findElement`](/docs/api/webdriver.html#findelement) command in order
* The `$` command is a short way to call the [`findElement`](/docs/api/webdriver#findelement) command in order
* to fetch a single element on the page similar to the `$` command from the browser scope. The difference when calling
* it from an element scope is that the driver will look within the children of that element. You can also pass in an object as selector
* where the object contains a property `element-6066-11e4-a52e-4f735466cecf` with the value of a reference
@ -16,7 +16,11 @@ import type { Selector } from '../../types'
* make unnecessary requests that slow down the test (e.g. `$('body').$('div')` will trigger two request whereas
* `$('body div')` does literally the same with just one request)
*
* For more information on how to select specific elements, see [`Selectors`](/docs/selectors.html).
* :::info
*
* For more information on how to select specific elements, check out the [Selectors](/docs/selectors) guide.
*
* :::
*
* <example>
:index.html

View file

@ -4,7 +4,7 @@ import { ClickOptions } from '../../types'
*
* Click on an element.
*
* Note: This issues a Webdriver `click` command for the selected element, which generally scrolls to and then clicks the
* Note: This issues a WeDdriver `click` command for the selected element, which generally scrolls to and then clicks the
* selected element. However, if you have fixed-position elements (such as a fixed header or footer) that cover up the
* selected element after it is scrolled within the viewport, the click will be issued at the given coordinates, but will
* be received by your fixed (overlaying) element. In these cased the following error is thrown:

View file

@ -17,6 +17,14 @@ type ElementCoordinates = {
*
* Drag an item to a destination element or position.
*
* :::info
*
* The functionality of this command highly depends on the way drag and drop is
* implemented in your app. If you experience issues please post your example
* in [#4134](https://github.com/webdriverio/webdriverio/issues/4134).
*
* :::
*
* <example>
:example.test.js
it('should demonstrate the dragAndDrop command', () => {

View file

@ -7,11 +7,15 @@ import { parseCSS } from '../../utils'
* is formatted to be testable. Colors gets parsed via [rgb2hex](https://www.npmjs.org/package/rgb2hex)
* and all other properties get parsed via [css-value](https://www.npmjs.org/package/css-value).
*
* __Note:__ that shorthand CSS properties (e.g. background, font, border, margin,
* padding, list-style, outline, pause, cue) will be expanded to fetch all longhand
* :::info
*
* Note that shorthand CSS properties (e.g. `background`, `font`, `border`, `margin`,
* `padding`, `list-style`, `outline`, `pause`, `cue`) will be expanded to fetch all longhand
* properties resulting in multiple WebDriver calls. If you are interested in a specific
* longhand property it is recommended to query for that instead.
*
* :::
*
* <example>
:example.html
<label id="myLabel" for="input" style="color: #0088cc; font-family: helvetica, arial, freesans, clean, sans-serif, width: 100px">Some Label</label>

View file

@ -3,7 +3,7 @@
* Get the text content from a DOM-element. Make sure the element
* you want to request the text from [is interactable](http://www.w3.org/TR/webdriver/#interactable)
* otherwise you will get an empty string as return value. If the element is disabled or not
* visible and you still want to receive the text content use [getHTML](https://webdriver.io/docs/api/element/getHTML.html)
* visible and you still want to receive the text content use [getHTML](https://webdriver.io/docs/api/element/getHTML)
* as a workaround.
*
* <example>

View file

@ -5,15 +5,20 @@ import isElementClickableScript from '../../scripts/isElementClickable'
/**
*
* Return true if the selected DOM-element:
* - exists;
* - is visible;
* - is within viewport (if not try scroll to it);
* - its center is not overlapped with another element;
* - is not disabled.
*
* - exists
* - is visible
* - is within viewport (if not try scroll to it)
* - its center is not overlapped with another element
* - is not disabled
*
* otherwise return false.
*
* Please note that `isClickable` works only in web and webviews, it doesn't work in mobile app native context.
* :::info
*
* Please note that `isClickable` works only in web browser and in mobile webviews, it doesn't work in mobile app native context.
*
* :::
*
* <example>
:isClickable.js

View file

@ -13,7 +13,12 @@ const resqScript = fs.readFileSync(require.resolve('resq'))
* The `react$$` command is a useful command to query multiple React Components
* by their actual name and filter them by props and state.
*
* **NOTE:** the command only works with applications using React v16.x
* :::info
*
* The command only works with applications using React v16.x. Read more about React
* selectors in the [Selectors](/docs/selectors#react-selectors) guide.
*
* :::
*
* <example>
:pause.js

View file

@ -12,7 +12,12 @@ const resqScript = fs.readFileSync(require.resolve('resq'))
* The `react$` command is a useful command to query React Components by their
* actual name and filter them by props and state.
*
* **NOTE:** the command only works with applications using React v16.x
* :::info
*
* The command only works with applications using React v16.x. Read more about React
* selectors in the [Selectors](/docs/selectors#react-selectors) guide.
*
* :::
*
* <example>
:pause.js

View file

@ -5,8 +5,6 @@
* `ConnectionFailed`, `NameNotResolved`, `InternetDisconnected`,
* `AddressUnreachable`, `BlockedByClient`, `BlockedByResponse`.
*
* > This is a __beta__ feature. Please give us feedback and file [an issue](https://github.com/webdriverio/webdriverio/issues/new/choose) if certain scenarios don't work as expected!
*
* <example>
:abort.js
it('should block Google Analytics from page', () => {

View file

@ -5,8 +5,6 @@
* `ConnectionFailed`, `NameNotResolved`, `InternetDisconnected`,
* `AddressUnreachable`, `BlockedByClient`, `BlockedByResponse`.
*
* > This is a __beta__ feature. Please give us feedback and file [an issue](https://github.com/webdriverio/webdriverio/issues/new/choose) if certain scenarios don't work as expected!
*
* <example>
:abortOnce.js
it('should block mock only once', () => {

View file

@ -1,8 +1,6 @@
/**
* Resets all information stored in the `mock.calls` array.
*
* > This is a __beta__ feature. Please give us feedback and file [an issue](https://github.com/webdriverio/webdriverio/issues/new/choose) if certain scenarios don't work as expected!
*
* <example>
:clear.js
it('should clear mock', () => {

View file

@ -1,8 +1,6 @@
/**
* Always respond with same overwrite.
*
* > This is a __beta__ feature. Please give us feedback and file [an issue](https://github.com/webdriverio/webdriverio/issues/new/choose) if certain scenarios don't work as expected!
*
* <example>
:respond.js
it('should demonstrate response overwrite with static data', () => {

View file

@ -4,8 +4,6 @@
* only use `respondOnce` and the resource is called more times a mock has been
* defined than it defaults back to the original resource.
*
* > This is a __beta__ feature. Please give us feedback and file [an issue](https://github.com/webdriverio/webdriverio/issues/new/choose) if certain scenarios don't work as expected!
*
* <example>
:respondOnce.js
function getToDos () {

View file

@ -1,8 +1,6 @@
/**
* Does everything that `mock.clear()` does, and also removes any mocked return values or implementations.
*
* > This is a __beta__ feature. Please give us feedback and file [an issue](https://github.com/webdriverio/webdriverio/issues/new/choose) if certain scenarios don't work as expected!
*
* <example>
:addValue.js
it('should demonstrate the addValue command', () => {

View file

@ -197,7 +197,7 @@ export const WDIO_DEFAULTS: Options.Definition<Options.WebdriverIO & Options.Tes
throw new Error(
'a reporter should be either a string in the format "wdio-<reportername>-reporter" ' +
'or a function/class. Please see the docs for more information on custom reporters ' +
'(https://webdriver.io/docs/customreporter.html)'
'(https://webdriver.io/docs/customreporter)'
)
}

View file

@ -53,7 +53,7 @@ describe('deleteCookies', () => {
// @ts-ignore test invalid input
await expect(browser.deleteCookies([2]))
.rejects
.toEqual(new Error('Invalid input (see https://webdriver.io/docs/api/browser/deleteCookies.html for documentation.'))
.toEqual(new Error('Invalid input (see https://webdriver.io/docs/api/browser/deleteCookies for documentation)'))
})
afterEach(() => {

View file

@ -62,7 +62,7 @@ describe('getCookies', () => {
// @ts-ignore test invalid input
await expect(browser.getCookies([2]))
.rejects
.toEqual(new Error('Invalid input (see https://webdriver.io/docs/api/browser/getCookies.html for documentation.'))
.toEqual(new Error('Invalid input (see https://webdriver.io/docs/api/browser/getCookies for documentation)'))
})
afterEach(() => {

View file

@ -72,7 +72,7 @@ describe('setCookies', () => {
// @ts-ignore test invalid parameter
await expect(browser.setCookies([2]))
.rejects
.toEqual(new Error('Invalid input (see https://webdriver.io/docs/api/browser/setCookies.html for documentation.'))
.toEqual(new Error('Invalid input (see https://webdriver.io/docs/api/browser/setCookies for documentation)'))
})
afterEach(() => {

View file

@ -130,7 +130,7 @@ describe('setTimeout', () => {
.rejects
.toEqual(invalidTimeoutParameterError)
const invalidTimeoutValueError = new Error('Specified timeout values are not valid integer (see https://webdriver.io/docs/api/browser/setTimeout.html for documentation).')
const invalidTimeoutValueError = new Error('Specified timeout values are not valid integer (see https://webdriver.io/docs/api/browser/setTimeout for documentation).')
await expect(browser.setTimeout({ implicit: Number.MAX_SAFE_INTEGER + 1 }))
.rejects
.toEqual(invalidTimeoutValueError)

1427
packages/webdriverio/webdriverio-core.d.ts vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,17 +1,17 @@
const PROTOCOLS = {
webdriver: require('../packages/wdio-protocols/protocols/webdriver.json'),
appium: require('../packages/wdio-protocols/protocols/appium.json'),
jsonwp: require('../packages/wdio-protocols/protocols/jsonwp.json'),
mjsonwp: require('../packages/wdio-protocols/protocols/mjsonwp.json'),
chromium: require('../packages/wdio-protocols/protocols/chromium.json'),
saucelabs: require('../packages/wdio-protocols/protocols/saucelabs.json'),
selenium: require('../packages/wdio-protocols/protocols/selenium.json')
selenium: require('../packages/wdio-protocols/protocols/selenium.json'),
jsonwp: require('../packages/wdio-protocols/protocols/jsonwp.json')
}
const PROTOCOL_NAMES = {
appium: 'Appium',
jsonwp: 'JSON Wire Protocol',
mjsonwp: 'Mobile JSON Wire Protocol',
webdriver: 'Webdriver Protocol',
webdriver: 'WebDriver Protocol',
chromium: 'Chromium',
saucelabs: 'Sauce Labs',
selenium: 'Selenium Standalone'
@ -48,8 +48,18 @@ capabilities. You can enable these by setting the following Sauce options:\n\n
\`\`\`
`
const JSONWP_API_DESCRIPTION = `
:::caution depcrecated
The JSONWireProtocol is decrecated and replaced by the [WebDriver](/docs/api/webdriver)
protocol.
:::
`
const PROTOCOL_API_DESCRIPTION = {
'saucelabs': SAUCE_API_DESCRIPTION
'saucelabs': SAUCE_API_DESCRIPTION,
'jsonwp': JSONWP_API_DESCRIPTION
}
module.exports = {

View file

@ -24,7 +24,7 @@ const readmeHeaders = ['===', '# ']
const readmeBadges = ['https://badge', 'https://travis-ci.org/']
const PROJECT_ROOT_DIR = path.join(__dirname, '..', '..')
const DOCS_ROOT_DIR = path.join(PROJECT_ROOT_DIR, 'docs')
const DOCS_ROOT_DIR = path.join(PROJECT_ROOT_DIR, 'website', 'docs')
/**
* Generate docs for 3rd party reporters and services
@ -32,10 +32,10 @@ const DOCS_ROOT_DIR = path.join(PROJECT_ROOT_DIR, 'docs')
*/
exports.generate3rdPartyDocs = async (sidebars) => {
for (const { category, namePlural, nameSingular, packages3rdParty } of plugins) {
const categoryDir = path.join(DOCS_ROOT_DIR, category)
const categoryDir = path.join(DOCS_ROOT_DIR, category === 'api' ? 'api' : '')
await fs.ensureDir(categoryDir)
for (const { packageName, title, githubUrl, npmUrl, suppressBuildInfo, location = githubReadme, branch = 'main' } of packages3rdParty) {
for (const { packageName, title, githubUrl, npmUrl, suppressBuildInfo, location = githubReadme, branch = 'master' } of packages3rdParty) {
const readme = await downloadReadme(githubUrl, branch, location)
const id = `${packageName}`.replace(/@/g, '').replace(/\//g, '-')
@ -44,6 +44,10 @@ exports.generate3rdPartyDocs = async (sidebars) => {
suppressBuildInfo ? [] : buildInfo(packageName, githubUrl, npmUrl))
await fs.writeFile(path.join(categoryDir, `_${id}.md`), doc, { encoding: 'utf-8' })
if (namePlural === 'Testrunner') {
return
}
if (!sidebars[category][namePlural]) {
sidebars[category][namePlural] = []
}
@ -51,7 +55,9 @@ exports.generate3rdPartyDocs = async (sidebars) => {
// eslint-disable-next-line no-console
console.log(`Generated docs for ${packageName}`)
sidebars[category][namePlural].push(`${category}/${id}`)
sidebars[category][namePlural].push(
category === 'api' ? `${category}/${id}` : id
)
}
}
}
@ -132,7 +138,9 @@ function normalizeDoc(readme, githubUrl, preface, repoInfo) {
}
})
return [...preface, ...repoInfo, ...readmeArr].join('\n')
return [...preface, ...repoInfo, ...readmeArr]
.join('\n')
.replace(/<br>/g, '<br />')
}
/**

View file

@ -8,14 +8,24 @@ const { generateWdioDocs } = require('./wdioDocs')
const { generateReportersAndServicesDocs } = require('./packagesDocs')
const { generate3rdPartyDocs } = require('./3rdPartyDocs')
function print (title) {
console.log(`
//////////////////////////////////////////////////
${title}
//////////////////////////////////////////////////`)
}
async function generateDocs() {
/**
* NOTE: all generate docs functions mutate `sidebars` object!
*/
try {
print('Generate Protocol Docs')
generateProtocolDocs(sidebars)
generateWdioDocs(sidebars)
print('Generate WebdriverIO Docs')
await generateWdioDocs(sidebars)
print('Generate Reporter & Services Docs')
generateReportersAndServicesDocs(sidebars)
await generate3rdPartyDocs(sidebars)

View file

@ -25,7 +25,7 @@ exports.generateReportersAndServicesDocs = (sidebars) => {
const readme = fs.readFileSync(path.join(__dirname, '..', '..', 'packages', pkg, 'README.md')).toString()
const preface = buildPreface(id, pkgName, nameSingular, `https://github.com/webdriverio/webdriverio/edit/main/packages/${pkg}/README.md`)
const doc = [...preface, ...readme.split('\n').slice(3)].join('\n')
fs.writeFileSync(path.join(__dirname, '..', '..', 'docs', `_${id}.md`), doc, { encoding: 'utf-8' })
fs.writeFileSync(path.join(__dirname, '..', '..', 'website', 'docs', `_${id}.md`), doc, { encoding: 'utf-8' })
if (!sidebars.docs[namePlural]) {
sidebars.docs[namePlural] = []

View file

@ -2,14 +2,14 @@ const fs = require('fs-extra')
const path = require('path')
const ejs = require('ejs')
const config = require('../../website/siteConfig')
const { repoUrl } = require('../../website/docusaurus.config.js')
const TEMPLATE_PATH = path.join(__dirname, '..', 'templates', 'api.tpl.ejs')
const {
PROTOCOLS, PROTOCOL_NAMES, MOBILE_PROTOCOLS, VENDOR_PROTOCOLS, PROTOCOL_API_DESCRIPTION
} = require('../constants')
const category = 'api'
const PROJECT_ROOT_DIR = path.join(__dirname, '..', '..')
const PROJECT_ROOT_DIR = path.join(__dirname, '..', '..', 'website')
const API_DOCS_ROOT_DIR = path.join(PROJECT_ROOT_DIR, 'docs', category)
/**
@ -21,6 +21,12 @@ exports.generateProtocolDocs = (sidebars) => {
const template = fs.readFileSync(TEMPLATE_PATH, 'utf8')
const protocolDocs = {}
sidebars[category].push({
type: 'category',
label: 'Protocols',
items: []
})
for (const [protocolName, definition] of Object.entries(PROTOCOLS)) {
const protocol = PROTOCOL_NAMES[protocolName]
@ -41,7 +47,7 @@ exports.generateProtocolDocs = (sidebars) => {
description.returnTags = [] // tbd
description.throwsTags = [] // tbd
description.isMobile = MOBILE_PROTOCOLS.includes(protocolName)
description.customEditUrl = `${config.repoUrl}/edit/main/packages/wdio-protocols/protocols/${protocolName}.json`
description.customEditUrl = `${repoUrl}/edit/main/packages/wdio-protocols/protocols/${protocolName}.json`
let protocolNote
if (VENDOR_PROTOCOLS.includes(protocolName)) {
@ -54,7 +60,7 @@ exports.generateProtocolDocs = (sidebars) => {
}
if (description.description) {
description.description += `<br><br>${protocolNote}`
description.description += `<br /><br />${protocolNote}`
} else {
description.description = protocolNote
}
@ -87,6 +93,6 @@ exports.generateProtocolDocs = (sidebars) => {
// eslint-disable-next-line no-console
console.log(`Generated docs for ${protocolName} protocol`)
sidebars[category].Protocols.push(`${category}/${protocolName}`)
sidebars[category][sidebars[category].length - 1].items.push(`${category}/${protocolName}`)
}
}

View file

@ -1,6 +1,7 @@
const fs = require('fs')
const path = require('path')
const markdox = require('markdox')
const { promisify } = require('util')
const formatter = require('../utils/formatter')
const compiler = require('../utils/compiler')
@ -11,11 +12,13 @@ const MARKDOX_OPTIONS = {
template: TEMPLATE_PATH
}
const processDocs = promisify(markdox.process)
/**
* Generate WebdriverIO docs
* @param {object} sidebars website/sidebars
*/
exports.generateWdioDocs = (sidebars) => {
exports.generateWdioDocs = async (sidebars) => {
const COMMAND_DIR = path.join(__dirname, '..', '..', 'packages', 'webdriverio', 'src', 'commands')
const COMMANDS = {
browser: fs.readdirSync(path.join(COMMAND_DIR, 'browser')),
@ -24,8 +27,17 @@ exports.generateWdioDocs = (sidebars) => {
}
for (const [scope, files] of Object.entries(COMMANDS)) {
/**
* add scope to sidebar
*/
sidebars.api.push({
type: 'category',
label: scope,
items: []
})
for (const file of files) {
const docDir = path.join(__dirname, '..', '..', 'docs', 'api', scope)
const docDir = path.join(__dirname, '..', '..', 'website', 'docs', 'api', scope)
if (!fs.existsSync(docDir)){
fs.mkdirSync(docDir)
}
@ -33,26 +45,11 @@ exports.generateWdioDocs = (sidebars) => {
const filepath = path.join(COMMAND_DIR, scope, file)
const output = path.join(docDir, `_${file.replace(/(js|ts)/, 'md')}`)
const options = Object.assign({}, MARKDOX_OPTIONS, { output })
markdox.process(
filepath,
options,
(err) => {
if (err) {
// eslint-disable-next-line no-console
console.error(`ERROR: ${err.stack}`)
}
// eslint-disable-next-line no-console
console.log(`Generated docs for ${scope}/${file} - ${output}`)
}
)
await processDocs(filepath, options)
console.log(`Generated docs for ${scope}/${file} - ${output}`)
/**
* add command to sidebar
*/
if (!sidebars.api[scope]) {
sidebars.api[scope] = []
}
sidebars.api[scope].push(`api/${scope}/${file.replace(/\.(js|ts)/, '')}`)
sidebars.api[sidebars.api.length - 1].items
.push(`api/${scope}/${file.replace(/\.(js|ts)/, '')}`)
}
}
}

View file

@ -31,7 +31,7 @@ title: <?= method.command ?>
var paramKey = paramTag.types
? paramTag.types.map((type) => `<code>${type.replace(/>/g, "&gt;").replace(/</g, "&lt;")}</code>`).join('|')
: paramTag.type
?>| <code><var><?= paramTag.name ?></var></code><? if ((!paramTag.required && typeof paramTag.optional === 'undefined') || paramTag.optional) { ?><br><span class="label labelWarning">optional</span><? }
?>| <code><var><?= paramTag.name ?></var></code><? if ((!paramTag.required && typeof paramTag.optional === 'undefined') || paramTag.optional) { ?><br /><span class="label labelWarning">optional</span><? }
?> | <?= paramKey.split('|').join(', ').replace('(', '').replace(')', '')
?> | <?= paramTag.description ?> |
<? }) ?>
@ -40,7 +40,7 @@ title: <?= method.command ?>
<? if (method.examples.length) { ?>
##### Example<? if (method.examples.length > 1) { ?>s<? } ?>
<? method.examples.forEach(function(example) { ?>
```<?= example.format ?><? if (example.file) { ?> <?= example.file ?><? } ?>
```<?= example.format ?><? if (example.file) { ?> title="<?= example.file ?>"<? } ?>
<?- example.code ?>
```
<? }); ?>

View file

@ -1 +1,103 @@
require('./webdriver-generate-typings')
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const camelCase = require('camelcase')
const { PROTOCOLS } = require('../constants')
const TYPINGS_PATH = path.join(__dirname, '..', '..', 'packages', 'wdio-protocols', 'src', 'commands')
const returnTypeMap = require('./webdriver-return-types.json')
const paramTypeMap = require('./webdriver-param-types.json')
const INDENTATION = ' '.repeat(4)
const EXAMPLE_INDENTATION = `${INDENTATION} * `
const jsDocTemplate = `
${INDENTATION}/**
${INDENTATION} * {PROTOCOL} Protocol Command
${INDENTATION} *
${INDENTATION} * {DESCRIPTION}
${INDENTATION} * @ref {REF}
${INDENTATION} *{EXAMPLE}
${INDENTATION} */`
/**
* create directory if not existing
*/
if (!fs.existsSync(TYPINGS_PATH)) {
fs.mkdirSync(TYPINGS_PATH)
}
for (const [protocolName, definition] of Object.entries(PROTOCOLS)) {
const interfaceName = protocolName.slice(0, 1).toUpperCase() + protocolName.slice(1)
const customTypes = new Set()
const lines = ['']
lines.push(`// ${protocolName} types`)
lines.push(`export default interface ${interfaceName}Commands {`)
for (const [, methods] of Object.entries(definition)) {
for (const [, description] of Object.entries(methods)) {
const { command, parameters = [], variables = [], returns, ref, examples } = description
if (!ref) {
throw new Error(`missing ref for command ${command} in ${protocolName}`)
}
const vars = variables
// sessionId is handled by WebdriverIO for all protocol requests
.filter((v) => v.name != 'sessionId')
// url params are always type of string
.map((v) => `${v.name}: string`)
const params = parameters.map((p, idx) => {
const paramType = paramTypeMap[command] && paramTypeMap[command][idx] && paramTypeMap[command][idx].name === p.name
? paramTypeMap[command][idx].type
: p.type.toLowerCase()
return `${camelCase(p.name)}${p.required === false ? '?' : ''}: ${paramType}`
})
const varsAndParams = vars.concat(params)
let returnValue = returns ? returns.type.toLowerCase() : 'void'
returnValue = returnValue === '*' ? 'any' : returnValue
if (returnTypeMap[command]) {
returnValue = returnTypeMap[command]
customTypes.add(returnTypeMap[command].replace('[]', ''))
}
if (returnValue === 'object') {
returnValue = 'ProtocolCommandResponse'
customTypes.add(returnValue)
}
const jsDoc = jsDocTemplate
.replace('{PROTOCOL}', interfaceName)
.replace('{DESCRIPTION}', description.description || 'No description available, please see reference link.')
.replace('{EXAMPLE}', (
(examples || [])
.map((example) => (
`\n${EXAMPLE_INDENTATION}@example\n` +
`${EXAMPLE_INDENTATION}\`\`\`js\n` +
EXAMPLE_INDENTATION +
`${example.map((l, i) => (i === 0
? `${l}`
: `${EXAMPLE_INDENTATION}${l.replace(/(\/\*\*|\s\*\s|\s\*\/)/, '// ')}`.trimEnd())
).join('\n')}\n` +
`${EXAMPLE_INDENTATION}` + '```'
))
.join(`\n${EXAMPLE_INDENTATION}`.trim())
)
)
.replace('{REF}', ref)
lines.push(jsDoc)
lines.push(`${INDENTATION}${command}(${varsAndParams.join(', ')}): ${returnValue};`)
}
}
/**
* import missing protocol types
*/
if (customTypes.size) {
lines.unshift(`import { ${[...customTypes].join(', ')} } from '../types'`)
}
lines.push('}')
fs.writeFileSync(path.join(TYPINGS_PATH, `${protocolName}.ts`), lines.join('\n'), 'utf8')
console.log(`Generated typings file for ${protocolName}`)
}

View file

@ -1,124 +0,0 @@
const returnTypeMap = require('./webdriver-return-types.json')
const { CUSTOM_INTERFACES } = require('./constants')
const changeType = (text) => {
if (text.indexOf('Array.') > -1) {
const arrayText = 'Array.<'
text = text.substring(arrayText.length, text.length - 1) + '[]'
}
if (!CUSTOM_INTERFACES.includes(text) && !CUSTOM_INTERFACES.includes(text.replace('[]', ''))) {
text = text.toLowerCase()
}
return text
}
const getTypes = (types, alwaysType) => {
types.forEach((type, index, array) => {
array[index] = changeType(type)
})
types = types.join(' | ')
if (types === '' && !alwaysType) {
types = 'void'
} else if (types === '*' || (types === '' && alwaysType)) {
types = 'any'
}
return types
}
const buildCommand = (commandName, commandTags, indentation = 0, promisify = false) => {
const allParameters = []
let returnType = 'void'
for (const { type, name, optional, types, string } of commandTags) {
// dox parse {*} as string instead of types
if (types && types.length === 0 && string.includes('{*}')) {
types.push('*')
}
if (type === 'param') {
let commandTypes = getTypes(types, true)
const paramName = `${name.split('[').pop().split('=')[0]}${optional ? '?' : ''}`
if (name === 'condition') {
const paramDesc = string.slice(1).split('}')[0]
const returnType = paramDesc.includes('#') ? paramDesc.split('#')[1] : 'void'
allParameters.push(`${paramName}: () => ${promisify ? `Promise<${returnType}>` : returnType}`)
continue
}
// skipping param with dot in name that stands for Object properties description, ex: attachmentObject.name
if (name.indexOf('.') < 0) {
// get rid from default values from param name, ex: [paramName='someString'] will become paramName
allParameters.push(`${paramName}: ${commandTypes}`)
}
}
if (type === 'return') {
returnType = getTypes(types, false)
returnType = returnType === 'object' ? (returnTypeMap[commandName] || 'ProtocolCommandResponse') : returnType
}
}
// wrap with Promise
returnType = promisify ? `Promise<${returnType}>` : returnType
return `${commandName}(${allParameters.length > 0 ? `\n${' '.repeat(8 + indentation)}` : ''}${allParameters.join(`,\n${' '.repeat(8 + indentation)}`)}${allParameters.length > 0 ? `\n${' '.repeat(4 + indentation)}` : ''}): ${returnType}`
}
/**
* get jsdoc from file
* @param {string} fileContent browser or element command file content
* @param {number} indentation
* @returns {string}
*/
const getJsDoc = (commandName, fileContent, indentation = 0) => {
if (!fileContent.includes('/**')) {
throw new Error(commandName + ' has no jsdoc!')
}
let lines = fileContent.split('\n').map(line => line.trim())
// remove code
lines = lines.splice(lines.indexOf('/**') + 1, lines.indexOf('*/'))
// remove empty lines in the top
let idx = lines.indexOf(lines.find(line => line !== '*')) // first line with text
lines = lines.splice(idx)
// remove example
if (lines.includes('* <example>')) {
lines = [...lines.splice(0, lines.indexOf('* <example>')), ...lines.splice(lines.indexOf('* </example>') + 1)]
}
// only inclide the first paragraph
if (lines.includes('*')) {
lines = [...lines.splice(0, lines.indexOf('*'))]
}
// stop processing if js doc is empty
if (lines.length === 0) {
throw new Error(commandName + ' has an empty jsdoc!')
}
lines = ['/**', ...lines, ' */', '']
lines = lines.map((line, idx) => {
if (idx === 0) {
return line
}
if (line.startsWith('*')) {
line = ' ' + line
}
return ' '.repeat(indentation) + line
})
return lines.join('\n')
}
module.exports = {
buildCommand,
getJsDoc,
changeType
}

View file

@ -1,103 +0,0 @@
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const camelCase = require('camelcase')
const { PROTOCOLS } = require('../constants')
const TYPINGS_PATH = path.join(__dirname, '..', '..', 'packages', 'wdio-protocols', 'src', 'commands')
const returnTypeMap = require('./webdriver-return-types.json')
const paramTypeMap = require('./webdriver-param-types.json')
const INDENTATION = ' '.repeat(4)
const EXAMPLE_INDENTATION = `${INDENTATION} * `
const jsDocTemplate = `
${INDENTATION}/**
${INDENTATION} * {PROTOCOL} Protocol Command
${INDENTATION} *
${INDENTATION} * {DESCRIPTION}
${INDENTATION} * @ref {REF}
${INDENTATION} *{EXAMPLE}
${INDENTATION} */`
/**
* create directory if not existing
*/
if (!fs.existsSync(TYPINGS_PATH)) {
fs.mkdirSync(TYPINGS_PATH)
}
for (const [protocolName, definition] of Object.entries(PROTOCOLS)) {
const interfaceName = protocolName.slice(0, 1).toUpperCase() + protocolName.slice(1)
const customTypes = new Set()
const lines = ['']
lines.push(`// ${protocolName} types`)
lines.push(`export default interface ${interfaceName}Commands {`)
for (const [, methods] of Object.entries(definition)) {
for (const [, description] of Object.entries(methods)) {
const { command, parameters = [], variables = [], returns, ref, examples } = description
if (!ref) {
throw new Error(`missing ref for command ${command} in ${protocolName}`)
}
const vars = variables
// sessionId is handled by WebdriverIO for all protocol requests
.filter((v) => v.name != 'sessionId')
// url params are always type of string
.map((v) => `${v.name}: string`)
const params = parameters.map((p, idx) => {
const paramType = paramTypeMap[command] && paramTypeMap[command][idx] && paramTypeMap[command][idx].name === p.name
? paramTypeMap[command][idx].type
: p.type.toLowerCase()
return `${camelCase(p.name)}${p.required === false ? '?' : ''}: ${paramType}`
})
const varsAndParams = vars.concat(params)
let returnValue = returns ? returns.type.toLowerCase() : 'void'
returnValue = returnValue === '*' ? 'any' : returnValue
if (returnTypeMap[command]) {
returnValue = returnTypeMap[command]
customTypes.add(returnTypeMap[command].replace('[]', ''))
}
if (returnValue === 'object') {
returnValue = 'ProtocolCommandResponse'
customTypes.add(returnValue)
}
const jsDoc = jsDocTemplate
.replace('{PROTOCOL}', interfaceName)
.replace('{DESCRIPTION}', description.description || 'No description available, please see reference link.')
.replace('{EXAMPLE}', (
(examples || [])
.map((example) => (
`\n${EXAMPLE_INDENTATION}@example\n` +
`${EXAMPLE_INDENTATION}\`\`\`js\n` +
EXAMPLE_INDENTATION +
`${example.map((l, i) => (i === 0
? `${l}`
: `${EXAMPLE_INDENTATION}${l.replace(/(\/\*\*|\s\*\s|\s\*\/)/, '// ')}`.trimEnd())
).join('\n')}\n` +
`${EXAMPLE_INDENTATION}` + '```'
))
.join(`\n${EXAMPLE_INDENTATION}`.trim())
)
)
.replace('{REF}', ref)
lines.push(jsDoc)
lines.push(`${INDENTATION}${command}(${varsAndParams.join(', ')}): ${returnValue};`)
}
}
/**
* import missing protocol types
*/
if (customTypes.size) {
lines.unshift(`import { ${[...customTypes].join(', ')} } from '../types'`)
}
lines.push('}')
fs.writeFileSync(path.join(TYPINGS_PATH, `${protocolName}.ts`), lines.join('\n'), 'utf8')
console.log(`Generated typings file for ${protocolName}`)
}

Some files were not shown because too many files have changed in this diff Show more