예제 #1
0
"""automating women menu hovering"""
from config import XL_PATH, WOMEN_LOCS
from expected_values import WOMEN_SUB_MENUS
from library.web_utils import WebUtils
from library.file_library import ReadFile
web = WebUtils()
read = ReadFile()
element, keys = read.read_objects(XL_PATH, WOMEN_LOCS)


class WomenSubMenu:
    """gets women submenus   """  # pylint:disable=R0801

    def __init__(self, driver):
        self.driver = driver

    def click_x(self):
        """clicks on x button"""  # pylint:disable=R0801
        web.click_element(self.driver, element['x_button'])  # pylint:disable=R0801

    def search_bar(self):
        """sends value to search box"""
        web.send_string(self.driver, 'sony vaio', element['search_bar'])

    def search_button(self):
        """clicks on search button"""
        web.click_element(self.driver, element['search_button'])

    def hover_on_menu(self):
        """hovers on electronics menu"""
        web.hover(self.driver, element["women"])
예제 #2
0
"""automating sports menu hovering"""
from config import XL_PATH, SPORTS_LOCS
from expected_values import SPORTS_SUB_MENUS
from library.web_utils import WebUtils
from library.file_library import ReadFile
web = WebUtils()
read = ReadFile()
element, keys = read.read_objects(XL_PATH, SPORTS_LOCS)


class SportsSubMenu:
    """extracts sports submenu"""  # pylint:disable=R0801

    def __init__(self, driver):
        self.driver = driver

    def click_x(self):
        """clicks on x button"""  # pylint:disable=R0801
        web.click_element(self.driver, element['x_button'])

    def search_bar(self):
        """sends value to search box"""
        web.send_string(self.driver, 'sony vaio', element['search_bar'])

    def search_button(self):
        """clicks on search button"""
        web.click_element(self.driver, element['search_button'])

    def hover_on_menu(self):
        """hovers on sports menu"""
        web.hover(self.driver, element["sports"])
예제 #3
0
"""Login automation page"""
from library.file_library import ReadFile
from library.web_utils import WebUtils
from config import XL_PATH, LOCATOR_VALS, TEST_SHEET

web = WebUtils()
read = ReadFile()
element, keys = read.read_objects(XL_PATH, LOCATOR_VALS)
# driver.implicitly_wait(5)


class Login:
    """login"""
    def __init__(self, driver, test_case):
        self.driver = driver
        self.test_case = test_case
        self.username, self.password = read.read_data(
            XL_PATH, TEST_SHEET, self.test_case)

    def enter_username(self):
        """user"""
        web.send_string(self.driver, self.username, element['enter_username'])

    def enter_password(self):
        """password"""
        web.send_string(self.driver, self.password, element['enter_password'])

    def click_login(self):
        """click on login button"""
        web.click_element(self.driver, element['click_login'])
예제 #4
0
"""automates renting a movie"""
from time import sleep
from library.web_utils import WebUtils
from library.file_library import ReadFile
# from selenium import webdriver
# from config import XL_PATH, RENT_TICKET_LOCS, CHROME_PATH, URL
read = ReadFile()
element, keys = read.read_objects(XL_PATH, RENT_TICKET_LOCS)
web = WebUtils()


class RentAMovie:
    """automates renting a movie"""

    def __init__(self, driver):
        self.driver = driver

    def scroll_down(self):
        """scrolls down"""
        web.scroll_down(self.driver)

    def scroll_up(self):
        """scrolls down"""
        web.scroll_up(self.driver)

    def select_city(self):
        """selects city"""
        web.click_element(self.driver, element['select_city'])

    def select_movie(self):
        """selects movie"""
예제 #5
0
"""automating buying a product end to end"""
from config import XL_PATH, BUY_PRODUCT_LOCS, BUY_PRODUCT_TESTCASES
from library.file_library import ReadFile
from library.web_utils import WebUtils

web = WebUtils()
read = ReadFile()
element, keys = read.read_objects(XL_PATH, BUY_PRODUCT_LOCS)


class BuyProduct:
    """automating buying a product end to end"""
    def __init__(self, driver, test_case):
        self.driver = driver
        self.test_case = test_case
        self.product, self.price = read.read_data(XL_PATH,
                                                  BUY_PRODUCT_TESTCASES,
                                                  self.test_case)
        # print(self.product, self.price)

    def click_x(self):
        """clicks on x button"""
        web.click_element(self.driver, element['x_button'])

    def search_box(self):
        """sends value to search box"""
        web.send_string(self.driver, self.product, element['search_box'])

    def search_button(self):
        """clicks on search button"""
        web.click_element(self.driver, element['search_button'])
