0
我有以下集成测试。它用一个表单加载一个页面。按下提交按钮时没有任何数据,因此表单应显示错误框。表单用ajax提交,并且应该将表单放回到出现错误的页面上。NOOB硒rspec测试未通过
我可以在浏览器中看到这个,但测试失败。
我在做什么错?我是一个完整的NOOB,所以需要一些指导。
需要 'spec_helper' 要求 “RubyGems的”
describe "Boards" do
describe "board creation failure" do
attr_reader :selenium_driver
alias :page :selenium_driver
before(:all) do
@verification_errors = []
@selenium_driver = Selenium::Client::Driver.new \
:host => "localhost",
:port => 4444,
:browser => "*chrome",
:url => "http://localhost:3000/",
:timeout_in_second => 60
end
before(:each) do
@selenium_driver.start_new_browser_session
end
after(:each) do
@selenium_driver.close_current_browser_session
@verification_errors.should == []
end
it "should show the error explanation div" do
page.open "/"
page.click "board_submit"
page.is_element_present("error_explanation").should be_true #should show error box
end
end