Example #1
0
 def test_cart_in_header_add_from_catalog(self):
     header_cart = HeaderPage(self.driver)
     catalog = CatalogPage(self.driver)
     self.driver.get(TEST_URL + project_page.get('category'))
     catalog.click_first_buy_button()
     assert catalog.check_present_button_in_cart
     assert '1' == header_cart.text_digit_cart_header
     assert header_cart.text_cart_price in catalog.text_first_price
Example #2
0
 def __init__(self):
     self.driver = webdriver.Chrome()  #Chrome  Ie  Firefox
     self.catalog_page = CatalogPage(self.driver)
     self.general_page = GenaralPage(self.driver)
     self.info_page = InfoPage(self.driver)
     self.prices_page = PricesPage(self.driver)
     self.login = Login(self.driver)
     self.product = Product(self)
     self.supporting = Supporting(self.driver)
Example #3
0
 def __init__(self):
     self.driver = webdriver.Chrome()
     self.driver.maximize_window()
     self.home_page = HomePage(self.driver)
     self.create_account_page = CreateAccountPage(self.driver)
     self.admin_panel_login_page = AdminPanelLoginPage(self.driver)
     self.admin_page = AdminPage(self.driver)
     self.customer_list_page = CustomerListPage(self.driver)
     self.countries_page = CountriesPage(self.driver)
     self.geo_zones_page = GeoZonesPage(self.driver)
     self.catalog_page = CatalogPage(self.driver)
Example #4
0
class Application:
    def __init__(self):
        self.driver = webdriver.Chrome()  #Chrome  Ie  Firefox
        self.catalog_page = CatalogPage(self.driver)
        self.general_page = GenaralPage(self.driver)
        self.info_page = InfoPage(self.driver)
        self.prices_page = PricesPage(self.driver)
        self.login = Login(self.driver)
        self.product = Product(self)
        self.supporting = Supporting(self.driver)

    def quit(self):
        self.driver.quit()

    def login_admin(self):
        if self.login.open().is_on_this_page():
            self.login.authorization()
            return self.catalog_page.open()

    def catalog_page_button(self):
        self.catalog_page.new_product_button()

    def fill_general_page(self, product):
        self.general_page.input_name_product.send_keys(product.product_name)
        self.general_page.input_code_product.send_keys(product.product_code)
        self.general_page.input_date_from.send_keys(product.date_from)
        self.general_page.input_date_to.send_keys(product.date_to)
        self.general_page.select_quantity_unit()
        self.general_page.select_delivery_status()
        self.general_page.select_sold_out_status()
        self.general_page.upload_image()
        self.general_page.input_radio_but.click()
        self.general_page.input_check_b()
        self.general_page.input_check_b2()

    def fill_info_page(self, product):
        self.catalog_page.click_info_part.click()
        self.info_page.input_head_title.send_keys(product.head_title)
        self.info_page.input_keywords.send_keys(product.keywords)
        self.info_page.input_short_descr.send_keys(product.short_desc)
        self.info_page.input_meta_descr.send_keys(product.meta_desc)
        self.info_page.select_manufacturer_id()
        self.info_page.put_full_descr.send_keys(product.full_desc)

    def fill_prices_page(self, product):
        self.catalog_page.click_prices_part.click()
        self.prices_page.input_purchase_price.clear()
        self.prices_page.input_purchase_price.send_keys(product.purchase_price)
        self.prices_page.input_USD.send_keys(product.prices_USD)
        self.prices_page.input_EUR.send_keys(product.prices_EUR)
        self.prices_page.select_purchase_currency()
        self.catalog_page.click_save_button.click()
Example #5
0
 def test_full_search_result_click_group(self, current_language):
     main = MainPage(self.driver)
     full_search_result = FullSearchResultPage(self.driver)
     group = CatalogPage(self.driver)
     self.driver.get(TEST_URL)
     self.change_language(self.driver, current_language)
     main.click_search_field()
     main.fill_search_field(self.brand)
     expected_group_name = full_search_result.text_first_group.strip()
     expected_group_url = full_search_result.url_first_group
     full_search_result.click_first_group()
     assert group.check_title(expected_group_name.upper())
     assert expected_group_url == self.driver.current_url
Example #6
0
 def test_full_search_result_click_category(self, current_language, side):
     main = MainPage(self.driver)
     full_search_result = FullSearchResultPage(self.driver)
     category = CatalogPage(self.driver)
     self.driver.get(TEST_URL)
     self.change_language(self.driver, current_language)
     main.click_search_field()
     main.fill_search_field(self.brand)
     expected_category_name = f"{full_search_result.text_first_category(side).upper()} {self.brand.upper()}"
     expected_category_url = full_search_result.url_first_category(side)
     full_search_result.click_first_category(side)
     assert category.check_title(expected_category_name)
     assert expected_category_url == self.driver.current_url
Example #7
0
    def __init__(self, browser, base_url):
        if browser == "firefox":
            self.wd = webdriver.Firefox()
        elif browser == "chrome":
            self.wd = webdriver.Chrome()
        elif browser == "ie":
            self.wd = webdriver.Ie()
        else:
            raise ValueError("Unrecognized browser %s" % browser)
#        self.wd.implicitly_wait(5)
        self.session = SessionHelper(self)
        #       self.group = GroupHelper(self)
        self.base_url = base_url
        self.catalog_page = CatalogPage(self.wd)
class CatalogActions(BasePageObject, BasePage):

    # Get an instance driver, app, SearchPageLocators
    def __init__(self, app):
        self.app = app
        self.driver = app.driver
        self.catalog_actions = CatalogPage(driver=self.driver)

    @allure.step("Verify navigate menu process")
    def verify_url(self, url):
        LOGGER.info("Verify navigate menu process")
        assert self.driver.current_url == url, "Test menu navigate failed" \
                                               f"Expected: {url}, " \
                                               f"Actual: {self.driver.current_url}"

    @allure.step("Navigate to selected subsection")
    def navigate_to_subsection(self, name):
        LOGGER.info(f"Navigate to subsection '{name}'")
        for index, section in enumerate(self.catalog_actions.subsections):
            if section.text == name:
                self.catalog_actions.click_subsection_link(index)
                break
        else:
            raise AttributeError("No such subsection was found")

    @allure.step("Navigate to selected product")
    def navigate_to_product(self, index=0):
        LOGGER.info(f"Navigate to product {index}")
        time.sleep(1)
        self.catalog_actions.click_product_link(index)

    @allure.step("Navigate to compare page through link on current page")
    def navigate_to_compare_page(self):
        LOGGER.info("Navigate to compare page")
        self.catalog_actions.click_compare()

    @allure.step("Remove compare")
    def remove_compare_icon(self):
        LOGGER.info("Remove compare")
        self.catalog_actions.click_remove_compare_icon()
        self.catalog_actions.click_remove_compare_button()

    def scroll_down(self):
        ActionChains(driver=self.driver).send_keys('ue015').perform()
Example #9
0
 def __init__(self, browser):
     if browser == "chrome":
         self.driver = webdriver.Chrome()
     elif browser == "firefox":
         self.driver = webdriver.Firefox()
     time.sleep(1.3)
     self.driver.maximize_window()
     self.driver.implicitly_wait(10)
     self.driver.set_page_load_timeout(20)
     self.base = BasePage(self.driver)
     self.catalog = CatalogPage(self.driver)
Example #10
0
 def test_comparison_info_cart_vs_catalog(self):
     module_cart = ModulePage(self.driver)
     header_cart = HeaderPage(self.driver)
     cart = CartPage(self.driver)
     catalog = CatalogPage(self.driver)
     self.driver.get(TEST_URL + project_page.get('category'))
     page_info = catalog.set_product_info()
     catalog.click_first_buy_button()
     catalog.click_first_in_cart_button()
     assert self.driver.current_url == (TEST_URL + project_page.get('cart'))
     cart_info = cart.set_product_info()
     # self.close_draggable(self.driver)
     header_cart.click_cart()
     assert module_cart.check_cart_module_info_loaded('грн')
     cart_module_info = module_cart.set_product_info()
     assert page_info == cart_info
     assert page_info == cart_module_info
Example #11
0
    def test_search_categories(self, current_language):

        search_category = {
            'RU': 'жидкости охлаждающие и сопутствующие товары',
            'UA': 'рідини охолоджуючі та супутні товари',
            'EN': 'liquid cooling and related products'}

        self.driver.get(TEST_URL + project_page.get('section'))
        self.change_language(self.driver, current_language)
        section = CatalogPage(self.driver)
        section.fill_search_field(search_category.get(current_language))
        section.click_category_in_search_result()
        url = f"{TEST_URL}{language_to_url.get(current_language)}{project_page.get('category')}"
        assert url == self.driver.current_url
