Skip to content

Update nightly version #1685

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

Merged
merged 20 commits into from
Apr 24, 2024
Merged

Update nightly version #1685

merged 20 commits into from
Apr 24, 2024

Conversation

diemol
Copy link
Member

@diemol diemol commented Apr 23, 2024

User description

Thanks for contributing to the Selenium site and documentation!
A PR well described will help maintainers to review and merge it quickly

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, and help reviewers by making them as simple and short as possible.

Description

Motivation and Context

Types of changes

  • Change to the site (I have double-checked the Netlify deployment, and my changes look good)
  • Code example added (and I also added the example to all translated languages)
  • Improved translation
  • Added new translation (and I also added a notice to each document missing translation)

Checklist

  • I have read the contributing document.
  • I have used hugo to render the site/docs locally and I am sure it works.

Type

enhancement, tests


Description

  • Introduced scripts in Bash and PowerShell to fetch the latest nightly versions of packages.
  • Updated various language-specific GitHub Actions workflows (.NET, Java, JavaScript, Python, Ruby) to dynamically use the latest nightly versions for testing.
  • Simplified project configurations in .NET and Ruby by removing conditional version settings, now managed by workflows.
  • Enhanced Maven configuration in Java examples to use a variable for Selenium version, allowing easier management between stable and nightly builds.

Changes walkthrough

Relevant files
Enhancement
10 files
latest-nightly-version.sh
Add Bash Script to Fetch Latest Nightly Version                   

