-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_login_page.py
58 lines (50 loc) · 2.48 KB
/
test_login_page.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import pytest
from login_page_var import *
from web_fixtures import *
from selenium.webdriver.common.by import By
@pytest.mark.login
class Test_Login(Basic_Test):
def test_valid_login(self):
self.login(good_user, all_passwords)
title = self.driver.find_element(By.CLASS_NAME,'title').text
assert title == 'PRODUCTS'
@pytest.mark.xfail
def test_bad_pass(self):
self.login(good_user, 'all_passwords')
title = self.driver.find_element(By.CLASS_NAME,'title').text
assert title == 'PRODUCTS'
@pytest.mark.skip(reason="element does not exist")
def test_fake_element(self):
email = self.driver.find_element(By.CLASS_NAME,'email')
email.send_keys('[email protected]')
email.submit()
title = self.driver.find_element(By.CLASS_NAME,'title').text
assert title == 'Products'
def test_valid_login_with_spaces(self):
self.login(' ' + good_user, all_passwords)
error_msg = 'Epic sadface: Username and password do not match any user in this service'
error_div = self.driver.find_element(By.CLASS_NAME,'error-message-container')
assert error_div.text == error_msg
def test_wrong_username(self):
self.login('foo' , all_passwords)
error_msg = 'Epic sadface: Username and password do not match any user in this service'
error_div = self.driver.find_element(By.CLASS_NAME,'error-message-container')
assert error_div.text == error_msg
def test_wrong_password(self):
self.login(good_user , 'wrong_password')
error_msg = 'Epic sadface: Username and password do not match any user in this service'
error_div = self.driver.find_element(By.CLASS_NAME,'error-message-container')
assert error_div.text == error_msg
def test_locked_login(self):
self.login(locked_user, all_passwords)
error_message = 'Epic sadface: Sorry, this user has been locked out.'
error_div = self.driver.find_element(By.CLASS_NAME,'error-message-container')
assert error_div.text == error_message
def test_problem_login(self):
self.login(problem_user, all_passwords)
title = self.driver.find_element(By.CLASS_NAME,'title').text
assert title == 'PRODUCTS'
def test_glitch_login(self):
self.login(glitched_user, all_passwords)
title = self.driver.find_element(By.CLASS_NAME,'title').text
assert title == 'PRODUCTS'