1) Fix an error in which I wasn't checking properly that the pledge_complete page should allow only the pledging user to see the results.
2) Now tests.campaigntest.support_campaign takes us all the way through pledging for the first campaignpull/1/head
parent
6b4c426a74
commit
744693f178
|
@ -467,8 +467,12 @@ should briefly note next steps (e.g. if this campaign succeeds you will be email
|
|||
try:
|
||||
if user.id == transaction.user.id:
|
||||
correct_user = True
|
||||
else:
|
||||
# should be 403 -- but let's try 404 for now -- 403 exception coming in Django 1.4
|
||||
raise Http404
|
||||
except Exception, e:
|
||||
pass
|
||||
raise Http404
|
||||
|
||||
|
||||
# check that the user had not already approved the transaction
|
||||
# do we need to first run PreapprovalDetails to check on the status
|
||||
|
|
|
@ -60,7 +60,8 @@ def loginSandbox(selenium):
|
|||
except:
|
||||
traceback.print_exc()
|
||||
|
||||
def paySandbox(test, selenium, url, authorize=False):
|
||||
def paySandbox(test, selenium, url, authorize=False, already_at_url=False, sleep_time=20):
|
||||
|
||||
|
||||
if authorize:
|
||||
print "AUTHORIZE SANDBOX"
|
||||
|
@ -69,8 +70,9 @@ def paySandbox(test, selenium, url, authorize=False):
|
|||
|
||||
try:
|
||||
# We need this sleep to make sure the JS engine is finished from the sandbox loging page
|
||||
time.sleep(20)
|
||||
time.sleep(sleep_time)
|
||||
|
||||
if not already_at_url:
|
||||
selenium.get(url)
|
||||
print "Opened URL %s" % url
|
||||
|
||||
|
@ -82,7 +84,7 @@ def paySandbox(test, selenium, url, authorize=False):
|
|||
|
||||
# This sleep is needed for js to slide the buyer login into view. The elements are always in the DOM
|
||||
# so selenium can find them, but we need them in view to interact
|
||||
time.sleep(20)
|
||||
time.sleep(sleep_time)
|
||||
except:
|
||||
print "Ready for Login"
|
||||
|
||||
|
@ -98,13 +100,13 @@ def paySandbox(test, selenium, url, authorize=False):
|
|||
submit_button.click()
|
||||
|
||||
# This sleep makes sure js has time to animate out the next page
|
||||
time.sleep(20)
|
||||
time.sleep(sleep_time)
|
||||
|
||||
final_submit = WebDriverWait(selenium, 60).until(lambda d : d.find_element_by_id("submit.x"))
|
||||
final_submit.click()
|
||||
|
||||
# This makes sure the processing of the final submit is complete
|
||||
time.sleep(20)
|
||||
time.sleep(sleep_time)
|
||||
|
||||
# Don't wait too long for this, it isn't really needed. By the time JS has gotten around to
|
||||
# displaying this element, the redirect has usually occured
|
||||
|
|
|
@ -161,12 +161,12 @@ def support_campaign():
|
|||
PASSWORD = settings.UNGLUEIT_TEST_PASSWORD
|
||||
|
||||
# PayPal developer sandbox
|
||||
from regluit.payment.tests import loginSandbox
|
||||
from regluit.payment.tests import loginSandbox, paySandbox
|
||||
|
||||
setup_selenium()
|
||||
|
||||
# we can experiment with different webdrivers
|
||||
# sel = webdriver.Firefox()
|
||||
#sel = webdriver.Firefox()
|
||||
|
||||
# Chrome
|
||||
sel = webdriver.Chrome(executable_path='/Users/raymondyee/C/src/Gluejar/regluit/test/chromedriver')
|
||||
|
@ -224,6 +224,11 @@ def support_campaign():
|
|||
pledge_button = WebDriverWait(sel,20).until(lambda d: d.find_element_by_css_selector("input[value*='Pledge']"))
|
||||
pledge_button.click()
|
||||
|
||||
# grab the URL where sel is now?
|
||||
|
||||
print "Now trying to pay PayPal", sel.current_url
|
||||
paySandbox(None, sel, sel.current_url, authorize=True, already_at_url=True, sleep_time=5)
|
||||
|
||||
#sel.quit()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue