def administration_page(admin_login_page: AdminLoginPage, browser: webdriver, page_logging: bool) -> AdministrationPage: admin_login_page.log_in(username=OPENCART_ADMIN_USERNAME, password=OPENCART_ADMIN_PASSWORD) administration_page = AdministrationPage(driver=browser, logging_enabled=page_logging) yield administration_page administration_page.log_out()
def test_login_logout(self, admin_login_page, browser, base_class_logging): with allure.step("Log in to administration page"): admin_login_page.log_in( username=OpenCart.ADMIN_USERNAME, password=OpenCart.ADMIN_PASSWORD ) with allure.step("Check administration page"): administration_page = AdministrationPage(driver=browser, logging_enabled=base_class_logging) assert administration_page.find_element(locator=administration_page.DIV_DASHBOARD) with allure.step("Log out"): administration_page.log_out()
def add_new_product(catalog_products_page: AdministrationPage, product_info: dict) -> AdministrationPage: catalog_products_page.add_product( product_name=product_info.get("product_name"), meta_tag_title=product_info.get("meta_tag_title"), model=product_info.get("model")) catalog_products_page.find_element( locator=catalog_products_page.DIV_ALERT_SUCCESS) catalog_products_page.find_element( locator=catalog_products_page.BUTTON_DISMISS_ALERT).click() return catalog_products_page
def catalog_products_page( administration_page: AdministrationPage) -> AdministrationPage: administration_page.open_catalog_products() return administration_page