зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1636105 [wpt PR 23456] - [WebDriver] Add test for triple click, a=testonly
Automatic update from web-platform-tests [WebDriver] Add test for triple click (#23456) This test does a triple-click and then checks that the entire paragraph has been selected. This currently fails in all drivers. -- wpt-commits: 3b5a990d7cbbb6fc196282a3f99c2c1bf9f04915 wpt-pr: 23456
This commit is contained in:
Родитель
76f6332a91
Коммит
0b27bafe6e
|
@ -0,0 +1,34 @@
|
||||||
|
from tests.perform_actions.support.refine import filter_dict, get_events
|
||||||
|
from tests.support.asserts import assert_move_to_coordinates
|
||||||
|
from tests.support.inline import inline
|
||||||
|
|
||||||
|
lots_of_text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor "\
|
||||||
|
"incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud "\
|
||||||
|
" exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
|
||||||
|
|
||||||
|
|
||||||
|
def test_tripleclick_at_coordinates(session, mouse_chain):
|
||||||
|
"""
|
||||||
|
This test does a triple click on a coordinate. On desktop platforms
|
||||||
|
this will select a paragraph. On mobile this will not have the same
|
||||||
|
desired outcome as taps are handled differently on mobile.
|
||||||
|
"""
|
||||||
|
session.url = inline("""<div>
|
||||||
|
{}
|
||||||
|
</div>""".format(lots_of_text))
|
||||||
|
div = session.find.css("div", all=False)
|
||||||
|
div_rect = div.rect
|
||||||
|
div_centre = {
|
||||||
|
"x": div_rect["x"] + div_rect["width"]/2,
|
||||||
|
"y": div_rect["y"] + div_rect["height"]/2
|
||||||
|
}
|
||||||
|
mouse_chain \
|
||||||
|
.pointer_move(div_centre["x"], div_centre["y"]) \
|
||||||
|
.click() \
|
||||||
|
.click() \
|
||||||
|
.click() \
|
||||||
|
.perform()
|
||||||
|
|
||||||
|
actual_text = session.execute_script("return document.getSelection().toString();")
|
||||||
|
|
||||||
|
assert lots_of_text == actual_text
|
Загрузка…
Ссылка в новой задаче