def test_hover_one(self): hover('Dropdown 1') result = self.read_result_from_browser() self.assertEqual( 'Dropdown 1', result, "Got unexpected result %r. Maybe the mouse cursor was over the " "browser window and interfered with the test?" % result)
def test_hover_two_consecutively(self): hover('Dropdown 2') hover('Item C') result = self.read_result_from_browser() self.assertEqual( 'Dropdown 2 - Item C', result, "Got unexpected result %r. Maybe the mouse cursor was over the " "browser window and interfered with the test?" % result)
def test_hover_hidden(self): with TemporaryAttrValue(Config, 'implicit_wait_secs', 1): try: hover("Item C") except LookupError: pass # Success! else: self.fail( "Didn't receive expected LookupError. Maybe the mouse " "cursor was over the browser window and interfered with " "the test?")
def setUp(self): super().setUp() if test_browser_name() != 'chrome': # Imagine two consecutive tests that hover the mouse cursor to the # same position. In the second test, Firefox does not generate a # "mouse move" event (probably because the cursor is already in the # "correct" location). However, this prevents our JavaScript from # firing, which updates the status text element required for this # text. Fix this by re-setting the mouse cursor. Chrome does not # suffer from this problem. hover(Point(0, 0))
def test_hover_top_left_offset(self): hover(Button("Button 3").top_left + (3, 4)) self.assert_result_is("Button 3 hovered at offset (3, 4).")
def test_hover_point(self): hover(Point(39, 13)) self.assert_result_is("Button 1 hovered at offset (37, 10).", offset_delta=(0, 1))
def test_hover_top_left(self): hover(Button("Button 1").top_left) self.assert_result_is("Button 1 hovered at offset (0, 0).", offset_delta=(1, 1))