-
Notifications
You must be signed in to change notification settings - Fork 912
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3834 from alexgibson/functional-test-firefox-all
Add functional tests for firefox/all page
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |