Skip to content

Commit

Permalink
Merge branch 'trunk' into session-id
Browse files Browse the repository at this point in the history
  • Loading branch information
nvborisenko authored Dec 19, 2024
2 parents 7810cf3 + 4f25f67 commit 4f873e6
Show file tree
Hide file tree
Showing 61 changed files with 5,871 additions and 5,892 deletions.
9 changes: 8 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ build --tool_java_runtime_version=remotejdk_17
build --javacopt="--release 11"

# Require java dependencies to be used and first-order

build --experimental_strict_java_deps=strict
build --explicit_java_test_deps

# Avoid ErrorProne getting annoyed about "impossible null checks"
build --javacopt="-Xep:ImpossibleNullComparison:OFF"

# Allow spaces in runfile paths
build --nobuild_runfile_links

Expand All @@ -55,6 +57,11 @@ query --@aspect_rules_ts//ts:default_to_tsc_transpiler

build --incompatible_strict_action_env

# Required to get `protobuf` compiling, which is required for `rules_closure`
build --incompatible_enable_cc_toolchain_resolution
build --cxxopt=-std=c++14
build --host_cxxopt=-std=c++14

# For build stamping

build --enable_platform_specific_config
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ jobs:
steps:
- name: Checkout source tree
uses: actions/checkout@v4
- name: Pull latest changes
if: startsWith(github.head_ref, 'renovate/')
run: git pull origin ${{ github.head_ref }}
- name: Free space
if: inputs.os != 'windows'
run: ./scripts/github-actions/free-disk-space.sh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-rbe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
format:
name: Format
if: github.repository_owner == 'seleniumhq'
if: github.repository_owner == 'seleniumhq' && startsWith(github.head_ref, 'renovate/') != true
uses: ./.github/workflows/bazel.yml
with:
name: Check format script run
Expand All @@ -20,7 +20,7 @@ jobs:

test:
name: Test
if: github.repository_owner == 'seleniumhq'
if: github.repository_owner == 'seleniumhq' && startsWith(github.head_ref, 'renovate/') != true
uses: ./.github/workflows/bazel.yml
with:
name: All RBE tests
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/ci-renovate-rbe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI - Renovate - RBE

