def test_row_to_dictionary(self): self.webdriver.get("http://the-internet.herokuapp.com/tables") header = self.webdriver.find_element_by_css_selector("#table1 thead tr") target_row = self.webdriver.find_element_by_css_selector("#table1 tbody tr") row_values = WebUtils.row_to_dictionary(header, target_row) self.assertEqual("Smith", row_values['Last Name']) self.assertEqual("*****@*****.**", row_values['Email']) self.assertEqual("http://www.jsmith.com", row_values['Web Site'])
def test_row_to_dictionary(self): self.webdriver.get("http://the-internet.herokuapp.com/tables") header = self.webdriver.find_element_by_css_selector( "#table1 thead tr") target_row = self.webdriver.find_element_by_css_selector( "#table1 tbody tr") row_values = WebUtils.row_to_dictionary(header, target_row) self.assertEqual("Smith", row_values['Last Name']) self.assertEqual("*****@*****.**", row_values['Email']) self.assertEqual("http://www.jsmith.com", row_values['Web Site'])
def test_get_browser_datetime(self): browser_time = WebUtils.get_browser_datetime(self.webdriver) local_time = datetime.now() time_difference = abs(local_time - browser_time) self.assertLess(time_difference, timedelta(days=1))
def test_get_base_url(self): self.webdriver.get("http://the-internet.herokuapp.com/status_codes/200") base_url = WebUtils.get_base_url(self.webdriver) self.assertEqual("http://the-internet.herokuapp.com", base_url)
def test_check_url_bad_url_case(self): result, resp = WebUtils.check_url("http://the-internet.herokuapp.com/status_codes/404") self.assertFalse(result) self.assertEqual(404, resp)
def test_check_url(self): result, resp = WebUtils.check_url("http://the-internet.herokuapp.com/status_codes/200") self.assertTrue(result) self.assertEqual(200, resp)
def test_get_base_url(self): self.webdriver.get( "http://the-internet.herokuapp.com/status_codes/200") base_url = WebUtils.get_base_url(self.webdriver) self.assertEqual("http://the-internet.herokuapp.com", base_url)
def test_check_url_bad_url_case(self): result, resp = WebUtils.check_url( "http://the-internet.herokuapp.com/status_codes/404") self.assertFalse(result) self.assertEqual(404, resp)
def test_check_url(self): result, resp = WebUtils.check_url( "http://the-internet.herokuapp.com/status_codes/200") self.assertTrue(result) self.assertEqual(200, resp)