Skip to content

Commit

Permalink
Merge branch 'trunk' into dotnet-ff-options-binary-location
Browse files Browse the repository at this point in the history
  • Loading branch information
nvborisenko authored May 15, 2024
2 parents cd95b83 + cf5234d commit 2ba835d
Show file tree
Hide file tree
Showing 70 changed files with 693 additions and 254 deletions.
2 changes: 1 addition & 1 deletion .bazelrc.remote
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test:remote --test_env=PATH=/bin:/usr/bin:/usr/local/bin
test:remote --test_env=HOME=/home/dev

# Make sure we sniff credentials properly
build:remote --credential_helper=%workspace%/scripts/credential-helper.sh
build:remote --credential_helper=gypsum.cluster.engflow.com=%workspace%/scripts/credential-helper.sh

# Use pinned browsers when running remotely
build:remote --//common:pin_browsers
Expand Down
11 changes: 10 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ use_repo(pip, "py_dev_requirements")

register_toolchains("@pythons_hub//:all")

# https://github.com/bazelbuild/rules_jvm_external/pull/1079
archive_override(
module_name = "rules_jvm_external",
integrity = "sha256-yS8Qes1PLbYbe10b1WSgl0Auqn/1Wlxg8O3wSr7a/Sg=",
patch_strip = 1,
patches = ["//java:rules_jvm_external_javadoc.patch"],
strip_prefix = "rules_jvm_external-f572a26116c7ef71d8842dd056c2605782f7be8d",
urls = ["https://github.com/bazelbuild/rules_jvm_external/archive/f572a26116c7ef71d8842dd056c2605782f7be8d.tar.gz"],
)

