-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_buy_items_and_checkout.py
More file actions
45 lines (28 loc) · 1.3 KB
/
test_buy_items_and_checkout.py
File metadata and controls
45 lines (28 loc) · 1.3 KB
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
import pytest
# import pytest_html
from selenium import webdriver
from pages.login_page import LoginPage
from pages.inventory_page import InventoryPage
from pages.cart_page import CartPage
from pages.checkout_page import CheckoutPage
import time
import os
from dotenv import load_dotenv
load_dotenv()
homepage_url = os.getenv("homepage_url")
class TestClass:
def test_buy_items_and_checkout(self,driver_init,valid_login_credentials,valid_checkout_credentials):
valid_username,valid_password = self.username, self.password #valid_login_credentials["username"], valid_login_credentials["password"]
# go to the home page url and login
login = LoginPage(homepage_url,driver_init,valid_username,valid_password)
login.valid_login_steps()
#add backpack_and_jacket to your cart
inventory = InventoryPage(driver_init)
inventory.buy_backpack_and_jacket()
## proceed to checkout
cart = CartPage(driver_init)
cart.go_to_checkout()
## complete checkout process
valid_first_name,valid_last_name,valid_zip_code = valid_checkout_credentials
checkout = CheckoutPage(driver_init,valid_first_name,valid_last_name,valid_zip_code)
checkout.complete_checkout()