-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_cart.py
57 lines (50 loc) · 2.06 KB
/
test_cart.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
from web_fixtures import *
import pytest
@pytest.mark.all_cart
class Test_Cart(Cart_Test):
@pytest.mark.cart
def test_cart_page(self):
self.login(good_user, all_passwords)
self.get_to_cart()
assert self.driver.current_url == ('https://www.saucedemo.com/cart.html')
@pytest.mark.cart
def test_one_item_checkout(self):
self.login(good_user, all_passwords)
self.one_item_cart()
self.get_to_cart()
assert self.driver.current_url == ('https://www.saucedemo.com/cart.html')
@pytest.mark.checkout
def test_no_last_name(self):
self.login(good_user, all_passwords)
self.three_item_cart()
self.get_to_cart()
self.check_out()
self.check_out_form('josh', '', '83554')
error_msg = self.driver.find_element(By.CLASS_NAME,'error-message-container')
assert error_msg.text == 'Error: Last Name is required'
@pytest.mark.checkout
def test_no_first_name(self):
self.login(good_user, all_passwords)
self.get_to_cart()
self.check_out()
self.check_out_form('', 'josh', '83554')
error_msg = self.driver.find_element(By.CLASS_NAME,'error-message-container')
assert error_msg.text == 'Error: First Name is required'
@pytest.mark.checkout
def test_no_zip(self):
self.login(good_user, all_passwords)
self.get_to_cart()
self.check_out()
self.check_out_form('josh', 'walk', '')
error_msg = self.driver.find_element(By.CLASS_NAME,'error-message-container')
assert error_msg.text == 'Error: Postal Code is required'
@pytest.mark.checkout
def test_succesful_checkout(self):
self.login(good_user, all_passwords)
self.get_to_cart()
self.check_out()
self.check_out_form('josh', 'walker', '78108')
self.click_button('finish')
confirmation = self.driver.find_element(By.CLASS_NAME,'complete-header').text
msg = 'THANK YOU FOR YOUR ORDER'
assert confirmation == msg