Sha256: 1fc4b3309edb2baf6817da22ae0b1eb30c121b6a8cb65a711a314d644b92985e

Contents?: true

Size: 743 Bytes

Versions: 97

Compression:

Stored size: 743 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

97 entries across 83 versions & 5 rubygems

Version Path
capybara-3.11.1 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.11.0 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.10.1 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.10.0 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.9.0 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.8.2 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.8.1 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.8.0 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.7.2 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.7.1 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.7.0 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.6.0 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.5.1 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.5.0 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.4.2 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.4.1 lib/capybara/spec/session/window/current_window_spec.rb
capybara-3.4.0 lib/capybara/spec/session/window/current_window_spec.rb