Skip to content

Commit 606ddfe

Browse files
authored
Merge branch 'trunk' into java-wip-branch
2 parents 7e4d387 + de7acb9 commit 606ddfe

23 files changed

Lines changed: 239 additions & 218 deletions

File tree

.github/workflows/ci-ruby.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
with:
3030
name: Lint
3131
cache-key: rb-lint
32-
run: bazel run //rb:lint
32+
run: bazel test //rb:lint
3333

3434
unit-tests:
3535
name: Unit Tests

README.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -207,27 +207,30 @@ Build targets:
207207
| `bazel build //rb:selenium-webdriver` | Build selenium-webdriver Ruby gem |
208208
| `bazel run //rb:selenium-devtools-release` | Build and push selenium-devtools gem to RubyGems |
209209
| `bazel run //rb:selenium-webdriver-release` | Build and push selenium-webdriver gem to RubyGems |
210-
| `bazel run //rb:console` | Start Pry REPL with all gems loaded |
210+
| `bazel run //rb:console` | Start REPL with all gems loaded |
211211
| `bazel run //rb:docs` | Generate YARD docs |
212-
| `bazel run //rb:lint` | Run RuboCop linter |
213212

214213
Test targets:
215214

216-
| Command | Description |
217-
|--------------------------------------------------------------------------------------|---------------------------------------------------------|
218-
| `bazel test //rb/spec/...` | Run both unit and integration tests using Chrome |
219-
| `bazel test //rb/spec/integration/...` | Run integration tests using Chrome |
220-
| `bazel test //rb/spec/integration/... --define browser=firefox` | Run integration tests using Firefox |
221-
| `bazel test //rb/spec/integration/... --define remote=true` | Run integration tests using Chrome and Selenium Server |
222-
| `bazel test //rb/spec/integration/... --define browser=firefox --define remote=true` | Run integration tests using Firefox and Selenium Server |
223-
| `bazel test //rb/spec/unit/...` | Run unit tests |
215+
| Command | Description |
216+
|--------------------------------------------------------------------------------------|------------------------------------------------|
217+
| `bazel test //rb/...` | Run unit, integration tests (Chrome) and lint |
218+
| `bazel test //rb:lint` | Run RuboCop linter |
219+
| `bazel test //rb/spec/...` | Run unit and integration tests (Chrome) |
220+
| `bazel test --test_size_filters large //rb/...` | Run integration tests using (Chrome) |
221+
| `bazel test //rb/spec/integration/...` | Run integration tests using (Chrome) |
222+
| `bazel test //rb/spec/integration/... --define browser=firefox` | Run integration tests using (Firefox) |
223+
| `bazel test //rb/spec/integration/... --define remote=true` | Run integration tests using (Chrome and Grid) |
224+
| `bazel test //rb/spec/integration/... --define browser=firefox --define remote=true` | Run integration tests using (Firefox and Grid) |
225+
| `bazel test --test_size_filters small //rb/...` | Run unit tests |
226+
| `bazel test //rb/spec/unit/...` | Run unit tests |
224227

225228
Suffix `...` tells Bazel to run all the test targets. They are conveniently named by test file name with `_spec.rb` removed so you can run them individually:
226229

227230
| Test file | Test target |
228231
|----------------------------------------------------------------|----------------------------------------------------------|
229232
| `rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb` | `//rb/spec/integration/selenium/webdriver/chrome:driver` |
230-
| `rb/spec/integration/selenium/webdriver/chrome/driver_spec.rb` | `//rb/spec/integration/selenium/webdriver/chrome:driver` |
233+
| `rb/spec/unit/selenium/webdriver/proxy_spec.rb` | `//rb/spec/unit/selenium/webdriver:proxy` |
231234

232235
Supported browsers:
233236

@@ -268,6 +271,16 @@ To run with a specific version of Ruby you can change the version in `rb/ruby_ve
268271
echo 'RUBY_VERSION = "<X.Y.Z>"' > rb/ruby_version.bzl
269272
```
270273

