require 'spec_helper' describe Symbiont::Locators do let(:watir_browser) { mock_browser_for_watir } let(:watir_definition) { DefinitionTest.new(watir_browser) } context "a definition using watir-webdriver" do it "should locate a link web object" do watir_browser.should_receive(:link).with(text: 'test').and_return(watir_browser) web_object = watir_definition.link_object(text: 'test') web_object.should be_instance_of Symbiont::WebObjects::Link end it "should locate a button web object" do watir_browser.should_receive(:button).with(value: 'test').and_return(watir_browser) web_object = watir_definition.button_object(value: 'test') web_object.should be_instance_of Symbiont::WebObjects::Button end it "should locate a text field web object" do watir_browser.should_receive(:text_field).with(id: 'test').and_return(watir_browser) web_object = watir_definition.text_field_object(id: 'test') web_object.should be_instance_of Symbiont::WebObjects::TextField end it "should locate a select list web object" do watir_browser.should_receive(:select_list).with(class: 'test').and_return(watir_browser) web_object = watir_definition.select_list_object(class: 'test') web_object.should be_instance_of Symbiont::WebObjects::SelectList end it "should locate a checkbox web object" do watir_browser.should_receive(:checkbox).with(id: 'test').and_return(watir_browser) web_object = watir_definition.checkbox_object(id: 'test') web_object.should be_instance_of Symbiont::WebObjects::CheckBox end it "should locate a radio web object" do watir_browser.should_receive(:radio).with(id: 'test').and_return(watir_browser) web_object = watir_definition.radio_object(id: 'test') web_object.should be_instance_of Symbiont::WebObjects::Radio end it "should locate a div web object" do watir_browser.should_receive(:div).with(id: 'test').and_return(watir_browser) web_object = watir_definition.div_object(id: 'test') web_object.should be_instance_of Symbiont::WebObjects::Div end it "should locate a span object" do watir_browser.should_receive(:span).with(id: 'test').and_return(watir_browser) web_object = watir_definition.span_object(id: 'test') web_object.should be_instance_of Symbiont::WebObjects::Span end it "should locate a table web object" do watir_browser.should_receive(:table).with(id: 'test').and_return(watir_browser) web_object = watir_definition.table_object(id: 'test') web_object.should be_instance_of Symbiont::WebObjects::Table end it "should locate a table cell web object" do watir_browser.should_receive(:td).with(id: 'test').and_return(watir_browser) web_object = watir_definition.cell_object(id: 'test') web_object.should be_instance_of Symbiont::WebObjects::TableCell end end end