예제 #6
0
"""fetches electronic submenus"""
from config import XL_PATH, ELECTRONIC_LOCS
from expected_values import ELECTRONIC_SUB_MENU  # pylint:disable=R0801
from library.web_utils import WebUtils
from library.file_library import ReadFile
web = WebUtils()
read = ReadFile()
element, keys = read.read_objects(XL_PATH, ELECTRONIC_LOCS)


class ElectronicSubMenu:
    """fetches electronic submenus"""  # pylint:disable=R0801

    def __init__(self, driver):
        self.driver = driver

    def click_x(self):
        """clicks on x button"""   # pylint:disable=R0801
        web.click_element(self.driver, element['x_button'])

    def search_bar(self):
        """sends value to search box"""
        web.send_string(self.driver, 'sony vaio', element['search_bar'])

    def search_button(self):
        """clicks on search button"""
        web.click_element(self.driver, element['search_button'])

    def hover_on_electronics(self):
        """hovers on electronics menu"""
        web.hover(self.driver, element["electronics"])
예제 #7
0
"""automating menu hovering"""
from config import XL_PATH, BABY_LOCS
from expected_values import BABY_SUB_MENUS  # pylint:disable=R0801
from library.web_utils import WebUtils
from library.file_library import ReadFile

web = WebUtils()
read = ReadFile()
element, keys = read.read_objects(XL_PATH, BABY_LOCS)


class BabySubMenu:
    """fetches baby submenus"""  # pylint:disable=R0801

    def __init__(self, driver):
        self.driver = driver

    def click_x(self):
        """clicks on x button"""  # pylint:disable=R0801
        web.click_element(self.driver, element['x_button'])

    def search_bar(self):
        """sends value to search box"""
        web.send_string(self.driver, 'sony vaio', element['search_bar'])

    def search_button(self):
        """clicks on search button"""
        web.click_element(self.driver, element['search_button'])

    def hover_on_menu(self):
        """hovers on baby sub menu"""
예제 #8
0
"""test login page"""
from time import sleep
import pytest
from library.base_fixtures import DriverInit
from library.file_library import ReadFile
from config import XL_PATH, TEST_SHEET
from pages.login import Login


read = ReadFile()
element, test_cases = read.read_objects(XL_PATH, TEST_SHEET)


class TestLogin(DriverInit):
    """tests login"""
    @pytest.mark.parametrize("testcase", test_cases)
    def test_launch_url(self, testcase):
        """tests login page"""
        sleep(2.5)
        obj = Login(self.driver, testcase)   # pylint:disable=E1101
        # self.driver.implicitly_wait(5)
        sleep(2.5)
        obj.enter_username()
        sleep(2.5)
        obj.enter_password()
        sleep(2.5)
        obj.click_login()
        sleep(2.5)
예제 #9
0
"""automating fashion menu hovering"""
from config import XL_PATH, FASHION_LOCS
from expected_values import FASHION_SUB_MENUS   # pylint:disable=R0801
from library.web_utils import WebUtils
from library.file_library import ReadFile
web = WebUtils()
read = ReadFile()
element, keys = read.read_objects(XL_PATH, FASHION_LOCS)


class FashionSubMenu:
    """fetches fashion submenus"""  # pylint:disable=R0801
    def __init__(self, driver):
        self.driver = driver

    def click_x(self):
        """clicks on x button"""
        web.click_element(self.driver, element['x_button'])

    def hover_on_menu(self):
        """hovers on fashion menu"""
        web.hover(self.driver, element["fashion"])

    def grab_sub_menu_items(self):
        """fetches electronic submenus"""
        sub_menus = web.grab_menus(self.driver, element['sub_menus'])
        sub_menus = [item.text for item in sub_menus]
        if sub_menus == FASHION_SUB_MENUS:
            print('All sub menus present')
        else:
            print('Some menu items maybe absent')
예제 #10
0
"""automating furniture menu hovering"""
from config import XL_PATH, FURNITURE_LOCS
from expected_values import FURNITURE_SUB_MENUS  # pylint:disable=R0801
from library.web_utils import WebUtils
from library.file_library import ReadFile
web = WebUtils()
read = ReadFile()
element, keys = read.read_objects(XL_PATH, FURNITURE_LOCS)


