import logging import unittest from datetime import date import allure import pytest from parameterized import parameterized from ui_automation_framework.core import TestStatus from ui_automation_framework.utils import AppConfig from ui_automation_framework.utils import logger as cl from app.api_client import ApiClient 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 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.api_client = ApiClient() self.ts = TestStatus(self.driver) @parameterized.expand(["global", "canada"]) @allure.story("AP-5031") @allure.severity(allure.severity_level.NORMAL) @allure.title("[4921] [Track -> Video Performance] Export verification. STEPS 5-15") @allure.description("TC verifies that user has possibility to export views data coming from Videos, so that I will be able to export data in csv and analyze the " "tracks performance from the Video side using exported file. STEPS 5-15") def test_youtube_vp_export_verification_steps_5_15(self, market): self.loginPage.login_with_worker() track = AppConfig.get("track6") self.tp.open_spotify_track_page_with_market_id(track_id=track["id"], market_id=AppConfig.get("market")[market]["url"]) self.tp.switch_to_youtube_video_performance() # step 5, 12-15 self.tp.verify_nvp_export_button_hover() # step 6-8 if market != "global": self.tp.market_dd_choose_few_countries(param=[AppConfig.get("market")[market]["name"]], tab="youtube_vp") table_data = self.tp.td_youtube_get_ids_titles() self.tp.nvp_vp_verify_file_name_export_date_country(track["isrc"], "", [AppConfig.get("market")[market]], table_data) self.tp.nvp_vp_verify_export( [AppConfig.get("market")[market]["api"]], AppConfig.get("source")["by_source"], track["isrc"], " (1)", table_data, ) # step 9-11 self.tp.youtube_change_sources(param=["Browse Features"], dd="vp") table_data = self.tp.td_youtube_get_ids_titles() self.tp.nvp_vp_verify_file_name_export_date_country(track["isrc"], " (2)", [AppConfig.get("market")[market]], table_data) self.tp.nvp_vp_verify_export( [AppConfig.get("market")[market]["api"]], AppConfig.get("source")["by_source"], track["isrc"], " (3)", table_data, ) @parameterized.expand( [ AppConfig.get("source")["all_views"], AppConfig.get("source")["by_video"], AppConfig.get("source")["by_likes"], AppConfig.get("source")["by_dislikes"], AppConfig.get("source")["by_comments"], AppConfig.get("source")["by_shares"], ] ) @allure.story("AP-5031") @allure.severity(allure.severity_level.NORMAL) @allure.title("[4921] [Track -> Video Performance] Export verification. STEPS 16-22") @allure.description("TC verifies that user has possibility to export views data coming from Videos, so that I will be able to export data in csv and analyze the " "tracks performance from the Video side using exported file. STEPS 16-22") def test_youtube_vp_export_verification_steps_16_22(self, view): self.loginPage.login_with_worker() track = AppConfig.get("track6") self.tp.open_spotify_track_page_with_market_id(track_id=track["id"], market_id=AppConfig.get("market")["us"]["url"]) self.tp.switch_to_youtube_video_performance() # step 16-19, 21-22 self.tp.market_dd_choose_few_countries(param=[AppConfig.get("market")["us"]["name"]], tab="youtube_vp") self.tp.vp_youtube_change_source_view(param=view) table_data = self.tp.td_youtube_get_ids_titles() self.tp.nvp_vp_verify_file_name_export_date_country(track["isrc"], "", [AppConfig.get("market")["us"]], table_data) self.tp.nvp_vp_verify_export([AppConfig.get("market")["us"]["api"]], view, track["isrc"], " (1)", table_data) @allure.story("AP-5031") @allure.severity(allure.severity_level.NORMAL) @allure.title("[4921] [Track -> Video Performance] Export verification. STEPS 23, 25") @allure.description("TC verifies that user has possibility to export views data coming from Videos, so that I will be able to export data in csv and analyze the " "tracks performance from the Video side using exported file. STEPS 23, 25") def test_youtube_vp_export_verification_steps_23_25(self): self.loginPage.login_with_worker() track = AppConfig.get("track40") self.tp.open_spotify_track_page_with_market_id(track_id=track["id"], market_id=AppConfig.get("market")["us"]["url"]) self.tp.switch_to_youtube_video_performance() # step 23 self.tp.market_dd_choose_few_countries( param=[ AppConfig.get("market")["us"]["name"], AppConfig.get("market")["canada"]["name"], AppConfig.get("market")["australia"]["name"], ], tab="youtube_vp", ) table_data = self.tp.td_youtube_get_ids_titles() self.tp.nvp_vp_verify_file_name_export_date_country( track["isrc"], "", [AppConfig.get("market")["us"], AppConfig.get("market")["canada"], AppConfig.get("market")["australia"]], table_data, ) self.tp.nvp_vp_verify_export( [ AppConfig.get("market")["us"]["api"], AppConfig.get("market")["canada"]["market"], AppConfig.get("market")["australia"]["market"], ], AppConfig.get("source")["by_source"], track["isrc"], " (1)", table_data, ) # step 25 today = date.today() url_before = self.tp.get_url() self.tp.open_current_url_with_param(f"&str_gr_start_date={today}&str_gr_end_date={today}") self.tp.verify_performance_no_data_displayed() self.tp.verify_export_inactive() self.tp.open_url(url_before) @allure.story("AP-5031") @allure.severity(allure.severity_level.NORMAL) @allure.title("[4921] [Track -> Video Performance] Export verification. STEPS 26") @allure.description("TC verifies that user has possibility to export views data coming from Videos, so that I will be able to export data in csv and analyze the " "tracks performance from the Video side using exported file. STEPS 26") def test_youtube_vp_export_verification_steps_26(self): self.loginPage.login_with_worker() track = AppConfig.get("track40") self.tp.open_spotify_track_page_with_market_id(track_id=track["id"], market_id=AppConfig.get("market")["us"]["url"]) self.tp.switch_to_youtube_video_performance() # step 26 self.tp.select_previous_mounth_period() self.tp.market_dd_choose_few_countries(param=[AppConfig.get("market")["us"]["name"]], tab="youtube_vp") table_data = self.tp.td_youtube_get_ids_titles() self.tp.nvp_vp_verify_file_name_export_date_country(track["isrc"], "", [AppConfig.get("market")["us"]], table_data) @allure.story("AP-5031") @allure.severity(allure.severity_level.NORMAL) @allure.title("[4921] [Track -> Video Performance] Export verification. STEPS 24") @allure.description("TC verifies that user has possibility to export views data coming from Videos, so that I will be able to export data in csv and analyze the " "tracks performance from the Video side using exported file. STEPS 24") def test_youtube_vp_export_verification_steps_24(self): self.loginPage.login_with_worker() track = AppConfig.get("track40") self.tp.open_spotify_track_page_with_market_id(track_id=track["id"], market_id=AppConfig.get("market")["us"]["url"]) self.tp.switch_to_youtube_video_performance() # step 24 self.tp.stream_and_source_choose_region(param=self.tp.REGION_EX_US, dd="youtube_vp") table_data = self.tp.td_youtube_get_ids_titles() ex_us_countries = AppConfig.get("regions")["ex_us"]["api"] ex_us_countries_list = [{"api": c} for c in ex_us_countries] self.tp.nvp_vp_verify_file_name_export_date_country(track["isrc"], "", ex_us_countries_list, table_data) # NOT AUTOMATED - STEPS 1-4, 20