import pytest import allure @pytest.mark.usefixtures("app") class TestFreshestReleasePayload: search_type = 'track' @allure.title("[Search Params Tracks] - Freshest Release - YouTube - Payload") @allure.description("As user I want to search tracks by Freshest Release YouTube parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-457") @pytest.mark.regression def test_freshest_release_youtube(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 latest_release = [['1 Week', 7], ['4 Weeks', 28], ['8 Weeks', 56], ['12 Weeks', 84], ] for period in latest_release: print("Verifying period: {}".format(period[0])) self.discovery_page.expand_freshest_release_block() with self.app.page.expect_request(self.discovery_page.api_track_total_count) as total_count: self.discovery_page.freshest_release_youtube.select_option(period[0]) expected = {'youtube': {'min_latest_release_days': period[1]}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected) @allure.title("[Search Params Tracks] - Freshest Release - SoundCloud - Payload") @allure.description("As user I want to search tracks by Freshest Release SoundCloud parameters") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-763") @pytest.mark.regression def test_freshest_release_soundcloud(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 latest_release = [['1 Week', 7], ['4 Weeks', 28], ['8 Weeks', 56], ['12 Weeks', 84], ] for period in latest_release: print("Verifying period: {}".format(period[0])) self.discovery_page.expand_freshest_release_block() with self.app.page.expect_request(self.discovery_page.api_track_total_count) as total_count: self.discovery_page.freshest_release_soundcloud.select_option(period[0]) expected = {'soundcloud': {'min_latest_release_days': period[1]}} self.discovery_page.click_discovery_and_compare_payloads_with_diff_and_return(self.search_type, total_count, expected)