274+
If you want to debug code in tests, you can do it via [`debug`](https://github.com/ruby/debug) gem:
275+
276+
1. Add `binding.break` to the code where you want the debugger to start.
277+
2. Run `bazel test --test_output streamed <test>`. Streaming output is not required, but will clearly say when debugger starts.
278+
3. When debugger starts, run the following in a separate terminal to connect to debugger:
279+
280+
```sh
281+
bazel-selenium/external/bundle/bin/rdbg -A
282+
```
283+
271284
If you want to use RubyMine for development, a bit of extra configuration is necessary to let the IDE know about Bazel toolchain and artifacts:
272285

273286
1. Run `bazel build @bundle//:bundle //rb:selenium-devtools //rb:selenium-webdriver` before configuring IDE.

dotnet/src/webdriver/Chromium/ChromiumDriver.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
using System;
2020
using System.Collections.Generic;
2121
using System.Collections.ObjectModel;
22-
using System.IO;
2322
using OpenQA.Selenium.DevTools;
2423
using OpenQA.Selenium.Remote;
2524

@@ -126,7 +125,7 @@ public class ChromiumDriver : WebDriver, ISupportsLogs, IDevTools
126125
/// <param name="options">The <see cref="ChromiumOptions"/> to be used with the ChromiumDriver.</param>
127126
/// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
128127
protected ChromiumDriver(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout)
129-
: base(new DriverServiceCommandExecutor(VerifyDriverServicePath(service, options), commandTimeout), ConvertOptionsToCapabilities(options))
128+
: base(new DriverServiceCommandExecutor(DriverFinder.VerifyDriverServicePath(service, options), commandTimeout), ConvertOptionsToCapabilities(options))
130129
{
131130
this.optionsCapabilityName = options.CapabilityName;
132131
}
@@ -432,15 +431,6 @@ protected override void Dispose(bool disposing)
432431
base.Dispose(disposing);
433432
}
434433

