Sha256: 91dec292fcfa3c40d5c906beb60ff506fb8d6ac7c567bc03d7db08e3564d9b91

Contents?: true

Size: 742 Bytes

Versions: 5

Compression:

Stored size: 742 Bytes

Contents

# frozen_string_literal: true

Capybara::SpecHelper.spec '#current_window', requires: [:windows] do
  before do
    @window = @session.current_window
    @session.visit('/with_windows')
  end
  after 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

5 entries across 5 versions & 2 rubygems

Version Path
tdiary-5.0.9 vendor/bundle/gems/capybara-3.2.1/lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.2.1 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.2.0 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.1.1 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.1.0 lib/capybara/spec/session/window/current_window_spec.rb