Sha256: 3dd07e0ba7be36a9cf408d53797a600dfaa3d335853b0cb7062f1405314795e6

Contents?: true

Size: 994 Bytes

Versions: 41

Compression:

Stored size: 994 Bytes

Contents

# frozen_string_literal: true
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

41 entries across 37 versions & 4 rubygems

Version Path
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/vendor/bundle/gems/capybara-2.16.1/lib/capybara/spec/session/window/windows_spec.rb
tdiary-5.0.8 vendor/bundle/ruby/2.5.0/gems/capybara-2.18.0/lib/capybara/spec/session/window/windows_spec.rb
tdiary-5.0.8 vendor/bundle/gems/capybara-2.18.0/lib/capybara/spec/session/window/windows_spec.rb
capybara-2.18.0 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.17.0 lib/capybara/spec/session/window/windows_spec.rb
tdiary-5.0.7 vendor/bundle/gems/capybara-2.16.1/lib/capybara/spec/session/window/windows_spec.rb
capybara-2.16.1 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.16.0 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.15.4 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.15.3 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.15.2 lib/capybara/spec/session/window/windows_spec.rb
tdiary-5.0.6 vendor/bundle/gems/capybara-2.15.1/lib/capybara/spec/session/window/windows_spec.rb
capybara-2.15.1 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.15.0 lib/capybara/spec/session/window/windows_spec.rb
tdiary-5.0.5 vendor/bundle/gems/capybara-2.14.3/lib/capybara/spec/session/window/windows_spec.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/capybara-2.13.0/lib/capybara/spec/session/window/windows_spec.rb
tdiary-5.0.5 vendor/bundle/gems/capybara-2.13.0/lib/capybara/spec/session/window/windows_spec.rb
capybara-2.14.4 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.14.3 lib/capybara/spec/session/window/windows_spec.rb
capybara-2.14.2 lib/capybara/spec/session/window/windows_spec.rb