class TestA11yKeyboardKeyNames(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) # enable auto-correction of keyboard self.data_layer.set_setting('keyboard.autocorrect', True) def test_a11y_keyboard_key_names(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() keyboard.switch_to_keyboard(); # check special 'return' key. It should have a role of pushbutton. self.assertEqual(keyboard.a11y_enter_key_name, 'return') self.assertEqual(keyboard.a11y_enter_key_role, 'pushbutton') # check special 'backspace' key. It should have a role of pushbutton. self.assertEqual(keyboard.a11y_backspace_key_name, 'delete') self.assertEqual(keyboard.a11y_backspace_key_role, 'pushbutton') # check 'space' key. It should have a role of key. self.assertEqual(keyboard.a11y_space_key_name, 'space') self.assertEqual(keyboard.a11y_space_key_role, 'key')
class TestKeyboardPredictiveKey(GaiaTestCase): def test_keyboard_predictive_key(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() # type first 6 letters of the expected word keyboard.switch_to_keyboard() expected_word = 'keyboard ' keyboard.send(expected_word[:6]) self.marionette.switch_to_frame() self.marionette.switch_to_frame(self.ui_tests.app.frame) keyboard_page.switch_to_frame() keyboard_page.tap_text_input() # tap the first predictive word keyboard.tap_first_predictive_word() self.marionette.switch_to_frame() self.marionette.switch_to_frame(self.ui_tests.app.frame) keyboard_page.switch_to_frame() # check if the word in the input field is the same as the expected word typed_word = keyboard_page.text_input self.assertEqual(typed_word, expected_word)
class TestUrlKeyboard(GaiaTestCase): def test_url_keyboard(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() self.ui_tests.tap_ui_button() keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=url" keyboard = keyboard_page.tap_url_input() keyboard.switch_to_keyboard() # Test forward slash keyboard._tap('/') self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() typed_key = keyboard_page.url_input self.assertEqual(typed_key, u'/') # Test .com key keyboard.tap_dotcom() keyboard_page.switch_to_frame() typed_key = keyboard_page.url_input self.assertEqual(typed_key, u'/.com')
class TestEmailKeyboard(GaiaMtbfTestCase): def test_basic_email_keyboard(self): self.ui_tests = UiTests(self.marionette) self.app_id = self.launch_by_touch(self.ui_tests) self.ui_tests.tap_ui_button() keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() keyboard = keyboard_page.tap_email_input() keyboard.send('post') self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() keyboard_page.tap_email_input() keyboard.switch_to_keyboard() keyboard._tap('@') keyboard.send('mydomain.com') keyboard_page.switch_to_frame() typed_email_adress = keyboard_page.email_input self.assertEqual(typed_email_adress, u'*****@*****.**') self.apps.switch_to_displayed_app() self.ui_tests.tap_back_button()
class TestKeyboardBug1073870(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) # enable auto-correction of keyboard self.data_layer.set_setting('keyboard.autocorrect', True) def test_keyboard_bug_1073870(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() keyboard.send('Hello worl') # set caret position to after Hello keyboard_page.switch_to_frame() self.marionette.execute_script( """var el = document.activeElement; el.selectionStart = el.selectionEnd = 5;""") keyboard.send(' ') keyboard_page.switch_to_frame() self.assertEqual(keyboard_page.text_input, 'Hello worl')
class TestKeyboardPredictiveKey(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) # enable auto-correction of keyboard self.data_layer.set_setting('keyboard.autocorrect', True) def test_keyboard_predictive_key(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() # type first 7 letters of the expected word expected_word = 'keyboard ' keyboard.send(expected_word[:7]) # tap the first predictive word keyboard.tap_first_predictive_word() self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() # check if the word in the input field is the same as the expected word typed_word = keyboard_page.text_input self.assertEqual(typed_word, expected_word)
class TestA11yKeyboardWordSuggestions(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) # enable auto-correction of keyboard self.data_layer.set_setting('keyboard.autocorrect', True) def test_a11y_keyboard_word_suggestions(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() # type first 7 letters of the expected word expected_word = 'keyboard ' keyboard.send(expected_word[:7]) keyboard.switch_to_keyboard() # check that suggestions area has proper accessibility name self.assertEqual(keyboard.a11y_candidate_panel_name, 'Word suggestions') # check that suggestions list has proper accessibility role self.assertEqual(keyboard.a11y_suggestions_container_role, 'listbox') # check that word suggestion has proper accessibility role and name self.assertEqual( keyboard.a11y_first_predictive_word_name, expected_word.strip()) self.assertEqual( keyboard.a11y_first_predictive_word_role, 'listbox option') # check that suggestions dismiss has proper accessibility role and name self.assertEqual(keyboard.a11y_dismiss_suggestions_button_name, 'Dismiss') self.assertEqual(keyboard.a11y_dismiss_suggestions_button_role, 'pushbutton') # check that word suggestion can be selected via accessibility API keyboard.a11y_first_predictive_word_click() self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() # check if the word in the input field is the same as the expected word typed_word = keyboard_page.text_input self.assertEqual(typed_word, expected_word)
def test_basic_email_keyboard(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() self.ui_tests.tap_ui_button() keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() keyboard = keyboard_page.tap_email_input() keyboard.switch_to_keyboard() keyboard.send('post') self.marionette.switch_to_frame() self.marionette.switch_to_frame(self.ui_tests.app.frame) keyboard_page.switch_to_frame() keyboard_page.tap_email_input() keyboard.switch_to_keyboard() keyboard._tap('@') keyboard.send('mydomain.com') self.marionette.switch_to_frame() self.marionette.switch_to_frame(self.ui_tests.app.frame) keyboard_page.switch_to_frame() typed_email_adress = keyboard_page.email_input self.assertEqual(typed_email_adress, u'*****@*****.**')
def test_keyboard_predictive_key(self): # TODO: Merge gaiatest new test of predictive key self.app_id = self.launch_by_touch("uitest") self.ui_tests = UiTests(self.marionette) self.mtbf_ui_tests = MTBF_UiTests(self.marionette) self.mtbf_ui_tests.back_to_main_screen() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() # type first 6 letters of the expected word keyboard.switch_to_keyboard() expected_word = u'keyboard' keyboard.send(expected_word[:7]) # tap the first predictive word keyboard.tap_first_predictive_word() self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() # check if the word in the input field is the same as the expected word typed_word = keyboard_page.text_input self.assertEqual(typed_word, expected_word)
class TestKeyboardPredictiveKey(GaiaMtbfTestCase): def setUp(self): GaiaMtbfTestCase.setUp(self) # enable auto-correction of keyboard self.data_layer.set_setting('keyboard.autocorrect', True) def test_keyboard_predictive_key(self): # TODO: Merge gaiatest new test of predictive key self.app_id = self.launch_by_touch("uitest") self.ui_tests = UiTests(self.marionette) self.mtbf_ui_tests = MTBF_UiTests(self.marionette) self.mtbf_ui_tests.back_to_main_screen() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() # type first 6 letters of the expected word keyboard.switch_to_keyboard() expected_word = u'keyboard' keyboard.send(expected_word[:7]) # tap the first predictive word keyboard.tap_first_predictive_word() self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() # check if the word in the input field is the same as the expected word typed_word = keyboard_page.text_input self.assertEqual(typed_word, expected_word)
def test_context_menu_activity_picker(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() self.ui_tests.tap_ui_button() context_menu_page = self.ui_tests.tap_context_menu_option() context_menu_page.switch_to_frame() activities_list = context_menu_page.long_press_context_menu_body() self.assertTrue(activities_list.is_menu_visible) self.assertTrue(activities_list.options_count == 4) activities_list.tap_cancel() self.assertFalse(activities_list.is_menu_visible)
def test_keyboard_predictive_key(self): # Check that the device is in portrait mode as the autocorrect words returned depend on the screen orientation self.assertEqual('portrait-primary', self.device.screen_orientation) self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() # type first 7 letters of the expected word expected_word = 'keyboard' keyboard.send(expected_word[:7]) # tap the first predictive word keyboard.tap_first_predictive_word() self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() # check if the word in the input field is the same as the expected word typed_word = keyboard_page.text_input self.assertEqual(typed_word, expected_word) ## TEST 2, tap second suggestion, then press space keyboard.send(' ') keyboard_page.switch_to_frame() # type some misspelled word keyboard.send('Tes') keyboard_page.switch_to_frame() self.assertEqual(keyboard_page.text_input, 'keyboard Tes') # tap second predictive word (tea) keyboard.tap_suggestion('Tea') self.apps.switch_to_displayed_app() # Send space keyboard.send(' ') keyboard_page.switch_to_frame() # Output should be 'Tea ' self.assertEqual(keyboard_page.text_input, 'keyboard Tea ') ## TEST 3 - type something with autocorrect and press space keyboard.send('ye ') keyboard_page.switch_to_frame() self.assertEqual(keyboard_page.text_input, 'keyboard Tea he ') # TEST 4 - autocorrect, dot and backspace keyboard.send('wot.') keyboard_page.switch_to_frame() self.assertEqual(keyboard_page.text_input, 'keyboard Tea he wit.') keyboard.tap_backspace() keyboard_page.switch_to_frame() self.assertEqual(keyboard_page.text_input, 'keyboard Tea he wot')
class TestContextmenuActivityPicker(GaiaTestCase): def test_contextmenu_activity_picker(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() self.ui_tests.tap_ui_button() contextmenu_page = self.ui_tests.tap_contextmenu_option() activities_list = contextmenu_page.long_press_contextmenu_body() self.assertTrue(activities_list.is_menu_visible) self.assertTrue(activities_list.options_count == 4) activities_list.tap_cancel() self.assertFalse(activities_list.is_menu_visible)
def test_persona_standard_sign_in(self): uitests = UiTests(self.marionette) uitests.launch() uitests.tap_api_button() moz_id = uitests.tap_moz_id_button() moz_id.switch_to_frame() persona = moz_id.tap_standard_sign_in() persona.login(self.user.email, self.user.password) moz_id.switch_to_frame() moz_id.wait_for_login_event() moz_id.tap_logout_button() moz_id.wait_for_logout_event() assertion = moz_id.get_assertion() assertionUtil = AssertionUtil() unpacked = assertionUtil.unpackAssertion(assertion) self.assertEqual(AUDIENCE, unpacked['payload']['aud']) self.assertEqual(self.user.email, unpacked['claim']['principal']['email']) verified = assertionUtil.verifyAssertion(assertion, AUDIENCE, VERIFIER_URL) self.assertEqual(verified['status'], 'okay') self.assertEqual(verified['email'], self.user.email) self.assertEqual(verified['audience'], AUDIENCE)
class TestKeyboardPredictiveKey(GaiaTestCase): def test_keyboard_predictive_key(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page self.ui_tests.tap_keyboard_option() keyboard_page = self.ui_tests.switch_to_keyboard_page_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() # type first 6 letters of the expected word keyboard.switch_to_keyboard() expected_word = 'keyboard ' keyboard.send(expected_word[:6]) self.marionette.switch_to_frame() self.marionette.switch_to_frame(self.ui_tests.app.frame) keyboard_page = self.ui_tests.switch_to_keyboard_page_frame() keyboard_page.tap_text_input() # tap the first predictive word keyboard.tap_first_predictive_word() self.marionette.switch_to_frame() self.marionette.switch_to_frame(self.ui_tests.app.frame) keyboard_page = self.ui_tests.switch_to_keyboard_page_frame() # check if the word in the input field is the same as the expected word typed_word = keyboard_page.text_input self.assertEqual(typed_word, expected_word)
def test_window_open_inside_iframe(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() self.ui_tests.tap_ui_button() window_open = self.ui_tests.tap_window_open_menu_option() window_open.switch_to_frame() # Tap on the second window.open popup = window_open.tap_window_open_from_iframe() popup.switch_to_frame() self.assertEqual('Hello world!', popup.header_text) # Tap on the 'X' button popup.tap_x_button() self.assertFalse(popup.is_popup_page_displayed, 'Pop-up did not close')
def test_a11y_keyboard_word_suggestions(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() # type first 6 letters of the expected word expected_word = 'keyboard ' keyboard.send(expected_word[:6]) keyboard.switch_to_keyboard() # check that suggestions area has proper accessibility name self.assertEqual(keyboard.a11y_candidate_panel_name, 'Word suggestions') # check that suggestions list has proper accessibility role self.assertEqual(keyboard.a11y_suggestions_container_role, 'listbox') # check that word suggestion has proper accessibility role and name self.assertEqual(keyboard.a11y_first_predictive_word_name, expected_word.strip()) self.assertEqual(keyboard.a11y_first_predictive_word_role, 'listbox option') # check that suggestions dismiss has proper accessibility role and name self.assertEqual(keyboard.a11y_dismiss_suggestions_button_name, 'Dismiss') self.assertEqual(keyboard.a11y_dismiss_suggestions_button_role, 'pushbutton') # check that word suggestion can be selected via accessibility API keyboard.a11y_first_predictive_word_click() self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() # check if the word in the input field is the same as the expected word typed_word = keyboard_page.text_input self.assertEqual(typed_word, expected_word)
def test_url_keyboard(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() self.ui_tests.tap_ui_button() keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=url" keyboard = keyboard_page.tap_url_input() keyboard.switch_to_keyboard() # Test forward slash keyboard._tap('/') self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() typed_key = keyboard_page.url_input self.assertEqual(typed_key, u'/')
def test_number_keyboard(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() self.ui_tests.tap_ui_button() keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() keyboard = keyboard_page.tap_number_input() self.assertEqual(str(keyboard.current_keyboard), 'en') keyboard.switch_to_keyboard() keyboard._tap('1') self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() typed_number = keyboard_page.number_input self.assertEqual(typed_number, u'1')
class TestWindowOpenInsideIframe(GaiaTestCase): def test_window_open_inside_iframe(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() self.ui_tests.tap_ui_button() window_open = self.ui_tests.tap_window_open_menu_option() window_open.switch_to_frame() # Tap on the second window.open popup = window_open.tap_window_open_from_iframe() popup.switch_to_frame() self.assertEqual('Hello world!', popup.header_text) # Tap on the 'X' button popup.tap_x_button() self.assertFalse(popup.is_popup_page_displayed, 'Pop-up did not close')
class TestNumberKeyboard(GaiaTestCase): def test_number_keyboard(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() self.ui_tests.tap_ui_button() keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() keyboard = keyboard_page.tap_number_input() self.assertEqual(str(keyboard.current_keyboard), "number") keyboard.switch_to_keyboard() keyboard._tap("1") self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() typed_number = keyboard_page.number_input self.assertEqual(typed_number, u"1")
class TestNumberKeyboard(GaiaTestCase): def test_number_keyboard(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() self.ui_tests.tap_ui_button() keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() keyboard = keyboard_page.tap_number_input() keyboard.switch_to_keyboard() self.assertEqual(str(keyboard.current_keyboard), 'number') keyboard._tap('1') self.marionette.switch_to_frame() self.marionette.switch_to_frame(self.ui_tests.app.frame) keyboard_page.switch_to_frame() typed_number = keyboard_page.number_input self.assertEqual(typed_number, u'1')
def test_keyboard_bug_1073870(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() keyboard.send('Hello worl') # set caret position to after Hello keyboard_page.switch_to_frame() self.marionette.execute_script("""var el = document.activeElement; el.selectionStart = el.selectionEnd = 5;""") keyboard.send(' ') keyboard_page.switch_to_frame() self.assertEqual(keyboard_page.text_input, 'Hello worl')
def test_persona_standard_sign_in(self): uitests = UiTests(self.marionette) uitests.launch() uitests.tap_api_button() moz_id = uitests.tap_moz_id_button() moz_id.switch_to_frame() persona = moz_id.tap_standard_sign_in() persona.login(self.user.email, self.user.password) moz_id.switch_to_frame() moz_id.wait_for_login_event() moz_id.tap_logout_button() moz_id.wait_for_logout_event() assertion = moz_id.get_assertion() assertionUtil = AssertionUtil() unpacked = assertionUtil.unpackAssertion(assertion) self.assertIn(AUDIENCE, unpacked["payload"]["aud"], "expected app://uitest.gaiamobile.org in the result") self.assertEqual(self.user.email, unpacked["claim"]["principal"]["email"]) verified = assertionUtil.verifyAssertion(assertion, AUDIENCE, VERIFIER_URL) self.assertEqual(verified["status"], "okay") self.assertEqual(verified["email"], self.user.email) self.assertEqual(verified["audience"], AUDIENCE)
def test_basic_email_keyboard(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() self.ui_tests.tap_ui_button() keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() keyboard = keyboard_page.tap_email_input() keyboard.send('post') self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() keyboard_page.tap_email_input() keyboard.switch_to_keyboard() keyboard._tap('@') keyboard.send('mydomain.com') self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() typed_email_adress = keyboard_page.email_input self.assertEqual(typed_email_adress, u'*****@*****.**')
def test_keyboard_predictive_key(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() # type first 7 letters of the expected word expected_word = 'keyboard ' keyboard.send(expected_word[:7]) # tap the first predictive word keyboard.tap_first_predictive_word() self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() # check if the word in the input field is the same as the expected word typed_word = keyboard_page.text_input self.assertEqual(typed_word, expected_word)
def test_number_keyboard(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() self.ui_tests.tap_keyboard_option() keyboard_page = self.ui_tests.switch_to_keyboard_page_frame() keyboard = keyboard_page.tap_number_input() keyboard.switch_to_keyboard() self.assertEqual(str(keyboard.current_keyboard), 'number') keyboard._tap('1') self.marionette.switch_to_frame() self.marionette.switch_to_frame(self.ui_tests.app.frame) keyboard_page = self.ui_tests.switch_to_keyboard_page_frame() typed_number = keyboard_page.number_input self.assertEqual(typed_number, u'1')
def test_a11y_keyboard_key_names(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() keyboard.switch_to_keyboard(); # check special 'return' key. It should have a role of pushbutton. self.assertEqual(keyboard.a11y_enter_key_name, 'return') self.assertEqual(keyboard.a11y_enter_key_role, 'pushbutton') # check special 'backspace' key. It should have a role of pushbutton. self.assertEqual(keyboard.a11y_backspace_key_name, 'delete') self.assertEqual(keyboard.a11y_backspace_key_role, 'pushbutton') # check 'space' key. It should have a role of key. self.assertEqual(keyboard.a11y_space_key_name, 'space') self.assertEqual(keyboard.a11y_space_key_role, 'key')
class TestNumberKeyboard(GaiaMtbfTestCase): def test_number_keyboard(self): self.ui_tests = UiTests(self.marionette) self.app_id = self.launch_by_touch(self.ui_tests) self.ui_tests.tap_ui_button() keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() keyboard = keyboard_page.tap_number_input() self.assertEqual(str(keyboard.current_keyboard), 'number') keyboard.switch_to_keyboard() keyboard._tap('1') self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() typed_number = keyboard_page.number_input self.assertEqual(typed_number, u'1') self.apps.switch_to_displayed_app() self.ui_tests.tap_back_button()
def test_keyboard_bug_1073870(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() keyboard.send('Hello worl') # set caret position to after Hello keyboard_page.switch_to_frame() self.marionette.execute_script( """var el = document.activeElement; el.selectionStart = el.selectionEnd = 5;""") keyboard.send(' ') keyboard_page.switch_to_frame() self.assertEqual(keyboard_page.text_input, 'Hello worl')
def test_a11y_keyboard_word_suggestions(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() # type first 7 letters of the expected word expected_word = "keyboard" keyboard.send(expected_word[:7]) keyboard.switch_to_keyboard() # check that suggestions area has proper accessibility name self.assertEqual(keyboard.a11y_candidate_panel_name, "Word suggestions") # check that suggestions list has proper accessibility role self.assertEqual(keyboard.a11y_suggestions_container_role, "listbox") # check that word suggestion has proper accessibility role and name self.assertEqual(keyboard.a11y_first_predictive_word_name, expected_word.strip()) self.assertEqual(keyboard.a11y_first_predictive_word_role, "listbox option") # check that suggestions dismiss has proper accessibility role and name self.assertEqual(keyboard.a11y_dismiss_suggestions_button_name, "Dismiss") self.assertEqual(keyboard.a11y_dismiss_suggestions_button_role, "pushbutton") # check that word suggestion can be selected via accessibility API keyboard.a11y_first_predictive_word_click() self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() # check if the word in the input field is the same as the expected word typed_word = keyboard_page.text_input self.assertEqual(typed_word, expected_word)
class TestKeyboardPredictiveKey(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) # enable auto-correction of keyboard self.data_layer.set_setting('keyboard.autocorrect', True) def test_keyboard_predictive_key(self): self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() # type first 7 letters of the expected word expected_word = 'keyboard' keyboard.send(expected_word[:7]) # tap the first predictive word keyboard.tap_first_predictive_word() self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() # check if the word in the input field is the same as the expected word typed_word = keyboard_page.text_input self.assertEqual(typed_word, expected_word) ## TEST 2, tap second suggestion, then press space keyboard.send(' ') keyboard_page.switch_to_frame() # type some misspelled word keyboard.send('Tes') keyboard_page.switch_to_frame() self.assertEqual(keyboard_page.text_input, 'keyboard Tes') # tap second predictive word (tea) keyboard.tap_suggestion('Tea') self.apps.switch_to_displayed_app() # Send space keyboard.send(' ') keyboard_page.switch_to_frame() # Output should be 'Tea ' self.assertEqual(keyboard_page.text_input, 'keyboard Tea ') ## TEST 3 - type something with autocorrect and press space keyboard.send('ye ') keyboard_page.switch_to_frame() self.assertEqual(keyboard_page.text_input, 'keyboard Tea he ') # TEST 4 - autocorrect, dot and backspace keyboard.send('wot.') keyboard_page.switch_to_frame() self.assertEqual(keyboard_page.text_input, 'keyboard Tea he wit.') keyboard.tap_backspace() keyboard_page.switch_to_frame() self.assertEqual(keyboard_page.text_input, 'keyboard Tea he wot')
def test_keyboard_predictive_key(self): # Check that the device is in portrait mode as the autocorrect words returned depend on the screen orientation # Bug 1008932 - On desktopb2g, mozOrientation reports landscape when Gaia is oriented in portrait if self.device.is_desktop_b2g: self.assertNotEqual('portrait-primary', self.device.screen_orientation) else: self.assertEqual('portrait-primary', self.device.screen_orientation) self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() # type first 7 letters of the expected word expected_word = 'keyboard' keyboard.send(expected_word[:7]) # tap the first predictive word keyboard.tap_first_predictive_word() self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() # check if the word in the input field is the same as the expected word typed_word = keyboard_page.text_input Wait(self.marionette).until(lambda m: typed_word == expected_word) ## TEST 2, tap second suggestion, then press space keyboard.send(' ') keyboard_page.switch_to_frame() # type some misspelled word keyboard.send('Tes') keyboard_page.switch_to_frame() Wait(self.marionette).until( lambda m: keyboard_page.text_input == 'keyboard Tes') # tap second predictive word (tea) keyboard.tap_suggestion('Tea') self.apps.switch_to_displayed_app() # Send space keyboard.send(' ') keyboard_page.switch_to_frame() # Output should be 'Tea ' Wait(self.marionette).until( lambda m: keyboard_page.text_input == 'keyboard Tea ') ## TEST 3 - type something with autocorrect and press space keyboard.send('ye ') keyboard_page.switch_to_frame() Wait(self.marionette).until( lambda m: keyboard_page.text_input == 'keyboard Tea he ') # TEST 4 - autocorrect, dot and backspace keyboard.send('wot.') keyboard_page.switch_to_frame() Wait(self.marionette).until( lambda m: keyboard_page.text_input == 'keyboard Tea he wit.') keyboard.tap_backspace() keyboard_page.switch_to_frame() Wait(self.marionette).until( lambda m: keyboard_page.text_input == 'keyboard Tea he wot')
class TestKeyboardPredictiveKey(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) # enable auto-correction of keyboard self.data_layer.set_setting('keyboard.autocorrect', True) def test_keyboard_predictive_key(self): # Check that the device is in portrait mode as the autocorrect words returned depend on the screen orientation # Bug 1008932 - On desktopb2g, mozOrientation reports landscape when Gaia is oriented in portrait if self.device.is_desktop_b2g: self.assertNotEqual('portrait-primary', self.device.screen_orientation) else: self.assertEqual('portrait-primary', self.device.screen_orientation) self.ui_tests = UiTests(self.marionette) self.ui_tests.launch() # go to UI/keyboard page keyboard_page = self.ui_tests.tap_keyboard_option() keyboard_page.switch_to_frame() # tap the field "input type=text" keyboard = keyboard_page.tap_text_input() # type first 7 letters of the expected word expected_word = 'keyboard' keyboard.send(expected_word[:7]) # tap the first predictive word keyboard.tap_first_predictive_word() self.apps.switch_to_displayed_app() keyboard_page.switch_to_frame() # check if the word in the input field is the same as the expected word typed_word = keyboard_page.text_input Wait(self.marionette).until(lambda m: typed_word == expected_word) ## TEST 2, tap second suggestion, then press space keyboard.send(' ') keyboard_page.switch_to_frame() # type some misspelled word keyboard.send('Tes') keyboard_page.switch_to_frame() Wait(self.marionette).until(lambda m: keyboard_page.text_input == 'keyboard Tes') # tap second predictive word (tea) keyboard.tap_suggestion('Tea') self.apps.switch_to_displayed_app() # Send space keyboard.send(' ') keyboard_page.switch_to_frame() # Output should be 'Tea ' Wait(self.marionette).until(lambda m: keyboard_page.text_input == 'keyboard Tea ') ## TEST 3 - type something with autocorrect and press space keyboard.send('ye ') keyboard_page.switch_to_frame() Wait(self.marionette).until(lambda m: keyboard_page.text_input == 'keyboard Tea he ') # TEST 4 - autocorrect, dot and backspace keyboard.send('wot.') keyboard_page.switch_to_frame() Wait(self.marionette).until(lambda m: keyboard_page.text_input == 'keyboard Tea he wit.') keyboard.tap_backspace() keyboard_page.switch_to_frame() Wait(self.marionette).until(lambda m: keyboard_page.text_input == 'keyboard Tea he wot')