import unittest import allure import pytest 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.login_page import LoginPage from app.src.pages.top_charts_page import TopChartsPage from app.src.pages.track_page import TrackPage @pytest.mark.usefixtures("set_up", "one_time_set_up") class TopChartsPageTest(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self): self.loginPage = LoginPage(self.driver) self.topChartsPage = TopChartsPage(self.driver) self.chart_digest = ChartDigestPage(self.driver) self.tp = TrackPage(self.driver) self.ts = TestStatus(self.driver) @allure.story("AP-9979") @allure.severity(allure.severity_level.NORMAL) @allure.title("[AP-9668][Top Charts] DL verification after opening from Charts Digest.") @allure.description("TC verifies DL for Top Charts when user opens it from the Charts Digest:") def test_dl_top_charts_after_opening_charts_digest(self): self.loginPage.login_with_worker() self.tp.select_market(AppConfig.get("market")["us"]["name"]) self.chart_digest.is_opened() # step 1 self.chart_digest.open_top_charts_from_table(self.chart_digest.TOP_VIEW) self.topChartsPage.verify_chosen_switch(self.topChartsPage.DAILY) self.tp.verify_params_in_url({self.topChartsPage.tab: self.topChartsPage.SPOTIFY_TYPE, self.topChartsPage.market: AppConfig.get("market")["us"]["market"], self.topChartsPage.chart_type: 1}) # step 2 self.topChartsPage.go_back() self.chart_digest.select_tab(f"{self.chart_digest.TOP_VIEW}-{self.chart_digest.TAB_APPLE}") self.chart_digest.open_top_charts_from_table(self.chart_digest.TOP_VIEW) self.topChartsPage.verify_chosen_switch(self.chart_digest.TAB_APPLE) self.tp.verify_params_in_url({self.topChartsPage.tab: self.topChartsPage.APPLE_TYPE, self.topChartsPage.market: AppConfig.get("market")["us"]["market"]}) # step 3 self.topChartsPage.go_back() self.chart_digest.select_tab(self.chart_digest.TAB_SPOTIFY) self.chart_digest.open_top_charts_from_table(self.chart_digest.MAJOR_MOVES) self.topChartsPage.verify_chosen_switch(self.topChartsPage.DAILY) self.tp.verify_params_in_url({self.topChartsPage.tab: self.topChartsPage.SPOTIFY_TYPE, self.topChartsPage.market: AppConfig.get("market")["us"]["market"], self.topChartsPage.chart_type: 1}) # step 4 self.topChartsPage.go_back() self.chart_digest.select_tab(self.chart_digest.TAB_APPLE) self.chart_digest.open_top_charts_from_table(self.chart_digest.MAJOR_MOVES) self.topChartsPage.verify_chosen_switch(self.chart_digest.TAB_APPLE) self.tp.verify_params_in_url({self.topChartsPage.tab: self.topChartsPage.APPLE_TYPE, self.topChartsPage.market: AppConfig.get("market")["us"]["market"]}) # step 5 self.topChartsPage.go_back() self.chart_digest.select_tab(self.chart_digest.TAB_SPOTIFY) self.chart_digest.open_top_charts_from_table(self.chart_digest.BUBBLING_UNDER) self.topChartsPage.verify_chosen_switch(self.topChartsPage.DAILY) self.tp.verify_params_in_url({self.topChartsPage.tab: self.topChartsPage.SPOTIFY_TYPE, self.topChartsPage.market: AppConfig.get("market")["us"]["market"], self.topChartsPage.chart_type: 1}) # step 6 self.topChartsPage.go_back() self.chart_digest.select_tab(self.chart_digest.TAB_APPLE) self.chart_digest.open_top_charts_from_table(self.chart_digest.BUBBLING_UNDER) self.topChartsPage.verify_chosen_switch(self.chart_digest.TAB_APPLE) self.tp.verify_params_in_url({self.topChartsPage.tab: self.topChartsPage.APPLE_TYPE, self.topChartsPage.market: AppConfig.get("market")["us"]["market"]})