Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/ci-ruby.yml
Original file line number Diff line number Diff line change
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
12 changes: 1 addition & 11 deletions 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.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 Expand Up @@ -124,16 +124,6 @@ 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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
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
3 changes: 2 additions & 1 deletion rb/lib/selenium/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def download_server(uri, destination)
def initialize(jar, opts = {})
raise Errno::ENOENT, jar unless File.exist?(jar)

@java = opts.fetch(:java, 'java')
@jar = jar
@host = '127.0.0.1'
@role = opts.fetch(:role, 'standalone')
Expand Down Expand Up @@ -241,7 +242,7 @@ def process
# extract any additional_args that start with -D as options
properties = @additional_args.dup - @additional_args.delete_if { |arg| arg[/^-D/] }
args = ['-jar', @jar, @role, '--port', @port.to_s]
server_command = ['java'] + properties + args + @additional_args
server_command = [@java] + properties + args + @additional_args
cp = WebDriver::ChildProcess.build(*server_command)

if @log.is_a?(String)
Expand Down
9 changes: 9 additions & 0 deletions rb/spec/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,12 @@ rb_library(
"//rb/spec/unit/selenium/webdriver/support:select",
],
)

genrule(
name = "java-location",
srcs = [],
outs = ["java-location"],
cmd = "echo $(JAVA) > $@",
toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
visibility = ["//rb/spec:__subpackages__"],
)
4 changes: 3 additions & 1 deletion rb/spec/integration/selenium/webdriver/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
GlobalTestEnv.quit_driver
end

c.filter_run focus: true if ENV['focus']
c.filter_run_when_matching :focus
c.run_all_when_everything_filtered = true
c.default_formatter = c.files_to_run.count > 1 ? 'progress' : 'doc'

c.before do |example|
guards = WebDriver::Support::Guards.new(example, bug_tracker: 'https://github.com/SeleniumHQ/selenium/issues')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def app_server
def remote_server
@remote_server ||= Selenium::Server.new(
remote_server_jar,
java: bazel_java,
port: random_port,
log_level: WebDriver.logger.debug? && 'FINE',
background: true,
Expand All @@ -95,6 +96,12 @@ def remote_server
)
end

def bazel_java
return unless ENV.key?('WD_BAZEL_JAVA_LOCATION')

File.expand_path(File.read(File.expand_path(ENV.fetch('WD_BAZEL_JAVA_LOCATION'))).chomp)
end

def reset_remote_server
@remote_server&.stop
@remote_server = nil
Expand Down Expand Up @@ -243,15 +250,13 @@ def safari_preview_driver(**opts)
def chrome_options(args: [], **opts)
opts[:binary] ||= ENV['CHROME_BINARY'] if ENV.key?('CHROME_BINARY')
args << '--headless=chrome' if ENV['HEADLESS']
args << '--no-sandbox'
args << '--disable-gpu'
WebDriver::Options.chrome(browser_version: 'stable', args: args, **opts)
end

def edge_options(args: [], **opts)
opts[:binary] ||= ENV['EDGE_BINARY'] if ENV.key?('EDGE_BINARY')
args << '--headless=chrome' if ENV['HEADLESS']
args << '--no-sandbox'
args << '--disable-gpu'
WebDriver::Options.edge(browser_version: 'stable', args: args, **opts)
end
Expand Down
3 changes: 1 addition & 2 deletions rb/spec/integration/selenium/webdriver/window_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ module WebDriver
expect(new_size.height).to be > old_size.height
end

it 'can minimize the window', except: [{browser: %i[chrome edge], headless: true},
{browser: :safari, ci: :github}],
it 'can minimize the window', except: [{browser: %i[chrome edge], headless: true}],
flaky: {browser: :chrome, platform: %i[macosx linux], ci: :github} do
window.minimize
expect {
Expand Down
7 changes: 6 additions & 1 deletion rb/spec/tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,13 @@ def rb_integration_test(name, srcs, deps = [], data = [], browsers = BROWSERS.ke
data = BROWSERS[browser]["data"] + data + [
"//common/src/web",
"//java/src/org/openqa/selenium/grid:selenium_server_deploy.jar",
"//rb/spec:java-location",
"@bazel_tools//tools/jdk:current_java_runtime",
],
env = BROWSERS[browser]["env"] | {"WD_SPEC_DRIVER": "remote"},
env = BROWSERS[browser]["env"] | {
"WD_SPEC_DRIVER": "remote",
"WD_BAZEL_JAVA_LOCATION": "$(rootpath //rb/spec:java-location)",
},
main = "@bundle//bin:rspec",
tags = COMMON_TAGS + BROWSERS[browser]["tags"] + tags + [
"{}-remote".format(browser),
Expand Down
4 changes: 3 additions & 1 deletion rb/spec/unit/selenium/webdriver/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ def with_env(hash)

c.include Selenium::WebDriver::UnitSpecHelper

c.filter_run focus: true if ENV['focus']
c.filter_run_when_matching :focus
c.run_all_when_everything_filtered = true
c.default_formatter = c.files_to_run.count > 1 ? 'progress' : 'doc'

c.before do
# https://github.com/ruby/debug/issues/797
Expand Down