import pytest import allure @pytest.mark.usefixtures("app") class TestPerformancePayload: search_type = 'track' @allure.title("[Search Params Tracks] - Performance - TikTok Likes MIN - Payload") @allure.description("As user I want to search tracks by releases TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-372") @pytest.mark.regression def test_performance_tiktok_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_tiktok_on(True) # DSP - TIKTOK - ON # TIKTOK - min_likes min_likes = [['1k', 1000], ['100k', 100000], ['200k', 200000], ['500k', 500000], ['1M', 1000000], ['5M', 5000000], ] for item in min_likes: with self.app.page.expect_request(self.discovery_page.api_track_total_count) as total_count: self.discovery_page.performance_tiktok_likes_min.slide(direction='Right', times=1) self.discovery_page.performance_tiktok_likes_min.has_value(item[0]) self.discovery_page.performance_tiktok_likes_max.has_value('10M+') 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("[Search Params Tracks] - Performance - TikTok Likes MAX - Payload") @allure.description("As user I want to search tracks by releases TikTok parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-372") @pytest.mark.regression def test_performance_tiktok_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_tiktok_on(True) # DSP - TIKTOK - ON # TIKTOK - max_likes max_likes = [['1k', 1000], ['100k', 100000], ['200k', 200000], ['500k', 500000], ['1M', 1000000], ['5M', 5000000], ] 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.performance_tiktok_likes_max.slide(direction='Left', times=1) self.discovery_page.performance_tiktok_likes_min.has_value('0') self.discovery_page.performance_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("[Search Params Tracks] - Performance - YouTube Views MIN - Payload") @allure.description("As user I want to search tracks by releases YouTube parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-753") @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.switch_scope_to_tracks() self.discovery_page.dsp_youtube_on(True) # DSP - YOUTUBE - ON # YOUTUBE - min_views min_views = [['1k', 1000], ['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['500k', 500000], ['1M', 1000000], ] for item in min_views: with self.app.page.expect_request(self.discovery_page.api_track_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('10M+') 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("[Search Params Tracks] - Performance - YouTube Views MAX - Payload") @allure.description("As user I want to search tracks by releases YouTube parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-753") @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.switch_scope_to_tracks() self.discovery_page.dsp_youtube_on(True) # DSP - YOUTUBE - ON # YOUTUBE - max_views max_views = [['1k', 1000], ['5k', 5000], ['10k', 10000], ['25k', 25000], ['50k', 50000], ['100k', 100000], ['500k', 500000], ['1M', 1000000], ] for item in reversed(max_views): with self.app.page.expect_request(self.discovery_page.api_track_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("[Search Params Tracks] - Performance - Spotify Streams MIN - Payload") @allure.description("As user I want to search tracks by releases Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-970") @pytest.mark.regression def test_performance_spotify_streams_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_streams min_streams = [['1k', 1000], ['10k', 10000], ['100k', 100000], ['500k', 500000], ['1M', 1000000], ['5M', 5000000], ['10M', 10000000], ['50M', 50000000], ] for item in min_streams: with self.app.page.expect_request(self.discovery_page.api_track_total_count) as total_count: self.discovery_page.performance_spotify_streams_min.slide(direction='Right', times=1) self.discovery_page.performance_spotify_streams_min.has_value(item[0]) self.discovery_page.performance_spotify_streams_max.has_value('100M+') expected = {'spotify': {'min_streams': item[1], 'max_streams': 100000000000}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Search Params Tracks] - Performance - Spotify Streams MAX - Payload") @allure.description("As user I want to search tracks by releases Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-970") @pytest.mark.regression def test_performance_spotify_streams_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_streams max_streams = [['1k', 1000], ['10k', 10000], ['100k', 100000], ['500k', 500000], ['1M', 1000000], ['5M', 5000000], ['10M', 10000000], ['50M', 50000000], ] for item in reversed(max_streams): with self.app.page.expect_request(self.discovery_page.api_track_total_count) as total_count: self.discovery_page.performance_spotify_streams_max.slide(direction='Left', times=1) self.discovery_page.performance_spotify_streams_min.has_value('0') self.discovery_page.performance_spotify_streams_max.has_value(item[0]) expected = {'spotify': {'min_streams': 0, 'max_streams': 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] - Performance - Spotify Playlists MIN - Payload") @allure.description("As user I want to search tracks by releases Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-755") @pytest.mark.regression def test_performance_spotify_playlists_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_playlists min_playlists = [['10', 10], ['25', 25], ['50', 50], ['100', 100], ['250', 250], ['500', 500], ] for item in min_playlists: with self.app.page.expect_request(self.discovery_page.api_track_total_count) as total_count: self.discovery_page.performance_spotify_playlists_min.slide(direction='Right', times=1) self.discovery_page.performance_spotify_playlists_min.has_value(item[0]) self.discovery_page.performance_spotify_playlists_max.has_value('1k+') expected = {'spotify': {'min_playlists': item[1], 'max_playlists': 100000000000}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Search Params Tracks] - Performance - Spotify Playlists MAX - Payload") @allure.description("As user I want to search tracks by releases Spotify parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-755") @pytest.mark.regression def test_performance_spotify_playlists_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_playlists max_playlists = [['10', 10], ['25', 25], ['50', 50], ['100', 100], ['250', 250], ['500', 500], ] for item in reversed(max_playlists): with self.app.page.expect_request(self.discovery_page.api_track_total_count) as total_count: self.discovery_page.performance_spotify_playlists_max.slide(direction='Left', times=1) self.discovery_page.performance_spotify_playlists_min.has_value('0') self.discovery_page.performance_spotify_playlists_max.has_value(item[0]) expected = {'spotify': {'min_playlists': 0, 'max_playlists': 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] - Performance - SoundCloud Plays MIN - Payload") @allure.description("As user I want to search tracks by releases SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-754") @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.switch_scope_to_tracks() self.discovery_page.dsp_soundcloud_on(True) # DSP - SOUNDCLOUD - ON # SOUNDCLOUD - min_plays min_plays = [['1k', 1000], ['10k', 10000], ['100k', 100000], ['500k', 500000], ['1M', 1000000], ['5M', 5000000], ['10M', 10000000], ['50M', 50000000], ] for item in min_plays: with self.app.page.expect_request(self.discovery_page.api_track_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("[Search Params Tracks] - Performance - SoundCloud Plays MAX - Payload") @allure.description("As user I want to search tracks by releases SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-754") @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.switch_scope_to_tracks() self.discovery_page.dsp_soundcloud_on(True) # DSP - SOUNDCLOUD - ON # SOUNDCLOUD - max_plays max_plays = [['1k', 1000], ['10k', 10000], ['100k', 100000], ['500k', 500000], ['1M', 1000000], ['5M', 5000000], ['10M', 10000000], ['50M', 50000000], ] for item in reversed(max_plays): with self.app.page.expect_request(self.discovery_page.api_track_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)