diff --git a/.bazelrc b/.bazelrc index c142e913463df..4c9ebcfd307a6 100644 --- a/.bazelrc +++ b/.bazelrc @@ -90,6 +90,7 @@ test --test_env=JRUBY_OPTS="--dev" # Expose necessary variables for Selenium-Manager. +test:windows --test_env=PATH test:windows --test_env=LOCALAPPDATA test:windows --test_env=PROGRAMFILES="C:\\Program Files" test:windows --test_env=PROGRAMFILES(X86)="C:\\Program Files (x86)" @@ -101,7 +102,6 @@ test:ruby_debug --test_output=streamed --test_env=RUBY_DEBUG_FORK_MODE=parent -- build:release --config=remote build:release --stamp -build:release --remote_download_outputs=toplevel # RBE import %workspace%/.bazelrc.remote diff --git a/.bazelrc.remote b/.bazelrc.remote index 075c9efafbcdf..db858bbfaf1f5 100644 --- a/.bazelrc.remote +++ b/.bazelrc.remote @@ -7,9 +7,6 @@ build:remote --remote_cache=grpcs://gypsum.cluster.engflow.com # The number of cores available build:remote -j 50 -# Build Without The Bytes -build:remote --remote_download_minimal - build:remote --define=EXECUTOR=remote build:remote --experimental_inmemory_dotd_files build:remote --experimental_inmemory_jdeps_files @@ -64,6 +61,7 @@ test:remote --test_timeout=600 build:remote-ci --config=remote build:remote-ci --curses=no --color=yes --show_timestamps --show_progress_rate_limit=5 build:remote-ci --bes_upload_mode=wait_for_upload_complete +build:remote-ci --remote_download_minimal # Configuration changes suggested by EngFlow build:remote --grpc_keepalive_time=30s diff --git a/.bazelversion b/.bazelversion index 21c8c7b46b899..0ee843cc60466 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.1.1 +7.2.0 diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index aca34a0191f00..0000000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,56 +0,0 @@ -version: 2 -updates: - - package-ecosystem: github-actions - directory: "/" - schedule: - interval: daily - time: '08:00' - open-pull-requests-limit: 0 - labels: - - "C-build" - - "dependencies" - - package-ecosystem: "npm" - directory: "/" - schedule: - interval: daily - time: '08:00' - open-pull-requests-limit: 0 - labels: - - "C-nodejs" - - "dependencies" - - package-ecosystem: "bundler" - directory: "/" - schedule: - interval: daily - time: '08:00' - open-pull-requests-limit: 0 - labels: - - "C-rb" - - "dependencies" - - package-ecosystem: "cargo" - directory: "/rust" - schedule: - interval: daily - time: '08:00' - open-pull-requests-limit: 0 - labels: - - "C-rust" - - "dependencies" - - package-ecosystem: "pip" - directory: "/py" - schedule: - interval: daily - time: '08:00' - open-pull-requests-limit: 0 - labels: - - "C-py" - - "dependencies" - - package-ecosystem: "nuget" - directory: "/dotnet" - schedule: - interval: daily - time: '08:00' - open-pull-requests-limit: 0 - labels: - - "C-dotnet" - - "dependencies" diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index 2c6a5a43381a4..41a100327c9db 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -116,7 +116,7 @@ jobs: node-version: ${{ inputs.node-version }} - name: Setup Bazel with caching if: inputs.caching - uses: bazel-contrib/setup-bazel@0.8.1 + uses: bazel-contrib/setup-bazel@0.8.5 with: bazelisk-cache: true bazelrc: common --color=yes @@ -130,7 +130,7 @@ jobs: repository-cache: true - name: Setup Bazel without caching if: inputs.caching == false - uses: bazel-contrib/setup-bazel@0.8.1 + uses: bazel-contrib/setup-bazel@0.8.5 with: bazelrc: common --color=yes - name: Setup Fluxbox and Xvfb @@ -143,22 +143,6 @@ jobs: - name: Set resolution if: inputs.os == 'windows' && inputs.browser != '' run: Set-DisplayResolution -Width 1920 -Height 1080 -Force - - name: Setup Chrome - if: inputs.browser == 'chrome' - uses: browser-actions/setup-chrome@latest - with: - chrome-version: ${{ inputs.browser-version || 'stable' }} - - name: Setup Firefox - if: inputs.browser == 'firefox' - uses: abhi1693/setup-browser@v0.3.5 - with: - browser: firefox - version: ${{ inputs.browser-version || 'latest' }} - - name: Setup Edge - if: inputs.browser == 'edge' - uses: browser-actions/setup-edge@latest - with: - edge-version: ${{ inputs.browser-version || 'stable' }} - name: Setup Safari if: inputs.browser == 'safari' run: sudo safaridriver --enable diff --git a/.github/workflows/ci-javascript.yml b/.github/workflows/ci-javascript.yml index 94b1f4777bb02..38f61cd0911cf 100644 --- a/.github/workflows/ci-javascript.yml +++ b/.github/workflows/ci-javascript.yml @@ -13,18 +13,9 @@ jobs: cache-key: javascript-build run: bazel build //javascript/node/selenium-webdriver:selenium-webdriver - small-tests: - name: Small Tests - needs: build - uses: ./.github/workflows/bazel.yml - with: - name: Small Tests - cache-key: javascript-small-tests - run: bazel test //javascript/node/selenium-webdriver:small-tests - browser-tests: name: Browser Tests - needs: small-tests + needs: build uses: ./.github/workflows/bazel.yml strategy: fail-fast: false @@ -40,4 +31,5 @@ jobs: bazel test --flaky_test_attempts 3 --test_tag_filters ${{ matrix.browser }} + --local_test_jobs 1 //javascript/node/... diff --git a/.github/workflows/ci-ruby.yml b/.github/workflows/ci-ruby.yml index 653034f947f45..79f941a23485b 100644 --- a/.github/workflows/ci-ruby.yml +++ b/.github/workflows/ci-ruby.yml @@ -73,7 +73,6 @@ jobs: - chrome - edge - firefox - - safari os: - ubuntu - windows @@ -83,10 +82,6 @@ jobs: os: ubuntu - browser: edge os: macos - - browser: safari - os: ubuntu - - browser: safari - os: windows with: name: Local Tests (${{ matrix.browser }}, ${{ matrix.os }}) browser: ${{ matrix.browser }} @@ -99,6 +94,7 @@ jobs: --local_test_jobs 1 --test_size_filters large --test_tag_filters ${{ matrix.browser }} + ${{ matrix.os != 'windows' && '--pin_browsers=true' || '' }} //rb/spec/... integration-tests-remote: @@ -115,8 +111,6 @@ jobs: os: ubuntu - browser: firefox os: ubuntu - - browser: safari - os: macos with: name: Remote Tests (${{ matrix.browser }}, ${{ matrix.os }}) browser: ${{ matrix.browser }} @@ -130,4 +124,5 @@ jobs: --local_test_jobs 1 --test_size_filters large --test_tag_filters ${{ matrix.browser }}-remote + ${{ matrix.os != 'windows' && '--pin_browsers=true' || '' }} //rb/spec/... diff --git a/.github/workflows/ci-rust.yml b/.github/workflows/ci-rust.yml index b23f74c55da3b..6b165b69cc05f 100644 --- a/.github/workflows/ci-rust.yml +++ b/.github/workflows/ci-rust.yml @@ -40,7 +40,7 @@ jobs: name: Tests (${{ matrix.os }}) cache-key: rust-test os: ${{ matrix.os }} - run: bazel test --test_env=RUST_BACKTRACE=1 --flaky_test_attempts=3 //rust/... + run: bazel test --test_env=RUST_BACKTRACE=full --test_env=RUST_TEST_NOCAPTURE=1 --flaky_test_attempts=3 //rust/... windows-stable: name: "Windows Stable" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b045ac440e1b5..2df302b754c39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: with: fetch-depth: 50 - name: Setup Bazel - uses: bazel-contrib/setup-bazel@0.8.1 + uses: bazel-contrib/setup-bazel@0.8.5 with: bazelisk-cache: true cache-version: 2 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 15a70b9665b94..eeea269c87f62 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -37,8 +37,24 @@ jobs: cache-key: rb-nightly-${{ matrix.gem }} run: | export GEM_HOST_API_KEY="Bearer $GITHUB_TOKEN" - bazel run //rb:${{ matrix.gem }}-bump-nightly-version ${{ inputs.version }} - bazel run //rb:${{ matrix.gem }}-release-nightly + ./go rb:release[nightly] + on-ruby-failure: + name: On Ruby Failure + runs-on: ubuntu-latest + if: ${{ always() && (needs.ruby.result == 'failure' || needs.ruby.result == 'timed_out') }} + needs: ruby + steps: + - uses: actions/checkout@v4 + - name: Slack Notification + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_ICON_EMOJI: ":rotating_light:" + SLACK_COLOR: ${{ needs.ruby.status }} + SLACK_CHANNEL: selenium-tlc + SLACK_USERNAME: GitHub Workflows + SLACK_TITLE: Nightly Ruby ${{ needs.ruby.result }} + MSG_MINIMAL: actions url + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} python: if: (github.repository_owner == 'seleniumhq') && (inputs.language == 'python' || github.event_name == 'schedule') @@ -47,13 +63,25 @@ jobs: with: name: Nightly Python Release cache-key: python-nightly - run: | - ./go "py:version[nightly]" - ./go py:build - pip install twine - twine upload --repository testpypi bazel-bin/py/selenium-4*.whl bazel-bin/py/selenium-4*.tar.gz + run: ./go py:release[nightly] secrets: inherit - + on-python-failure: + name: On Python Failure + runs-on: ubuntu-latest + if: ${{ always() && (needs.python.result == 'failure' || needs.python.result == 'timed_out') }} + needs: python + steps: + - uses: actions/checkout@v4 + - name: Slack Notification + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_ICON_EMOJI: ":rotating_light:" + SLACK_COLOR: ${{ needs.python.status }} + SLACK_CHANNEL: selenium-tlc + SLACK_USERNAME: GitHub Workflows + SLACK_TITLE: Nightly Python ${{ needs.python.result }} + MSG_MINIMAL: actions url + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} java: if: (github.repository_owner == 'seleniumhq') && (inputs.language == 'java' || github.event_name == 'schedule') @@ -62,9 +90,25 @@ jobs: with: name: Nightly Java Release cache-key: java-nightly - run: | - ./go publish-maven-snapshot + run: ./go java:release[nightly] secrets: inherit + on-java-failure: + name: On Java Failure + runs-on: ubuntu-latest + if: ${{ always() && (needs.java.result == 'failure' || needs.java.result == 'timed_out') }} + needs: java + steps: + - uses: actions/checkout@v4 + - name: Slack Notification + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_ICON_EMOJI: ":rotating_light:" + SLACK_COLOR: ${{ needs.java.status }} + SLACK_CHANNEL: selenium-tlc + SLACK_USERNAME: GitHub Workflows + SLACK_TITLE: Nightly Java ${{ needs.java.result }} + MSG_MINIMAL: actions url + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} dotnet: if: (github.repository_owner == 'seleniumhq') && (inputs.language == 'dotnet' || github.event_name == 'schedule') @@ -74,10 +118,25 @@ jobs: name: Nightly DotNet Release cache-key: dotnet-nightly dotnet-version: '6.x' - run: | - ./go "dotnet:version[nightly]" - ./go dotnet:release + run: ./go dotnet:release[--stamp,nightly] secrets: inherit + on-dotnet-failure: + name: On .NET Failure + runs-on: ubuntu-latest + if: ${{ always() && (needs.dotnet.result == 'failure' || needs.dotnet.result == 'timed_out') }} + needs: dotnet + steps: + - uses: actions/checkout@v4 + - name: Slack Notification + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_ICON_EMOJI: ":rotating_light:" + SLACK_COLOR: ${{ needs.dotnet.status }} + SLACK_CHANNEL: selenium-tlc + SLACK_USERNAME: GitHub Workflows + SLACK_TITLE: Nightly .NET ${{ needs.dotnet.result }} + MSG_MINIMAL: actions url + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} grid: if: (github.repository_owner == 'seleniumhq') && (inputs.language == 'grid' || github.event_name == 'schedule') @@ -86,10 +145,25 @@ jobs: with: name: Nightly Grid Release cache-key: grid-nightly - run: | - echo build --stamp >>.bazelrc.local - ./go java-release-zip + run: ./go java:package[--config=release] nightly-release-files: build/dist/*.* + on-grid-failure: + name: On Grid Failure + runs-on: ubuntu-latest + if: ${{ always() && (needs.grid.result == 'failure' || needs.grid.result == 'timed_out') }} + needs: grid + steps: + - uses: actions/checkout@v4 + - name: Slack Notification + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_ICON_EMOJI: ":rotating_light:" + SLACK_COLOR: ${{ needs.grid.status }} + SLACK_CHANNEL: selenium-tlc + SLACK_USERNAME: GitHub Workflows + SLACK_TITLE: Nightly Grid ${{ needs.grid.result }} + MSG_MINIMAL: actions url + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} javascript: if: (github.repository_owner == 'seleniumhq') && (inputs.language == 'javascript' || github.event_name == 'schedule') @@ -102,9 +176,25 @@ jobs: run: | sed -i 's|https://registry.npmjs.org/|https://npm.pkg.github.com|g' javascript/node/selenium-webdriver/package.json sed -i 's|"name": "selenium-webdriver"|"name": "@seleniumhq/selenium-webdriver"|g' javascript/node/selenium-webdriver/package.json - echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc - echo "@seleniumhq:registry=https://npm.pkg.github.com" >> .npmrc - echo "always-auth=true" >> .npmrc - ./go "node:version[nightly]" - ./go node:release + echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc + echo "@seleniumhq:registry=https://npm.pkg.github.com" >> ~/.npmrc + echo "always-auth=true" >> ~/.npmrc + ./go node:release[--stamp,nightly] secrets: inherit + on-javascript-failure: + name: On JavaScript Failure + runs-on: ubuntu-latest + if: ${{ always() && (needs.javascript.result == 'failure' || needs.javascript.result == 'timed_out') }} + needs: javascript + steps: + - uses: actions/checkout@v4 + - name: Slack Notification + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_ICON_EMOJI: ":rotating_light:" + SLACK_COLOR: ${{ needs.javascript.status }} + SLACK_CHANNEL: selenium-tlc + SLACK_USERNAME: GitHub Workflows + SLACK_TITLE: Nightly JavaScript ${{ needs.javascript.result }} + MSG_MINIMAL: actions url + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 94ed4483ae4da..42d6a0e0c0f31 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -68,7 +68,7 @@ jobs: fetch-tags: true ref: release-${{ github.event.inputs.version }} - name: Install Ruby - uses: ruby/setup-ruby@5f19ec79cedfadb78ab837f95b87734d0003c899 + uses: ruby/setup-ruby@v1 with: ruby-version: '3.1' working-directory: 'rb' @@ -80,10 +80,10 @@ jobs: run: git reset HEAD~1 - name: Update everything including early release CDP if: ${{ github.event.inputs.chrome_channel == 'early-stable' }} - run: ./go all:prepare['Beta'] + run: ./go all:prepare[${{ github.event.inputs.version }},Beta] - name: Update everything including released CDP if: ${{ github.event.inputs.chrome_channel == 'stable' }} - run: ./go "all:prepare[Stable]" + run: ./go "all:prepare[${{ github.event.inputs.version }},Stable]" - name: Create Pull Request uses: peter-evans/create-pull-request@v6 with: @@ -91,6 +91,7 @@ jobs: author: Selenium CI Bot delete-branch: true branch: release-preparation-${{ github.event.inputs.version }} + base: trunk title: "[build] Prepare for release of Selenium ${{ github.event.inputs.version }}" body: | **Warning: Manually update the changelogs before merging** diff --git a/.github/workflows/stage-release.yml b/.github/workflows/stage-release.yml new file mode 100644 index 0000000000000..ee722d1773eb5 --- /dev/null +++ b/.github/workflows/stage-release.yml @@ -0,0 +1,59 @@ +name: Release Staging + +on: + pull_request: + types: [closed] + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + github-release: + if: > + github.event.pull_request.merged == true && + github.repository_owner == 'seleniumhq' && + startsWith(github.event.pull_request.head.ref, 'release-preparation-') + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Extract version from branch name + id: extract_version + run: | + BRANCH_NAME="${{ github.event.pull_request.head.ref }}" + VERSION=$(echo $BRANCH_NAME | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Prep git + run: | + git config --local user.email "selenium-ci@users.noreply.github.com" + git config --local user.name "Selenium CI Bot" + - name: Tag Release + run: | + git tag selenium-${{ env.VERSION }} + git push origin selenium-${{ env.VERSION }} + - name: Update Nightly Tag to Remove pre-release + run: | + git fetch --tags + git tag -d nightly || echo "Nightly tag not found" + git tag nightly + git push origin refs/tags/nightly --force + - name: Setup Java + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + - name: Build and Stage Packages + run: ./go all:package[--config=release] + - name: Generate Draft Release + uses: softprops/action-gh-release@v2 + with: + name: Selenium ${{ env.VERSION }} + body: | + ## Detailed Changelogs by Component + **[Java](https://github.com/SeleniumHQ/selenium/blob/trunk/java/CHANGELOG)**     |     **[Python](https://github.com/SeleniumHQ/selenium/blob/trunk/py/CHANGES)**     |     **[DotNet](https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/CHANGELOG)**     |     **[Ruby](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES)**     |     **[JavaScript](https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/node/selenium-webdriver/CHANGES.md)**     |     **[IEDriver](https://github.com/SeleniumHQ/selenium/blob/trunk/cpp/iedriverserver/CHANGELOG)** +
+ tag_name: selenium-${{ env.VERSION }} + draft: true + generate_release_notes: true + prerelease: false + files: build/dist/*.* diff --git a/.github/workflows/update-documentation.yml b/.github/workflows/update-documentation.yml new file mode 100644 index 0000000000000..02166dc7a6d34 --- /dev/null +++ b/.github/workflows/update-documentation.yml @@ -0,0 +1,85 @@ +name: Update Documentation + +on: + workflow_dispatch: + inputs: + tag: + description: Release tag (e.g. selenium-4.21.0) + required: true + type: string + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + java-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout the tag + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag }} + - name: Setup Java + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + - name: Update Documentation + run: ./go java:docs[true] + + ruby-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout the tag + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag }} + - name: Setup Java + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + - name: Update Documentation + run: ./go ruby:docs[true] + + python-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout the tag + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag }} + - name: Set up Python 3.8 + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Update Documentation + run: ./go py:docs[true] + + dotnet-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout the tag + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag }} + - name: Install specific version of DocFX tool + # Pinning to 2.75.3 to avoid breaking changes in newer versions + # See https://github.com/dotnet/docfx/issues/9855 + run: dotnet tool install --global --version 2.75.3 docfx + - name: Update Documentation + run: ./go dotnet:docs[true] + + node-docs: + runs-on: ubuntu-latest + steps: + - name: Checkout the tag + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag }} + - name: Install npm dependencies + run: | + npm install + npm install --prefix javascript/node/selenium-webdriver + - name: Update Documentation + run: ./go node:docs[true] diff --git a/.gitignore b/.gitignore index e4adb09ff4f98..d0e0fbe7d099c 100644 --- a/.gitignore +++ b/.gitignore @@ -76,6 +76,7 @@ py/selenium/webdriver/remote/isDisplayed.js py/docs/build/ py/build/ py/LICENSE +py/pytestdebug.log selenium.egg-info/ third_party/java/jetty/jetty-repacked.jar *.user diff --git a/.skipped-tests b/.skipped-tests index 674c795e2c3a0..15dc35e335372 100644 --- a/.skipped-tests +++ b/.skipped-tests @@ -27,3 +27,9 @@ -//rb/spec/integration/selenium/webdriver/firefox:service-firefox -//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta -//rb/spec/integration/selenium/webdriver:element-chrome +-//rb/spec/integration/selenium/webdriver/chrome:service-chrome-bidi +-//rb/spec/integration/selenium/webdriver/edge:service-edge-bidi +-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-bidi +-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta-bidi +-//rb/spec/integration/selenium/webdriver:element-chrome-bidi +-//rb/spec/integration/selenium/webdriver/firefox:driver-firefox-beta-bidi diff --git a/AUTHORS b/AUTHORS index 13cd94023d7d2..39da6a60b9d47 100644 --- a/AUTHORS +++ b/AUTHORS @@ -41,6 +41,7 @@ Alex Savchuk Alexander Bayandin Alexander Dobrynin Alexander Kavanaugh +Alexander Millin Alexandr Savchuk Alexandre Abreu Alexei Barantsev @@ -63,6 +64,7 @@ Andras Hatvani Andre Wiggins <459878+andrewiggins@users.noreply.github.com> Andreas Tolf Tolfsen Andreas Tolfsen +Andrei Andrei Botalov Andrei Rusu Andrei Solntsev @@ -88,6 +90,7 @@ Ashley Trinh Aslak Hellesøy asmundak Atsushi Tatsuma +Augustin Gottlieb Pequeno <33221555+aguspe@users.noreply.github.com> Aurélien Pupier Austin Michael Wilkins <42476341+amwilkins@users.noreply.github.com> BaerMitUmlaut @@ -98,6 +101,7 @@ Ben Kucera <14625260+Bkucera@users.noreply.github.com> Ben Lamm Ben Sedat Benjamin Forehand Jr +bgermann bhecquet bhkwan Bill Agee @@ -364,6 +368,7 @@ James Garbutt <43081j@users.noreply.github.com> James Hilliard James Martin James Strachen +James Yuzawa jamespdo Jan Trejbal Jan Weitz @@ -696,6 +701,7 @@ reichsta Reinaldo Rossetti Reinhold Degenfellner Remco +renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> richard.hines RichCrook richseviora diff --git a/BUILD.bazel b/BUILD.bazel index df867ec44f7e8..43f9fae6400da 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -21,6 +21,14 @@ filegroup( visibility = ["//visibility:public"], ) +filegroup( + name = "rakefile", + srcs = [ + "Rakefile", + ], + visibility = ["//rb:__subpackages__"], +) + alias( name = "grid", actual = "//java/src/org/openqa/selenium/grid:executable-grid", diff --git a/MODULE.bazel b/MODULE.bazel index 2e2041ba4c4bd..ad934d7d09e27 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,24 +1,31 @@ module(name = "selenium") bazel_dep(name = "apple_rules_lint", version = "0.3.2") -bazel_dep(name = "aspect_bazel_lib", version = "2.5.3") -bazel_dep(name = "aspect_rules_esbuild", version = "0.18.0") -bazel_dep(name = "aspect_rules_js", version = "1.41.1") -bazel_dep(name = "aspect_rules_ts", version = "2.1.0") -bazel_dep(name = "bazel_features", version = "1.9.1") -bazel_dep(name = "bazel_skylib", version = "1.5.0") +bazel_dep(name = "aspect_bazel_lib", version = "2.7.7") +bazel_dep(name = "aspect_rules_esbuild", version = "0.20.1") +bazel_dep(name = "aspect_rules_js", version = "1.42.3") +bazel_dep(name = "aspect_rules_ts", version = "2.4.2") +bazel_dep(name = "bazel_features", version = "1.13.0") +bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "buildifier_prebuilt", version = "6.4.0") -bazel_dep(name = "contrib_rules_jvm", version = "0.24.0") -bazel_dep(name = "platforms", version = "0.0.8") -bazel_dep(name = "rules_dotnet", version = "0.14.0") -bazel_dep(name = "rules_java", version = "7.4.0") +bazel_dep(name = "contrib_rules_jvm", version = "0.27.0") +bazel_dep(name = "platforms", version = "0.0.10") + +# Required for the closure rules +bazel_dep(name = "protobuf", version = "21.7", dev_dependency = True, repo_name = "com_google_protobuf") + +# Required for rules_rust to import the crates properly +bazel_dep(name = "rules_cc", version = "0.0.9", dev_dependency = True) + +bazel_dep(name = "rules_dotnet", version = "0.15.1") +bazel_dep(name = "rules_java", version = "7.6.3") bazel_dep(name = "rules_jvm_external", version = "6.1") -bazel_dep(name = "rules_nodejs", version = "6.0.5") -bazel_dep(name = "rules_oci", version = "1.0.0") -bazel_dep(name = "rules_pkg", version = "0.9.1") -bazel_dep(name = "rules_python", version = "0.31.0") -bazel_dep(name = "rules_proto", version = "5.3.0-21.7") -bazel_dep(name = "rules_ruby", version = "0.8.1") +bazel_dep(name = "rules_nodejs", version = "6.2.0") +bazel_dep(name = "rules_oci", version = "1.7.6") +bazel_dep(name = "rules_pkg", version = "0.10.1") +bazel_dep(name = "rules_python", version = "0.33.0") +bazel_dep(name = "rules_proto", version = "6.0.0") +bazel_dep(name = "rules_ruby", version = "0.11.0") linter = use_extension("@apple_rules_lint//lint:extensions.bzl", "linter") linter.configure( @@ -155,11 +162,11 @@ maven.install( name = "maven", artifacts = [ "com.beust:jcommander:1.82", - "com.github.javaparser:javaparser-core:3.25.10", - "com.github.spotbugs:spotbugs:4.8.5", + "com.github.javaparser:javaparser-core:3.26.0", + "com.github.spotbugs:spotbugs:4.8.6", "com.github.stephenc.jcip:jcip-annotations:1.0-1", - "com.google.code.gson:gson:2.10.1", - "com.google.guava:guava:33.2.0-jre", + "com.google.code.gson:gson:2.11.0", + "com.google.guava:guava:33.2.1-jre", "com.google.auto:auto-common:1.2.2", "com.google.auto.service:auto-service:1.1.1", "com.google.auto.service:auto-service-annotations:1.1.1", @@ -169,33 +176,33 @@ maven.install( "dev.failsafe:failsafe:3.3.2", "io.grpc:grpc-context:1.64.0", "io.lettuce:lettuce-core:6.3.2.RELEASE", - "io.netty:netty-buffer:4.1.109.Final", - "io.netty:netty-codec-http:4.1.109.Final", - "io.netty:netty-codec-http2:4.1.109.Final", - "io.netty:netty-common:4.1.109.Final", - "io.netty:netty-handler:4.1.109.Final", - "io.netty:netty-handler-proxy:4.1.109.Final", - "io.netty:netty-transport:4.1.109.Final", - "io.opentelemetry:opentelemetry-api:1.38.0", - "io.opentelemetry:opentelemetry-context:1.38.0", - "io.opentelemetry:opentelemetry-exporter-logging:1.38.0", - "io.opentelemetry:opentelemetry-sdk:1.38.0", - "io.opentelemetry:opentelemetry-sdk-common:1.38.0", - "io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:1.38.0", - "io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi:1.38.0", - "io.opentelemetry:opentelemetry-sdk-testing:1.38.0", - "io.opentelemetry:opentelemetry-sdk-trace:1.38.0", + "io.netty:netty-buffer:4.1.111.Final", + "io.netty:netty-codec-http:4.1.111.Final", + "io.netty:netty-codec-http2:4.1.111.Final", + "io.netty:netty-common:4.1.111.Final", + "io.netty:netty-handler:4.1.111.Final", + "io.netty:netty-handler-proxy:4.1.111.Final", + "io.netty:netty-transport:4.1.111.Final", + "io.opentelemetry:opentelemetry-api:1.39.0", + "io.opentelemetry:opentelemetry-context:1.39.0", + "io.opentelemetry:opentelemetry-exporter-logging:1.39.0", + "io.opentelemetry:opentelemetry-sdk:1.39.0", + "io.opentelemetry:opentelemetry-sdk-common:1.39.0", + "io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:1.39.0", + "io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi:1.39.0", + "io.opentelemetry:opentelemetry-sdk-testing:1.39.0", + "io.opentelemetry:opentelemetry-sdk-trace:1.39.0", "io.opentelemetry.semconv:opentelemetry-semconv:1.25.0-alpha", "io.ous:jtoml:2.0.0", "it.ozimov:embedded-redis:0.7.3", - "net.bytebuddy:byte-buddy:1.14.15", - "org.htmlunit:htmlunit-core-js:4.1.0", + "net.bytebuddy:byte-buddy:1.14.17", + "org.htmlunit:htmlunit-core-js:4.2.0", "org.apache.commons:commons-exec:1.4.0", "org.apache.logging.log4j:log4j-core:2.23.1", - "org.assertj:assertj-core:3.25.3", + "org.assertj:assertj-core:3.26.0", "org.bouncycastle:bcpkix-jdk18on:1.78.1", "org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5", - "org.hsqldb:hsqldb:2.7.2", + "org.hsqldb:hsqldb:2.7.3", "org.junit.jupiter:junit-jupiter-api:5.10.2", "org.junit.jupiter:junit-jupiter-engine:5.10.2", "org.junit.jupiter:junit-jupiter-params:5.10.2", @@ -204,7 +211,7 @@ maven.install( "org.junit.platform:junit-platform-commons:1.10.2", "org.junit.platform:junit-platform-engine:1.10.2", "org.mockito:mockito-core:5.12.0", - "org.redisson:redisson:3.30.0", + "org.redisson:redisson:3.31.0", "org.slf4j:slf4j-api:2.0.13", "org.slf4j:slf4j-jdk14:2.0.13", "org.zeromq:jeromq:0.6.0", diff --git a/Rakefile b/Rakefile index eca0b215c5eeb..177e78f97279a 100644 --- a/Rakefile +++ b/Rakefile @@ -11,8 +11,6 @@ require 'open-uri' require 'git' require 'find' -include Rake::DSL - Rake.application.instance_variable_set(:@name, 'go') orig_verbose = verbose verbose(false) @@ -100,7 +98,7 @@ JAVA_RELEASE_TARGETS = %w[ //java/src/org/openqa/selenium/chrome:chrome.publish //java/src/org/openqa/selenium/chromium:chromium.publish //java/src/org/openqa/selenium/devtools/v125:v125.publish - //java/src/org/openqa/selenium/devtools/v123:v123.publish + //java/src/org/openqa/selenium/devtools/v126:v126.publish //java/src/org/openqa/selenium/devtools/v124:v124.publish //java/src/org/openqa/selenium/devtools/v85:v85.publish //java/src/org/openqa/selenium/edge:edge.publish @@ -271,16 +269,13 @@ ie_generator.generate_type_mapping( desc 'Generate Javadocs' task javadocs: %i[//java/src/org/openqa/selenium/grid:all-javadocs] do - rm_rf 'build/docs/api/java' - mkdir_p 'build/docs/api/java' - + FileUtils.rm_rf('build/docs/api/java') + FileUtils.mkdir_p('build/docs/api/java') out = 'bazel-bin/java/src/org/openqa/selenium/grid/all-javadocs.jar' cmd = %(cd build/docs/api/java && jar xf "../../../../#{out}" 2>&1) cmd = cmd.tr('/', '\\').tr(':', ';') if SeleniumRake::Checks.windows? - - ok = system(cmd) - ok or raise 'could not unpack javadocs' + raise 'could not unpack javadocs' unless system(cmd) File.open('build/docs/api/java/stylesheet.css', 'a') do |file| file.write(<<~STYLE @@ -332,90 +327,39 @@ task ios_driver: [ '//javascript/webdriver/atoms/fragments:get_location_in_view:ios' ] -desc 'Create zipped assets for Java for uploading to GitHub' +# This task does not allow running RBE, to run stamped with RBE use +# ./go java:package['--config=release'] +desc 'Create stamped zipped assets for Java for uploading to GitHub' task :'java-release-zip' do - Bazel.execute('build', ['--stamp'], '//java/src/org/openqa/selenium:client-zip') - Bazel.execute('build', ['--stamp'], '//java/src/org/openqa/selenium/grid:server-zip') - Bazel.execute('build', ['--stamp'], '//java/src/org/openqa/selenium/grid:executable-grid') - mkdir_p 'build/dist' - Dir.glob('build/dist/*{java,server}*').each { |file| FileUtils.rm_f(file) } - - FileUtils.copy('bazel-bin/java/src/org/openqa/selenium/grid/server-zip.zip', - "build/dist/selenium-server-#{java_version}.zip") - FileUtils.chmod(0666, "build/dist/selenium-server-#{java_version}.zip") - FileUtils.copy('bazel-bin/java/src/org/openqa/selenium/client-zip.zip', - "build/dist/selenium-java-#{java_version}.zip") - FileUtils.chmod(0666, "build/dist/selenium-java-#{java_version}.zip") - FileUtils.copy('bazel-bin/java/src/org/openqa/selenium/grid/selenium', - "build/dist/selenium-server-#{java_version}.jar") - FileUtils.chmod(0777, "build/dist/selenium-server-#{java_version}.jar") + Rake::Task['java:package'].invoke('--stamp') end task 'release-java': %i[java-release-zip publish-maven] def read_m2_user_pass - # First check env vars, then the settings.xml config inside .m2 - user = nil - pass = nil - if ENV['SEL_M2_USER'] && ENV['SEL_M2_PASS'] - puts 'Fetching m2 user and pass from environment variables.' - user = ENV['SEL_M2_USER'] - pass = ENV['SEL_M2_PASS'] - return [user, pass] - end + puts 'Maven environment variables not set, inspecting /.m2/settings.xml.' settings = File.read("#{Dir.home}/.m2/settings.xml") found_section = false settings.each_line do |line| if !found_section found_section = line.include? 'sonatype-nexus-staging' - elsif user.nil? && line.include?('') - user = line.split('')[1].split('') - pass = line.split('')[1].split('') + ENV['MAVEN_USER'] = line[%r{(.*?)}, 1] + elsif line.include?('') + ENV['MAVEN_PASSWORD'] = line[%r{(.*?)}, 1] end + break if ENV['MAVEN_PASSWORD'] && ENV['MAVEN_USER'] end - - [user, pass] end desc 'Publish all Java jars to Maven as stable release' -task 'publish-maven': JAVA_RELEASE_TARGETS do - creds = read_m2_user_pass - JAVA_RELEASE_TARGETS.each do |p| - Bazel.execute('run', - ['--stamp', - '--define', - 'maven_repo=https://oss.sonatype.org/service/local/staging/deploy/maven2', - '--define', - "maven_user=#{creds[0]}", - '--define', - "maven_password=#{creds[1]}", - '--define', - 'gpg_sign=true'], - p) - end +task 'publish-maven' do + Rake::Task['java:release'].invoke end desc 'Publish all Java jars to Maven as nightly release' -task 'publish-maven-snapshot': JAVA_RELEASE_TARGETS do - creds = read_m2_user_pass - if java_version.end_with?('-SNAPSHOT') - JAVA_RELEASE_TARGETS.each do |p| - Bazel.execute('run', - ['--stamp', - '--define', - 'maven_repo=https://oss.sonatype.org/content/repositories/snapshots', - '--define', - "maven_user=#{creds[0]}", - '--define', - "maven_password=#{creds[1]}", - '--define', - 'gpg_sign=false'], - p) - end - else - puts 'No SNAPSHOT version configured. Targets will not be pushed to the snapshot repo in SonaType.' - end +task 'publish-maven-snapshot' do + Rake::Task['java:release'].invoke('nightly') end desc 'Install jars to local m2 directory' @@ -490,73 +434,65 @@ namespace :node do end desc 'Build Node npm package' - task :build, [:args] do |_task, arguments| - args = Array(arguments[:args]) || [] + task :build do |_task, arguments| + args = arguments.to_a.compact Bazel.execute('build', args, '//javascript/node/selenium-webdriver') end task :'dry-run' do - Bazel.execute('run', ['--stamp'], '//javascript/node/selenium-webdriver:selenium-webdriver.publish -- --dry-run=true') + Bazel.execute('run', ['--stamp'], + '//javascript/node/selenium-webdriver:selenium-webdriver.publish -- --dry-run=true') end desc 'Release Node npm package' - task :release do + task :release do |_task, arguments| + args = arguments.to_a.compact + nightly = args.delete('nightly') + Rake::Task['node:version'].invoke('nightly') if nightly + Bazel.execute('run', ['--stamp'], '//javascript/node/selenium-webdriver:selenium-webdriver.publish') end desc 'Release Node npm package' task deploy: :release - desc 'Generate Node documentation — currently not working' + desc 'Generate Node documentation' task :docs, [:skip_update] do |_task, arguments| - puts "WARNING — Cannot currently update API Docs for JavaScript bindings" + FileUtils.rm_rf('build/docs/api/javascript/') + begin + sh 'npm run generate-docs --prefix javascript/node/selenium-webdriver || true', verbose: true + rescue StandardError + puts 'Ensure that npm is installed on your system' + raise + end + + unless arguments[:skip_update] + puts 'Updating JavaScript documentation' + puts update_gh_pages ? 'JavaScript Docs updated!' : 'JavaScript Doc update cancelled' + end end desc 'Update JavaScript changelog' task :changelog do header = "## #{node_version}" - update_changelog(node_version, 'javascript', 'javascript/node/selenium-webdriver/', 'javascript/node/selenium-webdriver/CHANGES.md', header) + update_changelog(node_version, 'javascript', 'javascript/node/selenium-webdriver/', + 'javascript/node/selenium-webdriver/CHANGES.md', header) end desc 'Update Node version' task :version, [:version] do |_task, arguments| - bump_nightly = arguments[:version] === 'nightly' old_version = node_version - new_version = nil - - # There are three cases we want to deal with: - # 1. Switching from a release build to a nightly one - # 2. Updating a nightly build for the next nightly build - # 3. Switching from nightlies to a release build. - - if bump_nightly && old_version.include?('-nightly') - # This is the case where we are updating a nightly build to the next nightly build. - # This change is usually done by the CI system and never committed. - # The "-nightlyYmdHM" is removed to add a new timestamp. - new_version = old_version.gsub(/\-nightly\d+$/, '') + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}" - elsif bump_nightly - # This is the case after a production release and the version number is configured - # to start doing nightly builds. - new_version = old_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}" - else - if old_version.include?('-nightly') - # From a nightly build to a release build. - new_version = old_version.gsub(/\-nightly\d+$/, '') - else - # From a release build to a nightly build. We use npm version for this. - new_version = updated_version(old_version.gsub(/\-nightly\d+$/, ''), arguments[:version]) - new_version = new_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}" - end - end + nightly = "-nightly#{Time.now.strftime('%Y%m%d%H%M')}" + new_version = updated_version(old_version, arguments[:version], nightly) ['javascript/node/selenium-webdriver/package.json', 'package-lock.json', 'javascript/node/selenium-webdriver/BUILD.bazel'].each do |file| text = File.read(file).gsub(old_version, new_version) - File.open(file, "w") { |f| f.puts text } + File.open(file, 'w') { |f| f.puts text } end - Rake::Task['node:changelog'].invoke unless new_version.include?('-nightly') || bump_nightly + Rake::Task['node:changelog'].invoke unless new_version.include?(nightly) end end @@ -567,16 +503,20 @@ def python_version end namespace :py do desc 'Build Python wheel and sdist with optional arguments' - task :build, [:args] do |_task, arguments| - args = Array(arguments[:args]) || [] + task :build do |_task, arguments| + args = arguments.to_a.compact Bazel.execute('build', args, '//py:selenium-wheel') Bazel.execute('build', args, '//py:selenium-sdist') end desc 'Release Python wheel and sdist to pypi' - task :release, [:args] do |_task, arguments| - args = Array(arguments[:args]) || ['--stamp'] - Bazel.execute('run', args, '//py:selenium-release') + task :release do |_task, arguments| + args = arguments.to_a.compact + nightly = args.delete('nightly') + Rake::Task['py:version'].invoke('nightly') if nightly + + command = nightly ? '//py:selenium-release-nightly' : '//py:selenium-release' + Bazel.execute('run', ['--stamp'], command) end desc 'generate and copy files required for local development' @@ -598,13 +538,13 @@ namespace :py do dirs.each { |dir| FileUtils.rm_rf("#{lib_path}/common/#{dir}") } Find.find(bazel_bin_path) do |path| - if File.directory?(path) && dirs.any? {|dir| path.include?("common/#{dir}")} + if File.directory?(path) && dirs.any? { |dir| path.include?("common/#{dir}") } Find.prune next end next if File.directory?(path) - target_file = File.join(lib_path, path.sub(/^#{bazel_bin_path}\//, '')) + target_file = File.join(lib_path, path.sub(%r{^#{bazel_bin_path}/}, '')) if File.exist?(target_file) puts "Removing target file: #{target_file}" FileUtils.rm(target_file) @@ -624,8 +564,8 @@ namespace :py do end unless arguments[:skip_update] - puts "Updating Python documentation" - puts update_gh_pages ? "Python Docs updated!" : "Python Doc update cancelled" + puts 'Updating Python documentation' + puts update_gh_pages ? 'Python Docs updated!' : 'Python Doc update cancelled' end end @@ -648,49 +588,26 @@ namespace :py do desc 'Update Python version' task :version, [:version] do |_task, arguments| - bump_nightly = arguments[:version] === 'nightly' old_version = python_version - new_version = nil - - # There are three cases we want to deal with: - # 1. Switching from a release build to a nightly one - # 2. Updating a nightly build for the next nightly build - # 3. Switching from nightlies to a release build. - - if bump_nightly && old_version.include?('.dev') - # This is the case where we are updating a nightly build to the next nightly build. - # This change is usually done by the CI system and never committed. - # The ".dev" is removed to have the pushed package in TestPyPi be shown as latest. - new_version = old_version.gsub(/\.dev\d+$/, '') + + ".#{Time.now.strftime("%Y%m%d%H%M")}" - elsif bump_nightly - # This is the case after a production release and the version number is configured - # to start doing nightly builds. - new_version = old_version + ".dev#{Time.now.strftime("%Y%m%d%H%M")}" - else - if old_version.include?('.dev') - new_version = old_version.gsub(/\.dev\d+$/, '') - else - new_version = updated_version(old_version.gsub(/\.dev\d+$/, ''), arguments[:version]) - new_version = new_version + ".dev#{Time.now.strftime("%Y%m%d%H%M")}" - end - end + nightly = ".dev#{Time.now.strftime('%Y%m%d%H%M')}" + new_version = updated_version(old_version, arguments[:version], nightly) ['py/setup.py', 'py/BUILD.bazel', 'py/selenium/__init__.py', 'py/selenium/webdriver/__init__.py', 'py/docs/source/conf.py'].each do |file| - text = File.read(file).gsub(old_version, new_version) - File.open(file, "w") { |f| f.puts text } + text = File.read(file).gsub(old_version, new_version) + File.open(file, 'w') { |f| f.puts text } end old_short_version = old_version.split('.')[0..1].join('.') new_short_version = new_version.split('.')[0..1].join('.') text = File.read('py/docs/source/conf.py').gsub(old_short_version, new_short_version) - File.open('py/docs/source/conf.py', "w") { |f| f.puts text } + File.open('py/docs/source/conf.py', 'w') { |f| f.puts text } - Rake::Task['py:changelog'].invoke unless new_version.include?('.dev') || bump_nightly + Rake::Task['py:changelog'].invoke unless new_version.include?(nightly) end desc 'Update Python Syntax' @@ -709,15 +626,15 @@ namespace :py do desc "Python #{browser} tests" task browser do Rake::Task['py:clean'].invoke - Bazel.execute('test', [],"//py:common-#{browser}") - Bazel.execute('test', [],"//py:test-#{browser}") + Bazel.execute('test', [], "//py:common-#{browser}") + Bazel.execute('test', [], "//py:test-#{browser}") end end - desc "Python Remote tests with Firefox" + desc 'Python Remote tests with Firefox' task :remote do Rake::Task['py:clean'].invoke - Bazel.execute('test', [],"//py:test-remote") + Bazel.execute('test', [], '//py:test-remote') end end @@ -732,8 +649,8 @@ namespace :py do desc "Python #{browser} tests" task browser do Rake::Task['py:clean'].invoke - Bazel.execute('test', %w[--test_output all],"//py:common-#{browser}") - Bazel.execute('test', %w[--test_output all],"//py:test-#{browser}") + Bazel.execute('test', %w[--test_output all], "//py:common-#{browser}") + Bazel.execute('test', %w[--test_output all], "//py:test-#{browser}") end end end @@ -746,12 +663,13 @@ def ruby_version end namespace :rb do desc 'Generate Ruby gems' - task :build, [:args] do |_task, arguments| - args = Array(arguments[:args]) || [] - webdriver = args.reject! { |item| item == 'webdriver' } - devtools = args.reject! { |item| item == 'devtools' } - Bazel.execute('build', args, '//rb:selenium-webdriver') if webdriver - Bazel.execute('build', args, '//rb:selenium-devtools') if devtools + task :build do |_task, arguments| + args = arguments.to_a.compact + webdriver = args.delete('webdriver') + devtools = args.delete('devtools') + + Bazel.execute('build', args, '//rb:selenium-webdriver') if webdriver || !devtools + Bazel.execute('build', args, '//rb:selenium-devtools') if devtools || !webdriver end desc 'Update generated Ruby files for local development' @@ -762,10 +680,17 @@ namespace :rb do end desc 'Push Ruby gems to rubygems' - task :release, [:args] do |_task, arguments| - args = Array(arguments[:args]) || ['--stamp'] - Bazel.execute('run', args, '//rb:selenium-webdriver-release') - Bazel.execute('run', args, '//rb:selenium-devtools-release') + task :release do |_task, arguments| + args = arguments.to_a.compact + nightly = args.delete('nightly') + + if nightly + Bazel.execute('run', [], '//rb:selenium-webdriver-bump-nightly-version') + Bazel.execute('run', ['--stamp'], '//rb:selenium-webdriver-release-nightly') + else + Bazel.execute('run', ['--stamp'], '//rb:selenium-webdriver-release') + Bazel.execute('run', ['--stamp'], '//rb:selenium-devtools-release') + end end desc 'Generate Ruby documentation' @@ -776,34 +701,34 @@ namespace :rb do FileUtils.cp_r('bazel-bin/rb/docs.sh.runfiles/_main/docs/api/rb/.', 'build/docs/api/rb') unless arguments[:skip_update] - puts "Updating Ruby documentation" - puts update_gh_pages ? "Ruby Docs updated!" : "Ruby Doc update cancelled" + puts 'Updating Ruby documentation' + puts update_gh_pages ? 'Ruby Docs updated!' : 'Ruby Doc update cancelled' end end desc 'Update Ruby changelog' task :changelog do - header = "#{ruby_version} (#{Time.now.strftime("%Y-%m-%d")})\n=========================" + header = "#{ruby_version} (#{Time.now.strftime('%Y-%m-%d')})\n=========================" update_changelog(ruby_version, 'rb', 'rb/lib/', 'rb/CHANGES', header) end desc 'Update Ruby version' task :version, [:version] do |_task, arguments| old_version = ruby_version - new_version = updated_version(old_version, arguments[:version]) - new_version += '.nightly' unless old_version.include?('nightly') + new_version = updated_version(old_version, arguments[:version], '.nightly') file = 'rb/lib/selenium/webdriver/version.rb' text = File.read(file).gsub(old_version, new_version) - File.open(file, "w") { |f| f.puts text } + File.open(file, 'w') { |f| f.puts text } - Rake::Task['rb:changelog'].invoke unless new_version.include?('nightly') + Rake::Task['rb:changelog'].invoke unless new_version.include?('.nightly') sh 'cd rb && bundle --version && bundle update' end desc 'Update Ruby Syntax' - task :lint do - `cd rb && bundle exec rubocop -a` + task :lint do |_task, arguments| + args = arguments.to_a.compact + Bazel.execute('run', args, '//rb:lint') end end @@ -814,40 +739,42 @@ def dotnet_version end namespace :dotnet do desc 'Build nupkg files' - task :build, [:args] do |_task, arguments| - args = Array(arguments[:args]) || [] + task :build do |_task, arguments| + args = arguments.to_a.compact Bazel.execute('build', args, '//dotnet:all') end - desc 'Create zipped assets for .NET for uploading to GitHub' - task :zip_assets, [:args] do |_task, arguments| - args = Array(arguments[:args]) || ['--stamp'] - Rake::Task['dotnet:build'].invoke(args) + desc 'Package .NET bindings into zipped assets and stage for release' + task :package do |_task, arguments| + args = arguments.to_a.compact.empty? ? ['--stamp'] : arguments.to_a.compact + Rake::Task['dotnet:build'].invoke(*args) mkdir_p 'build/dist' - FileUtils.rm_f('build/dist/*dotnet*') + FileUtils.rm_f(Dir.glob('build/dist/*dotnet*')) FileUtils.copy('bazel-bin/dotnet/release.zip', "build/dist/selenium-dotnet-#{dotnet_version}.zip") - FileUtils.chmod(0666, "build/dist/selenium-dotnet-#{dotnet_version}.zip") + FileUtils.chmod(0o666, "build/dist/selenium-dotnet-#{dotnet_version}.zip") FileUtils.copy('bazel-bin/dotnet/strongnamed.zip', "build/dist/selenium-dotnet-strongnamed-#{dotnet_version}.zip") - FileUtils.chmod(0666, "build/dist/selenium-dotnet-strongnamed-#{dotnet_version}.zip") + FileUtils.chmod(0o666, "build/dist/selenium-dotnet-strongnamed-#{dotnet_version}.zip") end desc 'Upload nupkg files to Nuget' - task :release, [:args] do |_task, arguments| - args = Array(arguments[:args]) || ['--stamp'] - Rake::Task['dotnet:build'].invoke(args) - Rake::Task['dotnet:zip_assets'].invoke(args) + task :release do |_task, arguments| + args = arguments.to_a.compact + nightly = args.delete('nightly') + Rake::Task['dotnet:version'].invoke('nightly') if nightly + Rake::Task['dotnet:package'].invoke('--stamp') - release_version = dotnet_version api_key = ENV.fetch('https://github.com/NUGET_API_KEY', nil) push_destination = 'https://api.nuget.org/v3/index.json' - if release_version.include?('-nightly') + if nightly # Nightly builds are pushed to GitHub NuGet repository # This commands will run in GitHub Actions api_key = ENV.fetch('https://github.com/GITHUB_TOKEN', nil) github_push_url = 'https://nuget.pkg.github.com/seleniumhq/index.json' push_destination = 'github' - sh "dotnet nuget add source --username seleniumhq --password #{api_key} --store-password-in-clear-text --name #{push_destination} #{github_push_url}" + flags = ['--username', 'seleniumhq', '--password', api_key, '--store-password-in-clear-text', '--name', + push_destination, github_push_url] + sh "dotnet nuget add source #{flags.join(' ')}" end ["./bazel-bin/dotnet/src/webdriver/Selenium.WebDriver.#{dotnet_version}.nupkg", @@ -860,7 +787,11 @@ namespace :dotnet do task :docs, [:skip_update] do |_task, arguments| FileUtils.rm_rf('build/docs/api/dotnet/') begin - sh 'dotnet tool update -g docfx' + # Pinning to 2.75.3 to avoid breaking changes in newer versions + # See https://github.com/dotnet/docfx/issues/9855 + sh 'dotnet tool uninstall --global docfx || true' + sh 'dotnet tool install --global --version 2.75.3 docfx' + # sh 'dotnet tool update -g docfx' rescue StandardError puts 'Please ensure that .NET SDK is installed.' raise @@ -880,8 +811,8 @@ namespace :dotnet do end unless arguments[:skip_update] - puts "Updating .NET documentation" - puts update_gh_pages ? ".NET Docs updated!" : ".NET Doc update cancelled" + puts 'Updating .NET documentation' + puts update_gh_pages ? '.NET Docs updated!' : '.NET Doc update cancelled' end end @@ -893,66 +824,69 @@ namespace :dotnet do desc 'Update .NET version' task :version, [:version] do |_task, arguments| - bump_nightly = arguments[:version] === 'nightly' old_version = dotnet_version - new_version = nil - - # There are three cases we want to deal with: - # 1. Switching from a release build to a nightly one - # 2. Updating a nightly build for the next nightly build - # 3. Switching from nightlies to a release build. - - if bump_nightly && old_version.include?('-nightly') - # This is the case where we are updating a nightly build to the next nightly build. - # This change is usually done by the CI system and never committed. - # The "-nightlyYmdHM" is removed to add a new timestamp. - new_version = old_version.gsub(/\-nightly\d+$/, '') + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}" - elsif bump_nightly - # This is the case after a production release and the version number is configured - # to start doing nightly builds. - new_version = old_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}" - else - if old_version.include?('-nightly') - new_version = old_version.gsub(/\-nightly\d+$/, '') - else - new_version = updated_version(old_version.gsub(/\-nightly\d+$/, ''), arguments[:version]) - new_version = new_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}" - end - end + nightly = "-nightly#{Time.now.strftime('%Y%m%d%H%M')}" + new_version = updated_version(old_version, arguments[:version], nightly) file = 'dotnet/selenium-dotnet-version.bzl' text = File.read(file).gsub(old_version, new_version) - File.open(file, "w") { |f| f.puts text } + File.open(file, 'w') { |f| f.puts text } - Rake::Task['dotnet:changelog'].invoke unless new_version.include?('-nightly') || bump_nightly + Rake::Task['dotnet:changelog'].invoke unless new_version.include?(nightly) end end namespace :java do desc 'Build Java Client Jars' - task :build, [:args] do |_task, arguments| - args = Array(arguments[:args]) || [] - Bazel.execute('build', args, '//java/src/org/openqa/selenium:client-combined') + task :build do |_task, arguments| + args = arguments.to_a.compact + JAVA_RELEASE_TARGETS.each { |target| Bazel.execute('build', args, target) } end - desc 'Build Grid Jar' - task :grid, [:args] do |_task, arguments| - args = Array(arguments[:args]) || [] - Bazel.execute('build', args, '//java/src/org/openqa/selenium/grid:grid') + desc 'Build Grid Server' + task :grid do |_task, arguments| + args = arguments.to_a.compact + Bazel.execute('build', args, '//java/src/org/openqa/selenium/grid:executable-grid') end - desc 'Package Java bindings and grid into releasable packages' - task :package, [:args] do |_task, arguments| - args = Array(arguments[:args]) || [] - Rake::Task['java:build'].invoke(args) - Rake::Task['java-release-zip'].invoke + desc 'Package Java bindings and grid into releasable packages and stage for release' + task :package do |_task, arguments| + args = arguments.to_a.compact.empty? ? ['--stamp'] : arguments.to_a.compact + Bazel.execute('build', args, '//java/src/org/openqa/selenium:client-zip') + Bazel.execute('build', args, '//java/src/org/openqa/selenium/grid:server-zip') + Bazel.execute('build', args, '//java/src/org/openqa/selenium/grid:executable-grid') + + mkdir_p 'build/dist' + Dir.glob('build/dist/*{java,server}*').each { |file| FileUtils.rm_f(file) } + + FileUtils.copy('bazel-bin/java/src/org/openqa/selenium/grid/server-zip.zip', + "build/dist/selenium-server-#{java_version}.zip") + FileUtils.chmod(0o666, "build/dist/selenium-server-#{java_version}.zip") + FileUtils.copy('bazel-bin/java/src/org/openqa/selenium/client-zip.zip', + "build/dist/selenium-java-#{java_version}.zip") + FileUtils.chmod(0o666, "build/dist/selenium-java-#{java_version}.zip") + FileUtils.copy('bazel-bin/java/src/org/openqa/selenium/grid/selenium', + "build/dist/selenium-server-#{java_version}.jar") + FileUtils.chmod(0o777, "build/dist/selenium-server-#{java_version}.jar") end desc 'Deploy all jars to Maven' - task :release, [:args] do |_task, arguments| - args = Array(arguments[:args]) || ['--stamp'] - Rake::Task['java:package'].invoke(args) - Rake::Task['publish-maven'].invoke + task :release do |_task, arguments| + args = arguments.to_a.compact + nightly = args.delete('nightly') + + ENV['MAVEN_USER'] ||= ENV.fetch('https://github.com/SEL_M2_USER', nil) + ENV['MAVEN_PASSWORD'] ||= ENV.fetch('https://github.com/SEL_M2_PASS', nil) + read_m2_user_pass unless ENV['MAVEN_PASSWORD'] && ENV['MAVEN_USER'] + + repo = nightly ? 'content/repositories/snapshots' : 'service/local/staging/deploy/maven2' + ENV['MAVEN_REPO'] = "https://oss.sonatype.org/#{repo}" + ENV['GPG_SIGN'] = (!nightly).to_s + + Rake::Task['java:version'].invoke if nightly + Rake::Task['java:package'].invoke('--stamp') + Rake::Task['java:build'].invoke('--stamp') + JAVA_RELEASE_TARGETS.each { |target| Bazel.execute('run', ['--stamp'], target) } end desc 'Install jars to local m2 directory' @@ -963,8 +897,8 @@ namespace :java do Rake::Task['javadocs'].invoke unless arguments[:skip_update] - puts "Updating Java documentation" - puts update_gh_pages ? "Java Docs updated!" : "Java Doc update cancelled" + puts 'Updating Java documentation' + puts update_gh_pages ? 'Java Docs updated!' : 'Java Doc update cancelled' end end @@ -986,7 +920,7 @@ namespace :java do versions = output.scan(/(\S+) \[\S+ -> (\S+)\]/).to_h versions.each do |artifact, version| if artifact.match?('graphql') - puts "WARNING — Cannot automatically update graphql" + puts 'WARNING — Cannot automatically update graphql' next end @@ -1008,13 +942,12 @@ namespace :java do desc 'Update Java version' task :version, [:version] do |_task, arguments| old_version = java_version - new_version = updated_version(old_version, arguments[:version]) - new_version += '-SNAPSHOT' unless old_version.include?('SNAPSHOT') + new_version = updated_version(old_version, arguments[:version], '-SNAPSHOT') file = 'java/version.bzl' text = File.read(file).gsub(old_version, new_version) - File.open(file, "w") { |f| f.puts text } - Rake::Task['java:changelog'].invoke if old_version.include?('SNAPSHOT') + File.open(file, 'w') { |f| f.puts text } + Rake::Task['java:changelog'].invoke unless new_version.include?('-SNAPSHOT') end end @@ -1025,8 +958,8 @@ def rust_version end namespace :rust do desc 'Build Selenium Manager' - task :build, [:args] do |_task, arguments| - args = Array(arguments[:args]) || [] + task :build do |_task, arguments| + args = arguments.to_a.compact Bazel.execute('build', args, '//rust:selenium-manager') end @@ -1052,16 +985,15 @@ namespace :rust do else old_version.split('.').tap(&:shift).append('0').join('.') end - converted_version = updated_version(equivalent_version, arguments[:version]) - new_version = converted_version.split('.').unshift("0").tap(&:pop).join('.') - new_version += '-nightly' unless old_version.include?('nightly') + updated = updated_version(equivalent_version, arguments[:version], '-nightly') + new_version = updated.split(/\.|-/).tap { |v| v.delete_at(2) }.unshift('0').join('.').gsub('.nightly', '-nightly') ['rust/Cargo.toml', 'rust/BUILD.bazel'].each do |file| text = File.read(file).gsub(old_version, new_version) - File.open(file, "w") { |f| f.puts text } + File.open(file, 'w') { |f| f.puts text } end - Rake::Task['rust:changelog'].invoke unless new_version.include?('nightly') + Rake::Task['rust:changelog'].invoke unless new_version.include?('-nightly') Rake::Task['rust:update'].invoke end @@ -1072,7 +1004,7 @@ namespace :rust do task :commit do @git.reset commit!("update Rust version to #{rust_version}", - ['rust/BUILD.bazel', 'rust/Cargo.Bazel.lock', 'rust/Cargo.lock', 'rust/Cargo.toml']) + ['rust/BUILD.bazel', 'rust/Cargo.Bazel.lock', 'rust/Cargo.lock', 'rust/Cargo.toml']) commit!('Rust Changelog', ['rust/CHANGELOG.md']) end end @@ -1081,7 +1013,7 @@ end namespace :all do desc 'Update all API Documentation' task :docs do - FileUtils.rm_rf('build/docs/api') if Dir.exist?('build/docs/api') + FileUtils.rm_rf('build/docs/api') Rake::Task['java:docs'].invoke(true) Rake::Task['py:docs'].invoke(true) @@ -1089,80 +1021,81 @@ namespace :all do Rake::Task['dotnet:docs'].invoke(true) Rake::Task['node:docs'].invoke(true) - puts "Updating All API Docs" - puts update_gh_pages ? "AP Docs updated!" : "API Doc update cancelled" + puts 'Updating All API Docs' + puts update_gh_pages ? 'AP Docs updated!' : 'API Doc update cancelled' end desc 'Build all artifacts for all language bindings' - task :build, [:args] do |_task, arguments| - args = Array(arguments[:args]) || [] - Rake::Task['java:build'].invoke(args) - Rake::Task['py:build'].invoke(args) - Rake::Task['rb:build'].invoke(args) - Rake::Task['dotnet:build'].invoke(args) - Rake::Task['node:build'].invoke(args) + task :build do |_task, arguments| + args = arguments.to_a.compact + Rake::Task['java:build'].invoke(*args) + Rake::Task['py:build'].invoke(*args) + Rake::Task['rb:build'].invoke(*args) + Rake::Task['dotnet:build'].invoke(*args) + Rake::Task['node:build'].invoke(*args) + end + + desc 'Package or build stamped artifacts for distribution in GitHub Release assets' + task :package do |_task, arguments| + args = arguments.to_a.compact + Rake::Task['java:package'].invoke(*args) + Rake::Task['dotnet:package'].invoke(*args) end desc 'Release all artifacts for all language bindings' - task :release, [:args] do |_task, arguments| + task :release do |_task, arguments| Rake::Task['clean'].invoke - tag = @git.add_tag("selenium-#{java_version}") - @git.push('origin', tag.name) - - args = Array(arguments[:args]) || ['--stamp'] - Rake::Task['java:release'].invoke(args) - Rake::Task['py:release'].invoke(args) - Rake::Task['rb:release'].invoke(args) - Rake::Task['dotnet:release'].invoke(args) - Rake::Task['node:release'].invoke(args) - Rake::Task['create_release_notes'].invoke(args) + + args = arguments.to_a.compact.empty? ? ['--stamp'] : arguments.to_a.compact + Rake::Task['java:release'].invoke(*args) + Rake::Task['py:release'].invoke(*args) + Rake::Task['rb:release'].invoke(*args) + Rake::Task['dotnet:release'].invoke(*args) + Rake::Task['node:release'].invoke(*args) Rake::Task['all:docs'].invoke Rake::Task['all:version'].invoke('nightly') - puts "Committing nightly version updates" + puts 'Committing nightly version updates' commit!('update versions to nightly', ['java/version.bzl', - 'rb/lib/selenium/webdriver/version.rb', - 'rb/Gemfile.lock', - 'py/setup.py', - 'py/BUILD.bazel', - 'py/selenium/__init__.py', - 'py/selenium/webdriver/__init__.py', - 'py/docs/source/conf.py', - 'rust/BUILD.bazel', - 'rust/Cargo.Bazel.lock', - 'rust/Cargo.lock', - 'rust/Cargo.toml']) + 'rb/lib/selenium/webdriver/version.rb', + 'rb/Gemfile.lock', + 'py/setup.py', + 'py/BUILD.bazel', + 'py/selenium/__init__.py', + 'py/selenium/webdriver/__init__.py', + 'py/docs/source/conf.py', + 'rust/BUILD.bazel', + 'rust/Cargo.Bazel.lock', + 'rust/Cargo.lock', + 'rust/Cargo.toml']) print 'Do you want to push the committed changes? (Y/n): ' - response = STDIN.gets.chomp.downcase - @git.push if response == 'y' || response == 'yes' + response = $stdin.gets.chomp.downcase + @git.push if %w[y yes].include?(response) end desc 'Update everything in preparation for a release' - task :prepare, [:channel] do |_task, arguments| - chrome_channel = if arguments[:channel].nil? - 'Stable' - else - arguments[:channel] - end + task :prepare, [:version, :channel] do |_task, arguments| + chrome_channel = arguments[:channel] || 'Stable' + version = arguments[:version] args = Array(chrome_channel) ? ['--', "--chrome_channel=#{chrome_channel.capitalize}"] : [] Bazel.execute('run', args, '//scripts:pinned_browsers') commit!('Update pinned browser versions', ['common/repositories.bzl']) Bazel.execute('run', args, '//scripts:update_cdp') commit!('Update supported versions for Chrome DevTools', - ['common/devtools/', - 'dotnet/src/webdriver/DevTools/', - 'dotnet/src/webdriver/WebDriver.csproj', - 'dotnet/test/common/DevTools/', - 'dotnet/test/common/CustomDriverConfigs/', - 'dotnet/selenium-dotnet-version.bzl', - 'java/src/org/openqa/selenium/devtools/', - 'javascript/node/selenium-webdriver/BUILD.bazel', - 'py/BUILD.bazel', - 'rb/lib/selenium/devtools/', - 'rb/Gemfile.lock', - 'Rakefile']) + ['common/devtools/', + 'dotnet/src/webdriver/DevTools/', + 'dotnet/src/webdriver/WebDriver.csproj', + 'dotnet/test/common/DevTools/', + 'dotnet/test/common/CustomDriverConfigs/', + 'dotnet/selenium-dotnet-version.bzl', + 'java/src/org/openqa/selenium/devtools/', + 'javascript/node/selenium-webdriver/BUILD.bazel', + 'py/BUILD.bazel', + 'rb/lib/selenium/devtools/', + 'rb/Gemfile.lock', + 'Rakefile']) Bazel.execute('run', args, '//scripts:selenium_manager') commit!('Update selenium manager version', ['common/selenium_manager.bzl']) @@ -1174,7 +1107,7 @@ namespace :all do commit!('Update authors file', ['AUTHORS']) # Note that this does not include Rust version changes that are handled in separate rake:version task - Rake::Task['all:version'].invoke + Rake::Task['all:version'].invoke(version) commit!("FIX CHANGELOGS BEFORE MERGING!\n\nUpdate versions and change logs to release Selenium #{java_version}", ['dotnet/CHANGELOG', 'dotnet/selenium-dotnet-version.bzl', @@ -1197,19 +1130,13 @@ namespace :all do desc 'Update all versions' task :version, [:version] do |_task, arguments| - version = arguments[:version] - if version == 'nightly' - Rake::Task['java:version'].invoke - Rake::Task['rb:version'].invoke - Rake::Task['rust:version'].invoke - Rake::Task['py:version'].invoke - else - Rake::Task['java:version'].invoke(version) - Rake::Task['rb:version'].invoke(version) - Rake::Task['node:version'].invoke(version) - Rake::Task['py:version'].invoke(version) - Rake::Task['dotnet:version'].invoke(version) - end + version = arguments[:version] || 'nightly' + + Rake::Task['java:version'].invoke(version) + Rake::Task['rb:version'].invoke(version) + Rake::Task['node:version'].invoke(version) + Rake::Task['py:version'].invoke(version) + Rake::Task['dotnet:version'].invoke(version) end end @@ -1217,158 +1144,116 @@ at_exit do system 'sh', '.git-fixfiles' if File.exist?('.git') && !SeleniumRake::Checks.windows? end -desc 'Create Release Notes for Minor Release' -task :create_release_notes do - range = "#{previous_tag(java_version)}...HEAD" - format = "* [\\`%h\\`](http://github.com/seleniumhq/selenium/commit/%H) - %s :: %aN" - git_log_command = %Q(git --no-pager log "#{range}" --pretty=format:"#{format}" --reverse) - git_log_output = `#{git_log_command}` - - release_notes = <<~RELEASE_NOTES - ### Changelog - - For each component's detailed changelog, please check: - * [Ruby](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES) - * [Python](https://github.com/SeleniumHQ/selenium/blob/trunk/py/CHANGES) - * [JavaScript](https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/node/selenium-webdriver/CHANGES.md) - * [Java](https://github.com/SeleniumHQ/selenium/blob/trunk/java/CHANGELOG) - * [DotNet](https://github.com/SeleniumHQ/selenium/blob/trunk/dotnet/CHANGELOG) - * [IEDriverServer](https://github.com/SeleniumHQ/selenium/blob/trunk/cpp/iedriverserver/CHANGELOG) - - ### Commits in this release -
- Click to see all the commits included in this release - - #{git_log_output} - -
- RELEASE_NOTES - - FileUtils.mkdir_p('build/dist') - release_notes_file = "build/dist/release_notes_#{java_version}.md" - File.write(release_notes_file, release_notes) - puts "Release notes have been generated at: #{release_notes_file}" -end - -def updated_version(current, desired = nil) - puts "Calculating " - version = desired ? desired.split('.') : current.split(/\.|-/) - if desired - # Allows user to pass in only major/minor versions - version << "0" while version.size < 3 - elsif version.size > 3 - # Assumes a pre-release version which means removing the pre-release portion - version.pop while version.size > 3 - else - version[1] = (version[1].to_i + 1).to_s - version[2] = '0' +def updated_version(current, desired = nil, nightly = nil) + if !desired.nil? && desired != 'nightly' + # If desired is present, return full 3 digit version + desired.split('.').tap { |v| v << 0 while v.size < 3 }.join('.') + elsif current.split(/\.|-/).size > 3 + # if current version is already nightly, just need to bump it; this will be noop for some languages + pattern = /-?\.?(nightly|SNAPSHOT|dev)\d*$/ + current.gsub(pattern, nightly) + elsif current.split(/\.|-/).size == 3 + # if current version is not nightly, need to bump the version and make nightly + "#{current.split(/\.|-/).tap { |i| (i[1] = i[1].to_i + 1) && (i[2] = 0) }.join('.')}#{nightly}" end - version.join('.') end +# TODO: make this less insane +# rubocop:disable all def update_gh_pages origin_reference = @git.current_branch origin_reference ||= begin # This allows updating docs from a tagged commit instead of a branch - puts "commit is not at HEAD, checking for matching tag" - tag = @git.tags.detect {|tag| tag.sha == @git.revparse("HEAD") } - tag ? tag.name : raise(StandardError, "Must be on a tagged commit or at the HEAD of a branch to update API Docs") + puts 'commit is not at HEAD, checking for matching tag' + tag = @git.tags.detect { |t| t.sha == @git.revparse('HEAD') } + tag ? tag.name : raise(StandardError, 'Must be on a tagged commit or at the HEAD of a branch to update API Docs') end - puts "Checking out gh-pages" + puts 'Checking out gh-pages' begin @git.checkout('gh-pages') - rescue Git::FailedError => ex + rescue Git::FailedError => e # This happens when the working directory is not clean and things need to be stashed or committed - line = ex.message.lines[2].gsub("output: \"error: ", '') + line = e.message.lines[2].gsub('output: "error: ', '') puts line.gsub('\t', "\t").split('\n')[0...-2].join("\n") # TODO: we could offer to automatically fix with a stash, but there may be edge cases - print "Manually Fix and Retry? (Y/n):" - response = STDIN.gets.chomp.downcase - return false unless response == 'y' || response == 'yes' + print 'Manually Fix and Retry? (Y/n):' + response = $stdin.gets.chomp.downcase + return false unless %w[y yes].include?(response) retry end - puts "Updating gh-pages branch from upstream repository" + puts 'Updating gh-pages branch from upstream repository' begin @git.pull - rescue Git::FailedError => ex + rescue Git::FailedError => e # This happens when upstream is not already set - line = ex.message.lines[2].gsub("output: \"error: ", '') + line = e.message.lines[2].gsub('output: "error: ', '') puts line.gsub('\t', "\t").split('\n').delete_if(&:empty?)[-2...-1].join("\n") - print "Manually Fix and Retry? (Y/n):" - response = STDIN.gets.chomp.downcase - return restore_git(origin_reference) unless response == 'y' || response == 'yes' + print 'Manually Fix and Retry? (Y/n):' + response = $stdin.gets.chomp.downcase + return restore_git(origin_reference) unless %w[y yes].include?(response) retry end - %w[java rb py dotnet].each do |language| - if Dir.exist?("build/docs/api/#{language}") && !Dir.empty?("build/docs/api/#{language}") - puts "Deleting #{language} directory in docs/api since corresponding directory in build/docs/api is not empty" - FileUtils.rm_rf("docs/api/#{language}") - puts "Moving documentation files from untracked build directory to tracked docs directory" - FileUtils.mv("build/docs/api/#{language}", "docs/api/#{language}") - end + %w[java rb py dotnet javascript].each do |language| + next unless Dir.exist?("build/docs/api/#{language}") && !Dir.empty?("build/docs/api/#{language}") + + puts "Deleting #{language} directory in docs/api since corresponding directory in build/docs/api is not empty" + FileUtils.rm_rf("docs/api/#{language}") + puts 'Moving documentation files from untracked build directory to tracked docs directory' + FileUtils.mv("build/docs/api/#{language}", "docs/api/#{language}") end print 'Do you want to commit the changes? (Y/n): ' - response = STDIN.gets.chomp.downcase - return restore_git(origin_reference) unless response == 'y' || response == 'yes' + response = $stdin.gets.chomp.downcase + return restore_git(origin_reference) unless %w[y yes].include?(response) - puts "Committing changes" + puts 'Committing changes' commit!('updating all API docs', ['docs/api/']) - puts "Pushing changes to upstream repository" + puts 'Pushing changes to upstream repository' @git.push puts "Checking out originating branch/tag — #{origin_reference}" @git.checkout(origin_reference) true end +# rubocop:disable all def restore_git(origin_reference) - puts "Stashing docs changes for gh-pages" - Git::Stash.new(@git, "docs changes for gh-pages") + puts 'Stashing docs changes for gh-pages' + Git::Stash.new(@git, 'docs changes for gh-pages') puts "Checking out originating branch/tag — #{origin_reference}" @git.checkout(origin_reference) false end -def previous_version(version) - current = version.split(/\.|-/) - if current.size > 3 - current.pop while current.size > 3 - else - current[1] = (current[1].to_i - 1).to_s - current[2] = '0' - end -end - -def previous_tag(current_version, language=nil) +def previous_tag(current_version, language = nil) version = current_version.split(/\.|-/) if version.size > 3 - puts "WARNING - Changelogs not updated when set to prerelease" + puts 'WARNING - Changelogs not updated when set to prerelease' elsif version[2].to_i > 1 # specified as patch release patch_version = (version[2].to_i - 1).to_s "selenium-#{[[version[0]], version[1], patch_version].join('.')}-#{language}" - elsif version[2] == "1" + elsif version[2] == '1' # specified as patch release; special case - "selenium-#{[[version[0]], version[1], "0"].join('.')}" + "selenium-#{[[version[0]], version[1], '0'].join('.')}" else minor_version = (version[1].to_i - 1) tags = @git.tags.map(&:name) - tag = language ? tags.select { |tag| tag.match?(/selenium-4\.#{minor_version}.*-#{language}/) }.last : nil - tag || "selenium-#{[[version[0]], minor_version, "0"].join('.')}" + tag = language ? tags.reverse.find { |tag| tag.match?(/selenium-4\.#{minor_version}.*-#{language}/) } : nil + tag || "selenium-#{[[version[0]], minor_version, '0'].join('.')}" end end def update_changelog(version, language, path, changelog, header) tag = previous_tag(version, language) log = `git --no-pager log #{tag}...HEAD --pretty=format:">>> %B" --reverse #{path}` - commits = log.split(">>>").map { |entry| + commits = log.split('>>>').map { |entry| lines = entry.split("\n") lines.reject! { |line| line.match?(/^(----|Co-authored|Signed-off)/) || line.empty? } lines.join("\n") @@ -1388,6 +1273,6 @@ def commit!(message, files = [], all: false) @git.add(file) end all ? @git.commit_all(message) : @git.commit(message) -rescue Git::FailedError => ex - puts ex.message +rescue Git::FailedError => e + puts e.message end diff --git a/WORKSPACE b/WORKSPACE index 26248d2563478..eb09ccc8726e0 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -2,14 +2,6 @@ workspace(name = "selenium") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -# This gets us a pre-compiled `protoc` - -load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") - -rules_proto_dependencies() - -rules_proto_toolchains() - # rules_closure are not published to BCR. http_archive( diff --git a/common/devtools/chromium/v123/BUILD.bazel b/common/devtools/chromium/v126/BUILD.bazel similarity index 100% rename from common/devtools/chromium/v123/BUILD.bazel rename to common/devtools/chromium/v126/BUILD.bazel diff --git a/common/devtools/chromium/v123/browser_protocol.pdl b/common/devtools/chromium/v126/browser_protocol.pdl similarity index 96% rename from common/devtools/chromium/v123/browser_protocol.pdl rename to common/devtools/chromium/v126/browser_protocol.pdl index 5b79452137dbf..31028c8b42049 100644 --- a/common/devtools/chromium/v123/browser_protocol.pdl +++ b/common/devtools/chromium/v126/browser_protocol.pdl @@ -475,6 +475,12 @@ experimental domain Animation # Animation that was started. Animation animation + # Event for animation that has been updated. + event animationUpdated + parameters + # Animation that was updated. + Animation animation + # Audits domain allows investigation of page violations and possible improvements. experimental domain Audits depends on Network @@ -729,6 +735,37 @@ experimental domain Audits WebAndOsHeaders NoWebOrOsSupport NavigationRegistrationWithoutTransientUserActivation + InvalidInfoHeader + NoRegisterSourceHeader + NoRegisterTriggerHeader + NoRegisterOsSourceHeader + NoRegisterOsTriggerHeader + + type SharedDictionaryError extends string + enum + UseErrorCrossOriginNoCorsRequest + UseErrorDictionaryLoadFailure + UseErrorMatchingDictionaryNotUsed + UseErrorUnexpectedContentDictionaryHeader + WriteErrorCossOriginNoCorsRequest + WriteErrorDisallowedBySettings + WriteErrorExpiredResponse + WriteErrorFeatureDisabled + WriteErrorInsufficientResources + WriteErrorInvalidMatchField + WriteErrorInvalidStructuredHeader + WriteErrorNavigationRequest + WriteErrorNoMatchField + WriteErrorNonListMatchDestField + WriteErrorNonSecureContext + WriteErrorNonStringIdField + WriteErrorNonStringInMatchDestList + WriteErrorNonStringMatchField + WriteErrorNonTokenTypeField + WriteErrorRequestAborted + WriteErrorShuttingDown + WriteErrorTooLongIdField + WriteErrorUnsupportedType # Details for issues around "Attribution Reporting API" usage. # Explainer: https://github.com/WICG/attribution-reporting-api @@ -756,6 +793,11 @@ experimental domain Audits string url optional SourceCodeLocation location + type SharedDictionaryIssueDetails extends object + properties + SharedDictionaryError sharedDictionaryError + AffectedRequest request + type GenericIssueErrorType extends string enum CrossOriginPortalPostMessageError @@ -807,6 +849,9 @@ experimental domain Audits type CookieDeprecationMetadataIssueDetails extends object properties array of string allowedSites + number optOutPercentage + boolean isOptOutTopLevel + CookieOperation operation type ClientHintIssueReason extends string enum @@ -865,6 +910,8 @@ experimental domain Audits SilentMediationFailure ThirdPartyCookiesBlocked NotSignedInWithIdp + MissingTransientUserActivation + ReplacedByButtonMode type FederatedAuthUserInfoRequestIssueDetails extends object properties @@ -959,6 +1006,7 @@ experimental domain Audits StylesheetLoadingIssue FederatedAuthUserInfoRequestIssue PropertyRuleIssue + SharedDictionaryIssue # This struct holds a list of optional fields with additional information # specific to the kind of issue. When adding a new issue code, please also @@ -985,6 +1033,7 @@ experimental domain Audits optional StylesheetLoadingIssueDetails stylesheetLoadingIssueDetails optional PropertyRuleIssueDetails propertyRuleIssueDetails optional FederatedAuthUserInfoRequestIssueDetails federatedAuthUserInfoRequestIssueDetails + optional SharedDictionaryIssueDetails sharedDictionaryIssueDetails # A unique id for a DevTools inspector issue. Allows other entities (e.g. # exceptions, CDP message, console messages, etc.) to reference an issue. @@ -1046,6 +1095,21 @@ experimental domain Audits parameters InspectorIssue issue +# Defines commands and events for browser extensions. Available if the client +# is connected using the --remote-debugging-pipe flag and +# the --enable-unsafe-extension-debugging flag is set. +experimental domain Extensions + # Installs an unpacked extension from the filesystem similar to + # --load-extension CLI flags. Returns extension ID once the extension + # has been installed. + command loadUnpacked + parameters + # Absolute file path. + string path + returns + # Extension id. + string id + # Defines commands and events for Autofill. experimental domain Autofill type CreditCard extends object @@ -1939,12 +2003,25 @@ experimental domain CSS CSSStyle style # CSS position-fallback rule representation. - type CSSPositionFallbackRule extends object + deprecated type CSSPositionFallbackRule extends object properties Value name # List of keyframes. array of CSSTryRule tryRules + # CSS @position-try rule representation. + type CSSPositionTryRule extends object + properties + # The prelude dashed-ident name + Value name + # The css style sheet identifier (absent for user agent stylesheet and user-specified + # stylesheet rules) this rule came from. + optional StyleSheetId styleSheetId + # Parent stylesheet's origin. + StyleSheetOrigin origin + # Associated style declaration. + CSSStyle style + # CSS keyframes rule representation. type CSSKeyframesRule extends object properties @@ -2118,7 +2195,9 @@ experimental domain CSS # A list of CSS keyframed animations matching this node. optional array of CSSKeyframesRule cssKeyframesRules # A list of CSS position fallbacks matching this node. - optional array of CSSPositionFallbackRule cssPositionFallbackRules + deprecated optional array of CSSPositionFallbackRule cssPositionFallbackRules + # A list of CSS @position-try rules matching this node, based on the position-try-options property. + optional array of CSSPositionTryRule cssPositionTryRules # A list of CSS at-property rules matching this node. optional array of CSSPropertyRule cssPropertyRules # A list of CSS property registrations matching this node. @@ -2160,6 +2239,15 @@ experimental domain CSS returns CSSLayerData rootLayer + # Given a CSS selector text and a style sheet ID, getLocationForSelector + # returns an array of locations of the CSS selector in the style sheet. + experimental command getLocationForSelector + parameters + StyleSheetId styleSheetId + string selectorText + returns + array of SourceRange ranges + # Starts tracking the given computed styles for updates. The specified array of properties # replaces the one previously specified. Pass empty array to disable tracking. # Use takeComputedStyleUpdates to retrieve the list of nodes that had properties modified. @@ -2541,11 +2629,14 @@ domain DOM marker backdrop selection + search-text target-text spelling-error grammar-error highlight first-line-inherited + scroll-marker + scroll-markers scrollbar scrollbar-thumb scrollbar-button @@ -3045,6 +3136,20 @@ domain DOM # NodeIds of top layer elements array of NodeId nodeIds + # Returns the NodeId of the matched element according to certain relations. + experimental command getElementByRelation + parameters + # Id of the node from which to query the relation. + NodeId nodeId + # Type of relation to get. + enum relation + # Get the popover target for a given element. In this case, this given + # element can only be an HTMLFormControlElement (,