File tree Expand file tree Collapse file tree
gadgets/standard_revisions-tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525from selenium .common .exceptions import NoAlertPresentException
2626import unittest , time , re
2727
28- class LoginHtml (unittest .TestCase ):
29- def setUp (self ):
30- self .driver = webdriver .Firefox ()
31- self .driver .implicitly_wait (30 )
28+ class CppTestCase (unittest .TestCase ):
29+ @classmethod
30+ def setUpClass (self ):
3231 self .base_url = "http://en.cppreference.com/"
33- self .verificationErrors = []
3432
35- def test_login_html ( self ):
36- driver = self . driver
33+ driver = webdriver . Firefox ()
34+ driver . implicitly_wait ( 30 )
3735 driver .get (self .base_url + "/mwiki/index.php?title=Special:UserLogout&returnto=Main+Page" )
3836 driver .find_element_by_link_text ("Log in" ).click ()
3937 driver .find_element_by_id ("wpName1" ).clear ()
@@ -42,10 +40,9 @@ def test_login_html(self):
4240 driver .find_element_by_id ("wpPassword1" ).send_keys ("test4" )
4341 driver .find_element_by_id ("wpLoginAttempt" ).click ()
4442 self .assertEqual ("Test5" , driver .find_element_by_link_text ("Test5" ).text )
43+ self .driver = driver
4544
46- def tearDown (self ):
45+ @classmethod
46+ def tearDownClass (self ):
4747 self .driver .quit ()
48- self .assertEqual ([], self .verificationErrors )
4948
50- if __name__ == "__main__" :
51- unittest .main ()
Original file line number Diff line number Diff line change 2424from selenium .common .exceptions import NoSuchElementException
2525from selenium .common .exceptions import NoAlertPresentException
2626import unittest , time , re
27+ from base import CppTestCase
2728
28- class HidesDclItemsInDclRev (unittest .TestCase ):
29- def setUp (self ):
30- self .driver = webdriver .Firefox ()
31- self .driver .implicitly_wait (30 )
32- self .base_url = "http://en.cppreference.com/"
33- self .verificationErrors = []
34-
29+ class HidesDclItemsInDclRev (CppTestCase ):
3530 def test_hides_dcl_items_in_dcl_rev (self ):
3631 driver = self .driver
3732 driver .get (self .base_url + "/w/test-gadget-stdrev/hides-dcl-items-in-dcl-rev" )
@@ -55,10 +50,3 @@ def test_hides_dcl_items_in_dcl_rev(self):
5550 except AssertionError as e : self .verificationErrors .append (str (e ))
5651 try : self .assertNotRegexpMatches (driver .find_element_by_xpath ("//body" ).text , r"^[\s\S]*void not_visible_in_cxx11[\s\S]*$" )
5752 except AssertionError as e : self .verificationErrors .append (str (e ))
58-
59- def tearDown (self ):
60- self .driver .quit ()
61- self .assertEqual ([], self .verificationErrors )
62-
63- if __name__ == "__main__" :
64- unittest .main ()
Original file line number Diff line number Diff line change 2424from selenium .common .exceptions import NoSuchElementException
2525from selenium .common .exceptions import NoAlertPresentException
2626import unittest , time , re
27+ from base import CppTestCase
2728
28- class HidesDclItemsInMember (unittest .TestCase ):
29- def setUp (self ):
30- self .driver = webdriver .Firefox ()
31- self .driver .implicitly_wait (30 )
32- self .base_url = "http://en.cppreference.com/"
33- self .verificationErrors = []
34-
29+ class HidesDclItemsInMember (CppTestCase ):
3530 def test_hides_dcl_items_in_member (self ):
3631 driver = self .driver
3732 driver .get (self .base_url + "/w/test-gadget-stdrev/hides-dcl-items-in-member" )
@@ -55,10 +50,3 @@ def test_hides_dcl_items_in_member(self):
5550 except AssertionError as e : self .verificationErrors .append (str (e ))
5651 try : self .assertNotRegexpMatches (driver .find_element_by_xpath ("//body" ).text , r"^[\s\S]*void not_visible_in_cxx11[\s\S]*$" )
5752 except AssertionError as e : self .verificationErrors .append (str (e ))
58-
59- def tearDown (self ):
60- self .driver .quit ()
61- self .assertEqual ([], self .verificationErrors )
62-
63- if __name__ == "__main__" :
64- unittest .main ()
Original file line number Diff line number Diff line change 2424from selenium .common .exceptions import NoSuchElementException
2525from selenium .common .exceptions import NoAlertPresentException
2626import unittest , time , re
27+ from base import CppTestCase
2728
28- class HidesDscItemsWithExplicitMark (unittest .TestCase ):
29- def setUp (self ):
30- self .driver = webdriver .Firefox ()
31- self .driver .implicitly_wait (30 )
32- self .base_url = "http://en.cppreference.com/"
33- self .verificationErrors = []
34-
29+ class HidesDscItemsWithExplicitMark (CppTestCase ):
3530 def test_hides_dsc_items_with_explicit_mark (self ):
3631 driver = self .driver
3732 driver .get (self .base_url + "/w/test-gadget-stdrev/hides-dsc-items-with-explicit-mark" )
@@ -49,10 +44,3 @@ def test_hides_dsc_items_with_explicit_mark(self):
4944 except AssertionError as e : self .verificationErrors .append (str (e ))
5045 try : self .assertNotRegexpMatches (driver .find_element_by_xpath ("//body" ).text , r"^[\s\S]*std::not_visible_in_cxx11[\s\S]*$" )
5146 except AssertionError as e : self .verificationErrors .append (str (e ))
52-
53- def tearDown (self ):
54- self .driver .quit ()
55- self .assertEqual ([], self .verificationErrors )
56-
57- if __name__ == "__main__" :
58- unittest .main ()
Original file line number Diff line number Diff line change 2424from selenium .common .exceptions import NoSuchElementException
2525from selenium .common .exceptions import NoAlertPresentException
2626import unittest , time , re
27+ from base import CppTestCase
2728
28- class HidesH3WhenSectionContainsDscWithRemovedElems (unittest .TestCase ):
29- def setUp (self ):
30- self .driver = webdriver .Firefox ()
31- self .driver .implicitly_wait (30 )
32- self .base_url = "http://en.cppreference.com/"
33- self .verificationErrors = []
29+ class HidesH3WhenSectionContainsDscWithRemovedElems (CppTestCase ):
3430
3531 def test_hides_h3_when_section_contains_dsc_with_removed_elems (self ):
3632 driver = self .driver
@@ -43,10 +39,3 @@ def test_hides_h3_when_section_contains_dsc_with_removed_elems(self):
4339 Select (driver .find_element_by_css_selector ("select" )).select_by_visible_text ("C++11" )
4440 try : self .assertTrue (driver .find_element_by_id ("Should_be_removed_when_c.2B.2B98" ).is_displayed ())
4541 except AssertionError as e : self .verificationErrors .append (str (e ))
46-
47- def tearDown (self ):
48- self .driver .quit ()
49- self .assertEqual ([], self .verificationErrors )
50-
51- if __name__ == "__main__" :
52- unittest .main ()
Original file line number Diff line number Diff line change 2424from selenium .common .exceptions import NoSuchElementException
2525from selenium .common .exceptions import NoAlertPresentException
2626import unittest , time , re
27+ from base import CppTestCase
2728
28- class HidesH3WhenSectionContainsDscWithRemovedUntil (unittest .TestCase ):
29- def setUp (self ):
30- self .driver = webdriver .Firefox ()
31- self .driver .implicitly_wait (30 )
32- self .base_url = "http://en.cppreference.com/"
33- self .verificationErrors = []
34-
29+ class HidesH3WhenSectionContainsDscWithRemovedUntil (CppTestCase ):
3530 def test_hides_h3_when_section_contains_dsc_with_removed_until (self ):
3631 driver = self .driver
3732 driver .get (self .base_url + "/w/test-gadget-stdrev/hides-h3-when-section-contains-dsc-with-removed-until" )
@@ -43,10 +38,3 @@ def test_hides_h3_when_section_contains_dsc_with_removed_until(self):
4338 Select (driver .find_element_by_css_selector ("select" )).select_by_visible_text ("C++11" )
4439 try : self .assertFalse (driver .find_element_by_id ("Should_be_removed_when_c.2B.2B11" ).is_displayed ())
4540 except AssertionError as e : self .verificationErrors .append (str (e ))
46-
47- def tearDown (self ):
48- self .driver .quit ()
49- self .assertEqual ([], self .verificationErrors )
50-
51- if __name__ == "__main__" :
52- unittest .main ()
Original file line number Diff line number Diff line change 2424from selenium .common .exceptions import NoSuchElementException
2525from selenium .common .exceptions import NoAlertPresentException
2626import unittest , time , re
27+ from base import CppTestCase
2728
28- class HidesH3WhenSectionContainsOnlyStdrev (unittest .TestCase ):
29- def setUp (self ):
30- self .driver = webdriver .Firefox ()
31- self .driver .implicitly_wait (30 )
32- self .base_url = "http://en.cppreference.com/"
33- self .verificationErrors = []
34-
29+ class HidesH3WhenSectionContainsOnlyStdrev (CppTestCase ):
3530 def test_hides_h3_when_section_contains_only_stdrev (self ):
3631 driver = self .driver
3732 driver .get (self .base_url + "/w/test-gadget-stdrev/hides-h3-when-section-contains-only-stdrev" )
@@ -43,10 +38,3 @@ def test_hides_h3_when_section_contains_only_stdrev(self):
4338 Select (driver .find_element_by_css_selector ("select" )).select_by_visible_text ("C++11" )
4439 try : self .assertTrue (driver .find_element_by_id ("Should_be_removed_in_cxx98" ).is_displayed ())
4540 except AssertionError as e : self .verificationErrors .append (str (e ))
46-
47- def tearDown (self ):
48- self .driver .quit ()
49- self .assertEqual ([], self .verificationErrors )
50-
51- if __name__ == "__main__" :
52- unittest .main ()
Original file line number Diff line number Diff line change 2424from selenium .common .exceptions import NoSuchElementException
2525from selenium .common .exceptions import NoAlertPresentException
2626import unittest , time , re
27+ from base import CppTestCase
2728
28- class PreservesH3WhenSectionVisible (unittest .TestCase ):
29- def setUp (self ):
30- self .driver = webdriver .Firefox ()
31- self .driver .implicitly_wait (30 )
32- self .base_url = "http://en.cppreference.com/"
33- self .verificationErrors = []
34-
29+ class PreservesH3WhenSectionVisible (CppTestCase ):
3530 def test_preserves_h3_when_section_visible (self ):
3631 driver = self .driver
3732 driver .get (self .base_url + "/w/test-gadget-stdrev/preserves-h3-when-section-with-h5-visible" )
@@ -43,10 +38,3 @@ def test_preserves_h3_when_section_visible(self):
4338 Select (driver .find_element_by_css_selector ("select" )).select_by_visible_text ("C++11" )
4439 try : self .assertTrue (driver .find_element_by_id ("Should_always_be_visible" ).is_displayed ())
4540 except AssertionError as e : self .verificationErrors .append (str (e ))
46-
47- def tearDown (self ):
48- self .driver .quit ()
49- self .assertEqual ([], self .verificationErrors )
50-
51- if __name__ == "__main__" :
52- unittest .main ()
Original file line number Diff line number Diff line change 2424from selenium .common .exceptions import NoSuchElementException
2525from selenium .common .exceptions import NoAlertPresentException
2626import unittest , time , re
27+ from base import CppTestCase
2728
28- class PreservesH3WhenSectionWithH5Visible (unittest .TestCase ):
29- def setUp (self ):
30- self .driver = webdriver .Firefox ()
31- self .driver .implicitly_wait (30 )
32- self .base_url = "http://en.cppreference.com/"
33- self .verificationErrors = []
34-
29+ class PreservesH3WhenSectionWithH5Visible (CppTestCase ):
3530 def test_preserves_h3_when_section_with_h5_visible (self ):
3631 driver = self .driver
3732 driver .get (self .base_url + "/w/test-gadget-stdrev/preserves-h3-when-section-with-h5-visible" )
@@ -55,10 +50,3 @@ def test_preserves_h3_when_section_with_h5_visible(self):
5550 except AssertionError as e : self .verificationErrors .append (str (e ))
5651 try : self .assertTrue (driver .find_element_by_id ("Should_not_be_visible_in_cxx98" ).is_displayed ())
5752 except AssertionError as e : self .verificationErrors .append (str (e ))
58-
59- def tearDown (self ):
60- self .driver .quit ()
61- self .assertEqual ([], self .verificationErrors )
62-
63- if __name__ == "__main__" :
64- unittest .main ()
Original file line number Diff line number Diff line change 2424from selenium .common .exceptions import NoSuchElementException
2525from selenium .common .exceptions import NoAlertPresentException
2626import unittest , time , re
27+ from base import CppTestCase
2728
28- class RevInlWorksInText (unittest .TestCase ):
29- def setUp (self ):
30- self .driver = webdriver .Firefox ()
31- self .driver .implicitly_wait (30 )
32- self .base_url = "http://en.cppreference.com/"
33- self .verificationErrors = []
34-
29+ class RevInlWorksInText (CppTestCase ):
3530 def test_rev_inl_works_in_text (self ):
3631 driver = self .driver
3732 driver .get (self .base_url + "/w/test-gadget-stdrev/rev-inl-works-in-text" )
@@ -49,10 +44,3 @@ def test_rev_inl_works_in_text(self):
4944 except AssertionError as e : self .verificationErrors .append (str (e ))
5045 try : self .assertNotRegexpMatches (driver .find_element_by_xpath ("//body" ).text , r"^[\s\S]*not_visible_in_cxx11[\s\S]*$" )
5146 except AssertionError as e : self .verificationErrors .append (str (e ))
52-
53- def tearDown (self ):
54- self .driver .quit ()
55- self .assertEqual ([], self .verificationErrors )
56-
57- if __name__ == "__main__" :
58- unittest .main ()
You can’t perform that action at this time.
0 commit comments