зеркало из https://github.com/mozilla/gecko-dev.git
bug 1504488: webdriver: add basic interactability tests for element click; r=whimboo
These tests are largely ported from element_send_keys/interactability.py. Differential Revision: https://phabricator.services.mozilla.com/D10826 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4dede9adc3
Коммит
72bb3f4e6c
|
@ -3,6 +3,7 @@ import pytest
|
|||
from tests.support.asserts import assert_error, assert_success
|
||||
from tests.support.inline import inline
|
||||
|
||||
|
||||
def element_click(session, element):
|
||||
return session.transport.send(
|
||||
"POST", "session/{session_id}/element/{element_id}/click".format(
|
||||
|
@ -10,6 +11,38 @@ def element_click(session, element):
|
|||
element_id=element.id))
|
||||
|
||||
|
||||
def test_display_none(session):
|
||||
session.url = inline("""<button style="display: none">foobar</button>""")
|
||||
element = session.find.css("button", all=False)
|
||||
|
||||
response = element_click(session, element)
|
||||
assert_error(response, "element not interactable")
|
||||
|
||||
|
||||
def test_visibility_hidden(session):
|
||||
session.url = inline("""<button style="visibility: hidden">foobar</button>""")
|
||||
element = session.find.css("button", all=False)
|
||||
|
||||
response = element_click(session, element)
|
||||
assert_error(response, "element not interactable")
|
||||
|
||||
|
||||
def test_hidden(session):
|
||||
session.url = inline("<button hidden>foobar</button>")
|
||||
element = session.find.css("button", all=False)
|
||||
|
||||
response = element_click(session, element)
|
||||
assert_error(response, "element not interactable")
|
||||
|
||||
|
||||
def test_disabled(session):
|
||||
session.url = inline("""<button disabled>foobar</button>""")
|
||||
element = session.find.css("button", all=False)
|
||||
|
||||
response = element_click(session, element)
|
||||
assert_success(response)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("transform", ["translate(-100px, -100px)", "rotate(50deg)"])
|
||||
def test_element_not_interactable_css_transform(session, transform):
|
||||
session.url = inline("""
|
||||
|
|
Загрузка…
Ссылка в новой задаче