352
edits
(remove content) |
(→Making test multi-locale: content added) |
||
Line 124: | Line 124: | ||
* Don't shorten variable names. A bad example: self.t_out_err_tim = 1000 instead of self.time_out_error_time | * Don't shorten variable names. A bad example: self.t_out_err_tim = 1000 instead of self.time_out_error_time | ||
== Making test multi-locale == | == Making test multi-locale <njpark> == | ||
It is recommended to make the test scripts (and especially the helper methods) locale independent, because this enables us to test devices in RTL locale. There are still some sections in gaiatest where it checks for the displayed English text, but unless one cannot avoid it, data-l10n-id attribute should be checked in place of any raw text comparison. | |||
* | |||
* | <source python> | ||
# below method will not work in a non-English locale, | |||
# should only be used when there is no appropriate tag for the Open App button | |||
button = self.root_element.find_element(*self._install_button_locator) | |||
Wait(self.marionette).until(lambda m: button.text == 'Open app') | |||
button.tap() | |||
# below code will tap 'Send Mozilla Feedback' button in any locale | |||
_send_feedback_locator = (By.CSS_SELECTOR, '[data-l10n-id="sendMozillaFeedback"]') | |||
element = Wait(self.marionette).until( | |||
expected.element_present(*self._send_feedback_locator)) | |||
Wait(self.marionette).until(expected.element_displayed(element)) | |||
element.tap() | |||
</source> | |||
The rules of thumb are: | |||
* We can check for the raw text in order to verify the user input (i.e., a phone number entered in the dialer app) | |||
* We check the data-l10n-id for any string that comes from Gaia only (i.e., an error message) | |||
== Be aware of outside consumers of ui-test == | == Be aware of outside consumers of ui-test == | ||
TBD - mwargers | TBD - mwargers | ||
* Be aware if you change the Gaia UI test API, that outside consumers (mtbf, etc) might get broken | * Be aware if you change the Gaia UI test API, that outside consumers (mtbf, etc) might get broken |
edits