def test_search_random_input_from_excel(self): # Get a random row greater than 0 to avoid the header and get that search data from the default input file # Within each row of data in the input file, [0] is the search string, [1] is the theater name, [2] is zip code index = randint(1,6) input = ReadExcel.get_sheet_values() searchText = input[index][0] expectedZip = str(input[index][2]) currentPage = self.driver.current_url self.header.do_search(searchText) newPage = self.driver.current_url self.assertNotEqual(currentPage, newPage, "Searching did not navigate to a new page") self.assertIn(expectedZip, self.driver.page_source, "Expected zip code not found in results page")
def test_search_random_input_from_excel(self): # Get a random row greater than 0 to avoid the header and get that search data from the default input file # [0] is the search string, [1] is the theater index, [2] is theater name, [3] is zip code index = randint(1,6) input = ReadExcel.get_sheet_values() searchText = input[index][0] theaterIndex = input[index][1] theaterText = input[index][2] if(_headerSearchText != searchText): # Setup did a different search than we want - redo the search and update the variables self.header = Header(self.driver) self.header.do_search(searchText) self.theaters = Theaters(self.driver) self.theater = TheaterDetailPage.TheaterDetail(self.driver, theaterIndex) theaterName = self.theater.theaterName self.assertIn(theaterText.lower(), theaterName.lower(), "Did not end up on theater detail page for selected theater")
def test_search_random_input_from_excel(self): # Get a random row greater than 0 to avoid the header and get that search data from the default input file # Within each row of data in the input file, [0] is the search string, [1] is the theater name, [2] is zip code index = randint(1,6) input = ReadExcel.get_sheet_values() searchText = input[index][0] theaterText = input[index][1] if(_headerSearchText != searchText): # Setup did a different search than we want - redo the search and update the variables self.header = Header(self.driver) self.header.do_search(searchText) self.theaters = Theaters(self.driver) currentPage = self.driver.current_url self.theaters.click_theater(theaterText) newPage = self.driver.current_url theaterName = TheaterDetailPage.TheaterDetail(self.driver).theaterName self.assertNotEqual(currentPage, newPage, "Selecting a theater did not navigate to a new page") self.assertIn(theaterText.lower(), theaterName.lower(), "Did not end up on theater detail page for selected theater")