Chromium Code Reviews| Index: chrome/test/webdriver/chromedriver_tests.py |
| =================================================================== |
| --- chrome/test/webdriver/chromedriver_tests.py (revision 79918) |
| +++ chrome/test/webdriver/chromedriver_tests.py (working copy) |
| @@ -351,6 +351,46 @@ |
| self.assertEquals(data['sessionId'], url_parts[4]) |
| +class AutofillTest(unittest.TestCase): |
| + """Autofill tests that interacts with web UI.""" |
|
kkania
2011/03/31 00:48:48
web settings UI?, is that what you mean
kkania
2011/03/31 00:48:48
Can you put these tests near the end of the file,
dyu1
2011/03/31 03:19:31
I don't think all Autofill tests will be related t
dyu1
2011/03/31 03:19:31
Done.
|
| + AUTOFILL_EDIT_ADDRESS = 'chrome://settings/autoFillEditAddress' |
| + |
| + def setUp(self): |
| + self._launcher = ChromeDriverLauncher() |
| + |
| + def tearDown(self): |
| + self._launcher.Kill() |
| + |
| + def testPostalCodeAndStateLabelsBasedOnCountry(self): |
| + """Verify postal code and state labels based on selected country.""" |
| + file_path = os.path.join('state_zip_labels.txt') |
| + import simplejson |
| + test_data = simplejson.loads(open(file_path).read()) |
| + |
| + driver = WebDriver(self._launcher.GetURL(), {}) |
| + driver.get(self.AUTOFILL_EDIT_ADDRESS) |
| + state_label = driver.find_element_by_id('state-label').text |
| + self.assertEqual('State', state_label) |
| + for country_code in test_data: |
| + query = '//option[@value="%s"]' % country_code |
| + driver.find_element_by_id( |
|
kkania
2011/03/31 00:48:48
this looks a bit funky; can you check the style gu
dyu1
2011/03/31 03:19:31
Turns out the line fits fine. The newline can go a
|
| + 'country').find_element_by_xpath(query).select() |
| + |
| + # Compare postal labels. |
| + actual_postal_label = driver.find_element_by_id( |
| + 'postal-code-label').text |
| + expected_postal_label = test_data[country_code]['postalCodeLabel'] |
| + self.assertEqual( |
| + actual_postal_label, expected_postal_label, |
| + 'Postal code label does not match Country "%s"' % country_code) |
| + # Compare state labels. |
| + actual_state_label = driver.find_element_by_id('state-label').text |
| + expected_state_label = test_data[country_code]['stateLabel'] |
| + self.assertEqual( |
| + actual_state_label, expected_state_label, |
| + 'State label does not match Country "%s"' % country_code) |
| + |
| + |
| # TODO(jleyba): Port this to WebDriver's own python test suite. |
| class ElementEqualityTest(unittest.TestCase): |
| """Tests that the server properly checks element equality.""" |