Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ on:
required: false
type: string
default: ''
nodejs-version:
description: Custom NodeJS version to use
required: false
type: string
default: ''
python-version:
description: Custom Python version to use
required: false
Expand Down Expand Up @@ -89,18 +94,21 @@ jobs:
if: contains(github.ref, 'renovate/')
run: git pull origin ${{ github.ref }}
- name: Free space
if: inputs.os != 'windows'
if: ${{ !startsWith(inputs.os, 'windows') }}
run: ./scripts/github-actions/free-disk-space.sh
- name: Remove driver directories Windows
if: inputs.os == 'windows'
if: startsWith(inputs.os, 'windows')
run: |
rm "$env:ChromeWebDriver" -r -v
rm "$env:EdgeWebDriver" -r -v
rm "$env:GeckoWebDriver" -r -v
- name: Remove driver directories Non-Windows
if: inputs.os != 'windows'
if: ${{ !startsWith(inputs.os, 'windows') }}
run: |
sudo rm -rf "$CHROMEWEBDRIVER" "$EDGEWEBDRIVER" "$GECKOWEBDRIVER"
- name: Set NodeJS version
if: inputs.nodejs-version != ''
run: echo '${{ inputs.nodejs-version }}' > javascript/selenium-webdriver/.nvmrc
- name: Set Python version
if: inputs.python-version != ''
run: echo '${{ inputs.python-version }}' > py/.python-version
Expand Down Expand Up @@ -172,10 +180,10 @@ jobs:
fluxbox -display :99 &
echo "DISPLAY=:99" >> "$GITHUB_ENV"
- name: Set resolution
if: inputs.os == 'windows' && inputs.browser != ''
if: startsWith(inputs.os, 'windows') && inputs.browser != ''
run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
- name: Disable 8dot3 short names
if: inputs.os == 'windows'
if: startsWith(inputs.os, 'windows')
run: fsutil 8dot3name set 0
- name: Setup Safari
if: inputs.browser == 'safari'
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/ci-javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CI - JavaScript

on:
workflow_call:
inputs:
targets:
required: false
type: string
default: ''
run-full-suite:
required: false
type: boolean
default: true
workflow_dispatch:

permissions:
contents: read

jobs:
unit-tests:
name: Unit Tests
if: ${{ github.event_name == 'workflow_dispatch' || inputs.run-full-suite }}
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
matrix:
nodejs-version: ['20.19.5', '24.11.1']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not 22 instead of 20?

Copy link
Member Author

@titusfortner titusfortner Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because 20 doesn't EOL until April, and we say we still support it.
We want to test the newest and oldest to make sure nothing is broken in either.
I'd use 25 instead of 24 if the current version of bazel rules supported it.
In May we switch to 22 and 26

os: [macos, windows]
with:
name: Unit Tests (node ${{ matrix.node-version }}, ${{ matrix.os }})
os: ${{ matrix.os }}
node-version: ${{ matrix.node-version }}
run: >
bazel test
--keep_going
--build_tests_only
--test_size_filters=small
//javascript/selenium-webdriver/...

filter-targets:
name: Filter Targets
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.filter.outputs.targets }}
steps:
- name: Filter JavaScript targets
id: filter
shell: bash
run: |
targets="${{ inputs.targets }}"
filtered=()

