Sha256: 632c5332fb34d33087f89c23d15b79fbbf35f2c77c5435def031998a9086ea9f

Contents?: true

Size: 756 Bytes

Versions: 6

Compression:

Stored size: 756 Bytes

Contents

# frozen_string_literal: true

Capybara::SpecHelper.spec '#current_window', requires: [:windows] do
  before(:each) do
    @window = @session.current_window
    @session.visit('/with_windows')
  end
  after(:each) do
    (@session.windows - [@window]).each do |w|
      @session.switch_to_window w
      w.close
    end
    @session.switch_to_window(@window)
  end

  it 'should return window' do
    expect(@session.current_window).to be_instance_of(Capybara::Window)
  end

  it "should be modified by switching to another window" do
    window = @session.window_opened_by { @session.find(:css, '#openWindow').click }

    expect do
      @session.switch_to_window(window)
    end.to change { @session.current_window }.from(@window).to(window)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
capybara-3.0.3 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.0.2 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.0.1 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.0.0 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.0.0.rc2 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.0.0.rc1 lib/capybara/spec/session/window/current_window_spec.rb