Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Commit

Permalink
Merge branch 'newtests'
Browse files Browse the repository at this point in the history
Conflicts:
	crash_stats_page.py
	test_smoke_tests.py
  • Loading branch information
Zac authored and Zac committed Sep 27, 2011
2 parents b147b3f + 04d5cae commit 69398be
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 29 deletions.
62 changes: 50 additions & 12 deletions crash_stats_page.py
Expand Up @@ -130,6 +130,7 @@ def current_details(self):
class CrashStatsHomePage(CrashStatsBasePage):
'''
Page Object for Socorro
https://crash-stats.allizom.org/
'''
_find_crash_id_or_signature = 'id=q'
_product_select = 'id=products_select'
Expand Down Expand Up @@ -177,7 +178,7 @@ def search_for_crash(self, crash_id_or_signature):
self.sel.type(self._find_crash_id_or_signature, crash_id_or_signature)
self.sel.key_press(self._find_crash_id_or_signature, "\\13")
self.sel.wait_for_page_to_load(self.timeout)
return CrashStatsSearchResults(self.testsetup)
return CrashStatsAdvancedSearch(self.testsetup)

def click_on_top_(self, element):
topElement = 'link=Top ' + element
Expand All @@ -202,7 +203,8 @@ def first_signature(self):


class CrashReportList(CrashStatsBasePage):

# https://crash-stats.allizom.org/topcrasher/byversion/Firefox/7.0a2/7/plugin

_reports_list_locator = 'css=#signatureList tbody tr'
_signature_locator = _reports_list_locator + ":nth-of-type(%s) td:nth-of-type(5) a"
_signature_text_locator = _signature_locator + " span"
Expand Down Expand Up @@ -253,7 +255,7 @@ class CrashReport(CrashStatsBasePage):
_version_locator = " td:nth-of-type(4)"
_row_locator = "css=#reportsList tbody tr"

def __init__(self, testsetup, index, signature = None):
def __init__(self, testsetup, index, signature=None):
CrashStatsBasePage.__init__(self, testsetup)
self.index = index
self._signature = signature
Expand Down Expand Up @@ -297,11 +299,16 @@ def has_valid_signature(self):


class CrashStatsAdvancedSearch(CrashStatsBasePage):
#https://crash-stats.allizom.org/query/query
# This po covers both initial adv search page and also results

_product_multiple_select = 'id=product'
_version_multiple_select = 'id=version'
_os_multiple_select = 'id=platform'
_filter_crash_reports_button = 'id=query_submit'
_data_table = 'id=signatureList'
_data_table_first_signature = 'css=table#signatureList > tbody > tr > td > a'
_data_table_first_signature_results = 'css=table#signatureList > tbody > tr > td:nth-child(3)'

def __init__(self, testsetup):
'''
Expand All @@ -310,16 +317,32 @@ def __init__(self, testsetup):
CrashStatsBasePage.__init__(self, testsetup)
self.wait_for_element_present(self._product_multiple_select)

def adv_select_product(self, product):
self.sel.select(self._product_multiple_select, product)

def adv_select_version(self, version):
self.sel.select(self._version_multiple_select, version)

def adv_select_os(self, os):
self.sel.select(self._os_multiple_select, os)

def filter_reports(self):
self.sel.click(self._filter_crash_reports_button)
self.sel.wait_for_page_to_load(self.timeout)

def click_first_signature(self):
self.wait_for_element_present(self._data_table_first_signature)
signature = self.sel.get_text(self._data_table_first_signature)
self.sel.click(self._data_table_first_signature)
self.sel.wait_for_page_to_load(self.timeout)
return signature
return CrashStatsSignatureReport(self.testsetup)

@property
def first_signature_name(self):
return self.sel.get_text(self._data_table_first_signature)

@property
def first_signature_number_of_results(self):
return self.sel.get_text(self._data_table_first_signature_results)

@property
def currently_selected_product(self):
Expand All @@ -330,17 +353,20 @@ def product_list(self):
return self.sel.get_select_options(self._product_multiple_select)


class CrashStatsSearchResults(CrashStatsBasePage):

_product_select = 'id=product'
_version_select = 'id=version'
_os_select = 'id=platform'
_filter_crash_reports_button = 'id=query_submit'
class CrashStatsSignatureReport(CrashStatsBasePage):

# https://crash-stats.allizom.org/report/list?

def __init__(self, testsetup):
CrashStatsBasePage.__init__(self, testsetup)
self.sel = testsetup.selenium
self.wait_for_element_present(self._product_select)
CrashStatsBasePage.__init__(self, testsetup)

_total_items = "css=span.totalItems"

@property
def total_items_label(self):
return self.sel.get_text(self._total_items).replace(",", "")


class CrashStatsPerActiveDailyUser(CrashStatsBasePage):
Expand All @@ -363,8 +389,13 @@ class CrashStatsTopCrashers(CrashStatsBasePage):
_product_header = 'css=h2 > span.current-product'
_product_version_header = 'css=h2 > span.current-version'

_filter_all = "link=All"

_result_rows = "css=table#signatureList > tbody > tr"

def __init__(self, testsetup):
self.sel = testsetup.selenium
CrashStatsBasePage.__init__(self, testsetup)

@property
def product_header(self):
Expand All @@ -373,6 +404,13 @@ def product_header(self):
@property
def product_version_header(self):
return self.sel.get_text(self._product_version_header)

@property
def count_results(self):
return self.sel.get_css_count(self._result_rows)

def click_filter_all(self):
self.click(self._filter_all, True)


class CrashStatsTopCrashersByUrl(CrashStatsBasePage):
Expand Down
15 changes: 14 additions & 1 deletion test_crash_reports.py
Expand Up @@ -37,7 +37,7 @@
# ***** END LICENSE BLOCK *****

from crash_stats_page import CrashStatsHomePage
from crash_stats_page import CrashStatsSearchResults
from crash_stats_page import CrashStatsAdvancedSearch
from crash_stats_page import CrashStatsPerActiveDailyUser
from unittestzero import Assert
import pytest
Expand Down Expand Up @@ -264,6 +264,19 @@ def test_that_current_version_selected_in_top_crashers_by_domain_header_for_fenn
Assert.equal(details['product'], cstc.product_header)
#Bug 611694 - Disabled till bug fixed
#Assert.true(cstc.product_version_header in details['versions'])

def test_that_top_crasher_filters_return_results(self, mozwebqa):
# https://bugzilla.mozilla.org/show_bug.cgi?id=678906
self.selenium = mozwebqa.selenium
csp = CrashStatsHomePage(mozwebqa)
details = csp.current_details
cstc = csp.select_report('Top Crashers')
if not csp.can_find_text('no data'):
Assert.equal(details['product'], cstc.product_header)

cstc.click_filter_all()
results = cstc.count_results
Assert.true(results > 0, "%s results found, expected >0" % results)

@xfail(reason = "Disabled until Bug 603561 is fixed")
def test_that_top_changers_is_highlighted_when_chosen(self, mozwebqa):
Expand Down
15 changes: 14 additions & 1 deletion test_search.py
Expand Up @@ -36,7 +36,6 @@
# ***** END LICENSE BLOCK *****

from crash_stats_page import CrashStatsHomePage
from crash_stats_page import CrashStatsSearchResults
from unittestzero import Assert
import pytest
xfail = pytest.mark.xfail
Expand Down Expand Up @@ -101,3 +100,17 @@ def test_that_advanced_search_for_seamonkey_can_be_filtered(self, mozwebqa):
cs_advanced = csp.click_advanced_search()
cs_advanced.filter_reports()
Assert.true(cs_advanced.can_find_text('product is one of SeaMonkey'))

def test_that_advanced_search_drilldown_results_are_correct(self, mozwebqa):
# https://bugzilla.mozilla.org/show_bug.cgi?id=679310
self.selenium = mozwebqa.selenium
csp = CrashStatsHomePage(mozwebqa)
cs_advanced = csp.click_advanced_search()

cs_advanced.adv_select_product("Firefox")
cs_advanced.adv_select_version("All")
cs_advanced.filter_reports()

results_page_count = cs_advanced.first_signature_number_of_results
cssr = cs_advanced.click_first_signature()
Assert.equal(results_page_count, cssr.total_items_label)
38 changes: 24 additions & 14 deletions test_smoke_tests.py
Expand Up @@ -38,7 +38,6 @@
# ***** END LICENSE BLOCK *****

from crash_stats_page import CrashStatsHomePage
from crash_stats_page import CrashStatsSearchResults
from unittestzero import Assert
import pytest
xfail = pytest.mark.xfail
Expand Down Expand Up @@ -88,14 +87,14 @@ def test_that_advanced_search_has_thunderbird_highlighted_in_multiselect(self, m
csp.select_product('Thunderbird')
cs_advanced = csp.click_advanced_search()
Assert.equal('Thunderbird', cs_advanced.currently_selected_product)

def test_that_advanced_search_has_fennec_highlighted_in_multiselect(self, mozwebqa):
self.selenium = mozwebqa.selenium
csp = CrashStatsHomePage(mozwebqa)
csp.select_product('Fennec')
cs_advanced = csp.click_advanced_search()
Assert.equal('Fennec', cs_advanced.currently_selected_product)

def test_that_advanced_search_has_camino_highlighted_in_multiselect(self, mozwebqa):
self.selenium = mozwebqa.selenium
csp = CrashStatsHomePage(mozwebqa)
Expand All @@ -116,50 +115,61 @@ def test_that_advanced_search_view_signature_for_firefox_crash(self, mozwebqa):
csp = CrashStatsHomePage(mozwebqa)
cs_advanced = csp.click_advanced_search()
cs_advanced.filter_reports()

if not cs_advanced.can_find_text('No results were found'):
signature = cs_advanced.click_first_signature()
Assert.true(signature in cs_advanced.page_heading)
signature = cs_advanced.first_signature_name
cssr = cs_advanced.click_first_signature()
Assert.contains(signature, cssr.page_heading)

def test_that_advanced_search_view_signature_for_thunderbird_crash(self, mozwebqa):
self.selenium = mozwebqa.selenium
csp = CrashStatsHomePage(mozwebqa)
csp.select_product('Thunderbird')
cs_advanced = csp.click_advanced_search()
cs_advanced.filter_reports()

if not cs_advanced.can_find_text('No results were found'):
signature = cs_advanced.click_first_signature()
Assert.true(signature in cs_advanced.page_heading)
signature = cs_advanced.first_signature_name
cssr = cs_advanced.click_first_signature()
Assert.contains(signature, cssr.page_heading)

def test_that_advanced_search_view_signature_for_fennec_crash(self, mozwebqa):
self.selenium = mozwebqa.selenium
csp = CrashStatsHomePage(mozwebqa)
csp.select_product('Fennec')
cs_advanced = csp.click_advanced_search()
cs_advanced.filter_reports()

if not cs_advanced.can_find_text('No results were found'):
signature = cs_advanced.click_first_signature()
Assert.true(signature in cs_advanced.page_heading)
signature = cs_advanced.first_signature_name
cssr = cs_advanced.click_first_signature()
Assert.contains(signature, cssr.page_heading)

def test_that_advanced_search_view_signature_for_camino_crash(self, mozwebqa):
self.selenium = mozwebqa.selenium
csp = CrashStatsHomePage(mozwebqa)
csp.select_product('Camino')
cs_advanced = csp.click_advanced_search()
cs_advanced.filter_reports()

if not cs_advanced.can_find_text('No results were found'):
signature = cs_advanced.click_first_signature()
Assert.true(signature in cs_advanced.page_heading)
signature = cs_advanced.first_signature_name
cssr = cs_advanced.click_first_signature()
Assert.contains(signature, cssr.page_heading)

def test_that_advanced_search_view_signature_for_seamonkey_crash(self, mozwebqa):
self.selenium = mozwebqa.selenium
csp = CrashStatsHomePage(mozwebqa)
csp.select_product('SeaMonkey')

if not csp.can_find_text('No results were found'):
cs_advanced = csp.click_advanced_search()
cs_advanced.filter_reports()
if not cs_advanced.can_find_text('No results were found'):
signature = cs_advanced.click_first_signature()
Assert.true(signature in cs_advanced.page_heading)

if not cs_advanced.can_find_text('No results were found'):
signature = cs_advanced.first_signature_name
cssr = cs_advanced.click_first_signature()
Assert.contains(signature, cssr.page_heading)

def test_that_simple_querystring_doesnt_return_500(self, mozwebqa):
import urllib
Expand Down
2 changes: 1 addition & 1 deletion test_specific_versions.py
Expand Up @@ -36,7 +36,7 @@
# ***** END LICENSE BLOCK *****

from crash_stats_page import CrashStatsHomePage
from crash_stats_page import CrashStatsSearchResults
from crash_stats_page import CrashStatsAdvancedSearch
import pytest
from unittestzero import Assert
xfail = pytest.mark.xfail
Expand Down

0 comments on commit 69398be

Please sign in to comment.