Skip to content

Commit

Permalink
[rb] update Windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Jul 11, 2020
1 parent dd7090c commit ad229a5
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion rb/lib/selenium/webdriver/ie/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Options < WebDriver::Options
use_per_process_proxy: 'ie.usePerProcessProxy',
validate_cookie_document_type: 'ie.validateCookieDocumentType'
}.freeze
BROWSER = 'internet_explorer'
BROWSER = 'internet explorer'

CAPABILITIES.each_key do |key|
define_method key do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ module WebDriver
expect(element.attribute(:value)).to eq('ContextClicked')
end

it 'can release pressed buttons via release action', except: {browser: :safari},
it 'can release pressed buttons via release action', except: [{browser: :safari},
{driver: :remote, browser: :ie}],
only: {browser: %i[edge chrome edge_chrome firefox ie]} do
driver.navigate.to url_for('javascriptPage.html')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def create_firefox_driver(opt = {})
end

def create_ie_driver(opt = {})
opt[:options] = WebDriver::IE::Options.new(require_window_focus: true)
opt[:capabilities] = WebDriver::IE::Options.new(require_window_focus: true)
WebDriver::Driver.for :ie, opt
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ module WebDriver
end
end

context 'with more than two windows', except: {browser: %i[safari safari_preview]} do
context 'with more than two windows', except: [{browser: %i[safari safari_preview]},
{driver: :remote, browser: :ie}] do
after do
# We need to reset driver because browsers behave differently
# when trying to open the same blank target in a new window.
Expand Down
2 changes: 1 addition & 1 deletion rb/spec/integration/selenium/webdriver/timeout_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module WebDriver
expect(driver.find_elements(class_name: 'redbox')).to be_empty
end

it 'should return after first attempt to find many after disabling implicit waits', except: {browser: :firefox, platform: :windows} do
it 'should return after first attempt to find many after disabling implicit waits' do
add = driver.find_element(id: 'adder')

driver.manage.timeouts.implicit_wait = 3
Expand Down
3 changes: 2 additions & 1 deletion rb/spec/integration/selenium/webdriver/zipper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def create_file
expect(File).to exist(zip_file)
end

it 'follows symlinks' do
# Bug - `File.symlink` has permissions issues on Windows
it 'follows symlinks', except: {platform: :windows} do
filename = create_file
File.symlink(filename, File.join(dir_to_zip, 'link'))

Expand Down
10 changes: 5 additions & 5 deletions rb/spec/unit/selenium/webdriver/ie/driver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def expect_request(body: nil, endpoint: nil)
it 'accepts provided Options as sole parameter' do
opts = {invalid: 'foobar', args: ['-f']}

expect_request(body: {capabilities: {firstMatch: ["browserName": "internet_explorer",
expect_request(body: {capabilities: {firstMatch: ["browserName": "internet explorer",
"se:ieOptions": {"invalid": "foobar",
"nativeEvents": true,
"ie.browserCommandLineSwitches": "-f"}]}})
Expand All @@ -135,7 +135,7 @@ def expect_request(body: nil, endpoint: nil)
it 'accepts combination of Options and Capabilities' do
caps = Remote::Capabilities.ie(invalid: 'foobar')
browser_opts = {args: ['-f']}
expect_request(body: {capabilities: {firstMatch: ["browserName": "internet_explorer",
expect_request(body: {capabilities: {firstMatch: ["browserName": "internet explorer",
"platformName": "windows",
"invalid": "foobar",
"se:ieOptions": {"nativeEvents": true,
Expand Down Expand Up @@ -219,7 +219,7 @@ def as_json(*)

it 'with Options instance' do
browser_opts = {start_page: 'http://selenium.dev'}
expect_request(body: {capabilities: {firstMatch: [browserName: "internet_explorer",
expect_request(body: {capabilities: {firstMatch: [browserName: "internet explorer",
'se:ieOptions': {"startPage": 'http://selenium.dev',
'nativeEvents': true}]}})

Expand All @@ -234,7 +234,7 @@ def as_json(*)
end

it 'with Options instance and an instance of a custom object responding to #as_json' do
expect_request(body: {capabilities: {firstMatch: [browserName: "internet_explorer",
expect_request(body: {capabilities: {firstMatch: [browserName: "internet explorer",
'se:ieOptions': {"nativeEvents": true},
'company:key': 'value']}})

Expand All @@ -244,7 +244,7 @@ def as_json(*)
it 'with Options instance, Capabilities instance and instance of a custom object responding to #as_json' do
capabilities = Remote::Capabilities.new(browser_name: 'internet explorer', invalid: 'foobar')
options = Options.new(start_page: 'http://selenium.dev')
expect_request(body: {capabilities: {firstMatch: [browserName: "internet_explorer",
expect_request(body: {capabilities: {firstMatch: [browserName: "internet explorer",
invalid: 'foobar',
'se:ieOptions': {"startPage": 'http://selenium.dev',
'nativeEvents': true},
Expand Down
8 changes: 4 additions & 4 deletions rb/spec/unit/selenium/webdriver/ie/options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module IE
expect(opts.require_window_focus).to eq(true)
expect(opts.use_per_process_proxy).to eq(true)
expect(opts.validate_cookie_document_type).to eq(true)
expect(opts.browser_name).to eq('internet_explorer')
expect(opts.browser_name).to eq('internet explorer')
expect(opts.browser_version).to eq('11')
expect(opts.platform_name).to eq('win10')
expect(opts.accept_insecure_certs).to eq(false)
Expand Down Expand Up @@ -106,13 +106,13 @@ module IE

describe '#as_json' do
it 'returns empty options by default' do
expect(options.as_json).to eq("browserName" => "internet_explorer",
expect(options.as_json).to eq("browserName" => "internet explorer",
"se:ieOptions" => {"nativeEvents" => true})
end

it 'returns added option' do
options.add_option(:foo, 'bar')
expect(options.as_json).to eq("browserName" => "internet_explorer",
expect(options.as_json).to eq("browserName" => "internet explorer",
"se:ieOptions" => {"nativeEvents" => true, "foo" => "bar"})
end

Expand Down Expand Up @@ -145,7 +145,7 @@ module IE
validate_cookie_document_type: true)

key = 'se:ieOptions'
expect(opts.as_json).to eq('browserName' => 'internet_explorer',
expect(opts.as_json).to eq('browserName' => 'internet explorer',
'browserVersion' => '11',
'platformName' => 'win10',
'acceptInsecureCerts' => false,
Expand Down

0 comments on commit ad229a5

Please sign in to comment.