'''
Author   : Govind Patidar
DateTime : 10/07/2020 11:30AM
File     : HomePage
'''

import unittest
from Utility.browser_load import BrowserLoad
from PageObject.home_page import HomePageObject
from Utility.logs import Logs

log = Logs(log="Homepage").getLogs()


class HomePage(unittest.TestCase):
    driver = None

    @classmethod
    def setUpClass(cls):
        '''
        #Load browser
        :return:
        '''
        print("------- Start Test Case--------")
        cls.browser = BrowserLoad(cls)
        cls.driver = cls.browser.browserOpen(cls)

    @classmethod
    def tearDownClass(cls):
        '''
        :return:
Exemplo n.º 2
0
'''
Author   : Govind Patidar
DateTime : 11/07/2020 11:40AM
File     : Checkout
'''

import time
from PageObject.checkout_page import CheckoutPageObject
from Utility.logs import Logs

log = Logs(log="Checkout").getLogs()


class Checkout():
    def __init__(self, driver):
        '''
        :param driver:
        '''
        self.driver = driver
        self.checkout = CheckoutPageObject(self.driver)

    def checkout_detail(self):
        '''
        :return:
        '''
        self.checkout.cart_btn()
        log.info("Click cart button.")
        # checkout page details
        amount = self.checkout.checkout_details()
        log.info(f"Checkout page added product total amount: {amount}")
Exemplo n.º 3
0
'''
Author   : Govind Patidar
DateTime : 11/07/2020 10:00AM
File     : Sunscreen
'''

from PageObject.add_to_cart_page import AddToCartPageObject
from Utility.logs import Logs

log = Logs(log="Sunscreen").getLogs()


class Sunscreen():
    def __init__(self, driver):
        '''
        :param driver:
        '''
        self.driver = driver

    def winter(self):
        '''
        :return:
        '''
        product = AddToCartPageObject(self.driver)
        name = product.product_name()
        price = product.product_price()

        for i in range(len(name)):
            # assert through match any random product name and price value
            if name[i] == "Anatoly Ultra Sunblock SPF-50":
                assert name[i] == "Anatoly Ultra Sunblock SPF-50"
Exemplo n.º 4
0
DateTime : 10/07/2020 11:30AM
File     : AddToCartAndPayment
'''

import unittest
import time
from Utility.browser_load import BrowserLoad
from Utility.logs import Logs
from PageObject.home_page import HomePageObject
from TestData.Moisturizes import Moisturize
from TestData.Sunscreens import Sunscreen
from TestData.AddCarts import AddCart
from TestData.CheckoutData import Checkout
from TestData.Payment import Payment

log = Logs(log="AddToCartAndPayment").getLogs()


class AddToCartAndPayment(unittest.TestCase):
    driver = None

    @classmethod
    def setUpClass(cls):
        '''
        #Load browser
        :return:
        '''
        print("-------Start Test Case--------")
        cls.browser = BrowserLoad(cls)
        cls.driver = cls.browser.browserOpen(cls)
Exemplo n.º 5
0
'''
Author   : Govind Patidar
DateTime : 10/07/2020 11:30AM
File     : BrowserLoad
'''

import os.path
from configparser import ConfigParser
from selenium import webdriver
from msedge.selenium_tools import EdgeOptions
from msedge.selenium_tools import Edge

from Utility.logs import Logs

log = Logs(log="BrowserLoad").getLogs()


class BrowserLoad(object):
    # Set the absolute path for drivers
    dir = os.path.dirname(os.path.abspath(''))

    # Get all browser
    chrome_driver_path = dir + "/Driver/chromedriver"
    firefox_driver_path = dir + "/Driver/geckodriver"
    ie_driver_path = dir + "/Driver/geckodriver"
    # Safari_driver_path = dir + "/Driver/safaridriver"
    edge_driver_path = dir + "/Driver/msedgedriver"

    # Define the constructor
    def __init__(self, driver):
        '''
'''
Author   : Govind Patidar
DateTime : 11/07/2020 11:50AM
File     : Payment
'''

from PageObject.payment_page import PaymentPageObject
from Utility.logs import Logs

log = Logs(log="Payment").getLogs()


class Payment():
    def __init__(self, driver):
        '''
        :param driver:
        '''
        self.driver = driver
        self.payment = PaymentPageObject(self.driver)

    def fill_card_detail(self):
        '''
        # This method use for fill all card details
        :return:
        '''
        self.payment.enter_email()
        log.info("Enter random email id")

        self.payment.enter_card_no()
        log.info("Enter card number")
'''
Author   : Govind Patidar
DateTime : 11/07/2020 10:00AM
File     : Moisturize
'''

from PageObject.add_to_cart_page import AddToCartPageObject
from Utility.logs import Logs

log = Logs(log="Moisturize").getLogs()


class Moisturize():
    def __init__(self, driver):
        '''
        :param driver:
        '''
        self.driver = driver

    def summer(self):
        '''
        :return:
        '''
        product = AddToCartPageObject(self.driver)
        name = product.product_name()
        price = product.product_price()

        try:
            for i in range(len(name)):
                # assert through match any random product name and price value
                if name[i] == "Tigran Aloe Isolani":