Well the user registration and login portion already works but I am attempting to add some tests to it.
The user can register, is redirected back to the main page with a Login button.
def test_visitor_can_register_and_login_logout(self):
self.browser.get(self.server_url)
self.browser.find_element_by_id('id_register').click()
self.browser.find_element_by_id('id_username').send_keys(TEST_USER)
self.browser.find_element_by_id('id_email').send_keys(TEST_EMAIL)
self.browser.find_element_by_id('id_password1').send_keys(TEST_PASSWORD)
self.browser.find_element_by_id('id_password2').send_keys(TEST_PASSWORD)
self.browser.find_element_by_id('submit_registration').click()
time.sleep(10)
## Existing user is invited to login
self.browser.find_element_by_id('id_login').click()
self.browser.find_element_by_id('id_login').send_keys(TEST_USER)
self.browser.find_element_by_id('id_password').send_keys(TEST_PASSWORD)
self.browser.find_element_by_id('log_me_in').click()
## test user is logged in and can logout
self.browser.find_element_by_id('id_logout').click()
self.browser.find_element_by_tag_name('button').click()
##redirected back to main page
self.browser.find_element_by_id('id_login')
I see the main page load, the registration page loads and the inputs are filled in.
When the submit_registion button is clicked I get a 500. You can see I put a sleep in there just so I could see it and verify that the process isn't running too fast for the server to respond.
I originally had the registration and login in separate tests but I understand that this might require TransactionTestCase ? I am using
from django.test import LiveServerTestCase in this class.
I have one other test before that runs fine.
Any ideas? Tips on troubleshooting this functional test?