From 65770c27abb5b23aaba5806893ed869731c963c6 Mon Sep 17 00:00:00 2001 From: Josh Mize Date: Sat, 29 Jun 2019 16:33:25 -0500 Subject: [PATCH] Replace mark.viewport('mobile') with selenium_mobile fixture --- tests/functional/conftest.py | 18 ++++++++---------- tests/functional/test_contact.py | 6 ++---- tests/functional/test_history.py | 3 +-- tests/functional/test_navigation.py | 3 +-- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index 9bd9b71c20a..18551925d8b 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -4,10 +4,6 @@ import pytest -VIEWPORT = { - 'desktop': {'width': 1280, 'height': 1024}, - 'mobile': {'width': 320, 'height': 480}} - @pytest.fixture def capabilities(request, capabilities): @@ -59,10 +55,12 @@ def filter_capabilities(request): @pytest.fixture -def selenium(request, selenium): - viewport = VIEWPORT['desktop'] - request_keywords_viewport = request.keywords.get('viewport') - if hasattr(request_keywords_viewport, 'args'): - viewport = VIEWPORT[request_keywords_viewport.args[0]] - selenium.set_window_size(viewport['width'], viewport['height']) +def selenium(selenium): + selenium.set_window_size(1280, 1024) # width, height + return selenium + + +@pytest.fixture +def selenium_mobile(selenium): + selenium.set_window_size(320, 480) # width, height return selenium diff --git a/tests/functional/test_contact.py b/tests/functional/test_contact.py index 7029d7b6a67..f93e7635b16 100644 --- a/tests/functional/test_contact.py +++ b/tests/functional/test_contact.py @@ -66,8 +66,7 @@ def test_communities_region_menus(slug, base_url, selenium): @pytest.mark.nondestructive -@pytest.mark.viewport('mobile') -def test_spaces_mobile_navigation(base_url, selenium): +def test_spaces_mobile_navigation(base_url, selenium_mobile): page = SpacesPage(selenium, base_url, slug='').open() assert not page.is_desktop_nav_displayed assert page.is_mobile_nav_displayed @@ -77,8 +76,7 @@ def test_spaces_mobile_navigation(base_url, selenium): @pytest.mark.nondestructive -@pytest.mark.viewport('mobile') -def test_communities_mobile_navigation(base_url, selenium): +def test_communities_mobile_navigation(base_url, selenium_mobile): page = CommunitiesPage(selenium, base_url, slug='').open() assert not page.is_desktop_nav_displayed assert page.is_mobile_nav_displayed diff --git a/tests/functional/test_history.py b/tests/functional/test_history.py index 6faf9c693cf..2117a67925a 100644 --- a/tests/functional/test_history.py +++ b/tests/functional/test_history.py @@ -16,8 +16,7 @@ def test_slideshow_displayed(base_url, selenium): @pytest.mark.nondestructive -@pytest.mark.viewport('mobile') -def test_list_displayed(base_url, selenium): +def test_list_displayed(base_url, selenium_mobile): page = HistoryPage(selenium, base_url).open() assert not page.is_slideshow_displayed assert not page.is_previous_button_displayed diff --git a/tests/functional/test_navigation.py b/tests/functional/test_navigation.py index 58c4f693c5b..b10b00f77e6 100644 --- a/tests/functional/test_navigation.py +++ b/tests/functional/test_navigation.py @@ -23,8 +23,7 @@ def test_navigation(base_url, selenium): @pytest.mark.nondestructive -@pytest.mark.viewport('mobile') -def test_mobile_navigation(base_url, selenium): +def test_mobile_navigation(base_url, selenium_mobile): page = HomePage(selenium, base_url).open() page.navigation.show() firefox_desktop_page = page.navigation.open_firefox_desktop_page()