Sha256: 8ed5c6d344df1c0bec990a06203ad63e9b0a583bc49e2f6c12d1237a10372c85

Contents?: true

Size: 1.83 KB

Versions: 3

Compression:

Stored size: 1.83 KB

Contents

require File.expand_path("../spec_helper", __FILE__)

module Selenium
  module WebDriver
    describe Window do
      let(:window) { driver.manage.window }

      compliant_on :browser => [:firefox, :chrome] do
        it "gets the size of the current window" do
          size = window.size

          size.should be_kind_of(Dimension)

          size.width.should > 0
          size.height.should > 0
        end

        it "sets the size of the current window" do
          size = window.size

          target_width = size.width - 20
          target_height = size.height - 20

          window.size = Dimension.new(target_width, target_height)

          new_size = window.size
          new_size.width.should == target_width
          new_size.height.should == target_height
        end

        it "gets the position of the current window" do
          pos = driver.manage.window.position

          pos.should be_kind_of(Point)

          pos.x.should >= 0
          pos.y.should >= 0
        end

        it "sets the position of the current window" do
          pos = window.position

          target_x = pos.x + 10
          target_y = pos.y + 10

          window.position = Point.new(target_x, target_y)

          new_pos = window.position
          new_pos.x.should == target_x
          new_pos.y.should == target_y
        end
      end

      compliant_on({:browser => :ie},
                   {:browser => :firefox, :platform => [:windows, :macosx]},
                   {:browser => :firefox, :platform => :linux, :window_manager => true}) do
        it "can maximize the current window" do
          window.size = old_size = Dimension.new(200, 200)

          window.maximize

          new_size = window.size
          new_size.width.should > old_size.width
          new_size.height.should > old_size.height
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
browserstack-webdriver-2.40.1 spec/integration/selenium/webdriver/window_spec.rb
browserstack-webdriver-0.0.22 spec/integration/selenium/webdriver/window_spec.rb
browserstack-webdriver-0.0.1 spec/integration/selenium/webdriver/window_spec.rb