From 2f5e7a71e6e28056cd33f39ddcdbd1630ca5bd6b Mon Sep 17 00:00:00 2001 From: Steven Miers Date: Wed, 15 Jul 2015 17:04:21 -0500 Subject: [PATCH] Fixes VRFS-3337 : Fixes youtube spec / google login to match new behavior. --- web/spec/support/utilities.rb | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/web/spec/support/utilities.rb b/web/spec/support/utilities.rb index bf171b162..22e6633cb 100644 --- a/web/spec/support/utilities.rb +++ b/web/spec/support/utilities.rb @@ -73,13 +73,13 @@ def wipe_s3_test_bucket end end -def authorize_google_user(youtube_client, user, google_password) +def authorize_google_user(youtube_client, user, google_password) youtube_client.wait_for_callback(2112) do |access_token| #puts("Authorizing with token #{access_token}") user_auth_hash = { :provider => "google_login", - :uid => user.email, - :token => access_token, + :uid => user.email, + :token => access_token, :token_expiration => nil, :secret => "" } @@ -91,24 +91,20 @@ def authorize_google_user(youtube_client, user, google_password) #puts("Login URL: #{url}") visit url sleep(1) - # save_screenshot("initial.png") - - # Fill in password (the username is filled in with a hint in URL): - # fill_in "Usernm", with: user.email - fill_in "Passwd", with: google_password - #save_screenshot("password.png") + # (the username is filled in with a hint in URL): + # fill_in "Usernm", with: user.email + find('#next').trigger(:click) + sleep(5) + + # Fill in password + fill_in "Passwd", with: google_password find('#signIn').trigger(:click) + # Wait for submit to enable and then click it: sleep(5) - - #save_screenshot("signin.png") - - #save_screenshot("submit.png") find('#submit_approve_access').trigger(:click) - #save_screenshot("log2.png") sleep(5) - #save_screenshot("submitted.png") youtube_client end @@ -155,7 +151,7 @@ def sign_in_poltergeist(user, options = {}) should_be_at_root end - visit signin_path + visit signin_path page.should have_selector('#landing-inner form.signin-form') within('#landing-inner form.signin-form') do @@ -188,7 +184,7 @@ end def set_login_cookie(user) page.driver.set_cookie(:remember_token, user.remember_token) end - + def sign_out() if Capybara.javascript_driver == :poltergeist page.driver.remove_cookie(:remember_token) @@ -327,7 +323,7 @@ def jk_select(text, select) # the approach here is to find the hidden select element, and work way back up to the elements that need to be interacted with find(select, :visible => false).find(:xpath, 'ancestor::div[contains(@class, "dropdown easydropdown") and not(contains(@class, "disabled"))]').trigger(:click) find(select, :visible => false).find(:xpath, 'ancestor::div[contains(@class, "dropdown-wrapper") and contains(@class, "easydropdown-wrapper") and contains(@class, "open") ]').find('li', text: text).trigger(:click) - + # works, but is 'cheating' because of visible = false #select(genre, :from => 'genres', :visible => false) end