import pytest import allure @pytest.mark.usefixtures("app") class TestEngagementPayload: search_type = 'track' @allure.title("[Search Params Tracks] - Engagement - TikTok Comments MIN - Payload") @allure.description("As user I want to search tracks by engagement TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-393") @pytest.mark.regression def test_engagement_tiktok_comments_min(self): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() self.discovery_page.switch_scope_to_tracks() self.discovery_page.dsp_tiktok_on(True) # DSP - TIKTOK - ON # TIKTOK - min_comments min_comments = [['10', 10], ['50', 50], ['100', 100], ['200', 200], ['1k', 1000], ] for item in min_comments: with self.app.page.expect_request(self.discovery_page.api_track_total_count) as total_count: self.discovery_page.engagement_tiktok_comments_min.slide(direction='Right', times=1) self.discovery_page.engagement_tiktok_comments_min.has_value(item[0]) self.discovery_page.engagement_tiktok_comments_max.has_value('10k+') expected = {'tiktok': {'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("[Search Params Tracks] - Engagement - TikTok Comments MAX - Payload") @allure.description("As user I want to search tracks by engagement TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-393") @pytest.mark.regression def test_engagement_tiktok_comments_max(self): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() self.discovery_page.switch_scope_to_tracks() self.discovery_page.dsp_tiktok_on(True) # DSP - TIKTOK - ON # TIKTOK - max_comments max_comments = [['10', 10], ['50', 50], ['100', 100], ['200', 200], ['1k', 1000], ] for item in reversed(max_comments): with self.app.page.expect_request(self.discovery_page.api_track_total_count) as total_count: self.discovery_page.engagement_tiktok_comments_max.slide(direction='Left', times=1) self.discovery_page.engagement_tiktok_comments_min.has_value('0') self.discovery_page.engagement_tiktok_comments_max.has_value(item[0]) expected = {'tiktok': {'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) @allure.title("[Search Params Tracks] - Engagement - TikTok Mentions MIN - Payload") @allure.description("As user I want to search tracks by engagement TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-373") @pytest.mark.regression def test_engagement_tiktok_mentions_min(self): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() self.discovery_page.switch_scope_to_tracks() 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_track_total_count) as total_count: self.discovery_page.engagement_tiktok_mentions_min.slide(direction='Right', times=1) self.discovery_page.engagement_tiktok_mentions_min.has_value(item[0]) self.discovery_page.engagement_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("[Search Params Tracks] - Engagement - TikTok Mentions MAX - Payload") @allure.description("As user I want to search tracks by engagement TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-373") @pytest.mark.regression def test_engagement_tiktok_mentions_max(self): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() self.discovery_page.switch_scope_to_tracks() 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_track_total_count) as total_count: self.discovery_page.engagement_tiktok_mentions_max.slide(direction='Left', times=1) self.discovery_page.engagement_tiktok_mentions_min.has_value('0') self.discovery_page.engagement_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("[Search Params Tracks] - Engagement - YouTube Likes MIN - Payload") @allure.description("As user I want to search tracks by engagement YouTube parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-758") @pytest.mark.regression def test_engagement_youtube_likes_min(self): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() self.discovery_page.switch_scope_to_tracks() self.discovery_page.dsp_youtube_on(True) # DSP - YOUTUBE - ON # YOUTUBE - min_likes min_likes = [['1k', 1000], ['5k', 5000], ['10k', 10000], ['50k', 50000], ['100k', 100000], ['200k', 200000], ['500k', 500000], ['1M', 1000000], ] for item in min_likes: with self.app.page.expect_request(self.discovery_page.api_track_total_count) as total_count: self.discovery_page.engagement_youtube_likes_min.slide(direction='Right', times=1) self.discovery_page.engagement_youtube_likes_min.has_value(item[0]) self.discovery_page.engagement_youtube_likes_max.has_value('10M+') expected = {'youtube': {'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("[Search Params Tracks] - Engagement - YouTube Likes MAX - Payload") @allure.description("As user I want to search tracks by engagement YouTube parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-758") @pytest.mark.regression def test_engagement_youtube_likes_max(self): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() self.discovery_page.switch_scope_to_tracks() self.discovery_page.dsp_youtube_on(True) # DSP - YOUTUBE - ON # YOUTUBE - max_likes max_likes = [['1k', 1000], ['5k', 5000], ['10k', 10000], ['50k', 50000], ['100k', 100000], ['200k', 200000], ['500k', 500000], ['1M', 1000000], ] for item in reversed(max_likes): with self.app.page.expect_request(self.discovery_page.api_track_total_count) as total_count: self.discovery_page.engagement_youtube_likes_max.slide(direction='Left', times=1) self.discovery_page.engagement_youtube_likes_min.has_value('0') self.discovery_page.engagement_youtube_likes_max.has_value(item[0]) expected = {'youtube': {'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("[Search Params Tracks] - Engagement - YouTube Comments MIN - Payload") @allure.description("As user I want to search tracks by engagement YouTube parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-757") @pytest.mark.regression def test_engagement_youtube_comments_min(self): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() self.discovery_page.switch_scope_to_tracks() self.discovery_page.dsp_youtube_on(True) # DSP - YOUTUBE - ON # YOUTUBE - min_comments min_comments = [['10', 10], ['50', 50], ['100', 100], ['500', 500], ['1k', 1000], ['5k', 5000], ] for item in min_comments: with self.app.page.expect_request(self.discovery_page.api_track_total_count) as total_count: self.discovery_page.engagement_youtube_comments_min.slide(direction='Right', times=1) self.discovery_page.engagement_youtube_comments_min.has_value(item[0]) self.discovery_page.engagement_youtube_comments_max.has_value('10k+') expected = {'youtube': {'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("[Search Params Tracks] - Engagement - YouTube Comments MAX - Payload") @allure.description("As user I want to search tracks by engagement YouTube parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-757") @pytest.mark.regression def test_engagement_youtube_comments_max(self): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() self.discovery_page.switch_scope_to_tracks() self.discovery_page.dsp_youtube_on(True) # DSP - YOUTUBE - ON # YOUTUBE - max_comments max_comments = [['10', 10], ['50', 50], ['100', 100], ['500', 500], ['1k', 1000], ['5k', 5000], ] for item in reversed(max_comments): with self.app.page.expect_request(self.discovery_page.api_track_total_count) as total_count: self.discovery_page.engagement_youtube_comments_max.slide(direction='Left', times=1) self.discovery_page.engagement_youtube_comments_min.has_value('0') self.discovery_page.engagement_youtube_comments_max.has_value(item[0]) expected = {'youtube': {'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) @allure.title("[Search Params Tracks] - Engagement - Spotify Popularity MIN - Payload") @allure.description("As user I want to search tracks by engagement Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-762") @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.switch_scope_to_tracks() self.discovery_page.dsp_spotify_on(True) # DSP - SPOTIFY - ON # 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_track_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("[Search Params Tracks] - Engagement - Spotify Popularity MAX - Payload") @allure.description("As user I want to search tracks by engagement Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-762") @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.switch_scope_to_tracks() self.discovery_page.dsp_spotify_on(True) # DSP - SPOTIFY - ON # 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_track_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("[Search Params Tracks] - Engagement - SoundCloud Likes MIN - Payload") @allure.description("As user I want to search tracks by engagement SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-761") @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.switch_scope_to_tracks() self.discovery_page.dsp_soundcloud_on(True) # DSP - SOUNDCLOUD - ON # 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_track_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("[Search Params Tracks] - Engagement - SoundCloud Likes MAX - Payload") @allure.description("As user I want to search tracks by engagement SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-761") @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.switch_scope_to_tracks() self.discovery_page.dsp_soundcloud_on(True) # DSP - SOUNDCLOUD - ON # 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_track_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("[Search Params Tracks] - Engagement - SoundCloud Comments MIN - Payload") @allure.description("As user I want to search tracks by engagement SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-760") @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.switch_scope_to_tracks() self.discovery_page.dsp_soundcloud_on(True) # DSP - SOUNDCLOUD - ON # 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_track_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("[Search Params Tracks] - Engagement - SoundCloud Comments MAX - Payload") @allure.description("As user I want to search tracks by engagement SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-760") @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.switch_scope_to_tracks() self.discovery_page.dsp_soundcloud_on(True) # DSP - SOUNDCLOUD - ON # 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_track_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)