import pytest import allure from assertpy import assert_that from src.data.entities_data import entity_types @pytest.mark.usefixtures("app") class TestFailedDiscoveryRequest: @allure.title("[Create new search] - Discover button state - N/A") @allure.description("Discovery button shows N/A value if data loading failed") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-416") @pytest.mark.regression @pytest.mark.parametrize('entity_type', entity_types) def test_failed_total_count_request(self, entity_type): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() if entity_type == 'track': self.discovery_page.switch_scope_to_tracks() self.app.abort_request("**total_count") self.discovery_page.dsp_tiktok_on(True) # randomly chosen assert_that(self.discovery_page.results_expected_value()).is_equal_to('N/A') self.discovery_page.bn_discovery.is_enabled(False) @allure.title("[Discovery results] - Failed to load placeholder") @allure.description("Discovery results placeholder should notify if data failed to load") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-174") @allure.testcase("https://data-analytics.atlassian.net/browse/DNAD-209") @pytest.mark.regression @pytest.mark.parametrize('entity_type', entity_types) def test_failed_discovery_results_request(self, entity_type): self.app.go_to(self.discovery_page.url) self.discovery_page.is_page_loaded() if entity_type == 'track': self.discovery_page.switch_scope_to_tracks() self.app.abort_request("**discovery") self.discovery_page.dsp_tiktok_on(True) # randomly chosen self.discovery_page.bn_discovery.click() self.common_page.error_titles_container.contain_text('Failed to load.Please try refreshing the page.')