import pytest import allure @pytest.mark.usefixtures("app") class TestAudiencePayload: search_type = 'artist' @allure.title("[Discovery Params Artist] - Audience - TikTok followers MIN - Payload") @allure.description("As user I want to search artists by audience TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-262") @pytest.mark.regression def test_audience_tiktok_followers_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 # AUDIENCE - TIKTOK - min_followers min_followers = [['1k', 1000], ['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['500k', 500000], ['1M', 1000000], ] for item in min_followers: with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.audience_tiktok_followers_min.slide(direction='Right', times=1) self.discovery_page.audience_tiktok_followers_min.has_value(item[0]) self.discovery_page.audience_tiktok_followers_max.has_value('10M+') expected = {'tiktok': {'min_followers': item[1], 'max_followers': 100000000000}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Audience - TikTok followers MAX - Payload") @allure.description("As user I want to search artists by audience TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-262") @pytest.mark.regression def test_audience_tiktok_followers_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 # AUDIENCE - TIKTOK - max_followers max_followers = [['1k', 1000], ['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['500k', 500000], ['1M', 1000000], ] for item in reversed(max_followers): with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.audience_tiktok_followers_max.slide(direction='Left', times=1) self.discovery_page.audience_tiktok_followers_min.has_value('0') self.discovery_page.audience_tiktok_followers_max.has_value(item[0]) expected = {'tiktok': {'min_followers': 0, 'max_followers': 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] - Audience - YouTube Subscribers MIN - Payload") @allure.description("As user I want to search artists by audience YouTube parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-263") @pytest.mark.regression def test_audience_youtube_subscribers_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 # AUDIENCE - YOUTUBE - min_subscribers min_subscribers = [['1k', 1000], ['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['250k', 250000], ['500k', 500000], ['1M', 1000000], ] for item in min_subscribers: with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.audience_youtube_subscribers_min.slide(direction='Right', times=1) self.discovery_page.audience_youtube_subscribers_min.has_value(item[0]) self.discovery_page.audience_youtube_subscribers_max.has_value('10M+') expected = {'youtube': {'min_subscribers': item[1], 'max_subscribers': 100000000000}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Audience - YouTube Subscribers MAX - Payload") @allure.description("As user I want to search artists by audience YouTube parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-263") @pytest.mark.regression def test_audience_youtube_subscribers_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 # AUDIENCE - YOUTUBE - max_subscribers max_subscribers = [['1k', 1000], ['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['250k', 250000], ['500k', 500000], ['1M', 1000000], ] for item in reversed(max_subscribers): with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.audience_youtube_subscribers_max.slide(direction='Left', times=1) self.discovery_page.audience_youtube_subscribers_min.has_value('0') self.discovery_page.audience_youtube_subscribers_max.has_value(item[0]) expected = {'youtube': {'min_subscribers': 0, 'max_subscribers': 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] - Audience - Spotify Followers MIN - Payload") @allure.description("As user I want to search artists by audience Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-265") @pytest.mark.regression def test_audience_spotify_followers_min(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 # AUDIENCE - SPOTIFY - min_followers min_followers = [['1k', 1000], ['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['250k', 250000], ['500k', 500000], ['1M', 1000000], ['5M', 5000000], ] for item in min_followers: with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.audience_spotify_followers_min.slide(direction='Right', times=1) self.discovery_page.audience_spotify_followers_min.has_value(item[0]) self.discovery_page.audience_spotify_followers_max.has_value('10M+') expected = {'spotify': {'min_followers': item[1], 'max_followers': 100000000000}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Audience - Spotify Followers MAX - Payload") @allure.description("As user I want to search artists by audience Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-265") @pytest.mark.regression def test_audience_spotify_followers_max(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 # AUDIENCE - SPOTIFY - max_followers max_followers = [['1k', 1000], ['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['250k', 250000], ['500k', 500000], ['1M', 1000000], ['5M', 5000000], ] for item in reversed(max_followers): with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.audience_spotify_followers_max.slide(direction='Left', times=1) self.discovery_page.audience_spotify_followers_min.has_value('0') self.discovery_page.audience_spotify_followers_max.has_value(item[0]) expected = {'spotify': {'min_followers': 0, 'max_followers': 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] - Audience - SoundCloud Followers MIN - Payload") @allure.description("As user I want to search artists by audience SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-266") @pytest.mark.regression def test_audience_soundcloud_followers_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 # AUDIENCE - SOUNDCLOUD - min_followers min_followers = [['1k', 1000], ['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['250k', 250000], ['500k', 500000], ['1M', 1000000], ['5M', 5000000], ] for item in min_followers: with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.audience_soundcloud_followers_min.slide(direction='Right', times=1) self.discovery_page.audience_soundcloud_followers_min.has_value(item[0]) self.discovery_page.audience_soundcloud_followers_max.has_value('10M+') expected = {'soundcloud': {'min_followers': item[1], 'max_followers': 100000000000}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Audience - SoundCloud Followers MAX - Payload") @allure.description("As user I want to search artists by audience SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-266") @pytest.mark.regression def test_audience_soundcloud_followers_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 # AUDIENCE - SOUNDCLOUD - max_followers max_followers = [['1k', 1000], ['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['250k', 250000], ['500k', 500000], ['1M', 1000000], ['5M', 5000000], ] for item in reversed(max_followers): with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.audience_soundcloud_followers_max.slide(direction='Left', times=1) self.discovery_page.audience_soundcloud_followers_min.has_value('0') self.discovery_page.audience_soundcloud_followers_max.has_value(item[0]) expected = {'soundcloud': {'min_followers': 0, 'max_followers': item[1]}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected)