bdd: Skip scroll checks with QtWebEngine

This commit is contained in:
Florian Bruhin 2016-08-18 19:20:48 +02:00
parent c0ffcfc585
commit 105c1952a8
2 changed files with 16 additions and 3 deletions

View File

@ -558,7 +558,11 @@ def _get_scroll_values(quteproc):
@bdd.then(bdd.parsers.re(r"the page should be scrolled "
r"(?P<direction>horizontally|vertically)"))
def check_scrolled(quteproc, direction):
def check_scrolled(request, quteproc, direction):
if request.config.getoption('--qute-bdd-webengine'):
# pylint: disable=no-member
pytest.xfail(reason="QtWebEngine TODO: Sessions are not implemented")
# pylint: enable=no-member
x, y = _get_scroll_values(quteproc)
if direction == 'horizontally':
assert x != 0
@ -569,7 +573,11 @@ def check_scrolled(quteproc, direction):
@bdd.then("the page should not be scrolled")
def check_not_scrolled(quteproc):
def check_not_scrolled(request, quteproc):
if request.config.getoption('--qute-bdd-webengine'):
# pylint: disable=no-member
pytest.xfail(reason="QtWebEngine TODO: Sessions are not implemented")
# pylint: enable=no-member
x, y = _get_scroll_values(quteproc)
assert x == 0
assert y == 0

View File

@ -17,12 +17,17 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import pytest
import pytest_bdd as bdd
bdd.scenarios('marks.feature')
@bdd.then(bdd.parsers.parse("the page should be scrolled to {x} {y}"))
def check_y(quteproc, x, y):
def check_y(request, quteproc, x, y):
if request.config.getoption('--qute-bdd-webengine'):
# pylint: disable=no-member
pytest.xfail(reason="QtWebEngine TODO: Sessions are not implemented")
# pylint: enable=no-member
data = quteproc.get_session()
pos = data['windows'][0]['tabs'][0]['history'][-1]['scroll-pos']
assert int(x) == pos['x']