class FurnitureSubMenu:
    """obtains furniture sub menus"""  # pylint:disable=R0801

    def __init__(self, driver):
        self.driver = driver

    def click_x(self):
        """clicks on x button"""  # pylint:disable=R0801
        web.click_element(self.driver, element['x_button'])

    def search_bar(self):
        """sends value to search box"""
        web.send_string(self.driver, 'sony vaio', element['search_bar'])

    def search_button(self):
        """clicks on search button"""
        web.click_element(self.driver, element['search_button'])

    def hover_on_menu(self):
        """hovers on electronics menu"""
        web.hover(self.driver, element["furniture"])
예제 #11
0
"""automating home menu hovering"""
from config import XL_PATH, HOME_LOCS
from expected_values import HOME_SUB_MENUS
from library.web_utils import WebUtils
from library.file_library import ReadFile
web = WebUtils()
read = ReadFile()
element, keys = read.read_objects(XL_PATH, HOME_LOCS)


class HomeSubMenu:
    """fetches fashion submenus"""
    def __init__(self, driver):
        self.driver = driver

    def click_x(self):
        """clicks on x button"""
        web.click_element(self.driver, element['x_button'])

    def hover_on_menu(self):
        """hovers on home menu"""
        web.hover(self.driver, element["home"])

    def grab_sub_menu_items(self):
        """fetches home submenus"""
        sub_menus = web.grab_menus(self.driver, element['sub_menus'])
        sub_menus = [item.text for item in sub_menus]
        # print(sub_menus)
        # print(ELECTRONIC_SUB_MENU)
        if sub_menus == HOME_SUB_MENUS:
            print('All sub menus present')
예제 #12
0
"""test products availability"""
from time import sleep
import pytest
from config import XL_PATH, BUY_PRODUCT_TESTCASES
from pages.buy_product import BuyProduct
from library.base_fixtures import DriverInit
from library.file_library import ReadFile

read = ReadFile()
element, test_cases = read.read_objects(XL_PATH, BUY_PRODUCT_TESTCASES)


class TestBuyProduct(DriverInit):
    """tests availability of products"""
    @pytest.mark.parametrize("testcase", test_cases)
    def test_buy_product(self, testcase):
        """tests availability of products"""
        obj = BuyProduct(self.driver, testcase)  # pylint:disable=E1101
        self.driver.implicitly_wait(10)  # pylint:disable=E1101
        obj.click_x()
        sleep(2.5)
        obj.search_box()
        sleep(2.5)
        obj.search_button()
        sleep(2.5)
        obj.price_filter()
        sleep(2.5)
        obj.rating_filter()
        sleep(2.5)
        obj.select_product()
        sleep(2.5)
예제 #13
0
""""fetches television submenus"""
from config import XL_PATH, TELEVISION_LOCS
from expected_values import TELEVISION
from library.web_utils import WebUtils
from library.file_library import ReadFile
web = WebUtils()
read = ReadFile()
element, keys = read.read_objects(XL_PATH, TELEVISION_LOCS)
# driver = webdriver.Chrome(CHROME_PATH, options=chrome_options)
# driver.get(URL)


class TelevisionSubMenu:
    """"fetches television submenus"""  # pylint:disable=R0801

    def __init__(self, driver):
        self.driver = driver

    def click_x(self):
        """clicks on x button"""  # pylint:disable=R0801
        web.click_element(self.driver, element['x_button'])

    def search_bar(self):
        """sends value to search box"""
        web.send_string(self.driver, 'sony vaio', element['search_bar'])

    def search_button(self):
        """clicks on search button"""
        web.click_element(self.driver, element['search_button'])

    def hover_on_television(self):
예제 #14
0
"""auotomates search box"""
from library.file_library import ReadFile
from library.web_utils import WebUtils
from config import XL_PATH, LOC_VALS2, TEST_SHEET2

web = WebUtils()
read = ReadFile()
element, keys = read.read_objects(XL_PATH, LOC_VALS2)
# print(element)
# print(keys)


class SearchBox:
    """search box"""
    def __init__(self, driver, test_case):
        self.driver = driver
        self.test_case = test_case
        self.search_item = read.read_data(XL_PATH, TEST_SHEET2, self.test_case)
        # print(self.search_item)

    def x_button(self):
        """ click on x button """
        web.click_element(self.driver, element['x_button'])

    def search_bar(self):
        """send string to search bar"""
        web.send_string(self.driver, self.search_item, element['search_bar'])

    def search_button(self):
        """click on search"""
        web.click_element(self.driver, element['search_button'])