import pytest import allure @pytest.mark.usefixtures("app") class TestSparklinePayload: search_type = 'artist' @allure.title("[Discovery Params Artist] - Sparkline - TikTok - Payload") @allure.description("As user I want to search artists by Sparkline TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-341") @pytest.mark.regression def test_sparkline_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 - chart_type=Likes self.discovery_page.expand_sparkline_block() with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.sparkline_tiktok.select_option('Likes') expected = {'tiktok': {'chart_type': 'LIKES'}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Sparkline - YouTube - Payload") @allure.description("As user I want to search artists by Sparkline YouTube parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-733") @pytest.mark.regression def test_sparkline_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 - chart_type=Views self.discovery_page.expand_sparkline_block() with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.sparkline_youtube.select_option('Views') expected = {'youtube': {'chart_type': 'VIEWS'}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Sparkline - Spotify - Payload") @allure.description("As user I want to search artists by Sparkline Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-734") @pytest.mark.regression def test_sparkline_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 - chart_type=Listeners self.discovery_page.expand_sparkline_block() with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.sparkline_spotify.select_option('Listeners/Mth') expected = {'spotify': {'chart_type': 'LISTENERS'}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) # SPOTIFY - chart_type=Popularity self.discovery_page.expand_sparkline_block() with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.sparkline_spotify.select_option('Popularity') expected = {'spotify': {'chart_type': 'POPULARITY'}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Sparkline - SoundCloud - Payload") @allure.description("As user I want to search artists by Sparkline SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-735") @pytest.mark.regression def test_sparkline_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 - chart_type=Plays self.discovery_page.expand_sparkline_block() with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.sparkline_soundcloud.select_option('Plays') expected = {'soundcloud': {'chart_type': 'PLAYS'}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) # SOUNDCLOUD - chart_type=Likes self.discovery_page.expand_sparkline_block() with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.sparkline_soundcloud.select_option('Likes') expected = {'soundcloud': {'chart_type': 'LIKES'}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) # SOUNDCLOUD - chart_type=Comments self.discovery_page.expand_sparkline_block() with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.sparkline_soundcloud.select_option('Comments') expected = {'soundcloud': {'chart_type': 'COMMENTS'}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected)