Commit graph

87 commits

Author SHA1 Message Date
mato533
3f1e7ef93a
feat: integrate the create-wdio package (#14618)
* chore: create sub-package of `create-wdio`

* docs: copy and adjustment for changing repository

* chore: copy a code of create-wdio

* chore: update compiler plugin

* chore: adjust npm script

* chore(wdio-cli): delete the code copied to `create-wdio`

* chore: remove compiler plugin for @wdio/cli

* docs: update root readme

* chore: update package.json

* style: apply format rule

* fix: remove unnecessary export `installPackages`

* test: remove unnecessary mocking in wdio-cli

---------

Co-authored-by: Christian Bromann <git@bromann.dev>
2025-07-08 16:13:28 -07:00
Christian Bromann
6464dc7d4a
fix(@wdio/jasmine-framework): become independant from expect-webdriverio (#14592)
* fix(@wdio/jasmine-framework): become independant from expect-webdriverio

* remove console.log

* get tests to work

* fix(ci): add eslint as dep

* fix tests

* run unit tests on Node.js 20, 22 and 24

* move @sveltejs/vite-plugin-svelte to browser runner

* remove usage of Node.js primitives in webdriver and webdriverio

* fix unit tests

* skip svelte test for now

* increase timeouts

* fix component test

* increase timeouts

* increase timeouts

* increase timeouts

* fix imageSize call
2025-07-08 12:51:42 -07:00
mato533
9847c0f0c6
chore: replace asset to with at import statement (#14607) 2025-07-01 07:49:26 -07:00
JustasM
10cddfd73c
feat(wdio-runner): automatically include SoftAssertionService (#14546)
* feat: automatically include SoftAssertionService in the core

* fix(docs): clarify default inclusion of SoftAssertionService in documentation

* feat: add autoAssertOnTestEnd option to control soft assertion behavior

* Update website/docs/Configuration.md

* Update website/docs/Assertion.md

* refactor(docs): reorganize Soft Assertions section for clarity

* feat: add SoftAssertionService to expect-webdriverio mock

* fix(tests): adjust snapshot formatting for consistency in React component tests

---------

Co-authored-by: Christian Bromann <git@bromann.dev>
2025-06-11 15:16:37 -07:00
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
Swastik Baranwal
7e6a5d2598
feat(reporter): add browserName function and use where required (#14454)
* feat(reporter): add browserName function and use where required

* do more changes

* oops

* Apply suggestions from code review

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

* fix

* remove unused import

* Update packages/wdio-allure-reporter/src/reporter.ts

---------

Co-authored-by: Christian Bromann <git@bromann.dev>
2025-05-06 08:05:03 -07:00
Erwin Heitzman
61c5243243
feat: introduce defineConfig function to create a typed configuration object (#14350) 2025-04-12 15:05:57 +02:00
Wim Selles
aa49a4707d
fix: support windows/mac apps for isDisplayed (#14287)
* fix: support windows/mac apps for isDisplayed

- add 2 new session flags for windows and mac apps
- add UT's
- add Docs

* chore: forgot to push the docs
2025-03-20 00:00:44 -07:00
Christian Bromann
c44832ba51
fix(webdriverio): double check elements that have a display: contents (#14103)
* fix(webdriverio): double check elements that have a display: contents

* fix smoke tests
2025-01-23 12:19:21 -08:00
Christian Bromann
ea3f50b778
feat(webdriverio): use checkVisibility for display checks (#14075)
* feat(webdriverio): use checkVisibility for display checks

* fix unit tests
2025-01-17 10:46:32 -08:00
Christian Bromann
33a1b19670
fix(webdriverio): properly switch context using switchToParentFrame() (#14070)
* fix(webdriverio): properly switch context using switchToParentFrame()

* fix e2e test

* fix unit test

* revert wrong change

* fix(webdriverio): allow to take screenshots of frames (#14071)

* fix(webdriverio): allow to take screenshots of frames

* Update packages/webdriverio/src/commands/browser/saveScreenshot.ts

Co-authored-by: Swastik Baranwal <swstkbaranwal@gmail.com>

---------

Co-authored-by: Swastik Baranwal <swstkbaranwal@gmail.com>

* fix(webdriverio): properly switch context using switchToParentFrame()

* pr feedback

---------

Co-authored-by: Swastik Baranwal <swstkbaranwal@gmail.com>
2025-01-17 10:45:03 -08:00
Christian Bromann
3b7f049dc1
fix(webdriverio): make WebdriverIO load-able in browser environments (#14080)
* fix(webdriverio): make webdriverio loadable in browser environments

* load scripts at build time

* remove eventemitter in addInitScript

* fix unit tests

* mock global scripts
2025-01-17 10:28:26 -08:00
Wim Selles
edbda17468
Add mobile tap command (#14012)
* feat: set basics for tap command

* feat: add different taps

- add native tap on coordinates
- add web tap on coordinates
- add native tap on element
- add web tab on element
- add automatically scrolling when element is not visible on native tap
- add first unit tests

* test: add 2 failing tests

* fix: update scroll logic

- tested and works on Android
- updated the implicitWait for tap
- updated UT's

* fix: reduce tap complexity

- fix docs for mobile element commands
- update UT's

* feat: add (browser|driver).tap()

- update tests

* chore: updated docs

* chore: fix build

* feat: update docs

- update template to support merged cells as row info
2024-12-27 13:24:39 -08:00
Wim Selles
21b53fde6b
feat: enhance scrollIntoView to support native mobile (#13870)
* feat: enhance scrollIntoView to support native mobile

Initial setup to support Native apps

* test: Add unit tests

* fix: fix types

* chore: add the docs and fix types

* fix: make use of $$ from the browser

- fix tests

* Update packages/webdriverio/src/commands/element/scrollIntoView.ts

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

* chore: updates after feedback

- changed code order
- updated error messages
- fixed UTs

* fix: exclude the scrollIntoView

* fix: fix type for scrollIntoView

* fix: fix type

* fix: type test

* test: fix all UTs

- due to the extra getContext call in mobile mode a lot of UT's failed

---------

Co-authored-by: Christian Bromann <git@bromann.dev>
2024-11-13 08:17:06 -08:00
Christian Bromann
943a698a5a
fix(webdriverio): improve switchFrame behavior (#13781)
* fix(webdriverio): improve switchFrame behavior

* progress

* fix tests

* resolve race conditions

* fix unit test

* minor tweak

* minor tweaks to test
2024-10-26 19:25:23 -07:00
Christian Bromann
43778e799c
fix(webdriverio): don't send desiredCapabilities anymore when initializing a session (#13622)
* fix(webdriverio): don't send desiredCapabilities anymore when initializing a session

* fix unit tests
2024-09-23 16:53:06 -07:00
Christian Bromann
a764e12c6b
fix(webdriver): better type check for webSocketUrl capability (#13417)
* fix(webdriver): better type check for webSocketUrl capability - fixes #13415

* update mock
2024-08-19 13:34:41 -07:00
Christian Bromann
f9b7a172a8
(@wdio/lighthouse-service): migrate over from devtools service (#12300)
* (@wdio/lighthouse-service): migrate over from devtools service

* more fixes

* fix e2e tests

* minor fixes

* mutliremote test fix
2024-06-19 23:32:01 -07:00
Christian Bromann
3a7b08ec8f
breaking(*): better type definitions for capabilities (#12987)
* breaking(*): better type definitions for capabilities

* fix resolving types

* fix tests

* webSocketUrl
2024-06-17 23:38:54 -07:00
nguyencuongabcxyz
c98c71d49b
[webdriverio] Fix issue wdio log is missing in standalone mode (#12669)
* Fix issue wdio log is missing in standalone mode

* Create a help method for enabling file logging, add and fix unit tests
2024-04-18 09:18:31 -07:00
Christian Bromann
a46cea223e
Support mocking interface for Bidi (#12598)
* wip

* progress

* make it work in the browser

* make it better

* clean up and tests

* fix issues

* fix test

* better stale element detection

* fix test config

* no mock tests for Safari
2024-04-04 01:55:26 -07:00
Christian Bromann
28e64e439f
(devtools): removing devtools automation protocol (#12301)
* (devtools): bye bye

* remove e2e tests

* more cleanuops

* fix unit tests

* fix test command
2024-03-03 15:42:28 -08:00
Tamil Selvan
9aca81ab55
V9 migrate from got to fetch (#11942)
* V9 drop support for Node.js 16 (#11493)

* (internal): drop support for Node.js 16

update engines of package.json files

* (internal): drop support for Node.js 16

update CONTRIBUTING.md with Node.js 20 as recommendation

* (internal): drop support for Node.js 16

update github workflows

* (internal): drop support for Node.js 16

update external packages that dropped the support already

* (internal): drop support for Node.js 16

resolve PR feedback

* Update packages/webdriver/package.json

* Update packages/wdio-cucumber-framework/package.json

* Update package.json

---------

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

* (webdriverio): merge isDisplayed and isDisplayedWithinViewport (#11857)

* (webdriverio): merge isDisplayed and isDisplayedWithinViewport

* allow to specify withinViewport check in waitForDisplayed

* V9 drop support for Node.js 16 (#11493)

* (internal): drop support for Node.js 16

update engines of package.json files

* (internal): drop support for Node.js 16

update CONTRIBUTING.md with Node.js 20 as recommendation

* (internal): drop support for Node.js 16

update github workflows

* (internal): drop support for Node.js 16

update external packages that dropped the support already

* (internal): drop support for Node.js 16

resolve PR feedback

* Update packages/webdriver/package.json

* Update packages/wdio-cucumber-framework/package.json

* Update package.json

---------

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

* (webdriverio): merge isDisplayed and isDisplayedWithinViewport (#11857)

* (webdriverio): merge isDisplayed and isDisplayedWithinViewport

* allow to specify withinViewport check in waitForDisplayed

* Migrating from got to fetch

* Migrate got to fetch in packages

* migrate got to fetch & update unit test

* doc update for proxy setup

* rebase and migrate got to fetch in browserstack

* Migrate hostname from 0.0.0.0 to localhost

* fix unit test by removing headers in safari driver

* fix smoke test: update nock to beta

* fix launch test for firefox

* fix unit test for startGeckodriver

* fix firefox executions in node 18

* Incorporating review comments

* fix component tests

* cleaning up RequestLibOptions

* Removing RequestLibOptions & incorporating other review comments

* use process from globalThis

---------

Co-authored-by: Erwin Heitzman <15839059+erwinheitzman@users.noreply.github.com>
Co-authored-by: Christian Bromann <git@bromann.dev>
2024-02-16 16:16:30 -08:00
Christian Bromann
1b0c8ba0ff
(webdriverio): allow to define new capabilities when calling `reloadSession (#12147) 2024-02-05 20:24:27 -08:00
Christian Bromann
9cd5f364ed
(@wdio/browser-runner): allow services and other hooks to register custom matcher (#12184)
* (@wdio/browser-runner): allow services and other hooks to register custom matcher

* fix unit tests
2024-02-05 19:27:15 -08:00
Muhammad Hammad Faisal
0bd4db52c2
(@wdio/spec-reporter): introduce color option to disable colors for spec reporter (#12092)
* disable colored output in @wdio/spec-reporter

* issue's test cases added and comments resolved

* enums added and snapshot updated
- ChalkColor and State enum added
- snapshot updated
- code is refactored accordingly

* comments resolved

* chalk usage updated
2024-02-01 23:47:42 -08:00
Wim Selles
285680132a
fix: not add pause for iOS keys (#12040)
* fix: not add pause for iOS keys

* chore: add docs
2024-01-17 12:08:51 -08:00
Christian Bromann
194bda204b
(@wdio/jasmine-framework): attach asymmetric matchers to expect object (#11820) 2023-12-06 21:52:30 +01:00
Christian Bromann
0ccef1688d
(internal): fix usage of intialise wording in variables, comments and elsewhere (#11672)
* (internal): fix usage of wrong wording in variables, comments and elsewhere

* fix file naming
2023-11-14 22:10:33 -08:00
Christian Bromann
c53480b266
(webdriverio): support emulating Web APIs for geolocation, colorScheme, userAgent and onLine (#11592)
* (webdriverio): new emulate command

* add docs

* add tests
2023-11-08 15:32:11 -08:00
Christian Bromann
658c217ecf
(@wdio/utils): separate between common and node utils (#11469)
* (@wdio/utils): seperate between common and node utils

* more cleanup

* test fixes

* adjust tests

* fix last test

* fix istanbul

* fix cucumber typing

* fix dirname for windows

* update snapshot
2023-10-19 15:43:14 -07:00
Christian Bromann
355adfe87c
(@wdio/cli) replace yarn-install with a custom install that supports pnpm as well (#11476)
* (@wdio/cli): Replace yarn-install with custom package installer

* fix tests

* improvements after some manual e2e tests

* fix test

* fix unit test

* fix unit test
2023-10-19 15:18:52 -07:00
Christian Bromann
a429320ede
(@wdio/cli): Support for sharding (#11441)
* (@wdio/cli): Support for sharding

* amend tests

* add docs

* fix smoke tests
2023-10-17 08:58:40 -07:00
Tamil Selvan
4004992018
Updating driver download logs (#11255)
* Updating driver download logs

* adding progress loglevel to logger

* incorporating review commands

* adding jsdoc for _install method
2023-09-29 08:55:40 -07:00
Christian Bromann
2e2f1a20dc
Delete __mocks__/mockery.ts
refs #11010
2023-09-01 17:35:25 +02:00
Christian Bromann
34661c5f45
(webdriver): improvements to driver management (#10952)
* (webdriver): improvements to driver management

* fix unit tests

* fix deps

* fix deps

* revert test changes

* fix test

* fix component tests

* disable edge e2e tests

* better error logging
2023-08-15 09:45:24 +02:00
Christian Bromann
8cb10cdd52
update setup 2023-06-13 00:05:36 +02:00
Christian Bromann
2fe1dcc2dd
(jasmine): Bring back Jasmine assertions (#10533)
* (jasmine): bring back jasmine assertions

* add unit and smoke tests

* add smoke tests for different matcher types

* add smoke test for expectationResultHandler

* fix unit test

* fix type generation in windows

* fix import
2023-06-11 22:10:29 +02:00
Fabien CELLIER
8c2d65c49a
Fix ScrollIntoView - correct position for the focus (#10224)
* Fix ScrollIntoView - correct position for the focus

* fix unit tests

* improve scroll function

* update e2e test

* revert changes on e2e tests
2023-04-20 21:56:17 +02:00
Christian Bromann
4afd9f2d20
[💡 Feature]: Replace shadowFnFactory with WebDriver shadow command (#9911)
* Replace shadow commands with WebDriver implementation

* move component testing examples into e2e test

* adjust component testing example

* push missing env file

* fall back to old behavior for Firefox
2023-03-08 09:53:12 +01:00
Konstantin Epishev
6b07f7238a
Allure2 (#9704)
* replicate correct report structure with the latest allure core

* updated logs, screenshots and another attachments api

* update public methods

add new public methods

* update reporter methods up to existing specs

* update constants and api specs

* update suite specs

* api fixes

* utils fixes

* fix suites finishing logic for cucumber

remove legacy logic for steps cutting due the new allure api
incompability

* update cucumber and allure features specs

* update allure features specs

* update reporter methods

* remove some useless comments and code

* add allure custom steps functionality

* update api specs to write allure results to temp dir

* update allure docs

* fix readme type

* partial review fixes

* spec fixes according the review comments

fix duplication of test case labels

* move screenshot command detection method form reporter to utils

extract reporter state to separated class

* add specs for the reporter state

* add suite and package labels

* fix state specs and add new checks to it

* add specs for package label

* fix file property in allure fixtures

* fix after command hook behaviour

* move allure steps specs to separate file

* fix problem with duplicated labels and parameters

* add tests for suite labels tags util
2023-02-28 18:32:19 +01:00
Christian Bromann
60db47e44f
Support test coverage reporting and assertion for browser runner (#9676)
* Support test coverage reporting and assertion

* implement per file treshold check

* add unit tests

* source map support

* add docs and clean up

* verify coverage as part of the test

* fix test in windows
2023-01-28 05:47:19 +01:00
Christian Bromann
68b011f8e5
Various browser runner improvements (#9673)
* Various browser runner improvements

* fix missing commands

* allow HTMLElement set in $$ command

* fix unit tests
2023-01-27 18:56:06 +01:00
dependabot[bot]
87a5103687
Bump vitest from 0.25.3 to 0.26.3 (#9500)
* Bump vitest from 0.25.3 to 0.26.3

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 0.25.3 to 0.26.3.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v0.26.3/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix unit tests

* adjust coverage treshold

* update unit test

* skip test on windows

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sri Harsha <12621691+harsha509@users.noreply.github.com>
Co-authored-by: Christian Bromann <git@bromann.dev>
2023-01-03 17:12:15 +01:00
SCG82
93d2894a61
Node16 compatibility (#9480)
* add file extensions to all relative path imports

* @wdio/protocol: convert json to ts

* scripts: replace shelljs with native node.js methods

* tests: assert type json

* build script: separate esm/cjs

* webdriver: revert to requiring package.json

* webdriverio: add missing Symbol.asyncIterator to ChainablePromiseArray

* webdriver: revert building in cjs (use wrapper)

* @wdio/logger: add cjs build

* @wdio/logger: revert adding cjs build

* package: revert some changes

* depcheck: remove unneeded ignore - webdriver

* @wdio/logger: move type to top

* webdriver: revert package.json import

* scripts: revert some scripts back to shelljs

* webdriver/webdriverio: set module to NodeNext, Node16 module resolution

* Compile NodeNext except: browser-runner, cli, junit, sauce, sumologic, utils

* devtools, webdriver, webdriverio: fix cjs build

* @wdio/cli: build using module NodeNext

* @wdio/browser-runner: build using module NodeNext

* @wdio/junit-reporter: build using module NodeNext

* @wdio/sumologic-reporter: build using module NodeNext

* @wdio/sauce-service: build using module NodeNext
2023-01-02 13:18:49 +01:00
Christian Bromann
33a14731f4
have fallback for scrollIntoView if actions command fails (#9435) 2022-12-21 11:26:25 +01:00
Christian Bromann
d2be9f3529
Explicitly fail if service initialisation fails (#9365)
* explicitly fail if service initialisation fails

* update tests
2022-12-11 05:52:28 +01:00
Diazole
d5718054c0
Fix SeleniumStandalone import (#9338) (#9339) 2022-12-07 08:50:07 +01:00
Christian Bromann
20ce1f3b32
add unit tests for browser runner 2022-11-30 00:07:00 -08:00
Christian Bromann
785d0cf78c
allow to use custom commands and overwrite command before session start 2022-11-29 16:43:53 -08:00