Sha256: 7db847332e45f01c9f5438f083cebfe9bff55be50e92b7cf5bc5279c4d3031de

Contents?: true

Size: 1.31 KB

Versions: 7

Compression:

Stored size: 1.31 KB

Contents

require 'capybara/poltergeist'
require 'spec_helper'
require 'dummy_app/dummy_app'

describe 'Napybara::Element#get' do
  describe '#has_content?' do
    describe 'waits for Ajax events to complete before processing' do
      let(:session) do
        Capybara::Session.new(:poltergeist, DummyApp)
      end

      let(:test_page) do
        Napybara::Element.new(session) do |page|
          def page.visit!
            get.visit '/test.html'
          end

          page.finder :form, 'form' do |form|
            form.finder :notice_updater, 'button.update'
            form.finder :notice, '.notice'
          end
        end
      end

      Steps do
        Given 'my page has an element A whose content changes a second after
          another element B is clicked' do
          test_page.visit!

          expect(test_page.form.notice.get).to have_content('Old content.')
          expect(test_page.form.notice.get).to have_no_content('New content.')
        end

        When 'I click on element B' do
          test_page.form.notice_updater.get.click
        end

        Then 'checking if element A has the new content should be true' do
          expect(test_page.form.notice.get).to have_content('New content.')
          expect(test_page.form.notice.get).to have_no_content('Old content.')
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
napybara-0.7.0 spec/integration/napybara_spec.rb
napybara-0.6.0 spec/integration/napybara_spec.rb
napybara-0.5.0 spec/integration/napybara_spec.rb
napybara-0.4.1 spec/integration/napybara_spec.rb
napybara-0.4.0 spec/integration/napybara_spec.rb
napybara-0.3.1 spec/integration/napybara_spec.rb
napybara-0.3.0 spec/integration/napybara_spec.rb