Skip to content

Commit

Permalink
Merge branch 'trunk' into flatten-routes
Browse files Browse the repository at this point in the history
  • Loading branch information
diemol committed May 3, 2024
2 parents 11a8093 + 17d927b commit f9c040d
Show file tree
Hide file tree
Showing 25 changed files with 258 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .bazelrc.remote
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
2 changes: 1 addition & 1 deletion .bazelversion
@@ -1 +1 @@
7.1.0
7.1.1
5 changes: 0 additions & 5 deletions .github/workflows/ci-ruby.yml
Expand Up @@ -87,11 +87,6 @@ jobs:
os: ubuntu
- browser: safari
os: windows
# TODO: Investigate why they are timing out
- browser: chrome
os: windows
- browser: edge
os: windows
with:
name: Local Tests (${{ matrix.browser }}, ${{ matrix.os }})
browser: ${{ matrix.browser }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -125,6 +125,7 @@ bazel-genfiles
bazel-out
bazel-selenium
bazel-testlogs
MODULE.bazel.lock

/.vscode/
/.scannerwork/
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Expand Up @@ -12,7 +12,7 @@ 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 = "rules_jvm_external", version = "6.0")
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")
Expand Down
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -370,7 +370,6 @@ Supported browsers:
* `safari-preview`

