Next-gen browser and mobile automation test framework for Node.js (Forked from https://github.com/webdriverio/webdriverio)
Find a file
David Prevost 2e070380e8
feat(runner+browserstack): Mask sensitive data for Reporters (and more) (#13938)
* Draft solution masking on the `onBeforeCommand`

Use same default string as appium

Use same default token as appium

Full working solutions

Fix compilation problems

Remove it from capabilities from simplicity

Fix grammar

Use Regex native type

Draft mask body & command args in webdriver directly

Full working solution

Removing old solution and complete the new one

Revert "Draft solution masking on the `onBeforeCommand`"

This reverts commit 5feb324af2d2a1ded4e81c86cad2670a34150b7b.

Code review

Update packages/webdriver/src/command.ts

Co-authored-by: Christian Bromann <git@bromann.dev>
Unit test on the regExp converter from string

Add missing case of missing starting and ending slash

Remove undesired changes

Convert string to regExps only once
Fix problem after rebase
remove occurences of any

Add new mask parameter to elementSendKeys to mask text input and more

Added also the `/session/:sessionId/appium/settings` endpoints to generate regEx from the sensitive value so that we can mask the value int he appium log on top of WebDriver log and other touchpoint
e2e test for masking text value with setValue command

Use `updateSettings` only with Appium

Review solution to be completely outside of `request.ts`

Use env `WDIO_LOG_MASKING_PATTERNS` to pass regex and mask log

Full working solutions to mask logs with 0 1 or 2 capturing group

Working solution to mask for example BrowserStack key in logs

Code review
Fix masking not working when output directly in console

mask string logging only

Better code for wdio-logger masking + more unit tests

- Better typing in logger to reflect reality of having only 1 arg of type string of 3 args where the third can be anything.
- Move masking utility code into an utils file and add better unit tests
- Add `setMaskingPatterns` following `setLogLevelsConfig` for more flexible configuration
- Fix a couple fo edge cases
- Ensure we mask the output of serializers too

Have mask in command optional and fix ut

- Have mask optional in send and add command to not interfere with expected output and be less "breaking" if masking is not used
- fix ut affected by new logData eventhandler

Better masking code for command with masking at true

- Move masking code for command into an utility
- Use args better with index to fetch mask and text
- Apply masking only if the command has the param 'mask', 'text' and mask is true
- Share the logger replacer with this package
- Fix Logger mock for the `SENSITIVE_DATA_REPLACER`
- Replace the sensitive info in both the body and args
- Make sure we reuse existing body and args if no masking require for better backward compatibility
- Add unit test for commands with masking

Review e2e tests to had a input with masking case

Remove `.only` on tests

Remove fail tentative

Tentative fix for failure in `react.test.tsx`

- react.test.tsx: SyntaxError: Importing binding name 'SENSITIVE_DATA_REPLACER' is not found

* Use the new appium http header masking automatically

* fix: used an additional non-typed options to pass the masking property

* Add an options object for future needs

* Fix masking e2e

* Be more verbose on the unmasked vs masked version in the code

* Update packages/wdio-logger/src/index.ts

Co-authored-by: Christian Bromann <git@bromann.dev>

* Update packages/wdio-logger/src/index.ts

Co-authored-by: Christian Bromann <git@bromann.dev>

* Code review

- Use optional options instead
- Add more comment on intentions

* Update packages/webdriver/src/types.ts

* Update packages/webdriverio/src/types.ts

* Update packages/webdriver/tests/command.test.ts

* Update packages/webdriverio/src/types.ts

* Update packages/webdriver/tests/utils.test.ts

* On more UT for emit and log.info cases with masked data

* make sure the capture data are reset

* Better integration of the appium header

* final code review

* Fix pipeline

* Fix depcheck

* Fix this.client header undesired alteration

* Ensure more code coverage

* Apply suggestions from code review
Apply suggestions from code review
Apply suggestions from code review

* Code reviews

* Fix `CommandRuntimeOptions is not defined`

* Review to mask all captured group + documentation

* Add more verbose e2e

* Add `maskingPatterns` capabilities to set easily masking patterns

* Code review

* Test if this is causing e2e to fails!

* Fix typo

* Rectify doc since it is not a capability

* More robust masking algorithm supporting logging of string array

- Apply masking on the entire string after stripping the colors (ansi) for a more robust algorithm
- The above allow to support regular expression with keyword like `RESULT` or `COMMAND` or `BIDI COMMAND`
- Downside is in the console some colors are lost
- Enhance doc for the above and show an example to configure all loggers since using wdio.conf object not always work for all of them

* Simplify `setMaskingPatterns` API

* Add JSDOC and simplify `mask` following previous changes

* Update packages/webdriverio/src/types.ts

Co-authored-by: Christian Bromann <git@bromann.dev>

* Update packages/webdriver/src/types.ts

Co-authored-by: Christian Bromann <git@bromann.dev>

* Use suggested return-early version of mask in used command.ts

* Fix grammar + review doc

* be more human friendly

* Test

* Code review

* Fix new line sometimes stripped away

* Update packages/wdio-logger/README.md

Co-authored-by: Christian Bromann <git@bromann.dev>

* Apply suggestions from code review

Co-authored-by: Christian Bromann <git@bromann.dev>

* Last comment review checking types in setMaskingPatterns

* Add doc on `maskingPatterns` in Configuration.md

* Add guides on security

* Apply suggestions from code review

* Add missing import in example

---------

Co-authored-by: Christian Bromann <git@bromann.dev>
2025-05-29 14:18:24 -07:00
.devcontainer docs(watch-mode): update running instructions (#13527) 2024-09-09 14:05:23 -07:00
.github chore(deps): bump dependabot/fetch-metadata (#14468) 2025-05-12 08:11:23 -07:00
.gitpod (webdriverio): manage browser drivers (#10767) 2023-08-01 08:10:51 +02:00
.husky build: Migrate to Husky v9 (#12395) 2024-03-03 12:31:35 -08:00
.vscode fix(@wdio/runner): Continue emitting event on the runner even when a reporter throws an error (#13958) 2024-12-09 04:27:50 -08:00
@types fix(@wdio/reporter): propagate failing session creation to report (#14223) 2025-02-24 10:50:20 -08:00
__mocks__ feat(runner+browserstack): Mask sensitive data for Reporters (and more) (#13938) 2025-05-29 14:18:24 -07:00
e2e feat(runner+browserstack): Mask sensitive data for Reporters (and more) (#13938) 2025-05-29 14:18:24 -07:00
examples feat: introduce defineConfig function to create a typed configuration object (#14350) 2025-04-12 15:05:57 +02:00
infra chore(deps): bump the minor-deps-updates-main group with 7 updates (#14173) 2025-02-10 12:16:30 +00:00
packages feat(runner+browserstack): Mask sensitive data for Reporters (and more) (#13938) 2025-05-29 14:18:24 -07:00
scripts feat: adding check in normalizeDoc function to make sure readmeArr is of string type (#14481) 2025-05-14 19:06:28 -07:00
tests feat: introduce defineConfig function to create a typed configuration object (#14350) 2025-04-12 15:05:57 +02:00
website feat(runner+browserstack): Mask sensitive data for Reporters (and more) (#13938) 2025-05-29 14:18:24 -07:00
.editorconfig Get rid of Babel and rewrite @wdio/repl (#5804) 2020-09-21 10:54:42 +02:00
.gitattributes fix line break for windows 2021-08-03 09:56:40 +02:00
.gitignore fix(docs): re-enable translation snippets 2025-04-29 10:14:16 -07:00
.gitpod.yml docs(watch-mode): update running instructions (#13527) 2024-09-09 14:05:23 -07:00
.nvmrc update all dependencies 2024-02-16 16:48:00 -08:00
AUTHORS.md Update AUTHORS.md (#12052) 2024-01-19 09:36:02 -08:00
BACKERS.md docs: remove Sauce Labs as premium sponsor 😢 2025-02-27 16:59:50 -08:00
CHANGELOG.md v9.14.0 2025-05-15 16:26:55 +00:00
CODE_OF_CONDUCT.md update link to foundation CoC 2020-08-26 00:46:51 +02:00
CONTRIBUTING.md fix(docs): prompt users to add their language rather than help translating 2025-05-15 10:24:47 -07:00
crowdin.yaml Update Crowdin configuration file 2023-03-26 20:05:08 +02:00
eslint.config.mjs chore: upgrade to Eslint v9 (#13867) 2024-12-18 11:55:43 -08:00
GOVERNANCE.md Update GOVERNANCE.md 2024-01-30 08:25:22 -08:00
lerna.json v9.14.0 2025-05-15 16:26:55 +00:00
LICENSE fix(docs): change file name of license from LICENSE-MIT to just LICENSE 2024-08-05 11:24:13 -07:00
package.json feat(protocol): WebDriver Bidi Protocol update (#14478) 2025-05-14 10:38:44 -07:00
pnpm-lock.yaml chore(deps): bump the patch-deps-updates-main group across 1 directory with 18 updates (#14509) 2025-05-26 12:27:44 +00:00
pnpm-workspace.yaml breaking(build): migrate to Esbuild for bundling (#13338) 2024-08-08 23:47:30 -07:00
PROJECT_CHARTER.md (devtools): removing devtools automation protocol (#12301) 2024-03-03 15:42:28 -08:00
README.md docs: remove Sauce Labs as premium sponsor 😢 2025-02-27 16:59:50 -08:00
ROADMAP.md docs: fix typo (#14435) 2025-04-29 09:45:18 -07:00
tsconfig.json breaking(build): migrate to Esbuild for bundling (#13338) 2024-08-08 23:47:30 -07:00
vitest.config.ts feat(eslint): Add support for multiple browser instances in eslint rules (#14188) 2025-02-14 11:41:30 -08:00

Stand With Ukraine

WebdriverIO

Next-gen browser and mobile automation test framework for Node.js.

Build Status Package Health OpenSSF Best Practices
Support Channel Issue Resolution time Open issues


Homepage | Developer Guide | API Reference | Contribute | Changelog | Roadmap


WebdriverIO is a test automation framework, for e2e as well as unit and component testing in the browser, that allows you to run tests based on the WebDriver and WebDriver BiDi as well as Appium automation technology. It provides support for your favorite BDD/TDD test framework and will run your tests locally or in the cloud using Sauce Labs, BrowserStack, TestingBot or LambdaTest.

👩‍💻 👨‍💻 Contributing

Do you like WebdriverIO and want to help make it better? Awesome! Have a look into our Contributor Documentation to get started and find out what contributions can be and how to make them.

Getting started with GitHub Codespaces

To get started, create a codespace for this repository by clicking this 👇

Open in GitHub Codespaces

A codespace will open in a web-based version of Visual Studio Code. The dev container is fully configured with the software needed for this project.

Note: Dev containers are an open spec that is supported by GitHub Codespaces and other tools.

Getting started with Gitpod

You can also just click on:

Open in Gitpod

to get a ready-to-use development environment for you to start working on this code base.

If you're looking for issues to help out with, check out the issues labeled "good first pick". You can also reach out to our Matrix Channel if you have questions on where to start contributing.

🏢 WebdriverIO for Enterprise

Available as part of the Tidelift Subscription.

The maintainers of WebdriverIO and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open-source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

📦 Packages

This repository contains some of the core packages of the WebdriverIO project. There are many wonderful curated resources the WebdriverIO community has put together.

Did you build a WebdriverIO service or reporter? That's awesome! Please add it to our configuration wizard and docs (e.g. like in this example commit) as well as to our awesome-webdriverio list. Thank you! 🙏 ❤️

Core

  • webdriver - A Node.js bindings implementation for the W3C WebDriver and Mobile JSONWire Protocol
  • webdriverio - Next-gen browser and mobile automation test framework for Node.js
  • @wdio/cli - A WebdriverIO testrunner command line interface

Helper

  • @wdio/config - A helper utility to parse and validate WebdriverIO options
  • @wdio/logger - A helper utility for logging WebdriverIO packages
  • @wdio/protocols - Utility package providing information about automation protocols
  • @wdio/repl - A WDIO helper utility to provide a repl interface for WebdriverIO
  • @wdio/reporter - A WebdriverIO utility to help report all events
  • @wdio/runner - A WebdriverIO service that runs tests in arbitrary environments
  • @wdio/utils - A WDIO helper utility to provide several utility functions used across the project
  • @wdio/globals - A WDIO helper utility for importing global variables directly

Reporter

Services

  • @wdio/appium-service - A WebdriverIO service to start & stop Appium Server
  • @wdio/browserstack-service - A WebdriverIO service that can be used to use BrowserStack Test Observability which is a reporting, debugging, and test suite quality tracking tool for any test running anywhere. The service also helps for a better integration with the BrowserStack grid if you're running tests on the grid.
  • @wdio/lighthouse-service - A WebdriverIO service that integrates Google Lighthouse commands to use it for automate tests
  • @wdio/firefox-profile-service - A WebdriverIO service that lets you define your Firefox profile in your wdio.conf.js
  • @wdio/sauce-service - A WebdriverIO service that provides a better integration into Sauce Labs
  • @wdio/shared-store-service - A WebdriverIO service to exchange data across processes
  • @wdio/testingbot-service - A WebdriverIO service that provides a better integration into TestingBot

Runner

Framework Adapters

Others

Infrastructure Packages

These packages are not released to NPM and used to work on this codebase.

  • @wdio/compiler - Esbuild script to compile the source code all of all packages
  • @wdio/lerna-patch - This sub-package is being used to patch Lerna to not run pnpm install after it prepared all packages for release

🤝 Project Governance

This project is maintained by awesome people following a common set of rules and treating each other with respect and appreciation.

👨‍🍳 👩‍🍳 Backers

Become a backer and show your support for our open-source project.

💸 Sponsors

Does your company use WebdriverIO? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time to maintenance and new features for everyone. Also, your company's logo will show on GitHub - who doesn't want a little extra exposure? Here's the info.

💎 Premium Sponsor

We are immensely grateful to our exclusive Premium Sponsor for their invaluable support in the development of this project:

BrowserStack

🥇 Gold Sponsor

Route4Me       Lambdatest

🥈 Silver Sponsor

TestingBot

🥉 Bronze Sponsor

Eslint Gridlastic

📄 License

MIT

🔰 Badge

Show the world you're using webdriver.io → tested with webdriverio

GitHub markup
[![tested with webdriver.io](https://img.shields.io/badge/tested%20with-webdriver.io-%23ea5906)](https://webdriver.io/)
HTML
<a href="https://webdriver.io/">
    <img alt="WebdriverIO" src="https://img.shields.io/badge/tested%20with-webdriver.io-%23ea5906">
</a>

👏 Supporters

Stargazers repo roster for WebdriverIO Forkers repo roster for WebdriverIO

Animated footer bars


Back to top