def logged_into_facebook(step): step.given('I have no cookies') step.given('I go to "http://www.facebook.com/"') step.given('I should see "Sign Up"') step.given('I fill in "Email" with "%s"' % world.facebook_email) step.given('I fill in "Password" with "%s"' % world.facebook_password) step.given('I press "Login"') wait_for_elem(world.browser, '//*[contains(., "News Feed")]') step.given('I should see "News Feed"')
def not_authorized_twitter_app(step): b = world.browser b.get('http://twitter.com/settings/connections') wait_for_elem(world.browser, '//a[@class="revoke-access"]', 4) elem = b.find_elements_by_xpath( '//li[contains(.//label//*, "%s")]//a[@class="revoke-access"]' % world.twitter_app_name ) if elem: elem[0].click() b.refresh()
def logged_into_google(step): step.given('I have no cookies') #ncr is needed to skip redirects like google.com.do and then get spanish text.... step.given('I go to "http://google.com/ncr"') step.given('I should see "Sign in"') world.browser.find_element_by_partial_link_text('Sign in').click() step.given('I fill in "Email" with "%s"' % world.google_username) step.given('I fill in "Passwd" with "%s"' % world.google_password) step.given('I press "Sign in"') wait_for_elem(world.browser, '//*[contains(., "Jorge Vargas")]')
def not_authorized_twitter_app(step): b = world.browser b.get("http://twitter.com/settings/connections") wait_for_elem(world.browser, '//a[@class="revoke-access"]', 4) elem = b.find_elements_by_xpath( '//li[contains(.//label//*, "%s")]//a[@class="revoke-access"]' % world.twitter_app_name ) if elem: elem[0].click() b.refresh()
def logged_into_twitter(step): step.given('I have no cookies') step.given('I go to "http://twitter.com/"') step.given('I should see "Sign in"') world.browser.find_element_by_partial_link_text('Sign in').click() step.given('I fill in "username" with "%s"' % world.twitter_username) step.given('I fill in "password" with "%s"' % world.twitter_password) step.given('I press "Sign in"') elems = wait_for_elem(world.browser, '//*[contains(., "Your Tweets")]', 4) if not elems: world.browser.refresh() elems = wait_for_elem(world.browser, '//*[contains(., "Your Tweets")]', 4)
def logged_into_twitter(step): step.given("I have no cookies") step.given('I go to "http://twitter.com/"') step.given('I should see "Sign in"') world.browser.find_element_by_partial_link_text("Sign in").click() step.given('I fill in "username" with "%s"' % world.twitter_username) step.given('I fill in "password" with "%s"' % world.twitter_password) step.given('I press "Sign in"') elems = wait_for_elem(world.browser, '//*[contains(., "Your Tweets")]', 4) if not elems: world.browser.refresh() elems = wait_for_elem(world.browser, '//*[contains(., "Your Tweets")]', 4)
def not_authorized_facebook_app(step): b = world.browser b.get('http://www.facebook.com/settings/?tab=applications') elems = b.find_elements_by_xpath('//span[contains(., "%s")]' % world.facebook_app_name) if elems: elems[0].click() wait_for_elem(b, '//a[contains(., "Remove app")]')[0].click() wait_for_elem(b, '//input[@type="button"][@value="Remove"]')[0].click() wait_for_elem(b, '//input[@type="button"][@value="Okay"]')[0].click()