Пример #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'])
Пример #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'])
Пример #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))
Пример #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)
Пример #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)
Пример #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)
Пример #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))
Пример #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)
Пример #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)
Пример #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)