Example #12
0
class Application:
    def __init__(self, browser, base_url):
        if browser == "firefox":
            self.wd = webdriver.Firefox()
        elif browser == "chrome":
            self.wd = webdriver.Chrome()
        elif browser == "ie":
            self.wd = webdriver.Ie()
        else:
            raise ValueError("Unrecognized browser %s" % browser)
#        self.wd.implicitly_wait(5)
        self.session = SessionHelper(self)
        #       self.group = GroupHelper(self)
        self.base_url = base_url
        self.catalog_page = CatalogPage(self.wd)

    def open_home_page(self):
        wd = self.wd
        wd.get(self.base_url)

    def destroy(self):
        self.wd.quit()

    def is_valid(self):
        try:
            self.wd.current_url
            return True
        except:
            return False

    def add_new_product(self, new_product):
        self.catalog_page.open()
        self.catalog_page.add_new_product_form()
        self.catalog_page.status_enabled()
        self.catalog_page.product_name_input.send_keys("name",
                                                       new_product.name)
        self.catalog_page.product_code_input.send_keys("code",
                                                       new_product.code)
        category = self.catalog_page.select_random_category()
        category.click()
        self.catalog_page.select_gender()
        self.catalog_page.quantity_input.send_keys("quantity",
                                                   new_product.quantity)
        self.catalog_page.date_valid_from_input.send_keys(
            "date_valid_from", new_product.date_valid_from)
        self.catalog_page.date_valid_to_input.send_keys(
            "date_valid_to", new_product.date_valid_to)
        self.catalog_page.save_general_info()