for t in $targets; do
[[ "$t" == //javascript/selenium-webdriver* ]] && filtered+=("$t")
done

if [ ${#filtered[@]} -eq 0 ]; then
echo "targets=//javascript/selenium-webdriver/..." >> "$GITHUB_OUTPUT"
else
echo "targets=${filtered[*]}" >> "$GITHUB_OUTPUT"
fi

browser-tests:
name: Browser Tests
needs: filter-targets
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
matrix:
browser: [chrome, firefox, chrome-bidi, firefox-bidi]
os: [windows-2022]
with:
name: Browser Tests (${{ matrix.browser }}, ${{ matrix.os }})
os: ${{ matrix.os }}
browser: ${{ matrix.browser }}
run: >
bazel test
--keep_going
--build_tests_only
--flaky_test_attempts 3
--local_test_jobs 1
--test_size_filters=large
--test_tag_filters=${{ matrix.browser }}
--pin_browsers=false
--test_env=SE_FORCE_BROWSER_DOWNLOAD=true
--test_env=SE_SKIP_DRIVER_IN_PATH=true
${{ needs.filter-targets.outputs.targets }}
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,23 @@ jobs:
contains(needs.check.outputs.targets, '//rust') ||
contains(join(github.event.commits.*.message), '[rust]') ||
contains(github.event.pull_request.title, '[rust]')

javascript:
name: JavaScript
needs: check
uses: ./.github/workflows/ci-javascript.yml
with:
targets: ${{ needs.check.outputs.targets }}
run-full-suite: >-
${{
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'workflow_call' ||
contains(github.event.pull_request.title, '[js]')
}}
if: >
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'workflow_call' ||
contains(needs.check.outputs.targets, '//javascript/selenium-webdriver/') ||
contains(github.event.pull_request.title, '[js]')
9 changes: 7 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bazel_dep(name = "rules_dotnet", version = "0.20.5")
bazel_dep(name = "rules_java", version = "8.7.1")
bazel_dep(name = "rules_jvm_external", version = "6.8")
bazel_dep(name = "rules_multitool", version = "1.3.0")
bazel_dep(name = "rules_nodejs", version = "6.3.2")
bazel_dep(name = "rules_nodejs", version = "6.6.2")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_python", version = "1.7.0")
bazel_dep(name = "rules_proto", version = "7.0.2")
Expand Down Expand Up @@ -50,7 +50,12 @@ linter.configure(
linter.register(name = "rust-rustfmt")

node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
node.toolchain(node_version = "20.9.0")
node.toolchain(
node_version_from_nvmrc = "//javascript/selenium-webdriver:.nvmrc",
)
use_repo(node, "nodejs_toolchains")

register_toolchains("@nodejs_toolchains//:all")

pnpm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
Expand Down
32 changes: 16 additions & 16 deletions javascript/private/browsers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ BROWSERS = {
"@linux_chrome//:chrome-js",
"@linux_chromedriver//:chromedriver-js",
],
# "@selenium//common:use_pinned_macos_chrome": [
# "@mac_chrome//:chrome-js",
# "@mac_chromedriver//:chromedriver-js",
# ],
"@selenium//common:use_pinned_macos_chrome": [
"@mac_chrome//:chrome-js",
"@mac_chromedriver//:chromedriver-js",
],
"//conditions:default": [],
}),
"env": select({
"@selenium//common:use_pinned_linux_chrome": {
"SE_CHROMEDRIVER": "linux_chromedriver/chromedriver",
"SE_CHROME": "linux_chrome/chrome-linux64/chrome",
},
# "@selenium//common:use_pinned_macos_chrome": {
# "SE_CHROMEDRIVER": "mac_chromedriver/chromedriver",
# "SE_CHROME": "mac_chrome/Chrome.app)/Contents/MacOS/Chrome",
# },
"@selenium//common:use_pinned_macos_chrome": {
"SE_CHROMEDRIVER": "mac_chromedriver/chromedriver",
"SE_CHROME": "mac_chrome/Chrome.app/Contents/MacOS/Chrome",
},
"//conditions:default": {},
}),
},
Expand All @@ -34,21 +34,21 @@ BROWSERS = {
"@linux_geckodriver//:geckodriver-js",
"@linux_firefox//:firefox-js",
],
# "@selenium//common:use_pinned_macos_firefox": [
# "@mac_geckodriver//:geckodriver-js",
# "@mac_firefox//:firefox-js",
# ],
"@selenium//common:use_pinned_macos_firefox": [
"@mac_geckodriver//:geckodriver-js",
"@mac_firefox//:firefox-js",
],
"//conditions:default": [],
}),
"env": select({
"@selenium//common:use_pinned_linux_firefox": {
"SE_GECKODRIVER": "linux_geckodriver/geckodriver",
"SE_FIREFOX": "linux_firefox/firefox/firefox",
},
# "@selenium//common:use_pinned_macos_firefox": {
# "SE_GECKODRIVER": "mac_geckodriver/geckodriver",
# "SE_FIREFOX": "mac_firefox/Firefox.app/Contents/MacOS/firefox",
# },
"@selenium//common:use_pinned_macos_firefox": {
"SE_GECKODRIVER": "mac_geckodriver/geckodriver",
"SE_FIREFOX": "mac_firefox/Firefox.app/Contents/MacOS/firefox",
},
"//conditions:default": {},
}),
},
Expand Down
1 change: 1 addition & 0 deletions javascript/selenium-webdriver/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.11.1
31 changes: 28 additions & 3 deletions javascript/selenium-webdriver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,30 @@ LARGE_TESTS = glob(
exclude = SMALL_TESTS,
)

CHROME_SPECIFIC = glob(["test/chrome/**/*_test.js"])

EDGE_SPECIFIC = glob(["test/edge/**/*_test.js"])

FIREFOX_SPECIFIC = glob(["test/firefox/**/*_test.js"])

IE_SPECIFIC = glob(["test/ie/**/*_test.js"])

SAFARI_SPECIFIC = glob(["test/safari_test.js"])

COMMON_TESTS = glob(
LARGE_TESTS,
exclude = CHROME_SPECIFIC +
EDGE_SPECIFIC +
FIREFOX_SPECIFIC +
IE_SPECIFIC +
SAFARI_SPECIFIC,
)

BROWSER_TESTS = {
"chrome": COMMON_TESTS + CHROME_SPECIFIC,
"firefox": COMMON_TESTS + FIREFOX_SPECIFIC,
}

js_library(
name = "small-test-srcs",
srcs = SMALL_TESTS,
Expand Down Expand Up @@ -178,16 +202,17 @@ mocha_test(
env = {
"SELENIUM_BROWSER": browser,
} | BROWSERS[browser]["env"],
tags = [
browser,
tags = (
["%s-bidi" % browser] if test.startswith("test/bidi/") else [browser]
) + [
"browser-test",
"no-sandbox",
"requires-network",
],
),
]
for test in LARGE_TESTS
for browser in BROWSERS.keys()
for test in BROWSER_TESTS[browser]
]

# npm_package does not pick up filegroup sources.
Expand Down
Loading