Skip to content

Commit

Permalink
[rb] update window specs for Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Nov 17, 2017
1 parent 0dce5d0 commit 576feaf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def initialize(guard, type)
@browsers = []
@platforms = []

set_window_manager(guard)
expand_drivers(guard)
expand_browsers(guard)
expand_platforms(guard)
Expand All @@ -41,11 +42,16 @@ def only?
end

def satisfied?
satisfies_driver? && satisfies_browser? && satisfies_platform?
satisfies_driver? && satisfies_browser? && satisfies_platform? && satisfies_window_manager?
end

private

def set_window_manager(guard)
return unless guard.key?(:window_manager)
@window_manager = guard[:window_manager]
end

def expand_drivers(guard)
return unless guard[:driver]
@drivers += Array(guard[:driver])
Expand All @@ -72,6 +78,10 @@ def satisfies_browser?
def satisfies_platform?
@platforms.empty? || @platforms.include?(Platform.os)
end

def satisfies_window_manager?
@window_manager.nil? || (@window_manager == (!Selenium::WebDriver::Platform.linux? || !ENV['DESKTOP_SESSION'].nil?))
end
end # Guard
end # Guards
end # SpecSupport
Expand Down
12 changes: 4 additions & 8 deletions rb/spec/integration/selenium/webdriver/window_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ module WebDriver
expect(new_rect.height).to eq(target_height)
end

# TODO: - Create Window Manager guard
it 'can maximize the current window', except: [{platform: :linux}, {browser: %i[ie safari]}] do
it 'can maximize the current window', except: [{window_manager: false}, {browser: %i[ie safari]}] do
window.size = old_size = Dimension.new(200, 200)

window.maximize
Expand All @@ -113,9 +112,8 @@ module WebDriver
expect(new_size.height).to be > old_size.height
end

# Firefox - https://bugzilla.mozilla.org/show_bug.cgi?id=1189749
# Edge: Not Yet - https://dev.windows.com/en-us/microsoft-edge/platform/status/webdriver/details/
it 'can make window full screen', only: {browser: :ie} do
it 'can make window full screen', only: {window_manager: true, browser: [:ie, :firefox]} do
window.maximize
old_size = window.size

Expand All @@ -125,12 +123,10 @@ module WebDriver
expect(new_size.height).to be > old_size.height
end

# Firefox - Not implemented yet, no bug to track
# Edge: Not Yet - https://dev.windows.com/en-us/microsoft-edge/platform/status/webdriver/details/
it 'can minimize the window', only: {browser: :ie} do
driver.execute_script('window.minimized = false; window.onblur = function(){ window.minimized = true };')
it 'can minimize the window', only: {window_manager: true, browser: [:ie, :firefox]} do
window.minimize
expect(driver.execute_script('return window.minimized;')).to be true
expect(driver.execute_script('return document.hidden;')).to be true
end
end
end # WebDriver
Expand Down

0 comments on commit 576feaf

Please sign in to comment.