on:
push:
branches:
- renovate/*
workflow_dispatch:

jobs:
format:
runs-on: ubuntu-latest
if: github.repository_owner == 'seleniumhq'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: java - repin dependencies
if: contains(join(github.event.commits.*.message), '[java]')
run: REPIN=1 bazel run @maven//:pin
- name: rust - repin dependencies
if: contains(join(github.event.commits.*.message), '[rust]')
run: CARGO_BAZEL_REPIN=true bazel sync --only=crates
- name: js - repin dependencies
if: contains(join(github.event.commits.*.message), '[js]')
run: bazel run -- @pnpm//:pnpm install --dir $PWD --lockfile-only
- name: dotnet - repin dependencies
if: contains(join(github.event.commits.*.message), '[dotnet]')
run: ./dotnet/update-deps.sh
- name: py - repin dependencies
if: contains(join(github.event.commits.*.message), '[py]')
run: bazel run //py:requirements.update
- name: Commit files
run: |
export CHANGES=$(git status -s)
if [ -n "$CHANGES" ]; then
git config --local user.email "[email protected]"
git config --local user.name "Selenium CI Bot"
git add .
git commit -m 'Repin dependencies'
git push
fi
check-format:
needs: format
name: Check format
if: github.repository_owner == 'seleniumhq'
uses: ./.github/workflows/bazel.yml
with:
name: Check format script run
caching: false
ruby-version: jruby-9.4.8.0
run: ./scripts/github-actions/check-format.sh

test:
name: Test
if: github.repository_owner == 'seleniumhq'
uses: ./.github/workflows/bazel.yml
with:
name: All RBE tests
caching: false
ruby-version: jruby-9.4.8.0
run: ./scripts/github-actions/ci-build.sh
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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")
bazel_dep(name = "protobuf", version = "29.1", 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)
Expand Down
17 changes: 4 additions & 13 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_closure",
patch_args = [
"-p1",
],
patches = [
"//javascript:rules_closure_shell.patch",
],
sha256 = "d66deed38a0bb20581c15664f0ab62270af5940786855c7adc3087b27168b529",
strip_prefix = "rules_closure-0.11.0",
urls = [
"https://github.com/bazelbuild/rules_closure/archive/0.11.0.tar.gz",
],
strip_prefix = "rules_closure-0.12.0",
url = "https://github.com/bazelbuild/rules_closure/archive/refs/tags/0.12.0.tar.gz",
)

load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies", "rules_closure_toolchains")
Expand All @@ -34,8 +25,8 @@ rules_closure_toolchains()

http_archive(
name = "rules_rust",
integrity = "sha256-Zx3bP+Xrz53TTQUeynNS+68z+lO/Ye7Qt1pMNIKeVIA=",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.52.2/rules_rust-v0.52.2.tar.gz"],
integrity = "sha256-eEXiHXSGUH6qD1bdI5KXZ/B04m0wIUeoyM7pmujzbbQ=",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.55.5/rules_rust-0.55.5.tar.gz"],
)

load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
Expand Down
11 changes: 7 additions & 4 deletions dotnet/src/webdriver/Alert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@
using System;
using System.Collections.Generic;

#nullable enable

namespace OpenQA.Selenium
{
/// <summary>
/// Defines the interface through which the user can manipulate JavaScript alerts.
/// </summary>
internal class Alert : IAlert
{
private WebDriver driver;
private readonly WebDriver driver;

/// <summary>
/// Initializes a new instance of the <see cref="Alert"/> class.
Expand All @@ -41,12 +43,12 @@ public Alert(WebDriver driver)
/// <summary>
/// Gets the text of the alert.
/// </summary>
public string Text
public string? Text
{
get
{
Response commandResponse = this.driver.InternalExecute(DriverCommand.GetAlertText, null);
return commandResponse.Value.ToString();
return (string?)commandResponse.Value;
}
}

Expand All @@ -70,9 +72,10 @@ public void Accept()
/// Sends keys to the alert.
/// </summary>
/// <param name="keysToSend">The keystrokes to send.</param>
/// <exception cref="ArgumentNullException">If <paramref name="keysToSend" /> is <see langword="null"/>.</exception>
public void SendKeys(string keysToSend)
{
if (keysToSend == null)
if (keysToSend is null)
{
throw new ArgumentNullException(nameof(keysToSend), "Keys to send must not be null.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public abstract record ClipRectangle
{
public record Box(double X, double Y, double Width, double Height) : ClipRectangle;

public record Element([property: JsonPropertyName("element")] Script.SharedReference SharedReference) : ClipRectangle;
public record Element([property: JsonPropertyName("element")] Script.ISharedReference SharedReference) : ClipRectangle;
}

public record CaptureScreenshotResult(string Data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal record LocateNodesCommandParameters(BrowsingContext Context, Locator Lo

public Script.SerializationOptions? SerializationOptions { get; set; }

public IEnumerable<Script.SharedReference>? StartNodes { get; set; }
public IEnumerable<Script.ISharedReference>? StartNodes { get; set; }
}

public record LocateNodesOptions : CommandOptions
Expand All @@ -42,7 +42,7 @@ public record LocateNodesOptions : CommandOptions

public Script.SerializationOptions? SerializationOptions { get; set; }

public IEnumerable<Script.SharedReference>? StartNodes { get; set; }
public IEnumerable<Script.ISharedReference>? StartNodes { get; set; }
}

public record LocateNodesResult : IReadOnlyList<Script.RemoteValue.Node>
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/BiDi/Modules/Input/Origin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public record Viewport() : Origin;

public record Pointer() : Origin;

public record Element([property: JsonPropertyName("element")] Script.SharedReference SharedReference) : Origin
public record Element([property: JsonPropertyName("element")] Script.ISharedReference SharedReference) : Origin
{
public string Type { get; } = "element";
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <copyright file="RemoteReference.cs" company="Selenium Committers">
// <copyright file="IRemoteReference.cs" company="Selenium Committers">
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
Expand All @@ -21,14 +21,18 @@

namespace OpenQA.Selenium.BiDi.Modules.Script;

public abstract record RemoteReference : LocalValue;
public interface IRemoteReference;

public record SharedReference(string SharedId) : RemoteReference
public interface ISharedReference : IRemoteReference
{
public string SharedId { get; }

public Handle? Handle { get; set; }
}

public record RemoteObjectReference(Handle Handle) : RemoteReference
public interface IRemoteObjectReference : IRemoteReference
{
public Handle Handle { get; }

public string? SharedId { get; set; }
}
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/BiDi/Modules/Script/RemoteValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public record HtmlCollection : RemoteValue
public IReadOnlyList<RemoteValue>? Value { get; set; }
}

public record Node : RemoteValue
public record Node : RemoteValue, ISharedReference
{
[JsonInclude]
public string? SharedId { get; internal set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
namespace OpenQA.Selenium.BiDi.Modules.Session;

[JsonPolymorphic(TypeDiscriminatorPropertyName = "proxyType")]
[JsonDerivedType(typeof(Autodetect), "autodetect")]
[JsonDerivedType(typeof(AutoDetect), "autodetect")]
[JsonDerivedType(typeof(Direct), "direct")]
[JsonDerivedType(typeof(Manual), "manual")]
[JsonDerivedType(typeof(Pac), "pac")]
[JsonDerivedType(typeof(System), "system")]
public abstract record ProxyConfiguration
{
public record Autodetect : ProxyConfiguration;
public record AutoDetect : ProxyConfiguration;

public record Direct : ProxyConfiguration;

Expand All @@ -48,7 +48,7 @@ public record Manual : ProxyConfiguration
public long? SocksVersion { get; set; }
}

public record Pac(string ProxyAutoconfigUrl) : ProxyConfiguration;
public record Pac(string ProxyAutoConfigUrl) : ProxyConfiguration;

public record System : ProxyConfiguration;
}
6 changes: 2 additions & 4 deletions dotnet/src/webdriver/Cookie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,12 @@ public override string ToString()
public override bool Equals(object obj)
{
// Two cookies are equal if the name and value match
Cookie cookie = obj as Cookie;

if (this == obj)
{
return true;
}

if (cookie == null)
if (obj is not Cookie cookie)
{
return false;
}
Expand All @@ -368,7 +366,7 @@ public override bool Equals(object obj)
return false;
}

return !(this.cookieValue != null ? !this.cookieValue.Equals(cookie.cookieValue) : cookie.Value != null);
return string.Equals(this.cookieValue, cookie.cookieValue);
}

/// <summary>
Expand Down
Loading

0 comments on commit 4f873e6

Please sign in to comment.