require 'spec_helper' require 'mock_app' describe Fluent::Evaluators do let(:watir_browser) { mock_browser_for_watir } let(:watir_definition) { TestDefinition.new(watir_browser) } describe 'browser-level actions' do context 'a definition using watir-webdriver' do it 'should get the active url' do watir_browser.should_receive(:url).twice.and_return('http://localhost:9292') watir_definition.url.should == 'http://localhost:9292' watir_definition.current_url.should == 'http://localhost:9292' end it 'should be able to clear all of the cookies from the browser' do watir_browser.should_receive(:cookies).twice.and_return(watir_browser) watir_browser.should_receive(:clear).twice watir_definition.remove_cookies watir_definition.clear_cookies end it 'should be able to refresh the page contents' do watir_browser.should_receive(:refresh).twice.and_return(watir_browser) watir_definition.refresh_page watir_definition.refresh 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 it 'should get a screenshot' do watir_browser.should_receive(:wd).twice.and_return(watir_browser) watir_browser.should_receive(:save_screenshot).twice watir_definition.screenshot('testing.png') watir_definition.save_screenshot('testing.png') end end end describe 'page-level actions' do context 'a definition using watir-webdriver' do it 'should return all the markup on a page' do watir_browser.should_receive(:html).twice.and_return('