module Assertions module Gmail def assert_logged_in(email,password) visit "http://gmail/com" fill_in "Email", :with => email fill_in "Passwd", :with => password assert_appears("#loading") do click_button "Sign in" end wait_until { has_no_css?("#loading") } within_frame "canvas_frame" do wait_until { has_css?("#gbi4m1", :text => email) } end end def assert_logged_out within_frame "canvas_frame" do find("#gbi4m1").click click_link "Sign out" end switch_to_main_window wait_until { assert has_css?(".signin-box #gaia_loginform") } end def assert_email_sent(subject,body,to) switch_to_main_window/ find("div", :text => "Compose mail").click within_frame "canvas_frame" do wait_until { assert has_css?("textarea[name='to']") } end end protected def switch_to_main_window page.driver.browser.switch_to.window page.driver.browser.window_handles.first end end end