Skip to content
Open
Show file tree
Hide file tree
Changes from 9 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
50 changes: 24 additions & 26 deletions .github/workflows/ci-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
os: windows
- ruby-version: 3.2.8
os: macos
- ruby-version: 3.4.3
- ruby-version: 4.0.0-preview3
os: ubuntu
- ruby-version: jruby-10.0.0.0
- ruby-version: jruby-10.0.2.0
os: ubuntu
- ruby-version: truffleruby-24.2.1
- ruby-version: truffleruby-25.0.0
os: ubuntu
with:
name: Unit Tests (${{ matrix.ruby-version }}, ${{ matrix.os }})
Expand All @@ -55,59 +55,57 @@
//rb/spec/...
integration-tests-local:
name: Local Tests
name: Integration Tests
needs: build
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
matrix:
browser:
- chrome
- edge
- firefox
os:
- windows
- macos
exclude:
- browser: edge
os: macos
browser: ['chrome', 'edge', 'firefox']
os: ['windows']
include:
- browser: edge-remote
os: windows
java-version: 17
with:
name: Local Tests (${{ matrix.browser }}, ${{ matrix.os }})
name: Integration (${{ matrix.browser }}, ${{ matrix.os }})
browser: ${{ matrix.browser }}
cache-key: rb-${{ matrix.browser }}-${{ matrix.os }}-test
java-version: ${{ matrix.java-version }}
os: ${{ matrix.os }}
run: >
bazel test
--keep_going
--build_tests_only
--flaky_test_attempts 3
--local_test_jobs 1
--test_size_filters large
--test_tag_filters ${{ matrix.browser }}
//rb/spec/...
integration-tests-remote:
name: Remote Tests
selenium-manager-tests:
name: Selenium Manager Tests
needs: build
uses: ./.github/workflows/bazel.yml
strategy:
fail-fast: false
matrix:
include:
- browser: edge
os: macos
os:
- windows
- macos
- ubuntu
with:
name: Remote Tests (${{ matrix.browser }}, ${{ matrix.os }})
browser: ${{ matrix.browser }}
cache-key: rb-remote-${{ matrix.browser }}-${{ matrix.os }}-test
name: Manager Tests ${{ matrix.os }})
cache-key: rb-manager-${{ matrix.os }}-test
os: ${{ matrix.os }}
java-version: 17
run: >
bazel test
--keep_going
--build_tests_only
--flaky_test_attempts 3
--local_test_jobs 1
--test_size_filters large
--test_tag_filters ${{ matrix.browser }}-remote
--test_size_filters medium
--pin_browsers=false
--test_env=SE_FORCE_BROWSER_DOWNLOAD=true
--test_env=SE_SKIP_DRIVER_IN_PATH=true
//rb/spec/...
8 changes: 0 additions & 8 deletions .skipped-tests
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@
-//javascript/selenium-webdriver:test-builder-test.js-chrome
-//javascript/selenium-webdriver:test-chrome-devtools-test.js-chrome
-//javascript/selenium-webdriver:test-firefox-options-test.js-firefox
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome
-//rb/spec/integration/selenium/webdriver/chrome:service-chrome-remote
-//rb/spec/integration/selenium/webdriver/edge:service-edge
-//rb/spec/integration/selenium/webdriver/edge:service-edge-remote
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-beta-remote
-//rb/spec/integration/selenium/webdriver/firefox:service-firefox-remote
-//rb/spec/integration/selenium/webdriver/remote:driver-chrome-remote
-//rb/spec/integration/selenium/webdriver/remote:driver-edge-remote
-//rb/spec/integration/selenium/webdriver/remote:driver-firefox-beta-remote
Expand Down
2 changes: 1 addition & 1 deletion rb/sig/lib/selenium/webdriver/common/options.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module Selenium

attr_accessor options: Hash[String | Symbol, String | Numeric | bool?]

def initialize: (Hash[String | Symbol, String | Numeric | bool] opts) -> void
def initialize: ?(Hash[String | Symbol, String | Numeric | bool] opts) -> void

def add_option: (String | Symbol name, String | Numeric | bool? value) -> (String | Numeric | bool)?

Expand Down
2 changes: 1 addition & 1 deletion rb/sig/lib/selenium/webdriver/support/guards.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module Selenium

def initialize: (untyped example, ?bug_tracker: String, ?conditions: untyped?) -> void

