File: title_spec.rb

package info (click to toggle)
ruby-capybara 3.40.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,368 kB
  • sloc: ruby: 23,988; javascript: 752; makefile: 11
file content (29 lines) | stat: -rw-r--r-- 817 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

Capybara::SpecHelper.spec '#title' do
  it 'should get the title of the page' do
    @session.visit('/with_title')
    expect(@session.title).to eq('Test Title')
  end

  context 'with css as default selector' do
    before { Capybara.default_selector = :css }

    after { Capybara.default_selector = :xpath }

    it 'should get the title of the page' do
      @session.visit('/with_title')
      expect(@session.title).to eq('Test Title')
    end
  end

  context 'within iframe', requires: [:frames] do
    it 'should get the title of the top level browsing context' do
      @session.visit('/within_frames')
      expect(@session.title).to eq('With Frames')
      @session.within_frame('frameOne') do
        expect(@session.title).to eq('With Frames')
      end
    end
  end
end