In addition to the [Common Options Examples](#common-options-examples), here are some additional Ruby specific ones:
* `--test_arg "-tfocus"` - test only [focused specs](https://relishapp.com/rspec/rspec-core/v/3-12/docs/filtering/inclusion-filters)
* `--test_arg "-eTimeouts"` - test only specs which name include "Timeouts"
* `--test_arg "<any other RSpec argument>"` - pass any extra RSpec arguments (see `bazel run @bundle//bin:rspec -- --help`)

Expand Down
8 changes: 4 additions & 4 deletions common/repositories.bzl
Expand Up @@ -50,8 +50,8 @@ js_library(

http_archive(
name = "linux_beta_firefox",
url = "https://ftp.mozilla.org/pub/firefox/releases/126.0b7/linux-x86_64/en-US/firefox-126.0b7.tar.bz2",
sha256 = "a7bd26d05857ffb08e46af9016973c74d16be806025a6329bb843dffde0672f9",
url = "https://ftp.mozilla.org/pub/firefox/releases/126.0b8/linux-x86_64/en-US/firefox-126.0b8.tar.bz2",
sha256 = "75198959b1eeedc81be229ad3066ee6d49ecde985ce5d5d11d61f0914e288517",
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.0b7/mac/en-US/Firefox%20126.0b7.dmg",
sha256 = "f98f772c94addfb05f2c1abe851938b2f806794af0104c73d51445132fa0855c",
url = "https://ftp.mozilla.org/pub/firefox/releases/126.0b8/mac/en-US/Firefox%20126.0b8.dmg",
sha256 = "ca247dbfa1b092f36c75ab785acb0c54e608545b76dc06fbac9a9034df0daf8a",
build_file_content = """
load("@aspect_rules_js//js:defs.bzl", "js_library")
package(default_visibility = ["//visibility:public"])
Expand Down
14 changes: 14 additions & 0 deletions common/src/web/select_space.html
@@ -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>
7 changes: 5 additions & 2 deletions java/src/org/openqa/selenium/chromium/ChromiumDriver.java
Expand Up @@ -347,13 +347,16 @@ public Optional<DevTools> maybeGetDevTools() {
}

private Optional<BiDi> createBiDi(Optional<URI> biDiUri) {
if (!biDiUri.isPresent()) {
if (biDiUri.isEmpty()) {
return Optional.empty();
}

URI wsUri =
biDiUri.orElseThrow(
() -> new BiDiException("This version of Chromium driver does not support BiDi"));
() ->
new BiDiException(
"Check if this browser version supports BiDi and if the 'webSocketUrl: true'"
+ " capability is set."));

HttpClient.Factory clientFactory = HttpClient.Factory.createDefault();
ClientConfig wsConfig = ClientConfig.defaultConfig().baseUri(wsUri);
Expand Down
12 changes: 8 additions & 4 deletions java/src/org/openqa/selenium/firefox/FirefoxDriver.java
Expand Up @@ -354,14 +354,16 @@ public DevTools getDevTools() {
}

private Optional<BiDi> createBiDi(Optional<URI> biDiUri) {
if (!biDiUri.isPresent()) {
if (biDiUri.isEmpty()) {
return Optional.empty();
}

URI wsUri =
biDiUri.orElseThrow(
() ->
new BiDiException("This version of Firefox or geckodriver does not support BiDi"));
new BiDiException(
"Check if this browser version supports BiDi and if the 'webSocketUrl: true'"
+ " capability is set."));

HttpClient.Factory clientFactory = HttpClient.Factory.createDefault();
ClientConfig wsConfig = ClientConfig.defaultConfig().baseUri(wsUri);
Expand All @@ -380,8 +382,10 @@ public Optional<BiDi> maybeGetBiDi() {

@Override
public BiDi getBiDi() {
if (!biDiUri.isPresent()) {
throw new BiDiException("This version of Firefox or geckodriver does not support Bidi");
if (biDiUri.isEmpty()) {
throw new BiDiException(
"Check if this browser version supports BiDi and if the 'webSocketUrl: true' capability"
+ " is set.");
}

return maybeGetBiDi()
Expand Down
Expand Up @@ -33,6 +33,7 @@
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream;
import org.openqa.selenium.Capabilities;
Expand Down Expand Up @@ -329,10 +330,11 @@ private Capabilities setBrowserBinary(Capabilities options, String browserPath)
.setCapability(vendorOptionsCapability, vendorOptions)
.setCapability("browserVersion", null);
} catch (Exception e) {
LOG.warning(
LOG.log(
Level.WARNING,
String.format(
"Exception while setting the browser binary path. %s: %s",
options, e.getMessage()));
"Exception while setting the browser binary path. Options: %s", options),
e);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion javascript/grid-ui/BUILD.bazel
Expand Up @@ -33,7 +33,6 @@ SRCS = glob(
exclude = [
"src/simple.ts",
"src/**/*.test.tsx",
# "src/assets/**/*",
],
)

Expand All @@ -54,7 +53,9 @@ DEPS = [
ts_project(
name = "transpile_ts",
srcs = SRCS,
allow_js = True,
assets = glob(["src/assets/**/*"]),
resolve_json_module = True,
tsconfig = "tsconfig.json",
deps = DEPS,
)
Expand Down
2 changes: 1 addition & 1 deletion javascript/grid-ui/tsconfig.json
Expand Up @@ -22,7 +22,7 @@
"types": [
"@types/node"
],
"sourceMap": false,
"sourceMap": false
},
"include": [
"src"
Expand Down
90 changes: 57 additions & 33 deletions javascript/node/selenium-webdriver/BUILD.bazel
@@ -1,4 +1,5 @@
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@npm//javascript/node/selenium-webdriver:eslint/package_json.bzl", eslint_bin = "bin")
Expand All @@ -18,31 +19,35 @@ BROWSER_VERSIONS = [
"v124",
]

SRC_FILES = [
"CHANGES.md",
"README.md",
"package.json",
] + glob([
"*.js",
"example/*.js",
"http/*.js",
"io/*.js",
"lib/*.js",
"net/*.js",
"remote/*.js",
"testing/*.js",
"devtools/*.js",
"common/*.js",
"bidi/*.js",
])
js_library(
name = "prod-src-files",
srcs = [
"CHANGES.md",
"README.md",
"package.json",
] + glob([
"*.js",
"example/*.js",
"http/*.js",
"io/*.js",
"lib/*.js",
"net/*.js",
"remote/*.js",
"testing/*.js",
"devtools/*.js",
"common/*.js",
"bidi/*.js",
]),
)

npm_package(
name = "selenium-webdriver",
srcs = SRC_FILES + [
srcs = [
":license",
":manager-linux",
":manager-macos",
":manager-windows",
":prod-src-files",
"//javascript/node/selenium-webdriver/lib/atoms:find-elements",
"//javascript/node/selenium-webdriver/lib/atoms:get_attribute",
"//javascript/node/selenium-webdriver/lib/atoms:is_displayed",
Expand All @@ -64,8 +69,6 @@ pkg_tar(
strip_prefix = "selenium-webdriver",
)

#TEST_FILES = glob(["test/**/*_test.js"])
#
SMALL_TESTS = [
"test/io/io_test.js",
"test/io/zip_test.js",
Expand All @@ -83,17 +86,30 @@ SMALL_TESTS = [
"test/net/portprober_test.js",
]

LARGE_TESTS = glob(
["test/**/*_test.js"],
exclude = SMALL_TESTS,
js_library(
name = "small-test-srcs",
srcs = SMALL_TESTS,
)

TEST_DATA = SRC_FILES + glob(
[
"lib/test/**",
"test/**",
],
exclude = LARGE_TESTS + SMALL_TESTS,
js_library(
name = "large-test-srcs",
srcs = glob(
["test/**/*_test.js"],
exclude = SMALL_TESTS,
),
)

js_library(
name = "test-data",
srcs = glob(
[
"lib/test/**",
"test/**",
],
exclude = [
"test/**/*_test.js",
],
),
)

mocha_test(
Expand All @@ -108,14 +124,16 @@ mocha_test(
":node_modules/sinon",
":node_modules/tmp",
":node_modules/ws",
":small-test-srcs",
":test-data",
"//:node_modules/selenium-webdriver",
"//common/extensions:js-lib",
"//common/src/web:js-lib",
"//javascript/node/selenium-webdriver/lib/atoms:find-elements",
"//javascript/node/selenium-webdriver/lib/atoms:get_attribute",
"//javascript/node/selenium-webdriver/lib/atoms:is_displayed",
"//javascript/node/selenium-webdriver/lib/atoms:mutation-listener",
] + SMALL_TESTS + TEST_DATA,
],
tags = [
"skip-remote",
],
Expand All @@ -127,7 +145,9 @@ mocha_test(
size = "large",
args = ["--retries 1"],
chdir = package_name(),
data = LARGE_TESTS + TEST_DATA + [
data = [
"test-data",
":large-test-srcs",
":node_modules/@bazel/runfiles",
":node_modules/express",
":node_modules/jszip",
Expand Down Expand Up @@ -198,7 +218,7 @@ copy_to_bin(
eslint_bin.eslint_test(
name = "eslint-test",
chdir = package_name(),
data = SRC_FILES + [
data = [
":eslint-config",
":node_modules/@eslint/js",
":node_modules/eslint-plugin-mocha",
Expand All @@ -211,6 +231,7 @@ eslint_bin.eslint_test(
":node_modules/tmp",
":node_modules/ws",
":package-json",
":prod-src-files",
],
tags = [
"lint",
Expand All @@ -231,9 +252,12 @@ prettier_bin.prettier_test(
"--config=.prettierrc",
],
chdir = package_name(),
data = SRC_FILES + SMALL_TESTS + LARGE_TESTS + [
data = [
":large-test-srcs",
":prettier-config",
":prettier-ignore",
":prod-src-files",
":small-test-srcs",
],
tags = [
"lint",
Expand Down

0 comments on commit f9c040d

Please sign in to comment.