Bug 781932 - Update enabled() to be is_enabled to make Selenium API. r=jgriffin
authorEkanan Ketunuti <ananuti@gmail.com>
Wed, 15 Aug 2012 08:21:41 +0700
changeset 102495 35518a0793837f031dda3f3acad20ca842b6b10e
parent 102494 e16055525c5991f08790788f8db48b64cbb45fd1
child 102496 8e656eb1630787d546d074715ed0c7fec51df296
push id23288
push useremorley@mozilla.com
push dateThu, 16 Aug 2012 13:14:48 +0000
treeherdermozilla-central@3940df6f9356 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin
bugs781932
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 781932 - Update enabled() to be is_enabled to make Selenium API. r=jgriffin
testing/marionette/client/marionette/marionette.py
testing/marionette/client/marionette/test_protocol.py
testing/marionette/client/marionette/tests/unit/test_clearing.py
testing/marionette/client/marionette/tests/unit/test_elementState.py
--- a/testing/marionette/client/marionette/marionette.py
+++ b/testing/marionette/client/marionette/marionette.py
@@ -66,17 +66,17 @@ class HTMLElement(object):
         return self.marionette._send_message('getElementValue', 'value', element=self.id)
 
     def clear(self):
         return self.marionette._send_message('clearElement', 'ok', element=self.id)
 
     def is_selected(self):
         return self.marionette._send_message('isElementSelected', 'value', element=self.id)
 
-    def enabled(self):
+    def is_enabled(self):
         return self.marionette._send_message('isElementEnabled', 'value', element=self.id)
 
     def is_displayed(self):
         return self.marionette._send_message('isElementDisplayed', 'value', element=self.id)
 
     @property
     def tag_name(self):
         return self.marionette._send_message('getElementTagName', 'value', element=self.id)
--- a/testing/marionette/client/marionette/test_protocol.py
+++ b/testing/marionette/client/marionette/test_protocol.py
@@ -45,17 +45,17 @@ if __name__ == '__main__':
         server.TEST_FIND_ELEMENTS)
     assert(m.find_element(HTMLElement.ID, 'id1').click())
     assert(m.find_element(HTMLElement.ID, 'id2').text() == server.TEST_GET_TEXT)
     assert(m.find_element(HTMLElement.ID, 'id3').send_keys('Mozilla Firefox'))
     assert(m.find_element(HTMLElement.ID, 'id3').value() == server.TEST_GET_VALUE)
     assert(m.find_element(HTMLElement.ID, 'id3').clear())
     assert(m.find_element(HTMLElement.ID, 'id3').is_selected())
     assert(m.find_element(HTMLElement.ID, 'id1').equals(m.find_element(HTMLElement.TAG, 'p')))
-    assert(m.find_element(HTMLElement.ID, 'id3').enabled())
+    assert(m.find_element(HTMLElement.ID, 'id3').is_enabled())
     assert(m.find_element(HTMLElement.ID, 'id3').displayed())
     assert(m.find_element(HTMLElement.ID, 'id3').get_attribute('value') == server.TEST_GET_VALUE)
     assert(m.delete_session())
 
     # verify a session is started automatically for us if needed
     assert(m.switch_to_frame('frame1'))
     assert(m.switch_to_frame(1))
     assert(m.switch_to_frame(m.find_element(HTMLElement.ID, 'frameid')))
--- a/testing/marionette/client/marionette/tests/unit/test_clearing.py
+++ b/testing/marionette/client/marionette/tests/unit/test_clearing.py
@@ -57,13 +57,13 @@ class TestClear(MarionetteTestCase):
         element.clear()
         self.assertEqual("", element.text)
         
     def testTextInputShouldNotClearWhenDisabled(self):
         test_html = self.marionette.absolute_url("test_clearing.html")
         self.marionette.navigate(test_html)
         try:
             element = self.marionette.find_element("id","textInputnotenabled")
-            self.assertFalse(element.enabled())
+            self.assertFalse(element.is_enabled())
             element.clear()
             self.fail("Should not have been able to clear")
         except InvalidElementStateException:
             pass
--- a/testing/marionette/client/marionette/tests/unit/test_elementState.py
+++ b/testing/marionette/client/marionette/tests/unit/test_elementState.py
@@ -5,19 +5,19 @@
 import os
 from marionette_test import MarionetteTestCase
 
 class TestState(MarionetteTestCase):
     def test_isEnabled(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         l = self.marionette.find_element("name", "myCheckBox")
-        self.assertTrue(l.enabled())
+        self.assertTrue(l.is_enabled())
         self.marionette.execute_script("arguments[0].disabled = true;", [l])
-        self.assertFalse(l.enabled())
+        self.assertFalse(l.is_enabled())
 
     def test_isDisplayed(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         l = self.marionette.find_element("name", "myCheckBox")
         self.assertTrue(l.is_displayed())
         self.marionette.execute_script("arguments[0].hidden = true;", [l])
         self.assertFalse(l.is_displayed())
@@ -31,19 +31,19 @@ class TestStateChrome(MarionetteTestCase
 
     def tearDown(self):
         self.marionette.execute_script("window.close();")
         self.marionette.switch_to_window(self.win)
         MarionetteTestCase.tearDown(self)
 
     def test_isEnabled(self):
         l = self.marionette.find_element("id", "textInput")
-        self.assertTrue(l.enabled())
+        self.assertTrue(l.is_enabled())
         self.marionette.execute_script("arguments[0].disabled = true;", [l])
-        self.assertFalse(l.enabled())
+        self.assertFalse(l.is_enabled())
         self.marionette.execute_script("arguments[0].disabled = false;", [l])
 
     def test_isDisplayed(self):
         l = self.marionette.find_element("id", "textInput")
         self.assertTrue(l.is_displayed())
         self.marionette.execute_script("arguments[0].hidden = true;", [l])
         self.assertFalse(l.is_displayed())
         self.marionette.execute_script("arguments[0].hidden = false;", [l])