import logging import allure from assertpy import assert_that from ui_automation_framework.core import BasePage, TestStatus from ui_automation_framework.utils import CoreConfig from ui_automation_framework.utils import logger as cl class AccountPage(BasePage): log = cl.Logger(logging.DEBUG) def __init__(self, driver): super().__init__(driver) self.driver = driver self.account_page = self.get_page_locators("AccountPage", "account_elements.json") self.ts = TestStatus(self.driver) @allure.step("Navigating to the specified acount page ") def open_account_page(self, account_id): self.driver.get(CoreConfig.ENV_BASE_URL + "/spotify/user/" + account_id) self.wait_for_element_visible(*self.locator(self.account_page, "account_title")) @allure.step("Account page - title is present") def title_is_present(self): el = self.wait_for_element_visible(*self.locator(self.account_page, "account_title")) title = self.is_element_displayed(element=el) self.log.info("Artist title is displayed:" + str(title)) assert_that(title).is_true() @allure.step("Artist page - get title") def get_title(self): el = self.wait_for_element_visible(*self.locator(self.account_page, "account_title")) title = self.get_text(element=el) self.log.info("Account title is displayed:" + title) return title @allure.step("Get account id from url") def get_account_id_from_url(self): url = self.get_url() account_id = url.split("/")[-1] return account_id