Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(@wdio/browser-runner): move assertions to Node.js environment #12005

Merged
merged 12 commits into from Jan 16, 2024

Conversation

christian-bromann
Copy link
Member

@christian-bromann christian-bromann commented Jan 15, 2024

Proposed changes

Currently we execute the expect-webdriverio library within the browser environment. However this has some drawbacks:

  • it adds some load weight as all matcher files need to be loaded
  • most importantly: it limits our capabilities for matchers as they have to support browser environments

In order to enable visual snapshot tests and DOM snapshot comparisons, we have to move out the assertion execution into the Node.js environment.

This patch makes the following changes:

  • removes additional web socket server in favor for using Vite's HMR socket
  • mocks out expect-webdriverio in the browser completely with fake matcher that redirect execution to the worker
  • partial rewrite of the communication logic between browser and worker process
  • support for custom command registration in Node.js

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Further comments

n/a

Reviewers: @webdriverio/project-committers

@christian-bromann christian-bromann marked this pull request as ready for review January 16, 2024 08:47
@christian-bromann christian-bromann merged commit 8f6766a into main Jan 16, 2024
8 checks passed
@christian-bromann christian-bromann deleted the cb/node-assertions branch January 16, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: New Feature 🚀 PRs that contain new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant