# import unittest # from math import isnan # # import allure # import pytest # from ui_automation_framework.core import TestStatus # from ui_automation_framework.utils import AppConfig, CoreConfig # # from app.api_client import ApiClient # from app.src.pages.comparison_page import TrackComparisonPage # from app.src.pages.login_page import LoginPage # from app.src.pages.third_party.spotifycharts_page import SpotifyCharts # 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): # MARKET = "Netherlands" # TRACK_POSITION = 125 # # @pytest.fixture(autouse=True) # def classSetup(self): # self.loginPage = LoginPage(self.driver) # self.topChartsPage = TopChartsPage(self.driver) # self.trackPage = TrackPage(self.driver) # self.comparison_page = TrackComparisonPage(self.driver) # self.spotify_charts = SpotifyCharts(self.driver) # self.api_client = ApiClient() # self.ts = TestStatus(self.driver) # # @allure.story("AP-2558") # @allure.severity(allure.severity_level.NORMAL) # @allure.title("Spotify Weekly top chart with track without ID") # @allure.description( # """TC verifies that the weekly chart where one of the tracks is without ID is received in response from BE, displayed on UI and can be downloaded in .csv file.""" # ) # def test_no_spotify_trackid_weekly(self): # user = self.loginPage.get_user_email_with_worker() # token = self.api_client.authorize(user=user) # self.loginPage.login_with_worker() # self.loginPage.is_logged_in() # # self.topChartsPage.open_top_chart_page() # self.topChartsPage.top_chart_page_is_opened() # # self.topChartsPage.select_market(self.MARKET) # self.topChartsPage.switch_tab(self.topChartsPage.SPOTIFY_TYPE) # # # Open a chart for a week when track without TrackId # self.topChartsPage.change_sub_tab("weekly") # self.topChartsPage.open_spotify_chart_for_date_dd("10/12/17") # is_table_empty = self.topChartsPage.table_is_empty() # self.ts.markFinal(not is_table_empty, "Step 1: Succesfully switched the Spotify date") # # # check that track is there on position and doesn't have name and picture # track = self.topChartsPage.get_track_at_position(self.TRACK_POSITION) # self.ts.markFinal(not track["name"], "Step 2.1: Track at position 125 have empty name") # self.ts.markFinal(track["trendType"] == self.topChartsPage.ENTRY, "Step 2.2: Track is marked as entry") # self.ts.markFinal(track["image"] == str(None), "Step 2.3: Track does not have image") # # self.comparison_page.open_new_tab() # self.comparison_page.switch_to_tab(2) # self.spotify_charts.open_weekly(market="nl", date="2017-10-13") # tracks = self.spotify_charts.get_track_names() # self.comparison_page.close_current_tab() # self.comparison_page.switch_to_tab(1) # self.ts.markFinal("" == tracks[124], "124 track name is: {}".format(tracks[124])) # # csv_tracks = self.topChartsPage.export_file(market=AppConfig.get("market")["nl"], token=token)[ # "Track Name" # ].to_list() # self.ts.markFinal(isnan(float(csv_tracks[124])), "track is present in csv: {}".format(csv_tracks[124])) # test is no longer relevant due to Delphi logic, skip until fixes are available