Skip to content

Commit aa0640b

Browse files
authored
[rb] have tests run with RubyMine use bazel artifacts by default (#12131)
1 parent a3794d7 commit aa0640b

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,8 @@ If you want to use RubyMine for development, a bit of extra configuration is nec
285285

286286
1. Run `bazel build @bundle//:bundle //rb:selenium-devtools //rb:selenium-webdriver` before configuring IDE.
287287
2. Open `rb/` as a main project directory.
288-
3. In <kbd>Settings / Lanugages & Frameworks / Ruby SDK and Gems</kbd> add new <kbd>Interpreter</kbd> pointing to `../bazel-selenium/external/ruby_rules_dist/dist/bin/ruby`.
289-
4. In <kbd>Run / Edit Configurations... / Edit configuration templates... / RSpec</kbd> add `-I ../bazel-bin/rb/lib` to <kbd>Ruby arguments</kbd>.
290-
5. You should now be able to run and debug any spec. It uses Chrome by default, but you can alter it using environment variables above.
288+
3. In <kbd>Settings / Languages & Frameworks / Ruby SDK and Gems</kbd> add new <kbd>Interpreter</kbd> pointing to `../bazel-selenium/external/rules_ruby_dist/dist/bin/ruby`.
289+
4. You should now be able to run and debug any spec. It uses Chrome by default, but you can alter it using environment variables above.
291290

292291
</details>
293292

rb/lib/selenium/webdriver/common/selenium_manager.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@ module WebDriver
2727
# @api private
2828
#
2929
class SeleniumManager
30-
BIN_PATH = '../../../../../bin'
31-
3230
class << self
31+
attr_writer :bin_path
32+
33+
def bin_path
34+
@bin_path ||= '../../../../../bin'
35+
end
36+
3337
# @param [Options] options browser options.
3438
# @return [String] the path to the correct driver.
3539
def driver_path(options)
@@ -72,7 +76,7 @@ def generate_command(binary, options)
7276
# @return [String] the path to the correct selenium manager
7377
def binary
7478
@binary ||= begin
75-
path = File.expand_path(BIN_PATH, __FILE__)
79+
path = File.expand_path(bin_path, __FILE__)
7680
path << if Platform.windows?
7781
'/windows/selenium-manager.exe'
7882
elsif Platform.mac?

rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def initialize
2727
@create_driver_error = nil
2828
@create_driver_error_count = 0
2929

30+
$LOAD_PATH.insert(0, root.join('bazel-bin/rb/lib').to_s) if File.exist?(root.join('bazel-bin/rb/lib'))
3031
WebDriver.logger.ignore(%i[logger_info selenium_manager])
32+
SeleniumManager.bin_path = root.join('bazel-bin/rb/bin').to_s if File.exist?(root.join('bazel-bin/rb/bin'))
3133

3234
@driver = ENV.fetch('WD_SPEC_DRIVER', 'chrome').tr('-', '_').to_sym
3335
@driver_instance = nil

0 commit comments

Comments
 (0)