require 'spec_helper' describe Symbiont::Enclosers do let(:watir_browser) { mock_browser_for_watir } let(:watir_definition) { DefinitionTest.new(watir_browser) } describe "browser-level actions" do context "a definition using watir-webdriver" do it "should visit a page" do watir_browser.should_receive(:goto).with("http://localhost:4567") watir_definition.visit("http://localhost:4567") end it "should get the active url" do watir_browser.should_receive(:url).and_return("http://localhost:4567") watir_definition.url.should == "http://localhost:4567" end it "should get a screenshot" do watir_browser.should_receive(:wd).and_return(watir_browser) watir_browser.should_receive(:save_screenshot) watir_definition.screenshot("testing.png") end it "should run a script against the browser" do watir_browser.should_receive(:execute_script).twice.and_return("input") watir_definition.run_script("return document.activeElement").should == "input" watir_definition.execute_script("return document.activeElement").should == "input" end end end describe "page-level actions" do context "a definition using watir-webdriver" do it "should return all the text on a page" do watir_browser.should_receive(:text).and_return("page text") watir_definition.text.should == "page text" end it "should return all the markup on a page" do watir_browser.should_receive(:html).twice.and_return("