import logging from contextlib import suppress import allure from ui_automation_framework.utils import logger as cl from waiting import TimeoutExpired, ALL from src.helpers.waiting_wrapper import wait from src.locators.library_locators import LibraryLocators from src.ui_elements.button_ui_element import ButtonUIElement from src.ui_elements.input_ui_element import InputUIElement from src.ui_elements.label_ui_element import LabelUIElement from src.pages.navigation_page import NavigationPage class LibraryPage(NavigationPage): log = cl.Logger(logging.DEBUG) def __init__(self, driver): super().__init__(driver) self.driver = driver @property def bn_switch_artist(self): return ButtonUIElement(self.driver, LibraryLocators.SWITCH_ARTIST_BTN, "Switch Artist") @property def bn_view_all_tracks(self): return ButtonUIElement(self.driver, LibraryLocators.VIEW_ALL_TRACKS_BTN, "View ALL Tracks") @property def bn_view_top_trending_tracks(self): return ButtonUIElement(self.driver, LibraryLocators.TOP_TRENDING_TILE, "Top Trending Tracks") @property def bn_view_tiktok_top_trending_tracks(self): return ButtonUIElement(self.driver, LibraryLocators.TIKTOK_TOP_TRENDING_TILE, "TikTok Top Trending Tracks") @property def bn_view_most_streamed_tracks(self): return ButtonUIElement(self.driver, LibraryLocators.MOST_STREAMED_TILE, "Most Streamed Tracks") @property def bn_view_newest_release_tracks(self): return ButtonUIElement(self.driver, LibraryLocators.NEWEST_RELEASES_TILE, "Newest Releases Tracks") @property def bn_view_favorites_tracks(self): return ButtonUIElement(self.driver, LibraryLocators.FAVORITES_TILE, "View Favorites tracks") @property def bn_view_all_videos(self): return ButtonUIElement(self.driver, LibraryLocators.VIEW_ALL_VIDEOS_BTN, "View All Videos") @property def bn_view_latest_uploads_videos(self): return ButtonUIElement(self.driver, LibraryLocators.LATEST_UPLOADS_TILE, "Latest Uploads Videos") @property def bn_view_all_albums(self): return ButtonUIElement(self.driver, LibraryLocators.VIEW_ALL_ALBUMS_BTN, "View All Albums") @property def bn_view_newest_release_albums(self): return ButtonUIElement(self.driver, LibraryLocators.NEWEST_RELEASES_ALBUM_TILE, "Newest Releases Albums") @allure.step("Go to View ALL tracks") def view_all_tracks(self): self.bn_view_all_tracks.click() return self @allure.step("Go to Favorites tracks") def view_favorites_tracks(self): self.bn_view_favorites_tracks.click() return self @allure.step("Go to View Top Trending tracks") def view_top_trending_tracks(self): self.bn_view_top_trending_tracks.click() return self @allure.step("Go to View TikTok Top Trending tracks") def view_tik_tok_top_trending_tracks(self): self.bn_view_tiktok_top_trending_tracks.click() return self @allure.step("Go to Most Streamed tracks") def view_most_streamed_tracks(self): self.bn_view_most_streamed_tracks.click() return self @allure.step("Go to Newest Releases tracks") def view_newest_releases_tracks(self): self.bn_view_newest_release_tracks.click() return self @allure.step("Go to View ALL videos") def view_all_videos(self): self.swipe_up() self.bn_view_all_videos.click() return self @allure.step("Go to Latest Uploads videos") def view_latest_uploads_videos(self): self.swipe_up() self.bn_view_latest_uploads_videos.click() return self @allure.step("Go to View ALL albums") def view_all_albums(self): self.swipe_up() self.bn_view_all_albums.click() return self @allure.step("Go to Newest Releases albums") def view_newest_releases_albums(self): self.swipe_up() self.bn_view_newest_release_albums.click() return self