def add_condition: (untyped name, ?untyped? condition) { () -> untyped } -> untyped
def add_condition: (untyped name, ?untyped? condition) ?{ () -> untyped } -> untyped

def add_message: (untyped name, untyped message) -> untyped

Expand Down
15 changes: 14 additions & 1 deletion rb/spec/integration/selenium/webdriver/chrome/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,18 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
],
data = ["//common/extensions"],
)
for file in glob(["*_spec.rb"])
for file in glob(
["*_spec.rb"],
exclude = ["service_spec.rb"],
)
]

rb_integration_test(
name = "service",
srcs = ["service_spec.rb"],
browsers = [
"chrome",
"chrome-beta",
],
tags = ["manager"],
)
16 changes: 11 additions & 5 deletions rb/spec/integration/selenium/webdriver/chrome/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@ module Chrome
exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :chrome}]} do
let(:service) { described_class.new }
let(:service_manager) { service.launch }
let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium' }

after { service_manager.stop }

it 'auto uses chromedriver' do
service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path
it 'selenium manager gets browser and driver', exclusive: {manager: true} do
driver_finder = DriverFinder.new(Options.new, service)
driver_path = driver_finder.driver_path
browser_path = driver_finder.browser_path

expect(service_manager.uri).to be_a(URI)
end
expect { Platform.assert_executable(driver_path) }.not_to raise_error
expect { Platform.assert_executable(browser_path) }.not_to raise_error
expect(browser_path).to include(cache_dir)
expect(driver_path).to include(cache_dir)

service.executable_path = driver_path

it 'can be started outside driver' do
expect(service_manager.uri).to be_a(URI)
end
end
Expand Down
12 changes: 11 additions & 1 deletion rb/spec/integration/selenium/webdriver/edge/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,15 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
srcs = [file],
browsers = ["edge"], # No need to run in other browsers.
)
for file in glob(["*_spec.rb"])
for file in glob(
["*_spec.rb"],
exclude = ["service_spec.rb"],
)
]

rb_integration_test(
name = "service",
srcs = ["service_spec.rb"],
browsers = ["edge"],
tags = ["manager"],
)
16 changes: 11 additions & 5 deletions rb/spec/integration/selenium/webdriver/edge/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@ module Edge
exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :edge}]} do
let(:service) { described_class.new }
let(:service_manager) { service.launch }
let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium' }

after { service_manager.stop }

it 'auto uses edgedriver' do
service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path
it 'selenium manager gets browser and driver', exclusive: {manager: true} do
driver_finder = DriverFinder.new(Options.new, service)
driver_path = driver_finder.driver_path
browser_path = driver_finder.browser_path

expect(service_manager.uri).to be_a(URI)
end
expect { Platform.assert_executable(driver_path) }.not_to raise_error
expect { Platform.assert_executable(browser_path) }.not_to raise_error
expect(browser_path).to include(cache_dir)
expect(driver_path).to include(cache_dir)

service.executable_path = driver_path

it 'can be started outside driver' do
expect(service_manager.uri).to be_a(URI)
end
end
Expand Down
15 changes: 14 additions & 1 deletion rb/spec/integration/selenium/webdriver/firefox/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,18 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
],
data = ["//common/extensions"],
)
for file in glob(["*_spec.rb"])
for file in glob(
["*_spec.rb"],
exclude = ["service_spec.rb"],
)
]

rb_integration_test(
name = "service",
srcs = ["service_spec.rb"],
browsers = [
"firefox",
"firefox-beta",
],
tags = ["manager"],
)
16 changes: 11 additions & 5 deletions rb/spec/integration/selenium/webdriver/firefox/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@ module Firefox
exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :firefox}]} do
let(:service) { described_class.new }
let(:service_manager) { service.launch }
let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium' }

after { service_manager.stop }

it 'auto uses geckodriver' do
service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path
it 'selenium manager gets browser and driver', exclusive: {manager: true} do
driver_finder = DriverFinder.new(Options.new, service)
driver_path = driver_finder.driver_path
browser_path = driver_finder.browser_path

expect(service_manager.uri).to be_a(URI)
end
expect { Platform.assert_executable(driver_path) }.not_to raise_error
expect { Platform.assert_executable(browser_path) }.not_to raise_error
expect(browser_path).to include(cache_dir)
expect(driver_path).to include(cache_dir)

service.executable_path = driver_path

