Skip to content

Commit

Permalink
Merge pull request #4291 from Osmose/e2e-tests-deps
Browse files Browse the repository at this point in the history
Fix bug 1429431: Use pyup to monitor and update e2e-tests dependencies.
  • Loading branch information
Osmose committed Jan 18, 2018
2 parents 962fab2 + 3caa73d commit 3e93f0e
Show file tree
Hide file tree
Showing 16 changed files with 223 additions and 50 deletions.
3 changes: 3 additions & 0 deletions .pyup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ requirements:
- docs/requirements.txt:
update: all
pin: true
- e2e-tests/requirements/default.txt:
update: all
pin: true
5 changes: 0 additions & 5 deletions e2e-tests/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ pipeline {
SAUCELABS = credentials('SAUCELABS')
}
stages {
stage('Lint') {
steps {
sh "tox -c e2e-tests/tox.ini -e flake8"
}
}
stage('Test') {
steps {
writeCapabilities(capabilities, 'e2e-tests/capabilities.json')
Expand Down
12 changes: 10 additions & 2 deletions e2e-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,23 @@ Continuous Integration
----------------------
This directory holds Socorro client-based end-to-end tests, which is why they're different than the rest of the code in this repository.

To review the specific-Python packages the tests use, please review `tox.ini`.
To review the specific-Python packages the tests use, please review
`requirements/default.txt`.

Prerequisites
-------------
These tests assume that the following software is installed:

* Pip 8.0.0 or higher

Set up and run Socorro tests
-----------------------------

Review the documentation for [pytest-selenium][pytest-selenium] and decide
which browser environment you wish to target.

* [Install Tox](https://tox.readthedocs.io/en/latest/install.html)
* [Install Tox](https://tox.readthedocs.io/en/latest/install.html) (1.6.1 or
higher)
* Run `tox`

An additional constraint for Firefox users: since version 48, Firefox now uses
Expand Down
23 changes: 17 additions & 6 deletions e2e-tests/pages/base_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ def current_version(self):
def current_versions(self):
from pages.version import FirefoxVersion
current_versions = []
for element in self.find_element(*self._all_versions_locator).find_elements(*self._current_versions_locator):
all_versions_element = self.find_element(*self._all_versions_locator)
current_versions_elements = all_versions_element.find_elements(
*self._current_versions_locator
)

for element in current_versions_elements:
str(current_versions.append(FirefoxVersion(element.text)))
return current_versions

Expand All @@ -79,7 +84,9 @@ def version_select_text(self):
Return the text in the Version selector
'''
versions = []
for element in self.find_element(*self._all_versions_locator).find_elements(*self._versions_locator):
all_versions_element = self.find_element(*self._all_versions_locator)
versions_elements = all_versions_element.find_elements(*self._versions_locator)
for element in versions_elements:
versions.append(element.text)
return versions

Expand Down Expand Up @@ -124,16 +131,20 @@ def select_report(self, report_name):

if 'Top Crashers' == report_name:
from pages.crash_stats_top_crashers_page import CrashStatsTopCrashers
return CrashStatsTopCrashers(self.selenium, self.page.base_url).wait_for_page_to_load()
page = CrashStatsTopCrashers(self.selenium, self.page.base_url)
return page.wait_for_page_to_load()
elif 'Top Crashers by TopSite' == report_name:
from pages.crash_stats_top_crashers_by_site_page import CrashStatsTopCrashersBySite
return CrashStatsTopCrashersBySite(self.selenium, self.page.base_url).wait_for_page_to_load()
page = CrashStatsTopCrashersBySite(self.selenium, self.page.base_url)
return page.wait_for_page_to_load()
elif 'Crashes per Day' == report_name:
from pages.crash_stats_per_day import CrashStatsPerDay
return CrashStatsPerDay(self.selenium, self.page.base_url).wait_for_page_to_load()
page = CrashStatsPerDay(self.selenium, self.page.base_url)
return page.wait_for_page_to_load()
elif 'Nightly Builds' == report_name:
from pages.crash_stats_nightly_builds_page import CrashStatsNightlyBuilds
return CrashStatsNightlyBuilds(self.selenium, self.page.base_url).wait_for_page_to_load()
page = CrashStatsNightlyBuilds(self.selenium, self.page.base_url)
return page.wait_for_page_to_load()

def search_for_crash(self, crash_id_or_signature):
'''
Expand Down
3 changes: 2 additions & 1 deletion e2e-tests/pages/crash_stats_top_crashers_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def current_os_filter(self):

@property
def signature_items(self):
return [self.SignatureItem(self, el) for el in self.find_elements(*self._signature_table_row_locator)]
elements = self.find_elements(*self._signature_table_row_locator)
return [self.SignatureItem(self, el) for el in elements]

def random_signature_items(self, count):
signature_items = self.signature_items
Expand Down
3 changes: 2 additions & 1 deletion e2e-tests/pages/home_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def wait_for_page_to_load(self):

@property
def release_channels(self):
return [self.ReleaseChannels(self, el) for el in self.find_elements(*self._release_channels_locator)]
elements = self.find_elements(*self._release_channels_locator)
return [self.ReleaseChannels(self, el) for el in elements]

class ReleaseChannels(Region):

Expand Down
51 changes: 40 additions & 11 deletions e2e-tests/pages/super_search_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,38 @@ class CrashStatsSuperSearch(CrashStatsBasePage):

_page_title = 'Search - Mozilla Crash Reports'
_page_loaded_locator = (By.CSS_SELECTOR, '#s2id_simple-product input')
_advanced_search_loaded_locator = (By.CSS_SELECTOR, '#advanced-search .select2-container-active')
_advanced_search_loaded_locator = (
By.CSS_SELECTOR,
'#advanced-search .select2-container-active',
)
_search_button_locator = (By.ID, 'search-button')

# Simple Search
_simple_search_product_field_locator = (By.CSS_SELECTOR, '#s2id_simple-product input')
_simple_search_version_field_locator = (By.CSS_SELECTOR, '#s2id_simple-version input')
_simple_search_platform_field_locator = (By.CSS_SELECTOR, '#s2id_simple-platform input')
_simple_search_platform_text_locator = (By.CSS_SELECTOR, '#s2id_simple-product .select2-choices li div')
_simple_search_platform_text_locator = (
By.CSS_SELECTOR,
'#s2id_simple-product .select2-choices li div',
)

# Advanced Search
_new_line_button_locator = (By.CSS_SELECTOR, 'button.new-line')
_highlighted_text_locator = (By.CSS_SELECTOR, 'li[class*="highlighted"]')
_facet_text_locator = (By.CSS_SELECTOR, '#advanced-search fieldset[id="%s"] > div:nth-child(2) span:first-child')
_facet_text_locator = (
By.CSS_SELECTOR,
'#advanced-search fieldset[id="%s"] > div:nth-child(2) span:first-child',
)
_input_locator = (By.CSS_SELECTOR, '#select2-drop.select2-drop-active input')
_operator_text_locator = (By.CSS_SELECTOR, '#advanced-search fieldset[id="%s"] > div:nth-child(4) span')
_match_field_locator = (By.CSS_SELECTOR, '#advanced-search fieldset[id="%s"] .select2-search-field input')
_match_text_locator = (By.CSS_SELECTOR, '#advanced-search fieldset[id="%s"] > div:nth-child(6) div')
_operator_text_locator = (
By.CSS_SELECTOR, '#advanced-search fieldset[id="%s"] > div:nth-child(4) span',
)
_match_field_locator = (
By.CSS_SELECTOR, '#advanced-search fieldset[id="%s"] .select2-search-field input',
)
_match_text_locator = (
By.CSS_SELECTOR, '#advanced-search fieldset[id="%s"] > div:nth-child(6) div',
)

# More options section
_more_options_locator = (By.CSS_SELECTOR, '.options h4')
Expand All @@ -46,7 +61,10 @@ class CrashStatsSuperSearch(CrashStatsBasePage):
_column_list_locator = (By.CSS_SELECTOR, '#s2id__columns_fake ul li.select2-search-choice')
_table_row_locator = (By.CSS_SELECTOR, '#reports-list tbody tr')
_loader_locator = (By.CLASS_NAME, 'loader')
_crash_reports_tab_locator = (By.CSS_SELECTOR, '#search_results-nav [href="#crash-reports"] span')
_crash_reports_tab_locator = (
By.CSS_SELECTOR,
'#search_results-nav [href="#crash-reports"] span',
)

def wait_for_page_to_load(self):
super(CrashStatsSuperSearch, self).wait_for_page_to_load()
Expand Down Expand Up @@ -101,13 +119,22 @@ def select_match(self, line_id, match):
self.find_element(*self._highlighted_text_locator).click()

def field(self, line_id):
return self.find_element(self._facet_text_locator[0], self._facet_text_locator[1] % line_id).text
return self.find_element(
self._facet_text_locator[0],
self._facet_text_locator[1] % line_id,
).text

def operator(self, line_id):
return self.find_element(self._operator_text_locator[0], self._operator_text_locator[1] % line_id).text
return self.find_element(
self._operator_text_locator[0],
self._operator_text_locator[1] % line_id,
).text

def match(self, line_id):
return self.find_element(self._match_text_locator[0], self._match_text_locator[1] % line_id).text
return self.find_element(
self._match_text_locator[0],
self._match_text_locator[1] % line_id,
).text

@property
def error(self):
Expand Down Expand Up @@ -178,7 +205,9 @@ def table_column_names(self):

def is_column_not_present(self, column_name):
self.wait.until(
lambda s: column_name not in self.table_column_names, message='Column %s found in table header.' % column_name)
lambda s: column_name not in self.table_column_names,
message='Column %s found in table header.' % column_name,
)
return True

class Column(Region):
Expand Down
5 changes: 4 additions & 1 deletion e2e-tests/pages/uuid_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ class UUIDReport(CrashStatsBasePage):

# https://crash-stats.mozilla.com/report/index/<UUID>
_body_uuid_locator = (By.CSS_SELECTOR, '#mainbody #report-header-details code:nth-of-type(1)')
_body_signature_locator = (By.CSS_SELECTOR, '#mainbody #report-header-details code:nth-of-type(2)')
_body_signature_locator = (
By.CSS_SELECTOR,
'#mainbody #report-header-details code:nth-of-type(2)',
)

_table_locator = (By.CSS_SELECTOR, 'table.data-table')
_table_uuid_locator = (By.CSS_SELECTOR, '#report-index tbody tr:nth-of-type(2) td')
Expand Down
72 changes: 72 additions & 0 deletions e2e-tests/requirements/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
six==1.11.0 \
--hash=sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb \
--hash=sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9
mozterm==0.1.0 \
--hash=sha256:005c09ca2eea3d71ae90d8cd01ce9bf137cf8539aa0d6d6eaf94cab34262082e \
--hash=sha256:4ebf8bd772d97c0f557184173f0f96cfca0abfc07e1ae975fbcfa76be50b5561
blessings==1.6.1 \
--hash=sha256:26dbaf2f89c3e6dee11c10f7c0b85756ed75cf602b1bb7935b4efd8ed67a000f \
--hash=sha256:466e43ff45723b272311de0437649df464b33b4daba7a54c69493212958e19c7 \
--hash=sha256:74919575885552e14bc24a68f8b539690bd1b5629180faa830b1a25b8c7fb6ea
zope.interface==4.4.3 \
--hash=sha256:9902d5fc11309e17cdce6574243dc114b9c30de5c60ab53c90f6e3e962688565 \
--hash=sha256:4cb1c56b0356da9a33249ef77a688c47107f54191c12a0055d284b6bee7f447e \
--hash=sha256:a6375035a4b45d199a8b990e3a2f6b71906c318c56dfc14b2d58350b6ca59392 \
--hash=sha256:dec19181cf6af58ccb8ba3fa3ca9d4ec555b2f3cb31f589f6e86d15df0926c31 \
--hash=sha256:ff20038fbc0e7ea050a7e28fcb8ae6ed8378a8d08ac70b848ea39960dda86bbf \
--hash=sha256:f6868378fffbb8651f1f8a767d17e42aed39926c8f6bb9c56f184022fe6c2090 \
--hash=sha256:b8f3491c9df4f0ffed32b275033e74041f420e5dcdefa4b1500d753c64ef42cf \
--hash=sha256:5d8813e438ab67a793b09e1223742b757dd95a4a64d466855a53cb113cc9c9c4 \
--hash=sha256:5a8cc535f4212b134e66a3e1c6b93b19d453dbad0e2f89d0df2c01deefc8cad9 \
--hash=sha256:bd626cd76b7e5cbecac9d3e0dd8f98e3eada15ead95713238a523f877327633d \
--hash=sha256:16fe824b3d93ee0629aa1f04848a1b515d6b5dc9e98cc7a04feaa35fdb0de5f1 \
--hash=sha256:f47d4138405eb67e5f059b9ab74e0a1147adc3277f5fe37d5bae5209b67e89e7 \
--hash=sha256:8dfdc1588db31895f81bcba6c36dc981b4cf4a526c62eae3745bbfbe102477ef \
--hash=sha256:88e3d54e88a601f45d03e2a062d5d16852d20e0863a92c19260ae72e2586378a \
--hash=sha256:3d033abd27cd54157cf42a3bfd4d8c28d7fc5c6f775df3332307d2632a79925b \
--hash=sha256:a21d69de2ee89fc59de93e7a43c0379ecedb5149739ff94e910c2bf0ca18e181 \
--hash=sha256:aef398a5b92e70b8152d2c4850bad0fe185adb50d948f32d0bba5694d82b67c7 \
--hash=sha256:11b068fc9916556f3820f38c2376c28d8e55e4a2c51c34915aaac38b75706d2e \
--hash=sha256:78321a6c0c8cc6ac928e44ef04d50384bc864a7f5e3c25b84110da2ede83739f \
--hash=sha256:4be05f79e952793f31a0c2d6a0672c81a3300315da587ce6a590357595217005 \
--hash=sha256:1d954d557b63124a65f2247ac6ed66fa36df18d1e8538d08c9b432e808a634de \
--hash=sha256:a16a3e07511fb6806bb48c8c661d38cdb91cd4bc6c2b6b0b173e72362ec1ceb4 \
--hash=sha256:d6d26d5dfbfd60c65152938fcb82f949e8dada37c041f72916fef6621ba5c5ce
zope.component==4.4.1 \
--hash=sha256:2776ab93945c8df3781fdcc2126dc7080e9a1d64fef5f76a21550473cbb505bf \
--hash=sha256:1b29aa65413f6dda29e64e2352a6aa13d9ba70078f6b91f328573488788d531c
attrs==17.4.0 \
--hash=sha256:a17a9573a6f475c99b551c0e0a812707ddda1ec9653bed04c13841404ed6f450 \
--hash=sha256:1c7960ccfd6a005cd9f7ba884e6316b5e430a3f1a6c37c5f87d8b43f83b54ec9
funcsigs==1.0.2 \
--hash=sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca \
--hash=sha256:a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50
py==1.5.2 \
--hash=sha256:8cca5c229d225f8c1e3085be4fcf306090b00850fefad892f9d96c7b6e2f310f \
--hash=sha256:ca18943e28235417756316bfada6cd96b23ce60dd532642690dcfdaba988a76d
pluggy==0.6.0 \
--hash=sha256:7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff
pytest-forked==0.2 \
--hash=sha256:e4500cd0509ec4a26535f7d4112a8cc0f17d3a41c29ffd4eab479d2a55b30805 \
--hash=sha256:f275cb48a73fc61a6710726348e1da6d68a978f0ec0c54ece5a5fae5977e5a08
execnet==1.5.0 \
--hash=sha256:fc155a6b553c66c838d1a22dba1dc9f5f505c43285a878c6f74a79c024750b83 \
--hash=sha256:a7a84d5fa07a089186a329528f127c9d73b9de57f1a1131b82bb5320ee651f6a
urllib3==1.22 \
--hash=sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b \
--hash=sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f
certifi==2017.11.5 \
--hash=sha256:244be0d93b71e93fc0a0a479862051414d0e00e16435707e5bf5000f92e04694 \
--hash=sha256:5ec74291ca1136b40f0379e1128ff80e866597e4e2c1e755739a913bbc3613c0
chardet==3.0.4 \
--hash=sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691 \
--hash=sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae
idna==2.6 \
--hash=sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4 \
--hash=sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f
zope.event==4.3.0 \
--hash=sha256:57b5fefd1d92774a7c26d7307b7ad9d0eac2181fd320b2061e69216e2a3b3a07 \
--hash=sha256:e0ecea24247a837c71c106b0341a7a997e3653da820d21ef6c08b32548f733e7
apipkg==1.4 \
--hash=sha256:65d2aa68b28e7d31233bb2ba8eb31cda40e4671f8ac2d6b241e358c9652a74b9 \
--hash=sha256:2e38399dbe842891fe85392601aab8f40a8f4cc5a9053c326de35a1cc0297ac6
33 changes: 33 additions & 0 deletions e2e-tests/requirements/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
mozlog==3.7 \
--hash=sha256:fbcbef51c80cdfee0803b3ecd6260589b9b3bafc085fbc6459314ec56b545327 \
--hash=sha256:414141131c4f5e7242e69a939d2b74f4ed8dbac12bef93eee4e7125cd1a131e9
PyPOM==1.2.0 \
--hash=sha256:f3b0e8af86fda2a05361b1862dcb3267ed316ad49c5a7410981b270e0754d525 \
--hash=sha256:068abbeffee51fcb703357a5db1e7d2b3e8e4ccd9828b8bbe64b0fae6db99365
pytest==3.3.2 \
--hash=sha256:b84878865558194630c6147f44bdaef27222a9f153bbd4a08908b16bf285e0b1 \
--hash=sha256:53548280ede7818f4dc2ad96608b9f08ae2cc2ca3874f2ceb6f97e3583f25bc4
pytest-base-url==1.4.1 \
--hash=sha256:7425e8163345494ac7f544e99c6f3e5a08f4228bee5e26013b98c462a4d31f6e \
--hash=sha256:31e42366a5fc22f450b398837dc819bb7569f5e6bd5d74e494b2b9ec239876d1
pytest-html==1.16.1 \
--hash=sha256:d6ae1ae5d10158d290b603ccf46b5d103e93cf7d67df42bb7d6516fb4f1317f3 \
--hash=sha256:135ea10b9ec0a5e370dc1820a5552d761aa3fec8400eabc0b06646f90f5c820e
pytest-metadata==1.5.1 \
--hash=sha256:26761319ecc916f16dc95f166e41e041d50a6d587d8332300594dfcfda6a7199 \
--hash=sha256:e126a4ab80b77f08d3bc7da6ec1ed053317eaed042690eb5b4272b79a25c7f88
pytest-selenium==1.11.3 \
--hash=sha256:b80ca8cf78411587bddeaef8412c77903a145ce2fd479e8d0a1988e333a31d5a \
--hash=sha256:835b03c5aa05547ce625ce957b7213c810089abce8c3a75e829da89b9b390239
pytest-variables==1.7.0 \
--hash=sha256:d333e1df272f9ef4bf45d8665ee46a4901b11ab52bf661e83174f42f2f83df39 \
--hash=sha256:61a6098175a59af5dbabf4c93ceee81a75f045868078903c44e2edb9582d5d6e
pytest-xdist==1.21.0 \
--hash=sha256:0b8622435e3c0650a8d5a07b73a7f9c4f79b52d7ed060536a6041f0da423ba8e \
--hash=sha256:74b18cc78abb334bfaaac223d82565be1ebcecf85c66a3cabe3ede8f86e16943
selenium==3.8.1 \
--hash=sha256:5acb9cdbc2d1a7fbb3e16a8ce9246211cc371f0367ad9c6bc2273cca60a6b045 \
--hash=sha256:9abd2dbd4a5e9b778483ce7e5adf1ea9364fcbc29da488e979213c825a1515d3
requests==2.18.4 \
--hash=sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b \
--hash=sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e
13 changes: 11 additions & 2 deletions e2e-tests/tests/test_crash_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ def test_that_bugzilla_link_contain_current_site(self, base_url, selenium):
assert 'bug_file_loc=%s%s' % (base_url, path) in urllib.unquote(csp.link_to_bugzilla)

@pytest.mark.nondestructive
def test_that_exploitable_crash_report_is_not_displayed_for_logged_out_users(self, base_url, selenium):
def test_that_exploitable_crash_report_is_not_displayed_for_logged_out_users(
self,
base_url,
selenium
):
csp = CrashStatsHomePage(selenium, base_url).open()
assert 'Exploitable Crashes' not in csp.header.report_list
csp.selenium.get(base_url + self._exploitability_url)
Expand All @@ -46,7 +50,12 @@ def test_that_reports_form_has_same_product(self, base_url, selenium, product):

@pytest.mark.nondestructive
@pytest.mark.parametrize('product', _expected_products)
def test_that_current_version_selected_in_top_crashers_header(self, base_url, selenium, product):
def test_that_current_version_selected_in_top_crashers_header(
self,
base_url,
selenium,
product
):
csp = CrashStatsHomePage(selenium, base_url).open()
csp.header.select_product(product)
cstc = csp.header.select_report('Top Crashers')
Expand Down
5 changes: 4 additions & 1 deletion e2e-tests/tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ def test_search_change_column(self, base_url, selenium):

# verify simple search terms have persisted
assert 'Firefox' == cs_super.selected_products
assert cs_super.columns[0].column_name in cs_super.search_results_table_header.table_column_names
assert (
cs_super.columns[0].column_name in
cs_super.search_results_table_header.table_column_names
)

@pytest.mark.nondestructive
def test_search_with_one_line(self, base_url, selenium):
Expand Down
Loading

0 comments on commit 3e93f0e

Please sign in to comment.