diff --git a/bin/integration_tests/functional_tests.sh b/bin/integration_tests/functional_tests.sh index 90a9f704a7a..718d8d36b44 100755 --- a/bin/integration_tests/functional_tests.sh +++ b/bin/integration_tests/functional_tests.sh @@ -61,7 +61,6 @@ docker run \ -e "PLATFORM=${PLATFORM:-}" \ -e "MARK_EXPRESSION=${MARK_EXPRESSION:-}" \ -e "BASE_URL=${BASE_URL:-}" \ - -e "BASE_POCKET_URL=${BASE_POCKET_URL:-}" \ -e "PYTEST_PROCESSES=${PYTEST_PROCESSES:=4}" \ -e "BOUNCER_URL=${BOUNCER_URL:=https://download.mozilla.org/}" \ -e "SCREEN_WIDTH=1600" \ diff --git a/docs/testing.rst b/docs/testing.rst index 1f3849e70ce..5ebb36ea736 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -304,7 +304,7 @@ to pull in external data such as event/blog feeds etc. These are required for some of the tests to pass. To run the full Selenium integration test suite against your local bedrock -instance in Mozorg mode: +instance: .. code-block:: bash @@ -314,25 +314,11 @@ This will run all test suites found in the ``tests/functional`` directory and assumes you have bedrock running at ``localhost`` on port ``8000``. Results will be reported in ``tests/functional/results.html``. -To run the full Selenium test suite against your local bedrock instance in -Pocket mode, things are slightly different, because of the way things are set -up in order to allow CI to test both Mozorg Mode and Pocket Mode at the same -time. You need to define a temporary environment variable (needed by the -`pocket_base_url` fixture) and scope pytest to only run Pocket tests: - -.. code-block:: bash - - $ BASE_POCKET_URL=http://localhost:8000 pytest -m pocket_mode --driver Firefox --html tests/functional/results.html tests/functional/ - -This will run all test suites found in the ``tests/functional`` directory that have -the pytest "`mark`" of `pocket_mode` and assumes you have bedrock running *in Pocket mode* at -``localhost`` on port ``8000``. Results will be reported in ``tests/functional/results.html``. - .. Note:: - If you omit the ``--base-url`` command line option in Mozorg mode (ie, not - in Pocket mode) then a local instance of bedrock will be started, however - the tests are not currently able to run against bedrock in this way. + If you omit the ``--base-url`` command line option then a local instance + of bedrock will be started, however the tests are not currently able to + run against bedrock in this way. By default, tests will run one at a time. This is the safest way to ensure predictable results, due to diff --git a/setup.cfg b/setup.cfg index ef4ae91aaa0..5e9a641fd2c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,6 @@ markers = skip_if_internet_explorer skip_if_not_firefox smoke - pocket_mode [tool:paul-mclendahand] diff --git a/tests/conftest.py b/tests/conftest.py index b420ec9c17a..619c0416dbe 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,17 +4,7 @@ import pytest -from bedrock.base.config_manager import config - @pytest.fixture(scope="session") def base_url(base_url, request): return base_url or request.getfixturevalue("live_server").url - - -@pytest.fixture(scope="session") -def pocket_base_url(request): - base_url = config("BASE_POCKET_URL", parser=str, default="") - if not base_url: - pytest.skip("No BASE_POCKET_URL detected in env vars") - return base_url diff --git a/tests/functional/pocket/__init__.py b/tests/functional/pocket/__init__.py deleted file mode 100644 index 448bb8652d6..00000000000 --- a/tests/functional/pocket/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. diff --git a/tests/functional/pocket/test_navigation.py b/tests/functional/pocket/test_navigation.py deleted file mode 100644 index 72ee553036f..00000000000 --- a/tests/functional/pocket/test_navigation.py +++ /dev/null @@ -1,44 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -import pytest -from selenium.webdriver.common.by import By - -from pages.pocket.about import AboutPage - -pytestmark = pytest.mark.pocket_mode - - -@pytest.mark.nondestructive -def test_mobile_menu(pocket_base_url, selenium_mobile): - page = AboutPage(selenium_mobile, pocket_base_url).open() - assert page.navigation.is_mobile_menu_open_button_displayed - page.navigation.open_mobile_menu() - assert page.navigation.is_mobile_menu_nav_list_displayed - - assert page.navigation.is_mobile_menu_close_button_displayed - page.navigation.close_mobile_menu() - assert not page.navigation.is_mobile_menu_nav_list_displayed - - -@pytest.mark.nondestructive -def test_accessible_mobile_menu_open_name(pocket_base_url, selenium_mobile): - page = AboutPage(selenium_mobile, pocket_base_url).open() - button_label_reference = page.navigation.mobile_menu_open_button.get_attribute("aria-labelledby") - string = page.navigation.mobile_menu_open_button.find_element(By.ID, button_label_reference).text - assert len(string) > 0 - - -@pytest.mark.nondestructive -def test_accessible_mobile_menu_close_name(pocket_base_url, selenium_mobile): - page = AboutPage(selenium_mobile, pocket_base_url).open() - page.navigation.open_mobile_menu() - string = page.navigation.mobile_menu_close_button.text - assert len(string) > 0 - - -@pytest.mark.nondestructive -def test_mobile_menu_not_displayed_on_desktop(pocket_base_url, selenium): - page = AboutPage(selenium, pocket_base_url).open() - assert not page.navigation.is_mobile_menu_open_button_displayed diff --git a/tests/functional/pocket/test_navigation_platform.py b/tests/functional/pocket/test_navigation_platform.py deleted file mode 100644 index 80a2ffebe67..00000000000 --- a/tests/functional/pocket/test_navigation_platform.py +++ /dev/null @@ -1,15 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -import pytest - -from pages.pocket.add import AddPage - -pytestmark = pytest.mark.pocket_mode - - -@pytest.mark.nondestructive -def test_mobile_menu(pocket_base_url, selenium_mobile): - page = AddPage(selenium_mobile, pocket_base_url).open() - assert page.navigation.mobile_nav_not_available diff --git a/tests/pages/pocket/__init__.py b/tests/pages/pocket/__init__.py deleted file mode 100644 index 448bb8652d6..00000000000 --- a/tests/pages/pocket/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. diff --git a/tests/pages/pocket/about.py b/tests/pages/pocket/about.py deleted file mode 100644 index ecc6d999082..00000000000 --- a/tests/pages/pocket/about.py +++ /dev/null @@ -1,9 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -from pages.pocket.base import BasePage - - -class AboutPage(BasePage): - _URL_TEMPLATE = "/{locale}/about/" diff --git a/tests/pages/pocket/add.py b/tests/pages/pocket/add.py deleted file mode 100644 index 2f17a12f57a..00000000000 --- a/tests/pages/pocket/add.py +++ /dev/null @@ -1,9 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -from pages.pocket.base import BasePage - - -class AddPage(BasePage): - _URL_TEMPLATE = "/{locale}/add/" diff --git a/tests/pages/pocket/base.py b/tests/pages/pocket/base.py deleted file mode 100644 index d14e9a323a9..00000000000 --- a/tests/pages/pocket/base.py +++ /dev/null @@ -1,112 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -from pypom import Page, Region -from selenium.webdriver.common.by import By -from selenium.webdriver.support import expected_conditions as expected - - -class BaseRegion(Region): - pass - - -class BasePage(Page): - _platform_nav_locator = (By.CSS_SELECTOR, ".pocket-header.platform") - - def __init__(self, selenium, pocket_base_url, locale="en", **url_kwargs): - super().__init__(selenium, pocket_base_url, locale=locale, **url_kwargs) - - def wait_for_page_to_load(self): - self.wait.until(lambda s: self.seed_url in s.current_url) - el = self.find_element(By.TAG_NAME, "html") - self.wait.until(lambda s: "loaded" in el.get_attribute("class")) - - # Dismiss cookie prompt before running tests - self.wait.until(lambda s: expected.presence_of_element_located(s.find_element(By.ID, "onetrust-banner-sdk"))) - cookie_banner = self.find_element(By.ID, "onetrust-banner-sdk") - self.wait.until(lambda s: "animation-name" not in cookie_banner.get_attribute("style")) - - accept_cookie_button = self.find_element(By.ID, "onetrust-accept-btn-handler") - self.wait.until(lambda s: expected.element_to_be_clickable(accept_cookie_button)) - accept_cookie_button.click() - - self.wait.until(lambda s: cookie_banner.is_displayed() is False) - - return self - - @property - def URL_TEMPLATE(self): - if "{params}" in self._URL_TEMPLATE: - return f"{self._URL_TEMPLATE}&automation=true" - else: - return f"{self._URL_TEMPLATE}?automation=true" - - @property - def navigation(self): - if self.is_element_displayed(*self._platform_nav_locator): - return self.NavigationPlatform(self) - else: - return self.Navigation(self) - - class Navigation(BaseRegion): - _content_wrapper_locator = (By.TAG_NAME, "body") - _mobile_menu_open_btn_locator = (By.CLASS_NAME, "global-nav-mobile-menu-btn") - _mobile_menu_close_btn_locator = (By.CLASS_NAME, "mobile-nav-close-btn") - _mobile_menu_wrapper_locator = (By.CLASS_NAME, "mobile-nav-wrapper") - _mobile_menu_nav_list_locator = (By.CSS_SELECTOR, ".mobile-nav-list") - - @property - def is_mobile_menu_nav_list_displayed(self): - return self.is_element_displayed(*self._mobile_menu_nav_list_locator) - - @property - def is_mobile_menu_open(self): - return ( - "mobile-nav-open" in self.find_element(*self._content_wrapper_locator).get_attribute("class") - and self.mobile_menu_open_button.get_attribute("aria-expanded") == "true" - and self.wait.until(lambda s: self.is_mobile_menu_close_button_displayed) - ) - - @property - def is_mobile_menu_closed(self): - return ( - "mobile-nav-open" not in self.find_element(*self._content_wrapper_locator).get_attribute("class") - and self.mobile_menu_open_button.get_attribute("aria-expanded") == "false" - and self.wait.until(lambda s: not self.is_mobile_menu_nav_list_displayed) - ) - - @property - def is_mobile_menu_open_button_displayed(self): - return self.is_element_displayed(*self._mobile_menu_open_btn_locator) - - @property - def is_mobile_menu_close_button_displayed(self): - return self.is_element_displayed(*self._mobile_menu_close_btn_locator) - - @property - def mobile_menu_open_button(self): - return self.find_element(*self._mobile_menu_open_btn_locator) - - @property - def mobile_menu_close_button(self): - return self.find_element(*self._mobile_menu_close_btn_locator) - - def open_mobile_menu(self): - assert not self.is_mobile_menu_open, "Menu is already open" - self.mobile_menu_open_button.click() - self.wait.until(lambda s: self.is_mobile_menu_open) - return self - - def close_mobile_menu(self): - assert not self.is_mobile_menu_closed, "Menu is already closed" - self.mobile_menu_close_button.click() - self.wait.until(lambda s: self.is_mobile_menu_closed) - return self - - class NavigationPlatform(BaseRegion): - _mobile_menu_open_btn_locator = (By.CLASS_NAME, "global-nav-mobile-menu-btn") - - @property - def mobile_nav_not_available(self): - return not self.is_element_displayed(*self._mobile_menu_open_btn_locator)