Skip to content

Instantly share code, notes, and snippets.

@abstatic
Created June 20, 2016 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abstatic/ac3cab3c9164c42a0984755bd2d0ad09 to your computer and use it in GitHub Desktop.
Save abstatic/ac3cab3c9164c42a0984755bd2d0ad09 to your computer and use it in GitHub Desktop.
Upload function
def test030_upload(self):
"""
This test is for checking if we can successfully upload a profile
"""
print "Test#3 Profile upload test"
# login into the app
driver = self.driver
driver.get("http://localhost:8080/")
self.login(driver)
# make sure that we are logged in
wait = WebDriverWait(driver, 60)
assert wait.until(
EC.element_to_be_clickable((By.ID, "signout"))).is_displayed()
# go to the upload page
driver.get("http://localhost:8080/upload")
# in the upload file field, upload the file
upload_field = driver.find_element_by_id("id_file")
test_profile_path = self.test_profile_path
upload_field.send_keys(test_profile_path)
# we need to use the submit() button
# because when we submit forms via click
# the whole thing has been found to freeze.
elem = driver.find_element_by_id("submit_button")
elem.submit()
assert wait.until(
EC.presence_of_element_located((By.ID, "success")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment