Sha256: 0a03d96dc21d65767df93be9b19501d30b4199fd70e61bb58a6bfe5c810fd9d0

Contents?: true

Size: 1.52 KB

Versions: 4

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe Symbiont::Enclosers do
  let(:watir_browser) { mock_browser_for_watir }
  let(:watir_definition) { DefinitionTest.new(watir_browser) }
  
  context "a definition using watir-webdriver" do
    it "should allow frames to act as a context" do
      watir_browser.should_receive(:frame).with(id: "frame").and_return(watir_browser)
      watir_browser.should_receive(:text_field).and_return(watir_browser)
      web_object = watir_definition.framedLoginName_text_field
      web_object.should_not be_nil
      web_object.should be_instance_of Symbiont::WebObjects::TextField
    end
    
    it "should wait for a condition to be true" do
      watir_browser.should_receive(:wait_until).with(5, "not quick enough")
      watir_definition.wait_for(5, "not quick enough")
    end
    
    it "should handle alert message boxes" do
      watir_browser.should_receive(:wd).twice.and_return(watir_browser)
      watir_browser.should_receive(:execute_script).twice
      watir_definition.will_alert do
      end
    end
    
    it "should handle confirmation message boxes" do
      watir_browser.should_receive(:wd).twice.and_return(watir_browser)
      watir_browser.should_receive(:execute_script).twice
      watir_definition.will_confirm(true) do
      end
    end
    
    it "should handle prompt message boxes" do
      watir_browser.should_receive(:wd).twice.and_return(watir_browser)
      watir_browser.should_receive(:execute_script).twice
      watir_definition.will_prompt("Question") do
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
symbiont-0.1.5 spec/symbiont/enclosers_spec.rb
symbiont-0.1.4 spec/symbiont/enclosers_spec.rb
symbiont-0.1.3 spec/symbiont/enclosers_spec.rb
symbiont-0.1.2 spec/symbiont/enclosers_spec.rb