import logging import unittest import allure import pytest from assertpy import assert_that from ui_automation_framework.core import TestStatus from ui_automation_framework.utils import AppConfig from ui_automation_framework.utils import logger as cl from ...pages.album_page import AlbumPage from ...pages.login_page import LoginPage from ...pages.track_page import TrackPage @pytest.mark.usefixtures("set_up", "one_time_set_up") class DeepLinkingTrackPageTest(unittest.TestCase): log = cl.Logger(logging.DEBUG) @pytest.fixture(autouse=True) def classSetup(self): self.loginPage = LoginPage(self.driver) self.tp = TrackPage(self.driver) self.ap = AlbumPage(self.driver) self.ts = TestStatus(self.driver) @allure.story("AP-8943") @allure.severity(allure.severity_level.NORMAL) @allure.title("[Track page] Switching between Charts and Current tabs") @allure.description("""TC verifies that the data is correctly shown on Charts tab while switching to Current tab""") def test_switch_charts_and_current_tabs_verification(self): self.loginPage.login_with_worker() self.tp.open_spotify_track_page_with_market_id(track_id=AppConfig.get("track57")["id"], market_id=AppConfig.get("market")["us"]["url"]) # step 1 self.tp.td_switch_to_charts_tab() # step 2 uri = "/tracks/charts/" events = self.tp.get_events_from_console(endpoint=uri) for event in events: assert_that(event.lower()).does_not_contain("null") charts_markets_step_2 = self.tp.get_markets_overview_charts_tab() # step 3 self.tp.td_switch_to_playlist("first_playlist") # step 4 self.tp.td_switch_to_charts_tab() events = self.tp.get_events_from_console(endpoint=uri) for event in events: assert_that(event.lower()).does_not_contain("null") charts_markets_step_4 = self.tp.get_markets_overview_charts_tab() assert_that(charts_markets_step_2).is_equal_to(charts_markets_step_4)