Sha256: c4fafb8f6fdbf17b832c0cce7dfa8d46575873bf4c335bcb96bea7dd14406a4b

Contents?: true

Size: 964 Bytes

Versions: 17

Compression:

Stored size: 964 Bytes

Contents

Capybara::SpecHelper.spec '#windows', requires: [:windows] do
  before(:each) do
    @window = @session.current_window
    @session.visit('/with_windows')
    @session.find(:css, '#openTwoWindows').click

    @session.document.synchronize(3, errors: [Capybara::CapybaraError]) do
      raise Capybara::CapybaraError if @session.windows.size != 3
    end
  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 objects of Capybara::Window class' do
    expect(@session.windows.map { |window| window.instance_of?(Capybara::Window) }).to eq([true] * 3)
  end

  it 'should switchable windows' do
    titles = @session.windows.map do |window|
      @session.within_window(window) { @session.title }
    end
    expect(titles).to match_array([
      'With Windows', 'Title of the first popup', 'Title of popup two'
    ])
  end
end

Version data entries

17 entries across 17 versions & 4 rubygems

Version Path
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/capybara-2.4.4/lib/capybara/spec/session/window/windows_spec.rb
capybara-2.6.2 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.6.1 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.6.0 lib/capybara/spec/session/window/windows_spec.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/capybara-2.4.4/lib/capybara/spec/session/window/windows_spec.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/capybara-2.4.4/lib/capybara/spec/session/window/windows_spec.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/capybara-2.4.4/lib/capybara/spec/session/window/windows_spec.rb
capybara-2.5.0 lib/capybara/spec/session/window/windows_spec.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/capybara-2.4.4/lib/capybara/spec/session/window/windows_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/capybara-2.4.4/lib/capybara/spec/session/window/windows_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/capybara-2.4.4/lib/capybara/spec/session/window/windows_spec.rb
capybara-2.4.4 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.4.3 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.4.2 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.4.1 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.4.0 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.3.0 lib/capybara/spec/session/window/windows_spec.rb