def test_A_000010(self): """ Confirms that filtering by all keywords and all data types returns the same number of results as if no search parameters were applied. This test is applied near both the Dallas Texas and Rio De Janeiro Brazil areas """ def oracle(): """ A search which filters for all keywords and all data types returns the same number of results as a search without any filters """ for rio_count in rio_counts: self.assertEqual(rio_count, rio_counts[0]) for dallas_count in dallas_counts: self.assertEqual(dallas_count, dallas_counts[0]) driver = self.driver rio_counts = [] dallas_counts = [] Search.search_location(driver, 'Rio De Janeiro') Keywords.filter_root(driver, ['Biological', 'Chemical', 'Physical']) rio_counts.append(Search.count_results(driver)) Advanced.filter_all_value_types(driver) rio_counts.append(Search.count_results(driver)) Search.reset(driver) rio_counts.append(Search.count_results(driver)) Search.search_location(driver, 'Dallas') Keywords.filter_root(driver, ['Biological', 'Chemical', 'Physical']) dallas_counts.append(Search.count_results(driver)) Advanced.filter_all_value_types(driver) dallas_counts.append(Search.count_results(driver)) Search.reset(driver) dallas_counts.append(Search.count_results(driver)) oracle()
def test_A_000019(self): """ Confirm empty operations on the filter modals don't affect the results set or the persistance of the searchbox entry """ def oracle_search_text_is_same(text): """ Check if the text is the same in the search field """ self.assertEqual(Search.get_searchbox_text(self.driver), text) def oracle_result(init_result): """ Compare search results count to the initial level """ self.assertEqual(init_result, Search.count_results(self.driver)) location = "NUIO üł. 54343nt, 342sf 234sdf, 12..." # deliberately random Search.search_location(self.driver, location) Search.search(self.driver) init_result_count = Search.count_results(self.driver) Services.filters(self.driver) # apply no services filters Keywords.empty_keywords(self.driver) # no keyword filters Advanced.empty_advanced(self.driver) # no advanced filters Search.search(self.driver) oracle_result(init_result_count) oracle_search_text_is_same(location) Search.reset(self.driver) Search.search(self.driver) oracle_result(init_result_count) oracle_search_text_is_same(location)
def test_A_000024(self): """ Confirms cycling of panel visibility and date filters does not result in result count problems """ def oracle(): """ Checks that search result is greater than 0 """ self.assertGreater(Search.count_results(self.driver), 0) Search.show_hide_panel(self.driver) Search.show_hide_panel(self.driver) Search.reset(self.driver) Search.search(self.driver) Search.filter_dates(self.driver, "11/12/2018", "11/13/2018") Search.reset(self.driver) Search.search(self.driver) oracle()
def test_A_000017(self): """ Confirm Reset button clears Filter Results text and categorical filters """ def oracle_results_count(expected_results, should_match): if should_match: self.assertEqual(Search.count_results(self.driver), expected_results) else: self.assertNotEqual(Search.count_results(self.driver), expected_results) def oracle_data_prop_selection(data_props, should_be_selected): """ Checks that filter options not selected """ for data_prop in data_props: if should_be_selected: self.assertTrue( Filter.data_prop_is_selected(self.driver, data_prop)) else: self.assertFalse( Filter.data_prop_is_selected(self.driver, data_prop)) def oracle_data_service_selection(data_services, should_be_selected): """ Checks that filter options not selected """ for data_service in data_services: if should_be_selected: self.assertTrue( Filter.data_service_is_selected( self.driver, data_service)) else: self.assertFalse( Filter.data_service_is_selected( self.driver, data_service)) data_props = ["Data Type", "Sample Medium"] data_services = ["Community Collaborative Rain, Hail and Snow Network"] Search.search_location(self.driver, "Montreal ") Search.search(self.driver) expected_results = Search.count_results(self.driver) Filter.open(self.driver) Filter.selection(self.driver) Filter.close(self.driver) TestSystem.wait(5) Search.reset(self.driver) Search.search(self.driver) oracle_results_count(expected_results, should_match=True) Filter.open(self.driver) Filter.find_in_table(self.driver, "DOLLARD") oracle_results_count(expected_results, should_match=False) Search.reset(self.driver) Search.search(self.driver) oracle_results_count(expected_results, should_match=True) Filter.open(self.driver) Filter.set_data_props(self.driver, data_props) Filter.open(self.driver) Filter.set_data_services(self.driver, data_services) oracle_results_count(expected_results, should_match=False) Filter.open(self.driver) oracle_data_prop_selection(data_props, should_be_selected=True) oracle_data_service_selection(data_services, should_be_selected=True) Filter.close(self.driver) Search.reset(self.driver) Search.search(self.driver) oracle_results_count(expected_results, should_match=True) Filter.open(self.driver) oracle_data_prop_selection(data_props, should_be_selected=False) oracle_data_service_selection(data_services, should_be_selected=False)