Example #13
0
class Application:
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.driver.maximize_window()
        self.home_page = HomePage(self.driver)
        self.create_account_page = CreateAccountPage(self.driver)
        self.admin_panel_login_page = AdminPanelLoginPage(self.driver)
        self.admin_page = AdminPage(self.driver)
        self.customer_list_page = CustomerListPage(self.driver)
        self.countries_page = CountriesPage(self.driver)
        self.geo_zones_page = GeoZonesPage(self.driver)
        self.catalog_page = CatalogPage(self.driver)

    def quit(self):
        self.driver.quit()

    def admin_login(self, admin):
        if self.admin_panel_login_page.open().is_on_this_page():
            self.admin_panel_login_page.username_input.send_keys(
                admin.username)
            self.admin_panel_login_page.password_input.send_keys(
                admin.password)
            self.admin_panel_login_page.submit_login()
        return

    def logout(self):
        self.home_page.logout()

    def login_new_user(self, customer):
        self.home_page.email_input.send_keys(customer.email)
        self.home_page.password_input.send_keys(customer.password)
        self.home_page.login_button.click()

    def all_main_menu_items(self):
        items = self.admin_page.number_of_menu_items()
        for i in range(0, items):
            menu_items = self.admin_page.menu_items()
            menu_items[i].click()
            sub_items = self.admin_page.number_of_menu_sub_items()
            if sub_items == 0:
                continue
            for j in range(0, sub_items):
                menu_sub_items = self.admin_page.menu_sub_items()
                menu_sub_items[j].click()

    def sorting_countries(self):
        self.countries_page.open()
        number_countries = self.countries_page.number_of_countries()
        countries = self.countries_page.sorting_countries(number_countries)
        self.countries_page.countries_with_zones(countries)

    def sorting_geo_zones(self):
        self.geo_zones_page.open()
        number_geo_zones = self.geo_zones_page.number_of_geo_zones()
        geo_zones = self.geo_zones_page.sorting_geo_zones(number_geo_zones)
        self.geo_zones_page.geo_zones_with_zones(geo_zones)

    def register_new_customer(self, customer):
        self.create_account_page.open()
        self.create_account_page.firstname_input.send_keys(customer.firstname)
        self.create_account_page.lastname_input.send_keys(customer.lastname)
        self.create_account_page.address1_input.send_keys(customer.address)
        self.create_account_page.postcode_input.send_keys(customer.postcode)
        self.create_account_page.city_input.send_keys(customer.city)
        self.create_account_page.select_country(customer.country)
        self.create_account_page.select_zone(customer.zone)
        self.create_account_page.email_input.send_keys(customer.email)
        self.create_account_page.phone_input.send_keys(customer.phone)
        self.create_account_page.password_input.send_keys(customer.password)
        self.create_account_page.confirmed_password_input.send_keys(
            customer.password)
        self.create_account_page.create_account_button.click()

    def add_new_product(self, new_product):
        self.catalog_page.open_add_new_product()
        self.catalog_page.status_enabled.click()
        self.catalog_page.product_name_input.send_keys(
            new_product.product_name)
        self.catalog_page.code_product_input.send_keys(
            new_product.code_product)
        self.catalog_page.product_group_selection()
        self.catalog_page.quantity_input.send_keys(new_product.quantity)
        self.catalog_page.sold_out_status_selection()
        self.catalog_page.image_input.send_keys(new_product.image)
        self.catalog_page.date_valid_from_input.send_keys(
            new_product.date_valid_from)
        self.catalog_page.date_valid_to_input.send_keys(
            new_product.date_valid_to)
        self.catalog_page.open_information()
        self.catalog_page.select_manufacturer_id()
        self.catalog_page.keywords_input.send_keys(new_product.keywords)
        self.catalog_page.short_description_input.send_keys(
            new_product.short_description)
        self.catalog_page.trumbowyg_editor_input.send_keys(
            new_product.trumbowyg_editor)
        self.catalog_page.head_title_input.send_keys(new_product.head_title)
        self.catalog_page.meta_description_input.send_keys(
            new_product.meta_description)
        self.catalog_page.open_prices()
        self.catalog_page.purchase_price_input.send_keys(
            new_product.purchase_price)
        self.catalog_page.currency_selection()
        self.catalog_page.price_usd_input.send_keys(new_product.prices_usd)
        self.catalog_page.price_eur_input.send_keys(new_product.prices_eur)
        self.catalog_page.save_new_product()

    def get_customer_ids(self, customer):
        if self.admin_panel_login_page.open().is_on_this_page():
            self.admin_panel_login_page.username_input.send_keys(
                customer.username1)
            self.admin_panel_login_page.password_input.send_keys(
                customer.password1)
            self.admin_panel_login_page.submit_login()
        return self.customer_list_page.open().get_customer_ids()

    def product_in_the_cart(self):
        self.home_page.open()
        self.home_page.product_selection()

    def clear_to_cart(self):
        self.home_page.open_cart()
        self.home_page.product_removal()

    def opening_new_windows(self):
        self.countries_page.open()
        self.countries_page.opening_the_country_creation_page()
        self.countries_page.opening_new_windows()
Example #14
0
def test_catalog_page(browser):

    CatalogPage(browser).check_elements_exist_on_page()
    CatalogPage(browser).check_product_thumbs()
Example #15
0
def catalog_page(request, driver, url):
    catalog_page = CatalogPage(driver, url, request.param)
    catalog_page.open()
    return catalog_page
def catalog_page(browser: webdriver, page_logging) -> CatalogPage:
    catalog_page = CatalogPage(driver=browser, logging_enabled=page_logging)
    catalog_page.open_page()
    return catalog_page
Example #17
0
 def test_category_block_all_type_model(self, current_language):
     catalog = CatalogPage(self.driver)
     self.driver.get(TEST_URL + project_page.get('catalog_with_car_model'))
     self.change_language(self.driver, current_language)
     assert catalog.text_title_all_type_models == all_type_models.get(
         current_language)
Example #18
0
 def test_seo_text_in_category_page(self, current_language):
     seo_category_page = CatalogPage(self.driver)
     self.driver.get(TEST_URL + project_page.get('category'))
     self.change_language(self.driver, current_language)
     assert change_symbols(seo_category_page.text_seo_our_cities, '\n', '') == \
            change_symbols(seo_text_our_cities.get(current_language), '\n ', '')
def catalog_page(browser: webdriver, base_class_logging: bool) -> CatalogPage:
    catalog_page = CatalogPage(driver=browser,
                               logging_enabled=base_class_logging)
    catalog_page.open_page()
    return catalog_page
 def __init__(self, app):
     self.app = app
     self.driver = app.driver
     self.catalog_actions = CatalogPage(driver=self.driver)