import datetime 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.login_page import LoginPage from app.src.pages.track_page import TrackPage from app.src.pages.tt_dashboard_page import TTDashboardPage @pytest.mark.usefixtures("set_up", "one_time_set_up") class TTDashboardPageTest(unittest.TestCase): date_1 = "2022-03-17" date_2 = "2022-03-16" @pytest.fixture(autouse=True) def classSetup(self): self.loginPage = LoginPage(self.driver) self.tt_dashboard = TTDashboardPage(self.driver) self.trackPage = TrackPage(self.driver) self.chart_digest = ChartDigestPage(self.driver) self.gtp = GlobalTrackPrioritiesPage(self.driver) self.ts = TestStatus(self.driver) @allure.story("AP-7347") @allure.severity(allure.severity_level.NORMAL) @allure.title("[AP-7196] TikTok Dashboard. Deep Linking") @allure.description("""TC verifies that users can share a link to Sony TikTok Toplist page with selected filters.""") def test_tt_dashboard_deep_linking_verification(self): self.loginPage.login_with_worker() self.trackPage.select_market(AppConfig.get("market")["us"]["name"]) self.tt_dashboard.open() # step 1 date_ui = self.tt_dashboard.get_selected_date_ui() date_ui = datetime.datetime.strptime(date_ui, self.trackPage.get_date_format_from_locale()).strftime("%Y-%m-%d") url_step1 = self.trackPage.get_url() self.trackPage.verify_params_in_url({self.tt_dashboard.date: date_ui, self.tt_dashboard.tab: self.tt_dashboard.bcc, self.tt_dashboard.filter: self.tt_dashboard.daily, self.tt_dashboard.market: AppConfig.get("market")["global"]["api3"]}) # step 2 self.trackPage.go_back() self.chart_digest.is_opened() # step 3 self.trackPage.go_forward() url_step3 = self.trackPage.get_url() assert_that(url_step1).is_equal_to(url_step3) # step 4 self.gtp.enter_datepicker_date_manually(date=self.date_1, location="top_charts") self.trackPage.verify_params_in_url({self.tt_dashboard.date: self.date_1}) # step 5 self.tt_dashboard.change_market(AppConfig.get("market")["sweden"]["name"]) self.trackPage.verify_params_in_url({self.tt_dashboard.date: self.date_1, self.tt_dashboard.tab: self.tt_dashboard.bcc, self.tt_dashboard.filter: self.tt_dashboard.daily, self.tt_dashboard.market: AppConfig.get("market")["sweden"]["api"]}) # step 6 self.tt_dashboard.select_view(self.tt_dashboard.days7) self.trackPage.verify_params_in_url({self.tt_dashboard.date: self.date_1, self.tt_dashboard.tab: self.tt_dashboard.bcc, self.tt_dashboard.filter: self.tt_dashboard.days7, self.tt_dashboard.market: AppConfig.get("market")["sweden"]["api"]}) # step 7 self.gtp.enter_datepicker_date_manually(date=self.date_2, location="top_charts") self.trackPage.verify_params_in_url({self.tt_dashboard.date: self.date_2}) # step 8 self.tt_dashboard.change_market(AppConfig.get("market")["australia"]["name"]) self.trackPage.verify_params_in_url({self.tt_dashboard.date: self.date_2, self.tt_dashboard.tab: self.tt_dashboard.bcc, self.tt_dashboard.filter: self.tt_dashboard.days7, self.tt_dashboard.market: AppConfig.get("market")["australia"]["market"]}) # step 9 self.tt_dashboard.select_view(self.tt_dashboard.daily) self.trackPage.verify_params_in_url({self.tt_dashboard.date: self.date_2, self.tt_dashboard.tab: self.tt_dashboard.bcc, self.tt_dashboard.filter: self.tt_dashboard.daily, self.tt_dashboard.market: AppConfig.get("market")["australia"]["market"]}) # step 10 self.tt_dashboard.select_tab(self.tt_dashboard.by_creations) self.trackPage.verify_params_in_url({self.tt_dashboard.date: date_ui, self.tt_dashboard.tab: self.tt_dashboard.bc, self.tt_dashboard.filter: self.tt_dashboard.daily, self.tt_dashboard.market: AppConfig.get("market")["global"]["api3"]}) # step 11 self.gtp.enter_datepicker_date_manually(date=self.date_1, location="top_charts") self.trackPage.verify_params_in_url({self.tt_dashboard.date: self.date_1}) # step 12 self.tt_dashboard.change_market(AppConfig.get("market")["us"]["name"]) self.trackPage.verify_params_in_url({self.tt_dashboard.date: self.date_1, self.tt_dashboard.tab: self.tt_dashboard.bc, self.tt_dashboard.filter: self.tt_dashboard.daily, self.tt_dashboard.market: AppConfig.get("market")["us"]["api"]}) # step 13 self.tt_dashboard.select_view(self.tt_dashboard.days7) self.trackPage.verify_params_in_url({self.tt_dashboard.date: self.date_1, self.tt_dashboard.tab: self.tt_dashboard.bc, self.tt_dashboard.filter: self.tt_dashboard.days7, self.tt_dashboard.market: AppConfig.get("market")["us"]["api"]}) # step 14 self.gtp.enter_datepicker_date_manually(date=self.date_2, location="top_charts") self.trackPage.verify_params_in_url({self.tt_dashboard.date: self.date_2, self.tt_dashboard.tab: self.tt_dashboard.bc, self.tt_dashboard.filter: self.tt_dashboard.days7, self.tt_dashboard.market: AppConfig.get("market")["us"]["api"]}) # step 15 self.tt_dashboard.change_market(AppConfig.get("market")["uk"]["name"]) self.trackPage.verify_params_in_url({self.tt_dashboard.date: self.date_2, self.tt_dashboard.tab: self.tt_dashboard.bc, self.tt_dashboard.filter: self.tt_dashboard.days7, self.tt_dashboard.market: AppConfig.get("market")["uk"]["market"]}) # step 16 self.tt_dashboard.select_view(self.tt_dashboard.daily) self.trackPage.verify_params_in_url({self.tt_dashboard.date: self.date_2, self.tt_dashboard.tab: self.tt_dashboard.bc, self.tt_dashboard.filter: self.tt_dashboard.daily, self.tt_dashboard.market: AppConfig.get("market")["uk"]["market"]}) # step 17 self.tt_dashboard.select_tab(self.tt_dashboard.by_creations_change) self.trackPage.verify_params_in_url({self.tt_dashboard.date: date_ui, self.tt_dashboard.tab: self.tt_dashboard.bcc, self.tt_dashboard.filter: self.tt_dashboard.daily, self.tt_dashboard.market: AppConfig.get("market")["global"]["api3"]})