import pytest import allure @pytest.mark.usefixtures("app") class TestPerformancePayload: search_type = 'artist' @allure.title("[Discovery Params Artist] - Performance - TikTok Mentions MIN - Payload") @allure.description("As user I want to search artists by performance TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-301") @pytest.mark.regression def test_performance_tiktok_mentions_min(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_mentions min_mentions = [['5', 5], ['10', 10], ['25', 25], ['50', 50], ['75', 75], ] for item in min_mentions: with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.performance_tiktok_mentions_min.slide(direction='Right', times=1) self.discovery_page.performance_tiktok_mentions_min.has_value(item[0]) self.discovery_page.performance_tiktok_mentions_max.has_value('100+') expected = {'tiktok': {'min_mentions': item[1], 'max_mentions': 100000000000}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Performance - TikTok Mentions MAX - Payload") @allure.description("As user I want to search artists by performance TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-301") @pytest.mark.regression def test_performance_tiktok_mentions_max(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 - max_mentions max_mentions = [['5', 5], ['10', 10], ['25', 25], ['50', 50], ['75', 75], ] for item in reversed(max_mentions): with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.performance_tiktok_mentions_max.slide(direction='Left', times=1) self.discovery_page.performance_tiktok_mentions_min.has_value('0') self.discovery_page.performance_tiktok_mentions_max.has_value(item[0]) expected = {'tiktok': {'min_mentions': 0, 'max_mentions': item[1]}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Performance - YouTube Views MIN - Payload") @allure.description("As user I want to search artists by performance YouTube parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-721") @pytest.mark.regression def test_performance_youtube_views_min(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_views min_views = [['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['1M', 1000000], ['5M', 5000000], ['10M', 10000000], ] for item in min_views: with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.performance_youtube_views_min.slide(direction='Right', times=1) self.discovery_page.performance_youtube_views_min.has_value(item[0]) self.discovery_page.performance_youtube_views_max.has_value('100M+') expected = {'youtube': {'min_views': item[1], 'max_views': 100000000000}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Performance - YouTube Views MAX - Payload") @allure.description("As user I want to search artists by performance YouTube parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-721") @pytest.mark.regression def test_performance_youtube_views_max(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 - max_views max_views = [['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['1M', 1000000], ['5M', 5000000], ['10M', 10000000], ] for item in reversed(max_views): with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.performance_youtube_views_max.slide(direction='Left', times=1) self.discovery_page.performance_youtube_views_min.has_value('0') self.discovery_page.performance_youtube_views_max.has_value(item[0]) expected = {'youtube': {'min_views': 0, 'max_views': item[1]}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Performance - SoundCloud Plays MIN - Payload") @allure.description("As user I want to search artists by performance SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-723") @pytest.mark.regression def test_performance_soundcloud_plays_min(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_plays min_plays = [['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['1M', 1000000], ['5M', 5000000], ['10M', 10000000], ] for item in min_plays: with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.performance_soundcloud_plays_min.slide(direction='Right', times=1) self.discovery_page.performance_soundcloud_plays_min.has_value(item[0]) self.discovery_page.performance_soundcloud_plays_max.has_value('100M+') expected = {'soundcloud': {'min_plays': item[1], 'max_plays': 100000000000}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Performance - SoundCloud Plays MAX - Payload") @allure.description("As user I want to search artists by performance SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-723") @pytest.mark.regression def test_performance_soundcloud_plays_max(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 - max_plays max_plays = [['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['1M', 1000000], ['5M', 5000000], ['10M', 10000000], ] for item in reversed(max_plays): with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.performance_soundcloud_plays_max.slide(direction='Left', times=1) self.discovery_page.performance_soundcloud_plays_min.has_value('0') self.discovery_page.performance_soundcloud_plays_max.has_value(item[0]) expected = {'soundcloud': {'min_plays': 0, 'max_plays': item[1]}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected)