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 app.src.pages.chart_digest import ChartDigestPage from app.src.pages.global_track_priorities_page import GlobalTrackPrioritiesPage from app.src.pages.left_navigation_panel import LeftNavigationPanel from app.src.pages.login_page import LoginPage from app.src.pages.track_page import TrackPage @pytest.mark.usefixtures("set_up", "one_time_set_up") class GlobalTrackPrioritiesPageTest(unittest.TestCase): date_to_change = "2020-12-10" second_date = "2021-01-18" @pytest.fixture(autouse=True) def classSetup(self): self.loginPage = LoginPage(self.driver) self.chartDigestPage = ChartDigestPage(self.driver) self.gtp = GlobalTrackPrioritiesPage(self.driver) self.lnp = LeftNavigationPanel(self.driver) self.chart_digest = ChartDigestPage(self.driver) self.trackPage = TrackPage(self.driver) self.ts = TestStatus(self.driver) @allure.story("AP-4211") @allure.severity(allure.severity_level.NORMAL) @allure.title("GTP links and banner verification") @allure.description("""TC verifies that user is able to open the GTP page using links on the Apollo portal or direct link.""") def test_gtp_links_and_banner(self): self.loginPage.login_with_worker() # step 1-3 self.lnp.open_gtp() # step 5, 8 self.chart_digest.open_charts_digest_page() self.chart_digest.gtp_verify_banner() # step 6, 24 self.chart_digest.open_gtp_from_dashboard() self.gtp.verify_gtp_elements() # step 12 gtp_track_card_info = self.gtp.get_tracks_card_info() # step 7 self.gtp.page_has_loaded() self.gtp.go_back() self.chart_digest.is_opened() # step 9, 13 cd_gtp_track_card_info = self.chart_digest.get_gtp_track_info() self.ts.markFinal( gtp_track_card_info == cd_gtp_track_card_info, f"cd info: {cd_gtp_track_card_info} and\n gtp info: {gtp_track_card_info} match", ) # step 10 self.chart_digest.gtp_swipe_verify_hover() # step 11 track_names = [t["track-name"] for t in cd_gtp_track_card_info] assert_that(track_names).is_sorted(key=str.lower) # step 14 for m in [AppConfig.get("market")["global"], AppConfig.get("market")["brazil"]]: self.chart_digest.open_charts_digest_page() self.trackPage.select_market(m["name"]) cd_gtp_track_card_info = self.chart_digest.get_gtp_track_info() self.chart_digest.open_gtp_from_dashboard() gtp_track_card_info = self.gtp.get_tracks_card_info() self.ts.markFinal( gtp_track_card_info == cd_gtp_track_card_info, f"market: {m}\ncd info: {cd_gtp_track_card_info} and\n gtp info: {gtp_track_card_info} match", ) # step 15 self.gtp.open_gtp_page_from_url(market=AppConfig.get("market")["australia"]["market"], date=self.date_to_change) self.gtp.click_track_name_verify() # step 16 self.gtp.open_gtp_page_from_url(market=AppConfig.get("market")["australia"]["market"], date=self.date_to_change) self.gtp.click_artist_name_verify() # step 17-18 self.gtp.open_gtp_page_from_url(market=AppConfig.get("market")["australia"]["market"], date=self.date_to_change) self.gtp.verify_hot_hits_tooltip_and_click() # step 19 self.gtp.open_gtp_page_from_url(market=AppConfig.get("market")["us"]["market"], date=self.second_date) self.gtp.open_cpot_popup() self.gtp.open_gtp_page_from_url(market=AppConfig.get("market")["latvia"]["market"], date=self.second_date) self.gtp.open_cpot_popup() # step 20 self.gtp.open_gtp_page_from_url(market=AppConfig.get("market")["france"]["market"], date=self.second_date) self.gtp.open_cpot_popup(open=False) # NOT AUTOMATED _ STEPS 4, 21-23