Bug 1316040 - Change target to non-target in test_caret_not_appear_when_typing_in_scrollable_content. draft
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 09 Nov 2016 14:14:53 +0800
changeset 435762 2f442af9ad81a4d04919d95097db0ec46da3cb6b
parent 435666 783356f1476eafd8e4d6fa5f3919cf6167e84f8d
child 536379 0bf872845c2d26301d3c2affdc9db58bc8456c5d
push id35122
push userbmo:tlin@mozilla.com
push dateWed, 09 Nov 2016 06:27:06 +0000
bugs1316040
milestone52.0a1
Bug 1316040 - Change target to non-target in test_caret_not_appear_when_typing_in_scrollable_content. In this test, we assume the caret does not appear at the end of the input. However in this case, self.actions.flick() will select all text within the input, and then send_keys() will replace it with '!'. As a result, the final content might varies on different platforms. Test the final content match tho target_content might not be reliable. To fix this, we instead assert that final content does *not* match the non_target_content as the bug occurs. MozReview-Commit-ID: 2YRN8W3PUXG
layout/base/tests/marionette/test_accessiblecaret_cursor_mode.py
--- a/layout/base/tests/marionette/test_accessiblecaret_cursor_mode.py
+++ b/layout/base/tests/marionette/test_accessiblecaret_cursor_mode.py
@@ -163,36 +163,36 @@ class AccessibleCaretCursorModeTestCase(
         self.actions.key_down(content_to_add).key_up(content_to_add).perform()
         self.assertNotEqual(non_target_content, sel.content)
 
     def test_caret_not_appear_when_typing_in_scrollable_content(self):
         self.open_test_html(self._cursor_html)
         el = self.marionette.find_element(By.ID, self._input_id)
         sel = SelectionManager(el)
         content_to_add = '!'
-        target_content = sel.content + string.ascii_letters + content_to_add
+        non_target_content = content_to_add + sel.content + string.ascii_letters
 
         el.tap()
         sel.move_cursor_to_end()
 
         # Insert a long string to the end of the <input>, which triggers
         # ScrollPositionChanged event.
         el.send_keys(string.ascii_letters)
 
         # The caret should not be visible. If it does appear wrongly due to the
         # ScrollPositionChanged event, we can drag it to the front of the
         # <input> to change the cursor position.
         src_x, src_y = sel.first_caret_location()
         dest_x, dest_y = 0, 0
         self.actions.flick(el, src_x, src_y, dest_x, dest_y).perform()
 
-        # The content should be inserted at the end of the <input>.
+        # The content should not be inserted at the front of the <input>.
         el.send_keys(content_to_add)
 
-        self.assertEqual(target_content, sel.content)
+        self.assertNotEqual(non_target_content, sel.content)
 
     @parameterized(_input_id, el_id=_input_id)
     @parameterized(_input_padding_id, el_id=_input_padding_id)
     @parameterized(_textarea_one_line_id, el_id=_textarea_one_line_id)
     @parameterized(_contenteditable_id, el_id=_contenteditable_id)
     def test_caret_not_jump_when_dragging_to_editable_content_boundary(self, el_id):
         self.open_test_html(self._cursor_html)
         el = self.marionette.find_element(By.ID, el_id)