java_toolchains = use_extension("@rules_java//java:extensions.bzl", "toolchains")
use_repo(
java_toolchains,
Expand Down Expand Up @@ -194,7 +204,6 @@ 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.11.0",
"org.mockito:mockito-inline:5.2.0",
"org.redisson:redisson:3.29.0",
"org.slf4j:slf4j-api:2.0.13",
"org.slf4j:slf4j-jdk14:2.0.13",
Expand Down
42 changes: 21 additions & 21 deletions common/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ js_library(

http_archive(
name = "linux_beta_firefox",
url = "https://ftp.mozilla.org/pub/firefox/releases/126.0b8/linux-x86_64/en-US/firefox-126.0b8.tar.bz2",
sha256 = "75198959b1eeedc81be229ad3066ee6d49ecde985ce5d5d11d61f0914e288517",
url = "https://ftp.mozilla.org/pub/firefox/releases/126.0b9/linux-x86_64/en-US/firefox-126.0b9.tar.bz2",
sha256 = "053e60089c6ab85507dca96ad8c9d32e3fc6d21ac5bdf7e616c673327804565f",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])
Expand All @@ -72,8 +72,8 @@ js_library(

dmg_archive(
name = "mac_beta_firefox",
url = "https://ftp.mozilla.org/pub/firefox/releases/126.0b8/mac/en-US/Firefox%20126.0b8.dmg",
sha256 = "ca247dbfa1b092f36c75ab785acb0c54e608545b76dc06fbac9a9034df0daf8a",
url = "https://ftp.mozilla.org/pub/firefox/releases/126.0b9/mac/en-US/Firefox%20126.0b9.dmg",
sha256 = "67806b532db26059fbe747ec3fc2f6306d9bb4b09e1b264c49461c4d613b5366",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])
Expand Down Expand Up @@ -123,10 +123,10 @@ js_library(

pkg_archive(
name = "mac_edge",
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/8325266a-e5ef-4b92-b110-6e387417723c/MicrosoftEdge-124.0.2478.67.pkg",
sha256 = "4c79de91852bda6a779761d06cfa00d48ae4f08dfe3903543f3674b973bd780b",
url = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/f12b802a-7a08-47df-b40e-04570cf4e133/MicrosoftEdge-124.0.2478.97.pkg",
sha256 = "a1c9df556e158a2564e3f8238082ea724ea4a2585b4b543376d0f0e4bc389749",
move = {
"MicrosoftEdge-124.0.2478.67.pkg/Payload/Microsoft Edge.app": "Edge.app",
"MicrosoftEdge-124.0.2478.97.pkg/Payload/Microsoft Edge.app": "Edge.app",
},
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
Expand All @@ -143,8 +143,8 @@ js_library(

deb_archive(
name = "linux_edge",
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_124.0.2478.67-1_amd64.deb",
sha256 = "3d12f66a279b0a82b478625696f23e1ac935e0596d57e19a41da232ee0c58a65",
url = "https://packages.microsoft.com/repos/edge/pool/main/m/microsoft-edge-stable/microsoft-edge-stable_124.0.2478.97-1_amd64.deb",
sha256 = "85d0ad1d63847b3dd54f0f214d18a2b54462bb43291536e773ad1b8b29bbf799",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])
Expand All @@ -165,8 +165,8 @@ js_library(

http_archive(
name = "linux_edgedriver",
url = "https://msedgedriver.azureedge.net/124.0.2478.67/edgedriver_linux64.zip",
sha256 = "25a169807beb4fc2485cf601f04c76cfffcc2c1e23a875941bc8aa41bee0587c",
url = "https://msedgedriver.azureedge.net/124.0.2478.97/edgedriver_linux64.zip",
sha256 = "b8c2b6c20c1669240ef601939a3097f3b704d062215ee5bd98cb6415f5a7c907",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])
Expand All @@ -182,8 +182,8 @@ js_library(

http_archive(
name = "mac_edgedriver",
url = "https://msedgedriver.azureedge.net/124.0.2478.67/edgedriver_mac64.zip",
sha256 = "571d910bc662e2dfcf10e47cf40d11f76568b893abbde877f2beb487693ed983",
url = "https://msedgedriver.azureedge.net/124.0.2478.97/edgedriver_mac64.zip",
sha256 = "8c70da916d7a040a90949a6dcb9c4bf9717d5d7daffeb7a4ca9304327c3ad199",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])
Expand All @@ -199,8 +199,8 @@ js_library(

http_archive(
name = "linux_chrome",
url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.91/linux64/chrome-linux64.zip",
sha256 = "035b3bce9748423b3d0c3f74fc6ff0f1a5b29a6454eff74565bab10af7397b75",
url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.207/linux64/chrome-linux64.zip",
sha256 = "22ac5d13b0bcbe1e7a454714421ab2448f8f8568ad3954cb4a87750bd70336c2",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])
Expand All @@ -221,8 +221,8 @@ js_library(

http_archive(
name = "mac_chrome",
url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.91/mac-x64/chrome-mac-x64.zip",
sha256 = "729da107fadce00d7d1f60347a9e5276f6fdec5d0131a7f551d3297261ed1dd8",
url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.207/mac-x64/chrome-mac-x64.zip",
sha256 = "67d8b832c49c0afc96f2b3f3480acae270293f097c162ef2805cead51694b870",
strip_prefix = "chrome-mac-x64",
patch_cmds = [
"mv 'Google Chrome for Testing.app' Chrome.app",
Expand All @@ -243,8 +243,8 @@ js_library(

http_archive(
name = "linux_chromedriver",
url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.91/linux64/chromedriver-linux64.zip",
sha256 = "c70691361eec965c8d6aaf3e68b0190d0dee0e0d3a72edca62a734d8b58f4b2c",
url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.207/linux64/chromedriver-linux64.zip",
sha256 = "c428b34691e071e9eddc3fed3012be0ad5e2c2d4dd1fad5f8dad6ef10c840820",
strip_prefix = "chromedriver-linux64",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
Expand All @@ -261,8 +261,8 @@ js_library(

http_archive(
name = "mac_chromedriver",
url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.91/mac-x64/chromedriver-mac-x64.zip",
sha256 = "44638284ae0986b15481563fe58aa01342852d197a6bb5f6965c3565f8623d76",
url = "https://storage.googleapis.com/chrome-for-testing-public/124.0.6367.207/mac-x64/chromedriver-mac-x64.zip",
sha256 = "d34e7cda39e5024564a85b329599d359f1e1e53264cfe9bd5bc4025d829eadfa",
strip_prefix = "chromedriver-mac-x64",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
Expand Down
14 changes: 14 additions & 0 deletions common/src/web/select_space.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Multiple Selection test page</title>
</head>
<body>
<select id="selectWithoutMultiple">
<option value="one">one</option>
<option value="two">&nbsp;&nbsp;two</option>
<option value="three">&nbsp;&nbsp;&nbsp;three</option>
<option value="four">&nbsp;&nbsp;&nbsp;&nbsp;four</option>
<option value="five">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;five</option>
</body>
</html>
16 changes: 14 additions & 2 deletions dotnet/src/webdriver/Internal/Logging/FileLogHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ public class FileLogHandler : ILogHandler, IDisposable
/// </summary>
/// <param name="filePath">The path of the log file.</param>
public FileLogHandler(string filePath)
: this(filePath, overwrite: true)
{

}

/// <summary>
/// Initializes a new instance of the <see cref="FileLogHandler"/> class with the specified file path.
/// </summary>
/// <param name="filePath">The path of the log file.</param>
/// <param name="overwrite">Specifies whether the file should be overwritten if it exists on the disk.</param>
public FileLogHandler(string filePath, bool overwrite)
{
if (string.IsNullOrEmpty(filePath)) throw new ArgumentException("File log path cannot be null or empty.", nameof(filePath));

Expand All @@ -31,8 +42,9 @@ public FileLogHandler(string filePath)
Directory.CreateDirectory(directory);
}

_fileStream = File.Open(filePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read);
_fileStream.Seek(0, SeekOrigin.End);
var fileMode = overwrite ? FileMode.Create : FileMode.Append;

_fileStream = File.Open(filePath, fileMode, FileAccess.Write, FileShare.Read);
_streamWriter = new StreamWriter(_fileStream, System.Text.Encoding.UTF8)
{
AutoFlush = true
Expand Down
91 changes: 91 additions & 0 deletions dotnet/test/common/Internal/Logging/FileLogHandlerTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using NUnit.Framework;
using System;
using System.IO;
using System.Text.RegularExpressions;

namespace OpenQA.Selenium.Internal.Logging
{
Expand Down Expand Up @@ -34,5 +35,95 @@ public void ShouldHandleLogEvent()
File.Delete(tempFile);
}
}

[Test]
public void ShouldCreateFileIfDoesNotExist()
{
var tempFile = Path.GetTempFileName();

try
{
using (var fileLogHandler = new FileLogHandler(tempFile))
{
fileLogHandler.Handle(new LogEvent(typeof(FileLogHandlerTest), DateTimeOffset.Now, LogEventLevel.Info, "test message"));
}

using (var fileLogHandler2 = new FileLogHandler(tempFile))
{
fileLogHandler2.Handle(new LogEvent(typeof(FileLogHandlerTest), DateTimeOffset.Now, LogEventLevel.Info, "test message"));
}

Assert.That(Regex.Matches(File.ReadAllText(tempFile), "test message").Count, Is.EqualTo(1));
}
finally
{
File.Delete(tempFile);
}
}

[Test]
public void ShouldAppendFileIfExists()
{
var tempFilePath = Path.GetTempPath() + "somefile.log";

try
{
using (var fileLogHandler = new FileLogHandler(tempFilePath))
{
fileLogHandler.Handle(new LogEvent(typeof(FileLogHandlerTest), DateTimeOffset.Now, LogEventLevel.Info, "test message"));
}

using (var fileLogHandler2 = new FileLogHandler(tempFilePath, overwrite: false))
{
fileLogHandler2.Handle(new LogEvent(typeof(FileLogHandlerTest), DateTimeOffset.Now, LogEventLevel.Info, "test message"));
}

Assert.That(Regex.Matches(File.ReadAllText(tempFilePath), "test message").Count, Is.EqualTo(2));
}
finally
{
File.Delete(tempFilePath);
}
}

[Test]
public void ShouldOverwriteFileIfExists()
{
var tempFile = Path.GetTempFileName();

try
{
using (var fileLogHandler = new FileLogHandler(tempFile, overwrite: true))
{
fileLogHandler.Handle(new LogEvent(typeof(FileLogHandlerTest), DateTimeOffset.Now, LogEventLevel.Info, "test message"));
}

Assert.That(Regex.Matches(File.ReadAllText(tempFile), "test message").Count, Is.EqualTo(1));
}
finally
{
File.Delete(tempFile);
}
}

[Test]
public void ShouldAppendFileIfDoesNotExist()
{
var tempFilePath = Path.GetTempPath() + "somefile.log";

try
{
using (var fileLogHandler = new FileLogHandler(tempFilePath, overwrite: true))
{
fileLogHandler.Handle(new LogEvent(typeof(FileLogHandlerTest), DateTimeOffset.Now, LogEventLevel.Info, "test message"));
}

Assert.That(Regex.Matches(File.ReadAllText(tempFilePath), "test message").Count, Is.EqualTo(1));
}
finally
{
File.Delete(tempFilePath);
}
}
}
}
16 changes: 2 additions & 14 deletions java/maven_install.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL",
"__INPUT_ARTIFACTS_HASH": 1731569326,
"__RESOLVED_ARTIFACTS_HASH": -177292306,
"__INPUT_ARTIFACTS_HASH": 804245233,
"__RESOLVED_ARTIFACTS_HASH": 375527245,
"conflict_resolution": {
"com.google.code.gson:gson:2.8.9": "com.google.code.gson:gson:2.10.1",
"com.google.errorprone:error_prone_annotations:2.3.2": "com.google.errorprone:error_prone_annotations:2.26.1",
Expand Down Expand Up @@ -710,13 +710,6 @@
},
"version": "5.11.0"
},
"org.mockito:mockito-inline": {
"shasums": {
"jar": "ee52e1c299a632184fba274a9370993e09140429f5e516e6c5570fd6574b297f",
"sources": "ee52e1c299a632184fba274a9370993e09140429f5e516e6c5570fd6574b297f"
},
"version": "5.2.0"
},
"org.objenesis:objenesis": {
"shasums": {
"jar": "02dfd0b0439a5591e35b708ed2f5474eb0948f53abf74637e959b8e4ef69bfeb",
Expand Down Expand Up @@ -1114,9 +1107,6 @@
"net.bytebuddy:byte-buddy-agent",
"org.objenesis:objenesis"
],
"org.mockito:mockito-inline": [
"org.mockito:mockito-core"
],
"org.ow2.asm:asm-analysis": [
"org.ow2.asm:asm-tree"
],
Expand Down Expand Up @@ -3153,8 +3143,6 @@
"org.junit.platform:junit-platform-reporting:jar:sources",
"org.mockito:mockito-core",
"org.mockito:mockito-core:jar:sources",
"org.mockito:mockito-inline",
"org.mockito:mockito-inline:jar:sources",
"org.objenesis:objenesis",
"org.objenesis:objenesis:jar:sources",
"org.opentest4j:opentest4j",
Expand Down
7 changes: 4 additions & 3 deletions java/src/org/openqa/selenium/Cookie.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Date;
import java.util.Map;
import java.util.Objects;
import java.util.TimeZone;
import java.util.TreeMap;

public class Cookie implements Serializable {
Expand Down Expand Up @@ -255,12 +256,12 @@ public Map<String, Object> toJson() {

@Override
public String toString() {
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
return name
+ "="
+ value
+ (expiry == null
? ""
: "; expires=" + new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss z").format(expiry))
+ (expiry == null ? "" : "; expires=" + sdf.format(expiry))
+ ("".equals(path) ? "" : "; path=" + path)
+ (domain == null ? "" : "; domain=" + domain)
+ (isSecure ? ";secure;" : "")
Expand Down
2 changes: 1 addition & 1 deletion java/src/org/openqa/selenium/bidi/network/FetchError.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private FetchError(BaseParameters baseParameters, String errorText) {

public static FetchError fromJsonMap(Map<String, Object> jsonMap) {
try (StringReader baseParameterReader = new StringReader(JSON.toJson(jsonMap));
JsonInput baseParamsInput = JSON.newInput(baseParameterReader); ) {
JsonInput baseParamsInput = JSON.newInput(baseParameterReader)) {
String errorText = JSON.toJson(jsonMap.get("errorText"));
return new FetchError(BaseParameters.fromJson(baseParamsInput), errorText);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public interface EvaluateResult {

String getRealmId();

public enum Type {
enum Type {
SUCCESS("success"),
EXCEPTION("exception");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class SerializationOptions {
public enum IncludeShadowTree {
NONE,
OPEN,
ALL;
ALL
}

private Optional<Long> maxDomDepth = Optional.empty();
Expand Down
Loading

0 comments on commit 2ba835d

Please sign in to comment.