Sha256: 95176b93074076e7bf94857e34d300239ce0eb636fc29a30b18c76d53083301c

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe Prickle::Capybara do
  let(:prickly) { Prickly.new }

  before do
    Capybara.default_driver = :selenium
    Prickle::Capybara.wait_time = nil
  end

  before(:each) do
    prickly.visit '/'
  end

  context 'Managing popups', :javascript => true do

    it 'can confirm an alert box' do
      prickly.click_by_name 'popups'
      prickly.confirm_popup
    end

    it 'can confirm a popup' do
      prickly.click_by_name 'confirm_box'
      prickly.confirm_popup
    end

    it 'can dismiss a popup' do
      prickly.click_by_name 'confirm_box'
      prickly.dismiss_popup
      prickly.popup_message.should eq "Aborting."
      prickly.confirm_popup
    end

    context "matching text" do
      it "can verify the content of a popup" do
        prickly.click_by_name "popups"
        prickly.popup_message_contains? "Hello"
        prickly.dismiss_popup
      end
    end
  end

  context 'Screenshots', :javascript => true do

    it 'can capture the screen' do
      screenshot_name = Time.now.strftime("%Y%m%d-%H.%M.%s")
      prickly.capture_screen screenshot_name
      `ls #{Prickle::Capybara.image_dir}`.should include "#{screenshot_name}"
    end

    after do
      `rm -f #{Prickle::Capybara.image_dir}/*.jpg`
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prickle-0.0.5 spec/capybara_spec.rb
prickle-0.0.4 spec/capybara_spec.rb
prickle-0.0.3 spec/capybara_spec.rb