-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
raise SyntaxError when constructing one of the deprecated classes
- Loading branch information
Showing
3 changed files
with
10 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,9 @@ | ||
import unittest | ||
import holmium.core | ||
import mock | ||
import selenium.webdriver | ||
class DeprecatedPageTest(unittest.TestCase): | ||
def setUp(self): | ||
self.driver = selenium.webdriver.PhantomJS() | ||
def test_basic_po(self): | ||
with mock.patch('warnings.warn') as warn: | ||
class BasicPage(holmium.core.PageObject): | ||
element = holmium.core.PageElement( holmium.core.Locators.ID, "test_id" ) | ||
elements = holmium.core.PageElements( holmium.core.Locators.ID, "test_id" ) | ||
elementmap = holmium.core.PageElementMap( holmium.core.Locators.ID, "test_id" ) | ||
self.driver.execute_script('document.write("%s");' % """<body><div id='test_id'>test_text</div></body>""") | ||
po = BasicPage(self.driver) | ||
self.assertEquals( "test_text", po.element.text) | ||
self.assertEquals( "test_text", po.elements[0].text) | ||
self.assertEquals( "test_id", po.elementmap["test_text"].get_attribute("id")) | ||
self.assertTrue( warn.call_count == 4 ) | ||
|
||
def tearDown(self): | ||
if self.driver: | ||
self.driver.quit() | ||
self.assertRaises(SyntaxError, holmium.core.PageObject) | ||
self.assertRaises(SyntaxError, holmium.core.PageElement) | ||
self.assertRaises(SyntaxError, holmium.core.PageElements) | ||
self.assertRaises(SyntaxError, holmium.core.PageElementMap) | ||
self.assertRaises(SyntaxError, holmium.core.HolmiumTestCase) |