-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_swag_labs.py
71 lines (50 loc) · 1.93 KB
/
test_swag_labs.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
59
60
61
62
63
64
65
66
67
68
69
70
71
import time #importaciones necesarias para ejecutar las pruebas
import data
import main
from selenium import webdriver
class TestSauceDemo:
driver = None
@classmethod
def setup_class(cls):
cls.driver = webdriver.Chrome()
def test_login(self):
self.driver.get(data.URL_SAUCE)
login = main.Login(self.driver)
login.wait_for_load_field()
login.set_username(data.USERNAME)
login.set_password(data.PASSWORD)
login.click_sign_up()
assert data.URL_SAUCE == "https://www.saucedemo.com/"
def test_add_product(self):
self.test_login()
add_product = main.AddProducts(self.driver)
add_product.wait_for_load_field()
add_product.backpack()
add_product.bike_light()
add_product.fleece()
add_product.click_cart_button()
assert data.URL_SAUCE == "https://www.saucedemo.com/"
def test_shopping_cart(self):
self.test_add_product()
cart = main.ShoppingCart(self.driver)
cart.wait_for_load_field()
cart.click_checkout_button()
assert data.URL_SAUCE == "https://www.saucedemo.com/"
def test_checkout_info(self):
self.test_shopping_cart()
checkout = main.CheckoutInfo(self.driver)
checkout.wait_for_load_field()
checkout.set_first_name(data.FIRSTNAME)
checkout.set_lastname(data.LASTNAME)
checkout.set_postal_code(data.POSTAL_CODE)
checkout.click_continue_button()
assert data.URL_SAUCE == "https://www.saucedemo.com/"
def test_finish_shopping(self):
self.test_checkout_info()
finish = main.FinishShopping(self.driver)
finish.wait_for_load_field()
finish.click_finish_button()
assert data.URL_SAUCE == "https://www.saucedemo.com/"
@classmethod
def teardown_class(cls):
cls.driver.quit()