Added screenshot capture to integration tests

This commit is contained in:
Wade Alcorn
2012-01-13 17:15:58 +10:00
parent 7bdfcb3d65
commit 5716da2af6

View File

@@ -2,16 +2,21 @@ require 'test/unit'
class TC_login < Test::Unit::TestCase
def save_screenshot(session)
session.driver.browser.save_screenshot("/tmp/" + Time.now.strftime("%Y-%m-%d--%H-%M-%S-%N") + ".png")
end
def test_log_in
session = Capybara::Session.new(:selenium)
session.visit('http://localhost:3000/ui/panel')
session.driver.browser.save_screenshot("/tmp/login.png")
save_screenshot(session)
session.has_content?('BeEF Authentication')
session.driver.browser.save_screenshot("/tmp/login.png")
session.fill_in 'user', :with => 'beef'
session.fill_in 'pass', :with => 'beef'
save_screenshot(session)
session.click_button('Login')
session.has_content?('logout')
save_screenshot(session)
session
end
@@ -21,7 +26,9 @@ class TC_login < Test::Unit::TestCase
session = test_log_in
session.has_content?('logout')
session.click_link('Logout')
save_screenshot(session)
session.has_content?('BeEF Authentication')
save_screenshot(session)
session
end