aspect-build / rules_js

High-performance Bazel rules for running Node.js tools and building JavaScript projects
https://docs.aspect.build/rules/aspect_rules_js
Apache License 2.0
309 stars 107 forks source link

[FR]: integrate with rules_webtesting / selenium / webdriver #1823

Open malt3 opened 5 months ago

malt3 commented 5 months ago

What is the current behavior?

There is no documented way on how to write js tests that perform browser testing using selenium and others. In Bazel, we already have rules_webtesting that takes care of setting up browsers and it integrates with Java, Scala, Python and Go. There seems to be no easy way to do webtesting with rules_js right now.

Describe the feature

You could use wrap_web_test_suite to get a js_test that has access to browsers for testing.

matthewjh commented 5 months ago

We have rules_js working with rules_webtesting. It is easy to use and the approach is almost exactly the same as under rules_nodejs. You can see an example with rules_nodejs here:

https://github.com/bazelbuild/rules_nodejs/blob/4.6.0/examples/angular/tools/karma.bzl

I agree there should be an example integration of rules_webtesting and rules_js though in the aspect bazel-examples repo. I imagine one reason for its absence is that rules_webtesting is barely maintained anymore. However, in my view this is misguided as there is really no alternative for managing browser binaries through Bazel and, in any case, it works just fine.

Aghassi commented 5 months ago

We use playwright directly through rules_js since it provides a test target via the exported bin. Then we have been modifying that on our own to support our needs. Just as an annecdote.