435-
private static ChromiumDriverService VerifyDriverServicePath(ChromiumDriverService service, ChromiumOptions options)
436-
{
437-
string driverFullPath = DriverFinder.GetPath(service, options);
438-
service.DriverServicePath = Path.GetDirectoryName(driverFullPath);
439-
service.DriverServiceExecutableName = Path.GetFileName(driverFullPath);
440-
441-
return service;
442-
}
443-
444434
private static ICapabilities ConvertOptionsToCapabilities(ChromiumOptions options)
445435
{
446436
if (options == null)

dotnet/src/webdriver/DriverFinder.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ public static class DriverFinder
3333
/// <param name="service">DriverService with the current path.</param>
3434
/// <param name="options">DriverOptions with the current browser options.</param>
3535
/// <returns>
36-
/// The path of the driver.
36+
/// The service with a verified driver executable path.
3737
/// </returns>
38-
public static string GetPath(DriverService service, DriverOptions options)
38+
public static DriverService VerifyDriverServicePath(DriverService service, DriverOptions options)
3939
{
4040
string executablePath = Path.Combine(service.DriverServicePath, service.DriverServiceExecutableName);
41-
if (File.Exists(executablePath)) return executablePath;
41+
if (File.Exists(executablePath)) return service;
4242
try
4343
{
44-
return SeleniumManager.DriverPath(options);
44+
string driverFullPath = SeleniumManager.DriverPath(options);
45+
service.DriverServicePath = Path.GetDirectoryName(driverFullPath);
46+
service.DriverServiceExecutableName = Path.GetFileName(driverFullPath);
47+
return service;
4548
}
4649
catch (Exception e)
4750
{

dotnet/src/webdriver/Firefox/FirefoxDriver.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public FirefoxDriver(FirefoxDriverService service, FirefoxOptions options)
186186
/// <param name="options">The <see cref="FirefoxOptions"/> to be used with the Firefox driver.</param>
187187
/// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
188188
public FirefoxDriver(FirefoxDriverService service, FirefoxOptions options, TimeSpan commandTimeout)
189-
: base(new DriverServiceCommandExecutor(VerifyDriverServicePath(service, options), commandTimeout), ConvertOptionsToCapabilities(options))
189+
: base(new DriverServiceCommandExecutor(DriverFinder.VerifyDriverServicePath(service, options), commandTimeout), ConvertOptionsToCapabilities(options))
190190
{
191191
// Add the custom commands unique to Firefox
192192
this.AddCustomFirefoxCommands();
@@ -439,15 +439,6 @@ private static FirefoxDriverService CreateService(FirefoxOptions options)
439439
return FirefoxDriverService.CreateDefaultService();
440440
}
441441

442-
private static FirefoxDriverService VerifyDriverServicePath(FirefoxDriverService service, FirefoxOptions options)
443-
{
444-
string driverFullPath = DriverFinder.GetPath(service, options);
445-
service.DriverServicePath = Path.GetDirectoryName(driverFullPath);
446-
service.DriverServiceExecutableName = Path.GetFileName(driverFullPath);
447-
448-
return service;
449-
}
450-
451442
private void AddCustomFirefoxCommands()
452443
{
453444
foreach (KeyValuePair<string, CommandInfo> entry in CustomCommandDefinitions)

dotnet/src/webdriver/IE/InternetExplorerDriver.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
// </copyright>
1818

1919
using System;
20-
using System.IO;
2120
using OpenQA.Selenium.Remote;
2221

2322
namespace OpenQA.Selenium.IE
@@ -141,7 +140,7 @@ public InternetExplorerDriver(InternetExplorerDriverService service, InternetExp
141140
/// <param name="options">The <see cref="InternetExplorerOptions"/> used to initialize the driver.</param>
142141
/// <param name="commandTimeout">The maximum amount of time to wait for each command.</param>
143142
public InternetExplorerDriver(InternetExplorerDriverService service, InternetExplorerOptions options, TimeSpan commandTimeout)
144-
: base(new DriverServiceCommandExecutor(VerifyDriverServicePath(service, options), commandTimeout), ConvertOptionsToCapabilities(options))
143+
: base(new DriverServiceCommandExecutor(DriverFinder.VerifyDriverServicePath(service, options), commandTimeout), ConvertOptionsToCapabilities(options))
145144
{
146145
}
147146

@@ -161,15 +160,6 @@ public override IFileDetector FileDetector
161160
set { }
162161
}
163162

164-
private static InternetExplorerDriverService VerifyDriverServicePath(InternetExplorerDriverService service, InternetExplorerOptions options)
165-
{
166-
string driverFullPath = DriverFinder.GetPath(service, options);
167-
service.DriverServicePath = Path.GetDirectoryName(driverFullPath);
168-
service.DriverServiceExecutableName = Path.GetFileName(driverFullPath);
169-
170-
return service;
171-
}
172-
173163
private static ICapabilities ConvertOptionsToCapabilities(InternetExplorerOptions options)
174164
{
175165
if (options == null)

dotnet/test/common/DevTools/DevToolsConsoleTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ public class DevToolsConsoleTest : DevToolsTestFixture
1818
[IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")]
1919
public async Task VerifyMessageAdded()
2020
{
21-
var domains = session.GetVersionSpecificDomains<V112.DevToolsSessionDomains>();
21+
var domains = session.GetVersionSpecificDomains<V113.DevToolsSessionDomains>();
2222
string consoleMessage = "Hello Selenium";
2323

2424
ManualResetEventSlim sync = new ManualResetEventSlim(false);
25-
EventHandler<V112.Console.MessageAddedEventArgs> messageAddedHandler = (sender, e) =>
25+
EventHandler<V113.Console.MessageAddedEventArgs> messageAddedHandler = (sender, e) =>
2626
{
2727
Assert.That(e.Message.Text, Is.EqualTo(consoleMessage));
2828
sync.Set();

dotnet/test/common/DevTools/DevToolsLogTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ public class DevToolsLogTest : DevToolsTestFixture
1919
[IgnoreBrowser(Selenium.Browser.Safari, "Safari does not support Chrome DevTools Protocol")]
2020
public async Task VerifyEntryAddedAndClearLog()
2121
{
22-
var domains = session.GetVersionSpecificDomains<V112.DevToolsSessionDomains>();
22+
var domains = session.GetVersionSpecificDomains<V113.DevToolsSessionDomains>();
2323
ManualResetEventSlim sync = new ManualResetEventSlim(false);
24-
EventHandler<V112.Log.EntryAddedEventArgs> entryAddedHandler = (sender, e) =>
24+
EventHandler<V113.Log.EntryAddedEventArgs> entryAddedHandler = (sender, e) =>
2525
{
2626
Assert.That(e.Entry.Text.Contains("404"));
27-
Assert.That(e.Entry.Level == V112.Log.LogEntryLevelValues.Error);
27+
Assert.That(e.Entry.Level == V113.Log.LogEntryLevelValues.Error);
2828
sync.Set();
2929
};
3030

0 commit comments

Comments
 (0)