import unittest import allure import pytest from assertpy import assert_that from app.src.helpers.api_data_provider import ApiDataProvider from app.src.helpers.test_data_helper import get_random_hot_hits_spotify_playlist from app.src.pages.chart_digest_page import ChartDigestPage from app.src.pages.hot_hits_placements_page import HotHitsPlacementsPage from app.src.pages.login_page import LoginPage from app.src.pages.playlist_page import PlaylistPage from app.src.pages.profile_page import ProfilePage from app.src.pages.search_page import SearchPage from app.src.pages.track_page import TrackPage @pytest.mark.usefixtures("set_up", "one_time_set_up", "authorized_api") class InfoPopupsTest(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, authorized_api): self.api = authorized_api self.loginPage = LoginPage(self.driver, authorized_api) self.profilePage = ProfilePage(self.driver) self.chartDigestPage = ChartDigestPage(self.driver, authorized_api) self.trackPage = TrackPage(self.driver, authorized_api) self.searchPage = SearchPage(self.driver, authorized_api) self.playlistPage = PlaylistPage(self.driver, authorized_api) self.hotHitsPage = HotHitsPlacementsPage(self.driver, authorized_api) self.data_provider = ApiDataProvider(authorized_api) @allure.story("https://data-analytics.atlassian.net/browse/AG-4992") @allure.severity(allure.severity_level.NORMAL) @allure.title("i popups on the charts page") @allure.description("User should be able to open and close info popups on the charts page") @allure.testcase("https://data-analytics.atlassian.net/browse/AG-2631," "https://data-analytics.atlassian.net/browse/AG-2637," "https://data-analytics.atlassian.net/browse/AG-2657," "https://data-analytics.atlassian.net/browse/AG-2672") @pytest.mark.smoke def test_chart_digest_popup(self): self.loginPage.login_as_regular_user().select_chart_digest_tab() self.chartDigestPage.open_entries_popup() assert_that(self.chartDigestPage.is_entries_popup_opened(), "Info popup is opened").is_true() self.chartDigestPage.close_popup_by_swipe().open_entries_popup() assert_that(self.chartDigestPage.is_entries_popup_opened(), "Info popup is opened").is_true() self.chartDigestPage.close_popup_tap_outside().open_exits_popup() assert_that(self.chartDigestPage.is_exits_popup_opened(), "Info popup is opened").is_true() self.chartDigestPage.close_popup_by_swipe().open_exits_popup() assert_that(self.chartDigestPage.is_exits_popup_opened(), "Info popup is opened").is_true() self.chartDigestPage.close_popup_tap_outside().scroll_to_major_moves().open_major_moves_popup() assert_that(self.chartDigestPage.is_major_moves_popup_opened(), "Info popup is opened").is_true() self.chartDigestPage.close_popup_by_swipe().open_major_moves_popup() assert_that(self.chartDigestPage.is_major_moves_popup_opened(), "Info popup is opened").is_true() self.chartDigestPage.close_popup_tap_outside().select_dsp("APPLE MUSIC").scroll_up().open_entries_popup() assert_that(self.chartDigestPage.is_entries_popup_opened(), "Info popup is opened").is_true() self.chartDigestPage.close_popup_by_swipe().open_entries_popup() assert_that(self.chartDigestPage.is_entries_popup_opened(), "Info popup is opened").is_true() self.chartDigestPage.close_popup_tap_outside().open_exits_popup() assert_that(self.chartDigestPage.is_exits_popup_opened(), "Info popup is opened").is_true() self.chartDigestPage.close_popup_by_swipe().open_exits_popup() assert_that(self.chartDigestPage.is_exits_popup_opened(), "Info popup is opened").is_true() self.chartDigestPage.close_popup_tap_outside().scroll_to_major_moves().open_major_moves_popup() assert_that(self.chartDigestPage.is_major_moves_popup_opened(), "Info popup is opened").is_true() self.chartDigestPage.close_popup_by_swipe().open_major_moves_popup() assert_that(self.chartDigestPage.is_major_moves_popup_opened(), "Info popup is opened").is_true() @allure.story("https://data-analytics.atlassian.net/browse/AG-4992") @allure.severity(allure.severity_level.NORMAL) @allure.title("i popups on the track page") @allure.description("User should be able to open and close info popups on the track page") @allure.testcase( "https://data-analytics.atlassian.net/browse/AG-2635," "https://data-analytics.atlassian.net/browse/AG-2649," "https://data-analytics.atlassian.net/browse/AG-2660," "https://data-analytics.atlassian.net/browse/AG-2662," "https://data-analytics.atlassian.net/browse/AG-2651," "https://data-analytics.atlassian.net/browse/AG-2653" ) @pytest.mark.smoke def test_track_page_popup(self): market = "Australia" track = self.data_provider.get_top_charts_spotify_track_data("au")[0] self.loginPage.login_as_regular_user() # Added selecting profile to get market info for a track self.profilePage.open_profile_screen_and_select_market(market).select_search_tab() self.searchPage.search_for(track).open_track_page_from_results(1) self.trackPage.open_markets_popup() assert_that(self.trackPage.is_markets_popup_opened(), "Info popup is opened").is_true() self.trackPage.close_popup_by_swipe().open_markets_popup() assert_that(self.trackPage.is_markets_popup_opened(), "Info popup is opened").is_true() self.trackPage.close_popup_tap_outside().swipe_down().swipe_down().open_charts_placements_popup() assert_that(self.trackPage.is_charts_placements_popup_opened(), "Info popup is opened").is_true() self.trackPage.close_popup_by_swipe().open_charts_placements_popup() assert_that(self.trackPage.is_charts_placements_popup_opened(), "Info popup is opened").is_true() self.trackPage.close_popup_tap_outside().click_playlists_info_icon() assert_that(self.trackPage.is_playlists_info_popup_opened(), "Info popup is opened").is_true() self.trackPage.close_popup_tap_outside().scroll_up().open_market_detailed_view().open_streams_overview_popup() assert_that(self.trackPage.is_streams_overview_popup_opened(), "Info popup is opened").is_true() self.trackPage.close_popup_by_swipe().open_streams_overview_popup() assert_that(self.trackPage.is_streams_overview_popup_opened(), "Info popup is opened").is_true() self.trackPage.close_popup_tap_outside().open_audience_popup() assert_that(self.trackPage.is_audience_popup_opened(), "Info popup is opened").is_true() self.trackPage.close_popup_by_swipe().open_audience_popup() assert_that(self.trackPage.is_audience_popup_opened(), "Info popup is opened").is_true() self.trackPage.scroll_down() self.trackPage.close_popup_tap_outside().scroll_to_streams_monitoring().open_streams_monitoring_popup() assert_that(self.trackPage.is_strams_monitoring_popup_opened(), "Info popup is opened").is_true() self.trackPage.close_popup_by_swipe().open_streams_monitoring_popup() assert_that(self.trackPage.is_strams_monitoring_popup_opened(), "Info popup is opened").is_true() @pytest.mark.smoke def test_track_page_popup_2(self): # moved from original test to increase stability market = "Australia" track = self.data_provider.get_top_charts_spotify_track_data("au")[0] self.loginPage.login_as_regular_user() self.profilePage.open_profile_screen_and_select_market(market).select_search_tab() self.searchPage.search_for(track).open_track_page_from_results(1) self.trackPage.swipe_down().click_playlists_info_icon() assert_that(self.trackPage.is_playlists_info_popup_opened(), "Info popup is opened").is_true() @allure.story("https://data-analytics.atlassian.net/browse/AG-9295") @allure.severity(allure.severity_level.NORMAL) @allure.title("Hot Hits popup") @allure.description("User should be able to open info popup on the Hot Hits placements page") @allure.testcase("https://data-analytics.atlassian.net/browse/AG-9271," "https://data-analytics.atlassian.net/browse/AG-9272," "https://data-analytics.atlassian.net/browse/AG-9273") @pytest.mark.smoke def test_hot_hits_popup(self): hh_playlist_id, hh_playlist_name = get_random_hot_hits_spotify_playlist() self.loginPage.login_as_regular_user() self.searchPage.click_playlists_tab().search_for(hh_playlist_name) self.searchPage.open_playlist_page_from_results(1) self.playlistPage.click_search_field().click_track_card(1) self.trackPage.click_hot_hits_widget() self.hotHitsPage.open_hot_hits_i_popup() assert_that(self.hotHitsPage.is_hot_hits_popup_opened()).is_true() self.hotHitsPage.close_popup_by_swipe() assert_that(self.hotHitsPage.is_hot_hits_popup_opened()).is_false()