Skip to content

Commit

Permalink
Improve Ruby tests for IE driver
Browse files Browse the repository at this point in the history
  • Loading branch information
p0deje committed Apr 28, 2019
1 parent 8fe0635 commit 1857ae2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
13 changes: 5 additions & 8 deletions rb/spec/integration/selenium/webdriver/manage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ module WebDriver
it 'should use DateTime for expires' do
driver.navigate.to url_for('xhtmlTest.html')

expected = DateTime.new(2039)
expected = (Date.today + 1).to_datetime
driver.manage.add_cookie name: 'foo',
value: 'bar',
expires: expected
Expand All @@ -103,17 +103,14 @@ module WebDriver
end

describe 'new_window' do
types = %i[tab window] # Stores the valid type values for new_window
after { ensure_single_window }

types = %i[tab window]
types.each do |type|
it "should be able to open a new #{type}", only: {browser: %i[safari_preview firefox ie]} do
# Store the count of window handles before executing action
before_window_handles = driver.window_handles.length
# Open a new window
driver.manage.new_window(type)
# Store the count of window handles after executing action
after_window_handles = driver.window_handles.length
# 1 window handle should have been added
expect(after_window_handles).to eq(before_window_handles + 1)
expect(driver.window_handles.length).to eq(before_window_handles + 1)
end
end

Expand Down
4 changes: 2 additions & 2 deletions rb/spec/integration/selenium/webdriver/window_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ module WebDriver
end

it 'can maximize the current window', except: {window_manager: false, browser: %i[ie firefox safari]} do
window.size = old_size = Dimension.new(200, 200)
window.size = old_size = Dimension.new(800, 800)

window.maximize
wait.until { window.size != old_size }
Expand All @@ -120,7 +120,7 @@ module WebDriver
# https://github.com/mozilla/geckodriver/issues/1281
it 'can make window full screen', only: {window_manager: true, browser: %i[chrome ie firefox safari_preview]},
exclude: [{driver: :remote, browser: :firefox, platform: :linux}, {browser: :chrome}] do
window.size = old_size = Dimension.new(200, 200)
window.size = old_size = Dimension.new(800, 800)

window.full_screen
wait.until { window.size != old_size }
Expand Down

0 comments on commit 1857ae2

Please sign in to comment.