it 'can be started outside driver' do
expect(service_manager.uri).to be_a(URI)
end
end
Expand Down
8 changes: 8 additions & 0 deletions rb/spec/integration/selenium/webdriver/ie/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("//rb/spec:tests.bzl", "rb_integration_test")

rb_integration_test(
name = "service",
srcs = ["service_spec.rb"],
browsers = ["ie"],
tags = ["manager"],
)
13 changes: 8 additions & 5 deletions rb/spec/integration/selenium/webdriver/ie/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,19 @@ module IE
exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :ie}]} do
let(:service) { described_class.new }
let(:service_manager) { service.launch }
let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium'}

after { service_manager.stop }

it 'auto uses iedriver' do
service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path
it 'selenium manager gets browser and driver', exclusive: {manager: true} do
driver_finder = DriverFinder.new(Options.new, service)
driver_path = driver_finder.driver_path

expect(service_manager.uri).to be_a(URI)
end
expect { Platform.assert_executable(driver_path) }.not_to raise_error
expect(driver_path).to include(cache_dir)

service.executable_path = driver_path

it 'can be started outside driver' do
expect(service_manager.uri).to be_a(URI)
end
end
Expand Down
12 changes: 11 additions & 1 deletion rb/spec/integration/selenium/webdriver/safari/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,15 @@ load("//rb/spec:tests.bzl", "rb_integration_test")
"safari-preview",
],
)
for file in glob(["*_spec.rb"])
for file in glob(
["*_spec.rb"],
exclude = ["service_spec.rb"],
)
]

rb_integration_test(
name = "service",
srcs = ["service_spec.rb"],
browsers = ["safari"],
tags = ["manager"],
)
16 changes: 11 additions & 5 deletions rb/spec/integration/selenium/webdriver/safari/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@ module Safari
exclusive: [{bidi: false, reason: 'Not yet implemented with BiDi'}, {browser: :safari}]} do
let(:service) { described_class.new }
let(:service_manager) { service.launch }
let(:cache_dir) { ENV['SE_CACHE'] || '.cache/selenium'}

after { service_manager.stop }

it 'auto uses safaridriver' do
service.executable_path = DriverFinder.new(Options.new, described_class.new).driver_path
it 'selenium manager gets browser and driver', exclusive: {manager: true} do
driver_finder = DriverFinder.new(Options.new, service)
driver_path = driver_finder.driver_path
browser_path = driver_finder.browser_path

expect(service_manager.uri).to be_a(URI)
end
expect { Platform.assert_executable(driver_path) }.not_to raise_error
expect { Platform.assert_executable(browser_path) }.not_to raise_error
expect(browser_path).to include(cache_dir)
expect(driver_path).to include(cache_dir)

service.executable_path = driver_path

it 'can be started outside driver' do
expect(service_manager.uri).to be_a(URI)
end
end
Expand Down
1 change: 1 addition & 0 deletions rb/spec/integration/selenium/webdriver/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def example_finished(notification)
guards.add_condition(:bidi, !ENV['WEBDRIVER_BIDI'].nil?)
guards.add_condition(:rbe, GlobalTestEnv.rbe?)
guards.add_condition(:version, GlobalTestEnv.browser_version)
guards.add_condition(:manager, !ENV['SE_FORCE_BROWSER_DOWNLOAD']).nil?

results = guards.disposition
send(*results) if results
Expand Down
7 changes: 5 additions & 2 deletions rb/spec/tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,14 @@ def rb_integration_test(name, srcs, deps = [], data = [], browsers = BROWSERS.ke
visibility = ["//rb:__subpackages__"],
)

# Selenium manager tests are lighter weight (no full browser session needed)
size = "medium" if "manager" in tags else "large"

for browser in browsers:
# Generate a test target for local browser execution.
rb_test(
name = "{}-{}".format(name, browser),
size = "large",
size = size,
srcs = srcs,
args = ["rb/spec/"],
data = BROWSERS[browser]["data"] + data + ["//common/src/web"],
Expand Down Expand Up @@ -218,7 +221,7 @@ def rb_integration_test(name, srcs, deps = [], data = [], browsers = BROWSERS.ke
if "bidi" in tags:
rb_test(
name = "{}-{}-bidi".format(name, browser),
size = "large",
size = size,
srcs = srcs,
args = ["rb/spec/"],
data = BROWSERS[browser]["data"] + data + ["//common/src/web"],
Expand Down
Loading