Ejemplo n.º 1
0
    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'])
Ejemplo n.º 2
0
    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'])
Ejemplo n.º 3
0
 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))
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 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)
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
 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))
Ejemplo n.º 8
0
 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)
Ejemplo n.º 9
0
 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)
Ejemplo n.º 10
0
 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)