-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathspec_helper.rb
48 lines (38 loc) · 1.56 KB
/
spec_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# frozen_string_literal: true
require 'selenium-webdriver'
require 'selenium/webdriver/support/guards'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
Dir.mktmpdir('tmp')
config.example_status_persistence_file_path = "tmp/examples.txt"
config.expect_with :rspec do |c|
c.syntax = :expect
end
config.before do |example|
bug_tracker = 'https://gigithub.com/SeleniumHQ/seleniumhq.github.io/issues'
guards = Selenium::WebDriver::Support::Guards.new(example,
bug_tracker: bug_tracker)
guards.add_condition(:platform, Selenium::WebDriver::Platform.os)
guards.add_condition(:ci, Selenium::WebDriver::Platform.ci)
results = guards.disposition
send(*results) if results
end
config.after { @driver&.quit }
def start_session
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('disable-search-engine-choice-screen')
options.add_argument('--no-sandbox')
@driver = Selenium::WebDriver.for(:chrome, options: options)
end
def start_bidi_session
options = Selenium::WebDriver::Chrome::Options.new(web_socket_url: true)
@driver = Selenium::WebDriver.for :chrome, options: options
end
def start_firefox
options = Selenium::WebDriver::Options.firefox(timeouts: {implicit: 1500})
@driver = Selenium::WebDriver.for :firefox, options: options
end
end