class TheaterDetailTests(unittest.TestCase): def setUp(self): self.driver = TestBrowser().get_browser() # For internal testing purposes, navigate to a theater details page self.header = Header(self.driver) self.header.do_search(_headerSearchText) self.theaters = Theaters(self.driver) self.theaters.click_theater(_theaterLinkText) self.theater = TheaterDetailPage.TheaterDetail(self.driver) self.theaterCalendar = TheaterDetailPage.TheaterCalendar(self.driver) def tearDown(self): self.driver.quit() def test_change_days(self): currentPage = self.driver.current_url self.theaterCalendar.click_today_plus_two() newPage = self.driver.current_url self.assertNotEqual(currentPage, newPage, "Selecting a different day did not navigate to a new page") def test_movies_list_different_days(self): currentMovieList = self.theater.theaterMoviesList self.theaterCalendar.click_today_plus_one() newTheater = TheaterDetailPage.TheaterDetail(self.driver) newMovieList = newTheater.theaterMoviesList self.assertNotEqual(currentMovieList[0].movieShowTimeList[0], newMovieList[0].movieShowTimeList[0], "Movie date and time from today matches movie date and time from tomorrow")
class TheatersTests(unittest.TestCase): def setUp(self): self.driver = TestBrowser().get_browser() # For internal testing purposes, navigate to the theater search results page self.header = Header(self.driver) self.header.do_search(_headerSearchText) self.theaters = Theaters(self.driver) def tearDown(self): self.driver.quit() def test_theaters_list(self): self.assertNotEqual(0, len(self.theaters.theatersList), "Did not create theaters list") self.assertNotEqual(0, len(self.theaters.theatersList[0]), "Did not get a valid list of theaters") def test_click_theater_bad_input_text(self): self.assertRaises(NoSuchElementException, self.theaters.click_theater, _headerSearchTextNoSpaces) def test_click_theater_valid_input_text(self): currentPage = self.driver.current_url self.theaters.click_theater(_theaterLinkText) 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(_theaterLinkText.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")
def setUp(self): self.driver = TestBrowser().get_browser() # For internal testing purposes, navigate to a theater details page self.header = Header(self.driver) self.header.do_search(_headerSearchText) self.theaters = Theaters(self.driver) self.theaters.click_theater(_theaterLinkText) self.theater = TheaterDetailPage.TheaterDetail(self.driver) self.theaterCalendar = TheaterDetailPage.TheaterCalendar(self.driver)
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")
def setUp(self): self.driver = TestBrowser().get_browser() # For internal testing purposes, navigate to the theater search results page self.header = Header(self.driver) self.header.do_search(_headerSearchText) self.theaters = Theaters(self.driver)
class MovieInfoTests(unittest.TestCase): def setUp(self): self.driver = TestBrowser().get_browser() # For internal testing purposes, navigate to a theater details page self.header = Header(self.driver) self.header.do_search(_headerSearchText) self.theaters = Theaters(self.driver) self.theaters.click_theater(_theaterLinkText) self.theater = TheaterDetailPage.TheaterDetail(self.driver) self.theaterCalendar = TheaterDetailPage.TheaterCalendar(self.driver) def tearDown(self): self.driver.quit() def test_log_csv(self): currentFileSize = 0 try: currentFileSize = os.path.getsize(_csvFileName) except FileNotFoundError: # Error is due to file not existing which means size 0 so do nothing pass # TODO: After TheaterDetailPage.TheaterCalendar has index based function, rewrite below in a loop # Initial load of self.theater is today so no need to click, just write data FileOutput.WriteCSV.write_movie_details(self.theater, _csvFileName) self.theaterCalendar.click_today_plus_one() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteCSV.write_movie_details(newDay, _csvFileName) self.theaterCalendar.click_today_plus_two() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteCSV.write_movie_details(newDay, _csvFileName) self.theaterCalendar.click_today_plus_three() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteCSV.write_movie_details(newDay, _csvFileName) self.theaterCalendar.click_today_plus_four() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteCSV.write_movie_details(newDay, _csvFileName) self.theaterCalendar.click_today_plus_five() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteCSV.write_movie_details(newDay, _csvFileName) self.theaterCalendar.click_today_plus_six() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteCSV.write_movie_details(newDay, _csvFileName) newFileSize = os.path.getsize(_csvFileName) self.assertLess(currentFileSize, newFileSize, "Did not write new data to csv output file") def test_log_excel(self): currentFileSize = 0 try: currentFileSize = os.path.getsize(_excelFileName) except FileNotFoundError: # Error is due to file not existing which means size 0 so do nothing pass # TODO: After TheaterDetailPage.TheaterCalendar has index based function, rewrite below in a loop # Initial load of self.theater is today so no need to click, just write data. FileOutput.WriteExcel.write_movie_details(self.theater, _excelFileName) self.theaterCalendar.click_today_plus_one() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteExcel.write_movie_details(newDay, _excelFileName) self.theaterCalendar.click_today_plus_two() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteExcel.write_movie_details(newDay, _excelFileName) self.theaterCalendar.click_today_plus_three() TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteExcel.write_movie_details(newDay, _excelFileName) self.theaterCalendar.click_today_plus_four() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteExcel.write_movie_details(newDay, _excelFileName) self.theaterCalendar.click_today_plus_five() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteExcel.write_movie_details(newDay, _excelFileName) self.theaterCalendar.click_today_plus_six() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteExcel.write_movie_details(newDay, _excelFileName) newFileSize = os.path.getsize(_excelFileName) self.assertLess(currentFileSize, newFileSize, "Did not write new data to Excel output file") def test_log_json(self): currentFileSize = 0 try: currentFileSize = os.path.getsize(_jsonFileName) except FileNotFoundError: # Error is due to file not existing which means size 0 so do nothing pass # TODO: After TheaterDetailPage.TheaterCalendar has index based function, rewrite below in a loop # Initial load of self.theater is today so no need to click, just write data. FileOutput.WriteJSON.write_movie_details(self.theater, _jsonFileName) self.theaterCalendar.click_today_plus_one() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteJSON.write_movie_details(newDay, _jsonFileName) self.theaterCalendar.click_today_plus_two() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteJSON.write_movie_details(newDay, _jsonFileName) self.theaterCalendar.click_today_plus_three() TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteJSON.write_movie_details(newDay, _jsonFileName) self.theaterCalendar.click_today_plus_four() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteJSON.write_movie_details(newDay, _jsonFileName) self.theaterCalendar.click_today_plus_five() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteJSON.write_movie_details(newDay, _jsonFileName) self.theaterCalendar.click_today_plus_six() newDay = TheaterDetailPage.TheaterDetail(self.driver) FileOutput.WriteJSON.write_movie_details(newDay, _jsonFileName) newFileSize = os.path.getsize(_jsonFileName) self.assertLess(currentFileSize, newFileSize, "Did not write new data to JSON output file")