import pytest import allure @pytest.mark.usefixtures("app") class TestEngagementPayload: search_type = 'artist' @allure.title("[Discovery Params Artist] - Engagement - TikTok Likes MIN - Payload") @allure.description("As user I want to search artists by engagement TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-302") @pytest.mark.regression def test_engagement_tiktok_likes_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 # ENGAGEMENT - TIKTOK - min_likes min_likes = [['5k', 5000], ['10k', 10000], ['100k', 100000], ['1M', 1000000], ['5M', 5000000], ['10M', 10000000], ] for item in min_likes: with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.engagement_tiktok_likes_min.slide(direction='Right', times=1) self.discovery_page.engagement_tiktok_likes_min.has_value(item[0]) self.discovery_page.engagement_tiktok_likes_max.has_value('100M+') expected = {'tiktok': {'min_likes': item[1], 'max_likes': 100000000000}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Engagement - TikTok Likes MAX - Payload") @allure.description("As user I want to search artists by engagement TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-302") @pytest.mark.regression def test_engagement_tiktok_likes_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 # ENGAGEMENT - TIKTOK - max_likes max_likes = [['5k', 5000], ['10k', 10000], ['100k', 100000], ['1M', 1000000], ['5M', 5000000], ['10M', 10000000], ] for item in reversed(max_likes): with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.engagement_tiktok_likes_max.slide(direction='Left', times=1) self.discovery_page.engagement_tiktok_likes_min.has_value('0') self.discovery_page.engagement_tiktok_likes_max.has_value(item[0]) expected = {'tiktok': {'min_likes':0, 'max_likes': 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] - Engagement - Spotify Listeners MIN - Payload") @allure.description("As user I want to search artists by engagement Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-724") @pytest.mark.regression def test_engagement_spotify_listeners_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 # ENGAGEMENT - SPOTIFY - min_listeners min_listeners = [['100', 100], ['1k', 1000], ['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['250k', 250000], ['500k', 500000], ['1M', 1000000], ['5M', 5000000], ] for item in min_listeners: with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.engagement_spotify_listeners_min.slide(direction='Right', times=1) self.discovery_page.engagement_spotify_listeners_min.has_value(item[0]) self.discovery_page.engagement_spotify_listeners_max.has_value('10M+') expected = {'spotify': {'min_listeners': item[1], 'max_listeners':100000000000}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Engagement - Spotify Listeners MAX - Payload") @allure.description("As user I want to search artists by engagement Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-724") @pytest.mark.regression def test_engagement_spotify_listeners_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 # ENGAGEMENT - SPOTIFY - max_listeners max_listeners = [['100', 100], ['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_listeners): with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.engagement_spotify_listeners_max.slide(direction='Left', times=1) self.discovery_page.engagement_spotify_listeners_min.has_value('0') self.discovery_page.engagement_spotify_listeners_max.has_value(item[0]) expected = {'spotify': {'min_listeners': 0, 'max_listeners': 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] - Engagement - Spotify Popularity MIN - Payload") @allure.description("As user I want to search artists by engagement Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-725") @pytest.mark.regression def test_engagement_spotify_popularity_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 # ENGAGEMENT - SPOTIFY - min_popularity min_popularity = [['10', 10], ['20', 20], ['30', 30], ['40', 40], ['50', 50], ['60', 60], ['70', 70], ['80', 80], ['90', 90], ] for item in min_popularity: with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.engagement_spotify_popularity_min.slide(direction='Right', times=1) self.discovery_page.engagement_spotify_popularity_min.has_value(item[0]) self.discovery_page.engagement_spotify_popularity_max.has_value('100') expected = {'spotify': {'min_popularity': item[1], 'max_popularity': 100}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Engagement - Spotify Popularity MAX - Payload") @allure.description("As user I want to search artists by engagement Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-725") @pytest.mark.regression def test_engagement_spotify_popularity_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 # ENGAGEMENT - SPOTIFY - max_popularity max_popularity = [['10', 10], ['20', 20], ['30', 30], ['40', 40], ['50', 50], ['60', 60], ['70', 70], ['80', 80], ['90', 90], ] for item in reversed(max_popularity): with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.engagement_spotify_popularity_max.slide(direction='Left', times=1) self.discovery_page.engagement_spotify_popularity_min.has_value('0') self.discovery_page.engagement_spotify_popularity_max.has_value(item[0]) expected = {'spotify': {'min_popularity': 0, 'max_popularity': 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] - Engagement - SoundCloud Likes MIN - Payload") @allure.description("As user I want to search artists by engagement SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-727") @pytest.mark.regression def test_engagement_soundcloud_likes_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 # ENGAGEMENT - SOUNDCLOUD - min_likes min_likes = [['10', 10], ['50', 50], ['100', 100], ['500', 500], ['1k', 1000], ['10k', 10000], ['50k', 50000], ] for item in min_likes: with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.engagement_soundcloud_likes_min.slide(direction='Right', times=1) self.discovery_page.engagement_soundcloud_likes_min.has_value(item[0]) self.discovery_page.engagement_soundcloud_likes_max.has_value('100k+') expected = {'soundcloud': {'min_likes': item[1], 'max_likes': 100000000000}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Engagement - SoundCloud Likes MAX - Payload") @allure.description("As user I want to search artists by engagement SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-727") @pytest.mark.regression def test_engagement_soundcloud_likes_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 # ENGAGEMENT - SOUNDCLOUD - max_likes max_likes = [['10', 10], ['50', 50], ['100', 100], ['500', 500], ['1k', 1000], ['10k', 10000], ['50k', 50000], ] for item in reversed(max_likes): with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.engagement_soundcloud_likes_max.slide(direction='Left', times=1) self.discovery_page.engagement_soundcloud_likes_min.has_value('0') self.discovery_page.engagement_soundcloud_likes_max.has_value(item[0]) expected = {'soundcloud': {'min_likes': 0, 'max_likes': 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] - Engagement - SoundCloud Comments MIN - Payload") @allure.description("As user I want to search artists by engagement SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-726") @pytest.mark.regression def test_engagement_soundcloud_comments_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 # ENGAGEMENT - SOUNDCLOUD - min_comments min_comments = [['10', 10], ['50', 50], ['100', 100], ['500', 500], ['1k', 1000], ['10k', 10000], ['50k', 50000], ] for item in min_comments: with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.engagement_soundcloud_comments_min.slide(direction='Right', times=1) self.discovery_page.engagement_soundcloud_comments_min.has_value(item[0]) self.discovery_page.engagement_soundcloud_comments_max.has_value('100k+') expected = {'soundcloud': {'min_comments': item[1], 'max_comments': 100000000000}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Discovery Params Artist] - Engagement - SoundCloud Comments MAX - Payload") @allure.description("As user I want to search artists by engagement SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-726") @pytest.mark.regression def test_engagement_soundcloud_comments_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 # ENGAGEMENT - SOUNDCLOUD - max_comments max_comments = [['10', 10], ['50', 50], ['100', 100], ['500', 500], ['1k', 1000], ['10k', 10000], ['50k', 50000], ] for item in reversed(max_comments): with self.app.page.expect_request(self.discovery_page.api_artist_total_count) as total_count: self.discovery_page.engagement_soundcloud_comments_max.slide(direction='Left', times=1) self.discovery_page.engagement_soundcloud_comments_min.has_value('0') self.discovery_page.engagement_soundcloud_comments_max.has_value(item[0]) expected = {'soundcloud': {'min_comments': 0, 'max_comments': item[1]}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected)