Chromium Code Reviews| Index: chrome/test/webdriver/chromedriver_tests.py |
| =================================================================== |
| --- chrome/test/webdriver/chromedriver_tests.py (revision 79956) |
| +++ chrome/test/webdriver/chromedriver_tests.py (working copy) |
| @@ -376,6 +376,47 @@ |
| self.assertTrue(result['value']) |
| +"""Chrome functional test section. Put all tests of ChromeDriver below. |
|
kkania
2011/03/31 03:33:25
except you got the wording wrong; how about: "all
dyu1
2011/03/31 03:46:23
Done.
|
| + |
| +TODO(dyu): Move these tests out of here when pyauto has these capabilities. |
| +""" |
| +class AutofillTest(unittest.TestCase): |
|
kkania
2011/03/31 03:33:25
two newlines above
dyu1
2011/03/31 03:46:23
Done.
|
| + """Autofill tests.""" |
|
kkania
2011/03/31 03:33:25
hehe, if this is the best you can do just drop the
dyu1
2011/03/31 03:46:23
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('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) |
| + |
| if __name__ == '__main__': |
| unittest.main(module='chromedriver_tests', |
| testRunner=GTestTextTestRunner(verbosity=1)) |