diff --git a/tests/functional/firefox/test_all.py b/tests/functional/firefox/test_all.py new file mode 100644 index 00000000000..a865f5f907c --- /dev/null +++ b/tests/functional/firefox/test_all.py @@ -0,0 +1,27 @@ +# 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 http://mozilla.org/MPL/2.0/. + +import pytest + +from pages.firefox.all import FirefoxAllPage + + +@pytest.mark.smoke +@pytest.mark.nondestructive +def test_search_language(base_url, selenium): + page = FirefoxAllPage(base_url, selenium).open() + language = 'english' + page.search_for(language) + for build in page.displayed_builds: + assert language in build.language.lower() + + +@pytest.mark.nondestructive +def test_newsletter_default_values(base_url, selenium): + page = FirefoxAllPage(base_url, selenium).open() + page.newsletter.expand_form() + assert '' == page.newsletter.email + assert 'United States' == page.newsletter.country + assert not page.newsletter.privacy_policy_accepted + assert page.newsletter.is_privacy_policy_link_displayed diff --git a/tests/pages/firefox/all.py b/tests/pages/firefox/all.py new file mode 100644 index 00000000000..c53ecbe74fa --- /dev/null +++ b/tests/pages/firefox/all.py @@ -0,0 +1,42 @@ +# 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 http://mozilla.org/MPL/2.0/. + +from selenium.webdriver.common.by import By + +from pages.firefox.base import FirefoxBasePage, FirefoxBasePageRegion + + +class FirefoxAllPage(FirefoxBasePage): + + _url = '{base_url}/{locale}/firefox/all' + + _search_input_locator = (By.ID, 'language-search-q') + _submit_button_locator = (By.CSS_SELECTOR, '#language-search button') + _build_rows_locator = (By.CSS_SELECTOR, '#builds table > tbody > tr') + + @property + def _builds(self): + return [Build(self, root=el) for el in + self.find_elements(self._build_rows_locator)] + + @property + def displayed_builds(self): + return [b for b in self._builds if b.is_displayed] + + def search_for(self, value): + self.find_element(self._search_input_locator).send_keys(value) + self.find_element(self._submit_button_locator).click() + expected_builds = [b for b in self._builds if value in b.language.lower()] + self.wait.until(lambda s: len(expected_builds) == len(self.displayed_builds)) + + +class Build(FirefoxBasePageRegion): + + @property + def language(self): + return self._root.get_attribute('data-search') + + @property + def is_displayed(self): + return self._root.is_displayed()