Tests - update e2e tests
This commit is contained in:
		@@ -23,8 +23,6 @@ class TestRegistration:
 | 
				
			|||||||
        assert inputs[1].get_attribute('type') == 'email'
 | 
					        assert inputs[1].get_attribute('type') == 'email'
 | 
				
			||||||
        assert inputs[2].get_attribute('id') == 'password'
 | 
					        assert inputs[2].get_attribute('id') == 'password'
 | 
				
			||||||
        assert inputs[2].get_attribute('type') == 'password'
 | 
					        assert inputs[2].get_attribute('type') == 'password'
 | 
				
			||||||
        assert inputs[3].get_attribute('id') == 'confirm-password'
 | 
					 | 
				
			||||||
        assert inputs[3].get_attribute('type') == 'password'
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        button = selenium.find_element_by_tag_name('button')
 | 
					        button = selenium.find_element_by_tag_name('button')
 | 
				
			||||||
        assert button.get_attribute('type') == 'submit'
 | 
					        assert button.get_attribute('type') == 'submit'
 | 
				
			||||||
@@ -45,7 +43,6 @@ class TestRegistration:
 | 
				
			|||||||
            'username': user_name,
 | 
					            'username': user_name,
 | 
				
			||||||
            'email': user_name,
 | 
					            'email': user_name,
 | 
				
			||||||
            'password': 'p@ssw0rd',
 | 
					            'password': 'p@ssw0rd',
 | 
				
			||||||
            'password_conf': 'p@ssw0rd',
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        register(selenium, user_infos)
 | 
					        register(selenium, user_infos)
 | 
				
			||||||
@@ -76,18 +73,3 @@ class TestRegistration:
 | 
				
			|||||||
        assert selenium.current_url == URL
 | 
					        assert selenium.current_url == URL
 | 
				
			||||||
        errors = selenium.find_element_by_class_name('error-message').text
 | 
					        errors = selenium.find_element_by_class_name('error-message').text
 | 
				
			||||||
        assert 'Sorry, that user already exists.' in errors
 | 
					        assert 'Sorry, that user already exists.' in errors
 | 
				
			||||||
 | 
					 | 
				
			||||||
    def test_it_displays_error_if_passwords_do_not_match(self, selenium):
 | 
					 | 
				
			||||||
        user_name = random_string()
 | 
					 | 
				
			||||||
        user_infos = {
 | 
					 | 
				
			||||||
            'username': user_name,
 | 
					 | 
				
			||||||
            'email': f'{user_name}@example.com',
 | 
					 | 
				
			||||||
            'password': 'p@ssw0rd',
 | 
					 | 
				
			||||||
            'password_conf': 'password',
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        register(selenium, user_infos)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        assert selenium.current_url == URL
 | 
					 | 
				
			||||||
        errors = selenium.find_element_by_class_name('error-message').text
 | 
					 | 
				
			||||||
        assert 'password and password confirmation don\'t match' in errors
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,8 +24,6 @@ def register(selenium, user):
 | 
				
			|||||||
    email.send_keys(user.get('email'))
 | 
					    email.send_keys(user.get('email'))
 | 
				
			||||||
    password = selenium.find_element_by_id('password')
 | 
					    password = selenium.find_element_by_id('password')
 | 
				
			||||||
    password.send_keys(user.get('password'))
 | 
					    password.send_keys(user.get('password'))
 | 
				
			||||||
    password_conf = selenium.find_element_by_id('confirm-password')
 | 
					 | 
				
			||||||
    password_conf.send_keys(user.get('password_conf'))
 | 
					 | 
				
			||||||
    submit_button = selenium.find_element_by_tag_name('button')
 | 
					    submit_button = selenium.find_element_by_tag_name('button')
 | 
				
			||||||
    submit_button.click()
 | 
					    submit_button.click()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -47,7 +45,6 @@ def register_valid_user(selenium):
 | 
				
			|||||||
        'username': user_name,
 | 
					        'username': user_name,
 | 
				
			||||||
        'email': f'{user_name}@example.com',
 | 
					        'email': f'{user_name}@example.com',
 | 
				
			||||||
        'password': 'p@ssw0rd',
 | 
					        'password': 'p@ssw0rd',
 | 
				
			||||||
        'password_conf': 'p@ssw0rd',
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    register(selenium, user)
 | 
					    register(selenium, user)
 | 
				
			||||||
    WebDriverWait(selenium, 15).until(EC.url_changes(f"{TEST_URL}/register"))
 | 
					    WebDriverWait(selenium, 15).until(EC.url_changes(f"{TEST_URL}/register"))
 | 
				
			||||||
@@ -60,7 +57,6 @@ def register_valid_user_and_logout(selenium):
 | 
				
			|||||||
        'username': user_name,
 | 
					        'username': user_name,
 | 
				
			||||||
        'email': f'{user_name}@example.com',
 | 
					        'email': f'{user_name}@example.com',
 | 
				
			||||||
        'password': 'p@ssw0rd',
 | 
					        'password': 'p@ssw0rd',
 | 
				
			||||||
        'password_conf': 'p@ssw0rd',
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    register(selenium, user)
 | 
					    register(selenium, user)
 | 
				
			||||||
    WebDriverWait(selenium, 15).until(EC.url_changes(f"{TEST_URL}/register"))
 | 
					    WebDriverWait(selenium, 15).until(EC.url_changes(f"{TEST_URL}/register"))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user