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:
Andreas Tolfsen 2018-11-05 20:32:19 +00:00
Родитель 4dede9adc3
Коммит 72bb3f4e6c
1 изменённых файлов: 33 добавлений и 0 удалений

Просмотреть файл

@ -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("""