scripts/latest-nightly-version.sh

  • Added a script to fetch the latest nightly version for a given package
    type and name using GitHub API.
  • +12/-0   
    latest-nightly-version.ps1
    Add PowerShell Script for Nightly Version Fetch                   

    scripts/latest-nightly-version.ps1

  • Introduced a PowerShell script equivalent to fetch the latest nightly
    version for package management.
  • +9/-0     
    dotnet-examples.yml
    Update .NET Examples Workflow for Nightly Builds                 

    .github/workflows/dotnet-examples.yml

  • Updated workflow to dynamically set the version of Selenium packages
    based on the latest nightly version.
  • +20/-3   
    java-examples.yml
    Enhance Java Examples Workflow with Nightly Support           

    .github/workflows/java-examples.yml

  • Modified Java examples workflow to handle both stable and nightly
    releases.
  • +12/-1   
    js-examples.yml
    Update JavaScript Examples for Nightly Version Installation

    .github/workflows/js-examples.yml

  • Adjusted JavaScript examples workflow to install the latest nightly
    version of selenium-webdriver.
  • +14/-4   
    python-examples.yml
    Configure Python Examples Workflow for Nightly Builds       

    .github/workflows/python-examples.yml

  • Python examples workflow now installs dependencies based on the
    release type (stable or nightly).
  • +10/-1   
    ruby-examples.yml
    Update Ruby Examples Workflow for Nightly Version               

    .github/workflows/ruby-examples.yml

  • Ruby examples workflow updated to install the latest nightly version
    of selenium-webdriver.
  • +25/-1   
    SeleniumDocs.csproj
    Simplify .NET Project Configuration                                           

    examples/dotnet/SeleniumDocs/SeleniumDocs.csproj

  • Removed conditional item groups for nightly and stable, as version
    management is handled by the workflow.
  • +0/-8     
    pom.xml
    Refactor Java POM for Flexible Selenium Versioning             

    examples/java/pom.xml

  • Updated Maven dependencies to use a variable for selenium version,
    facilitating easier version management.
  • +3/-2     
    Gemfile
    Clean Up Ruby Gemfile for Simplified Dependency Management

    examples/ruby/Gemfile

  • Streamlined Gemfile by removing conditional source and version
    settings for nightly builds.
  • +2/-10   

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    @diemol diemol changed the title Update nightly version Using nightly version for Selenium examples Apr 23, 2024
    Copy link
    Contributor

    qodo-merge-pro bot commented Apr 23, 2024

    CI Failure Feedback

    (Checks updated until commit 6bfbc33)

    Action: test_examples (windows-latest, nightly)

    Failed stage: Run tests [❌]

    Failure summary:

    The action failed due to compilation errors in multiple test files within the SeleniumDocs project.
    The class DriverFinder is referenced in several test files, but it lacks definitions for DriverPath
    and BrowserPath. These missing definitions or the absence of necessary using directives or assembly
    references caused the build to fail repeatedly, even after multiple retry attempts.

    Relevant error logs:
    1:  ##[group]Operating System
    2:  Microsoft Windows Server 2022
    ...
    
    372:  timeout_minutes: 20
    373:  max_attempts: 3
    374:  command: cd examples/dotnet/SeleniumDocs
    375:  dotnet test
    376:  
    377:  retry_wait_seconds: 10
    378:  polling_interval_seconds: 1
    379:  warning_on_retry: true
    380:  continue_on_error: false
    ...
    
    383:  GITHUB_TOKEN: ***
    384:  GH_TOKEN: ***
    385:  DOTNET_ROOT: C:\Program Files\dotnet
    386:  JAVA_HOME: C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.23-9\x64
    387:  JAVA_HOME_11_X64: C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\11.0.23-9\x64
    388:  ##[endgroup]
    389:  Determining projects to restore...
    390:  All projects are up-to-date for restore.
    391:  ##[error]D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\Drivers\ServiceTest.cs(41,46): error CS1061: 'DriverFinder' does not contain a definition for 'DriverPath' and no accessible extension method 'DriverPath' accepting a first argument of type 'DriverFinder' could be found (are you missing a using directive or an assembly reference?) [D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\SeleniumDocs.csproj]
    392:  ##[error]D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\Browsers\EdgeTest.cs(180,46): error CS1061: 'DriverFinder' does not contain a definition for 'BrowserPath' and no accessible extension method 'BrowserPath' accepting a first argument of type 'DriverFinder' could be found (are you missing a using directive or an assembly reference?) [D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\SeleniumDocs.csproj]
    393:  ##[error]D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\Browsers\FirefoxTest.cs(204,46): error CS1061: 'DriverFinder' does not contain a definition for 'BrowserPath' and no accessible extension method 'BrowserPath' accepting a first argument of type 'DriverFinder' could be found (are you missing a using directive or an assembly reference?) [D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\SeleniumDocs.csproj]
    394:  ##[error]D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\Browsers\ChromeTest.cs(180,46): error CS1061: 'DriverFinder' does not contain a definition for 'BrowserPath' and no accessible extension method 'BrowserPath' accepting a first argument of type 'DriverFinder' could be found (are you missing a using directive or an assembly reference?) [D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\SeleniumDocs.csproj]
    395:  ##[warning]Attempt 1 failed. Reason: Child_process exited with error code 1
    396:  Determining projects to restore...
    397:  All projects are up-to-date for restore.
    398:  ##[error]D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\Drivers\ServiceTest.cs(41,46): error CS1061: 'DriverFinder' does not contain a definition for 'DriverPath' and no accessible extension method 'DriverPath' accepting a first argument of type 'DriverFinder' could be found (are you missing a using directive or an assembly reference?) [D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\SeleniumDocs.csproj]
    399:  ##[error]D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\Browsers\FirefoxTest.cs(204,46): error CS1061: 'DriverFinder' does not contain a definition for 'BrowserPath' and no accessible extension method 'BrowserPath' accepting a first argument of type 'DriverFinder' could be found (are you missing a using directive or an assembly reference?) [D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\SeleniumDocs.csproj]
    400:  ##[error]D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\Browsers\EdgeTest.cs(180,46): error CS1061: 'DriverFinder' does not contain a definition for 'BrowserPath' and no accessible extension method 'BrowserPath' accepting a first argument of type 'DriverFinder' could be found (are you missing a using directive or an assembly reference?) [D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\SeleniumDocs.csproj]
    401:  ##[error]D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\Browsers\ChromeTest.cs(180,46): error CS1061: 'DriverFinder' does not contain a definition for 'BrowserPath' and no accessible extension method 'BrowserPath' accepting a first argument of type 'DriverFinder' could be found (are you missing a using directive or an assembly reference?) [D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\SeleniumDocs.csproj]
    402:  ##[warning]Attempt 2 failed. Reason: Child_process exited with error code 1
    403:  Determining projects to restore...
    404:  All projects are up-to-date for restore.
    405:  ##[error]D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\Drivers\ServiceTest.cs(41,46): error CS1061: 'DriverFinder' does not contain a definition for 'DriverPath' and no accessible extension method 'DriverPath' accepting a first argument of type 'DriverFinder' could be found (are you missing a using directive or an assembly reference?) [D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\SeleniumDocs.csproj]
    406:  ##[error]D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\Browsers\EdgeTest.cs(180,46): error CS1061: 'DriverFinder' does not contain a definition for 'BrowserPath' and no accessible extension method 'BrowserPath' accepting a first argument of type 'DriverFinder' could be found (are you missing a using directive or an assembly reference?) [D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\SeleniumDocs.csproj]
    407:  ##[error]D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\Browsers\FirefoxTest.cs(204,46): error CS1061: 'DriverFinder' does not contain a definition for 'BrowserPath' and no accessible extension method 'BrowserPath' accepting a first argument of type 'DriverFinder' could be found (are you missing a using directive or an assembly reference?) [D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\SeleniumDocs.csproj]
    408:  ##[error]D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\Browsers\ChromeTest.cs(180,46): error CS1061: 'DriverFinder' does not contain a definition for 'BrowserPath' and no accessible extension method 'BrowserPath' accepting a first argument of type 'DriverFinder' could be found (are you missing a using directive or an assembly reference?) [D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\dotnet\SeleniumDocs\SeleniumDocs.csproj]
    409:  ##[error]Final attempt failed. Child_process exited with error code 1
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    @qodo-merge-pro qodo-merge-pro bot added enhancement New feature or request tests labels Apr 23, 2024
    @qodo-merge-pro qodo-merge-pro bot changed the title Using nightly version for Selenium examples Update nightly version Apr 23, 2024
    Copy link
    Contributor

    PR Description updated to latest commit (cce119e)

    Copy link
    Contributor

    PR Review

    ⏱️ Estimated effort to review [1-5]

    4, because the PR introduces significant changes across multiple workflow files and scripts, affecting various programming environments (dotnet, java, javascript, python, ruby). The complexity is increased by the introduction of conditional logic based on the release type (stable vs nightly) and operating system specifics. Each change needs to be carefully reviewed to ensure it doesn't break existing functionalities and that it integrates well with the different environments.

    🧪 Relevant tests

    No

    🔍 Possible issues

    Possible Bug: The scripts latest-nightly-version.sh and latest-nightly-version.ps1 are critical as they fetch the latest package versions. If there's an error in these scripts, it could lead to incorrect package versions being used, potentially breaking builds or leading to unexpected behaviors.

    Environment Variables: The use of GH_TOKEN and GITHUB_TOKEN in different places might cause confusion or misconfiguration, especially since their usage contexts are not clearly differentiated.

    🔒 Security concerns

    No


    ✨ Review tool usage guide:

    Overview:
    The review tool scans the PR code changes, and generates a PR review which includes several types of feedbacks, such as possible PR issues, security threats and relevant test in the PR. More feedbacks can be added by configuring the tool.

    The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.

    • When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:
    /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
    
    [pr_reviewer]
    some_config1=...
    some_config2=...
    

    See the review usage page for a comprehensive guide on using this tool.

    Copy link

    netlify bot commented Apr 23, 2024

    Deploy Preview for selenium-dev ready!

    Name Link
    🔨 Latest commit cce119e
    🔍 Latest deploy log https://app.netlify.com/sites/selenium-dev/deploys/6627a80950579d0008f8dbce
    😎 Deploy Preview https://deploy-preview-1685--selenium-dev.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    Copy link
    Contributor

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Enhancement
    Add error handling for the JSON parsing command to improve robustness.

    Consider adding error handling for the jq command to ensure it does not fail silently if
    the JSON parsing fails or the expected field is missing.

    scripts/latest-nightly-version.sh [12]

    -gh api -H "$ACCEPT_HEADER" -H "$VERSION_HEADER" $PATH_PACKAGES_API | jq -r '.[0].name'
    +gh api -H "$ACCEPT_HEADER" -H "$VERSION_HEADER" $PATH_PACKAGES_API | jq -r '.[0].name' || { echo "Failed to parse JSON or field missing"; exit 1; }
     
    Best practice
    Standardize environment variable names for consistency and clarity.

    Ensure consistency in environment variable names by using GITHUB_TOKEN instead of GH_TOKEN
    to align with GitHub's standard naming conventions.

    .github/workflows/dotnet-examples.yml [68]

    -GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    +GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     
    Centralize the management of Selenium version to simplify updates and maintain consistency.

    Use a property for the Selenium version to manage dependency versions centrally, which
    simplifies updates and ensures consistency across multiple dependencies.

    examples/java/pom.xml [33]

    +<properties>
    +    <selenium.version>4.20.0</selenium.version>
    +</properties>
    +...
     <version>${selenium.version}</version>
     
    Maintainability
    Use a unified script for package installation to simplify maintenance and ensure consistency.

    Consider using a script to handle the installation process in a unified way across
    different platforms, rather than having separate commands for Windows and non-Windows
    systems.

    .github/workflows/js-examples.yml [96-97]

    -latest_nightly=$(./scripts/latest-nightly-version.sh npm selenium-webdriver)
    -npm install --prefix ./examples/javascript --save selenium-webdriver@npm:@seleniumhq/selenium-webdriver@$latest_nightly
    +./scripts/install-nightly.sh npm selenium-webdriver ./examples/javascript
     
    Refactor repeated bundle commands into a script to reduce code duplication.

    Extract the repeated bundle commands into a script to reduce duplication and improve
    maintainability.

    .github/workflows/ruby-examples.yml [58-60]

    -bundle install
    -bundle remove selenium-webdriver
    -bundle add selenium-webdriver --version $latest_nightly_webdriver --source "https://token:${{secrets.GITHUB_TOKEN}}@rubygems.pkg.github.com/seleniumhq"
    +./scripts/manage-ruby-gems.sh $latest_nightly_webdriver
     

    ✨ Improve tool usage guide:

    Overview:
    The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.

    • When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:
    /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
    
    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    

    See the improve usage page for a comprehensive guide on using this tool.

    Copy link

    netlify bot commented Apr 23, 2024

    Deploy Preview for selenium-dev ready!

    Name Link
    🔨 Latest commit 98b7f5a
    🔍 Latest deploy log https://app.netlify.com/sites/selenium-dev/deploys/6627a81f9f5846000876f366
    😎 Deploy Preview https://deploy-preview-1685--selenium-dev.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    Copy link

    netlify bot commented Apr 23, 2024

    Deploy Preview for selenium-dev ready!

    Name Link
    🔨 Latest commit 6bfbc33
    🔍 Latest deploy log https://app.netlify.com/sites/selenium-dev/deploys/662974b2ef04d900073982bf
    😎 Deploy Preview https://deploy-preview-1685--selenium-dev.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    @diemol
    Copy link
    Member Author

    diemol commented Apr 24, 2024

    I will merge this and fix the code once the dependencies are updated.

    @diemol diemol merged commit d51d29a into trunk Apr 24, 2024
    18 of 30 checks passed
    @diemol diemol deleted the update-nightly-version branch April 24, 2024 21:15
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant