import pytest import allure @pytest.mark.usefixtures("app") class TestFreshestReleasePayload: search_type = 'artist' @allure.title("[Discovery Params Artist] - Freshest Release - TikTok - Payload") @allure.description("As user I want to search artists by performance TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-340") @pytest.mark.regression def test_freshest_release_tiktok(self): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() self.discovery_page.dsp_tiktok_on(True) # DSP - TIKTOK - ON # TIKTOK - min_latest_release_days latest_release = [['1 Week', 7], ['4 Weeks', 28], ['8 Weeks', 56], ['12 Weeks', 84], ] for period in latest_release: print("Verifying period: {}".format(period[0])) self.discovery_page.expand_freshest_release_block() with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.freshest_release_tiktok.select_option(period[0]) expected = {'tiktok': {'min_latest_release_days': period[1]}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Freshest Release - YouTube - Payload") @allure.description("As user I want to search artists by performance YouTube parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-731") @pytest.mark.regression def test_freshest_release_youtube(self): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() self.discovery_page.dsp_youtube_on(True) # DSP - YOUTUBE - ON # YOUTUBE - min_latest_release_days latest_release = [['1 Week', 7], ['4 Weeks', 28], ['8 Weeks', 56], ['12 Weeks', 84], ] for period in latest_release: print("Verifying period: {}".format(period[0])) self.discovery_page.expand_freshest_release_block() with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.freshest_release_youtube.select_option(period[0]) expected = {'youtube': {'min_latest_release_days': period[1]}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Freshest Release - Spotify - Payload") @allure.description("As user I want to search artists by performance Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-732") @pytest.mark.regression def test_freshest_release_spotify(self): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() self.discovery_page.dsp_spotify_on(True) # DSP - SPOTIFY - ON # SPOTIFY - min_latest_release_days latest_release = [['1 Week', 7], ['4 Weeks', 28], ['8 Weeks', 56], ['12 Weeks', 84], ] for period in latest_release: print("Verifying period: {}".format(period[0])) self.discovery_page.expand_freshest_release_block() with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.freshest_release_spotify.select_option(period[0]) expected = {'spotify': {'min_latest_release_days': period[1]}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Freshest Release - SoundCloud - Payload") @allure.description("As user I want to search artists by performance SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-736") @pytest.mark.regression def test_freshest_release_soundcloud(self): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() self.discovery_page.dsp_soundcloud_on(True) # DSP - SOUNDCLOUD - ON # SOUNDCLOUD - min_latest_release_days latest_release = [['1 Week', 7], ['4 Weeks', 28], ['8 Weeks', 56], ['12 Weeks', 84], ] for period in latest_release: print("Verifying period: {}".format(period[0])) self.discovery_page.expand_freshest_release_block() with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.freshest_release_soundcloud.select_option(period[0]) expected = {'soundcloud': {'min_latest_release_days': period[1]}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected)