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

Commit

Permalink
resolved the confilts.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlinT committed Sep 28, 2011
2 parents 9c75d0b + 69398be commit d8fad11
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 26 deletions.
74 changes: 65 additions & 9 deletions crash_stats_page.py
Expand Up @@ -20,6 +20,8 @@
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): David Burns
# Teodosia Pop <teodosia.pop@softvision.ro>
# Alin Trif <alin.trif@softvision.ro>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
Expand Down Expand Up @@ -97,6 +99,8 @@ def select_report(self, report_name):
return CrashStatsTopCrashersBySite(self.testsetup)
elif 'Crashes per User' == report_name:
return CrashStatsPerActiveDailyUser(self.testsetup)
elif 'Top Changers' == report_name:
return CrashStatsTopChangers(self.testsetup)

def click_server_status(self):
self.sel.click('link=Server Status')
Expand Down Expand Up @@ -128,6 +132,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 @@ -176,7 +181,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 @@ -201,6 +206,7 @@ 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"
Expand Down Expand Up @@ -296,11 +302,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 @@ -309,16 +320,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 @@ -329,17 +356,20 @@ def product_list(self):
return self.sel.get_select_options(self._product_multiple_select)


class CrashStatsSearchResults(CrashStatsBasePage):
class CrashStatsSignatureReport(CrashStatsBasePage):

_product_select = 'id=product'
_version_select = 'id=version'
_os_select = 'id=platform'
_filter_crash_reports_button = 'id=query_submit'
# 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 @@ -362,8 +392,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 +408,13 @@ def product_header(self):
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 Expand Up @@ -469,3 +511,17 @@ def click_product(self, product):
self.sel.click('%s:contains(%s) a' % (self._root_locator, product))
self.sel.wait_for_page_to_load(self.timeout)
return CrashStatsHomePage(self.testsetup, product)


class CrashStatsTopChangers(CrashStatsBasePage):

_report_locator = 'id=report_select'

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

@property
def is_top_changers_highlighted(self):
selected_report = self.sel.get_selected_label(self._report_locator)
return (selected_report == 'Top Changers')
31 changes: 30 additions & 1 deletion test_crash_reports.py
Expand Up @@ -20,6 +20,8 @@
# the Initial Developer. All Rights Reserved.
#
# Contributor(s): David Burns
# Teodosia Pop <teodosia.pop@softvision.ro>
# Alin Trif <alin.trif@softvision.ro>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
Expand All @@ -36,14 +38,17 @@
# ***** 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 crash_stats_page import ProductsLinksPage
from unittestzero import Assert
import pytest
import mozwebqa


xfail = pytest.mark.xfail


class TestCrashReports:

def test_that_reports_form_has_same_product_for_firefox(self, mozwebqa):
Expand Down Expand Up @@ -265,6 +270,19 @@ def test_that_current_version_selected_in_top_crashers_by_domain_header_for_fenn
#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)

def test_that_products_page_links_work(self, mozwebqa):
self.selenium = mozwebqa.selenium
products_page = ProductsLinksPage(mozwebqa)
Expand All @@ -276,3 +294,14 @@ def test_that_products_page_links_work(self, mozwebqa):
csp = products_page.click_product(product)
Assert.contains(product, csp.get_url_current_page())
products_page = ProductsLinksPage(mozwebqa)

@xfail(reason="Disabled until Bug 603561 is fixed")
def test_that_top_changers_is_highlighted_when_chosen(self, mozwebqa):
""" Test for https://bugzilla.mozilla.org/show_bug.cgi?id=679229"""
self.selenium = mozwebqa.selenium
csp = CrashStatsHomePage(mozwebqa)
for version in csp.current_details['versions']:
if not csp.can_find_text('no data'):
csp.select_version(version)
cstc = csp.select_report('Top Changers')
Assert.true(cstc.is_top_changers_highlighted)
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 d8fad11

Please sign in to comment.