Bug 1316040 - Change target to non-target in test_caret_not_appear_when_typing_in_scrollable_content. r=mtseng
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 09 Nov 2016 14:14:53 +0800
changeset 348544 b737f14975c2a83bf6c3753528641e0f51745778
parent 348543 fb579bc49c2f153e61cf06b34bcd6a03a409e6c4
child 348545 8ffd0e45ac580a8d0a85d603e5395297b5f2d9d3
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmtseng
bugs1316040
milestone52.0a1
Bug 1316040 - Change target to non-target in test_caret_not_appear_when_typing_in_scrollable_content. r=mtseng 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)