Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 461 lines (339 sloc) 16.983 kb
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
1 #!/usr/bin/env python
96f3c51 Migrate to MPL2
Zac authored
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
5
99c60d5 @AlinT Just a preview
AlinT authored
6 from selenium.webdriver.common.by import By
943c12f First step towards removing can_find_text
Zac authored
7 from selenium.common.exceptions import NoSuchElementException
5d19215 Merge CrashReportList and CrashStatsTopCrasher page objects
Zac authored
8 from selenium.webdriver.support.ui import WebDriverWait
b68f3f3 Revise imports
Zac authored
9 from pages.page import Page
66205ff Split base page into its own file
Zac authored
10 from pages.base import CrashStatsBasePage
99c60d5 @AlinT Just a preview
AlinT authored
11 from selenium.webdriver.support.select import Select
609a1df @AlinT Merge remote-tracking branch 'mozilla/master' into test_that_links_from_...
AlinT authored
12
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
13
14 class CrashStatsHomePage(CrashStatsBasePage):
15 '''
16 Page Object for Socorro
ab5c082 Week's work on Sorocco. 2 new tests and minor changes to PO to accomodat...
Zac authored
17 https://crash-stats.allizom.org/
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
18 '''
c3948e3 Refactor homepage PO and release channel region
Zac authored
19 _release_channels_locator = (By.CSS_SELECTOR, '.release_channel')
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
20
6a8495c Fix for test_that_current_version_selected_in_top_crashers_header_for_se...
unknown authored
21 def __init__(self, testsetup, product=None):
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
22 '''
23 Creates a new instance of the class and gets the page ready for testing
24 '''
24eaea9 Changing from Seleniumsetup to Testsetup part II
Tobias Markus authored
25 CrashStatsBasePage.__init__(self, testsetup)
609a1df @AlinT Merge remote-tracking branch 'mozilla/master' into test_that_links_from_...
AlinT authored
26
b8d6c73 work
Zac authored
27 if product is None:
99c60d5 @AlinT Just a preview
AlinT authored
28 self.selenium.get(self.base_url)
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
29
3dc51c5 Adapting test to new site
Tobias Markus authored
30 def click_first_product_top_crashers_link(self):
c3948e3 Refactor homepage PO and release channel region
Zac authored
31 return self.release_channels[0].click_top_crasher()
2478dbf Getting first valid signature (not null) instead of signature by name
Tobias Markus authored
32
33 @property
c3948e3 Refactor homepage PO and release channel region
Zac authored
34 def release_channels(self):
35 return [self.ReleaseChannels(self.testsetup, element) for element in self.selenium.find_elements(*self._release_channels_locator)]
0bf6130 @AlinT Ensure that links to topcrasher reports work
AlinT authored
36
c3948e3 Refactor homepage PO and release channel region
Zac authored
37 class ReleaseChannels(CrashStatsBasePage):
0bf6130 @AlinT Ensure that links to topcrasher reports work
AlinT authored
38
c3948e3 Refactor homepage PO and release channel region
Zac authored
39 _release_channel_header_locator = (By.TAG_NAME, 'h4')
40 _top_crashers_link_locator = (By.LINK_TEXT, 'Top Crashers')
0bf6130 @AlinT Ensure that links to topcrasher reports work
AlinT authored
41
99c60d5 @AlinT Just a preview
AlinT authored
42 def __init__(self, testsetup, element):
0bf6130 @AlinT Ensure that links to topcrasher reports work
AlinT authored
43 CrashStatsBasePage.__init__(self, testsetup)
c2dbb3c @AlinT Updated according to comments
AlinT authored
44 self._root_element = element
0bf6130 @AlinT Ensure that links to topcrasher reports work
AlinT authored
45
46 @property
c3948e3 Refactor homepage PO and release channel region
Zac authored
47 def product_version_label(self):
48 return self._root_element.find_element(*self._release_channel_header_locator).text
0bf6130 @AlinT Ensure that links to topcrasher reports work
AlinT authored
49
50 def click_top_crasher(self):
c3948e3 Refactor homepage PO and release channel region
Zac authored
51 self._root_element.find_element(*self._top_crashers_link_locator).click()
0bf6130 @AlinT Ensure that links to topcrasher reports work
AlinT authored
52 return CrashStatsTopCrashers(self.testsetup)
53
0bd7b69 Revise locators and failure messages
Zac authored
54
cd02772 @AlinT Fixed all the failing tests.
AlinT authored
55 class CrashReport(Page):
0bd7b69 Revise locators and failure messages
Zac authored
56
5d19215 Merge CrashReportList and CrashStatsTopCrasher page objects
Zac authored
57 _reports_tab_locator = (By.ID, 'reports')
cd02772 @AlinT Fixed all the failing tests.
AlinT authored
58 _reports_row_locator = (By.CSS_SELECTOR, '#reportsList tbody tr')
5d19215 Merge CrashReportList and CrashStatsTopCrasher page objects
Zac authored
59 _report_tab_button_locator = (By.CSS_SELECTOR, '#report-list-nav li:nth-of-type(4) > a')
25263ac @AlinT debugging part 1
AlinT authored
60
61 @property
cd02772 @AlinT Fixed all the failing tests.
AlinT authored
62 def reports(self):
63 return [self.Report(self.testsetup, element) for element in self.selenium.find_elements(*self._reports_row_locator)]
25263ac @AlinT debugging part 1
AlinT authored
64
cd02772 @AlinT Fixed all the failing tests.
AlinT authored
65 def click_reports(self):
5d19215 Merge CrashReportList and CrashStatsTopCrasher page objects
Zac authored
66 self.selenium.find_element(*self._report_tab_button_locator).click()
1245595 Change is_visible, use None where parent element not valid
Zac authored
67 WebDriverWait(self.selenium, 10).until(lambda s: self.is_element_visible(None, *self._reports_tab_locator))
25263ac @AlinT debugging part 1
AlinT authored
68
cd02772 @AlinT Fixed all the failing tests.
AlinT authored
69 class Report(Page):
70 _product_locator = (By.CSS_SELECTOR, 'td:nth-of-type(3)')
71 _version_locator = (By.CSS_SELECTOR, 'td:nth-of-type(4)')
25263ac @AlinT debugging part 1
AlinT authored
72
73 def __init__(self, testsetup, element):
74 Page.__init__(self, testsetup)
75 self._root_element = element
76
77 @property
78 def product(self):
79 return self._root_element.find_element(*self._product_locator).text
80
cd02772 @AlinT Fixed all the failing tests.
AlinT authored
81 @property
82 def version(self):
83 return self._root_element.find_element(*self._version_locator).text
84
25263ac @AlinT debugging part 1
AlinT authored
85
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
86 class CrashStatsAdvancedSearch(CrashStatsBasePage):
ab5c082 Week's work on Sorocco. 2 new tests and minor changes to PO to accomodat...
Zac authored
87 #https://crash-stats.allizom.org/query/query
88 # This po covers both initial adv search page and also results
99c60d5 @AlinT Just a preview
AlinT authored
89 _page_title = 'Query Results - Mozilla Crash Reports'
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
90
99c60d5 @AlinT Just a preview
AlinT authored
91 _product_multiple_select = (By.ID, 'product')
92 _version_multiple_select = (By.ID, 'version')
93 _os_multiple_select = (By.ID, 'platform')
94 _filter_crash_reports_button = (By.ID, 'query_submit')
c333cec Update advanced search page object and associated tests.
Zac authored
95 _query_results_text = (By.CSS_SELECTOR, '.body.notitle > p:nth-child(1)')
96 _no_results_text = (By.CSS_SELECTOR, '.body.notitle > p:nth-child(2)')
99c60d5 @AlinT Just a preview
AlinT authored
97 _build_id_locator = (By.ID, 'build_id')
c333cec Update advanced search page object and associated tests.
Zac authored
98 _report_process_base_locator = (By.XPATH, "//p[span[preceding-sibling::span[text()='Report Process:']]]")
99 _report_type_base_locator = (By.XPATH, "//p[span[preceding-sibling::span[text()='Report Type:']]]")
100
101 _next_locator = (By.XPATH, "//div[@class='pagination']/a[contains(text(), 'Next')]")
abbee15 refactor results table
Bebe authored
102 _table_row_locator = (By.CSS_SELECTOR, '#signatureList > tbody > tr')
b827444 @AlinT Test that reports are filtered by plugin/browser type
AlinT authored
103
ab5c082 Week's work on Sorocco. 2 new tests and minor changes to PO to accomodat...
Zac authored
104 def adv_select_product(self, product):
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
105 element = self.selenium.find_element(*self._product_multiple_select)
106 select = Select(element)
107 select.select_by_visible_text(product)
69398be Merge branch 'newtests'
Zac authored
108
ab5c082 Week's work on Sorocco. 2 new tests and minor changes to PO to accomodat...
Zac authored
109 def adv_select_version(self, version):
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
110 element = self.selenium.find_element(*self._version_multiple_select)
111 select = Select(element)
112 select.select_by_visible_text(version)
69398be Merge branch 'newtests'
Zac authored
113
c333cec Update advanced search page object and associated tests.
Zac authored
114 def deselect_version(self):
115 element = self.selenium.find_element(*self._version_multiple_select)
116 select = Select(element)
117 select.deselect_all()
118
ab5c082 Week's work on Sorocco. 2 new tests and minor changes to PO to accomodat...
Zac authored
119 def adv_select_os(self, os):
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
120 element = self.selenium.find_element(*self._os_multiple_select)
121 select = Select(element)
122 select.select_by_visible_text(os)
ab5c082 Week's work on Sorocco. 2 new tests and minor changes to PO to accomodat...
Zac authored
123
cb61280 Fix the click_filter_reports in smoke_test
Zac authored
124 @property
125 def product_list(self):
126 element = self.selenium.find_element(*self._product_multiple_select)
127 return Select(element).options
128
c333cec Update advanced search page object and associated tests.
Zac authored
129 def click_filter_reports(self):
99c60d5 @AlinT Just a preview
AlinT authored
130 self.selenium.find_element(*self._filter_crash_reports_button).click()
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
131
132 def click_first_signature(self):
c333cec Update advanced search page object and associated tests.
Zac authored
133 return self.results[0].click_signature()
69398be Merge branch 'newtests'
Zac authored
134
efdd3af @AlinT Updated according to comments
AlinT authored
135 def build_id_field_input(self, value):
99c60d5 @AlinT Just a preview
AlinT authored
136 self.selenium.find_element(*self._build_id_locator).send_keys(value)
159e6d3 @AlinT Verify search for a given BuildID
AlinT authored
137
ab5c082 Week's work on Sorocco. 2 new tests and minor changes to PO to accomodat...
Zac authored
138 @property
e872e50 @AlinT Removed get...
AlinT authored
139 def build_id(self):
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
140 return str(self.selenium.execute_script('navigator.buildID'))
677bf8a @AlinT Removed the hard-coded input of the build id and added a method to get t...
AlinT authored
141
142 @property
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
143 def currently_selected_product(self):
99c60d5 @AlinT Just a preview
AlinT authored
144 element = self.selenium.find_element(*self._product_multiple_select)
145 select = Select(element)
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
146 return select.first_selected_option.text
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
147
c333cec Update advanced search page object and associated tests.
Zac authored
148 def select_report_process(self, lookup):
149 base = self.selenium.find_element(*self._report_process_base_locator)
150 input_element = base.find_element(By.XPATH, "//label[normalize-space(text())='%s']/input" % lookup)
151 input_element.click()
abbee15 refactor results table
Bebe authored
152
c333cec Update advanced search page object and associated tests.
Zac authored
153 def select_report_type(self, lookup):
154 base = self.selenium.find_element(*self._report_type_base_locator)
155 input_element = base.find_element(By.XPATH, "//label[normalize-space(text())='%s']/input" % lookup)
156 input_element.click()
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
157
c333cec Update advanced search page object and associated tests.
Zac authored
158 @property
159 def results_lead_in_text(self):
160 return self.selenium.find_element(*self._query_results_text).text
abbee15 refactor results table
Bebe authored
161
7488b1c added necesary methods
bebef1987 authored
162 @property
163 def results_found(self):
164 try:
abbee15 refactor results table
Bebe authored
165 self.selenium.find_element(*self._table_row_locator)
166 return True
7488b1c added necesary methods
bebef1987 authored
167 except NoSuchElementException:
168 return False
169
09134c1 Create test for bug 562380
Zac authored
170 @property
c333cec Update advanced search page object and associated tests.
Zac authored
171 def no_results_text(self):
172 return self.selenium.find_element(*self._no_results_text).text
173
174 def click_next(self):
175 self.selenium.find_element(*self._next_locator).click()
176
177 @property
178 def is_next_visible(self):
179 return self.is_element_visible(None, *self._next_locator)
180
181 @property
abbee15 refactor results table
Bebe authored
182 def results(self):
183 return [self.Result(self.testsetup, row) for row in self.selenium.find_elements(*self._table_row_locator)]
184
c333cec Update advanced search page object and associated tests.
Zac authored
185 @property
186 def results_table_header(self):
187 return self.ResultHeader(self.testsetup)
188
abbee15 refactor results table
Bebe authored
189 class Result(Page):
190 _columns_locator = (By.CSS_SELECTOR, 'td')
c333cec Update advanced search page object and associated tests.
Zac authored
191 _browser_icon_locator = (By.CSS_SELECTOR, 'div.signature-icons > img.browser')
192 _plugin_icon_locator = (By.CSS_SELECTOR, 'div.signature-icons > img.plugin')
193 _link_locator = (By.TAG_NAME, 'a')
194
abbee15 refactor results table
Bebe authored
195 def __init__(self, testsetup, row):
196 Page.__init__(self, testsetup)
197 self._columns = row.find_elements(*self._columns_locator)
09134c1 Create test for bug 562380
Zac authored
198
abbee15 refactor results table
Bebe authored
199 @property
200 def signature(self):
201 return self._columns[1].text
b827444 @AlinT Test that reports are filtered by plugin/browser type
AlinT authored
202
abbee15 refactor results table
Bebe authored
203 def click_signature(self):
c333cec Update advanced search page object and associated tests.
Zac authored
204 self._columns[1].find_element(*self._link_locator).click()
abbee15 refactor results table
Bebe authored
205 return CrashStatsSignatureReport(self.testsetup)
206
207 @property
208 def is_plugin_icon_visible(self):
c333cec Update advanced search page object and associated tests.
Zac authored
209 return self.is_element_visible(self._columns[1], *self._plugin_icon_locator)
abbee15 refactor results table
Bebe authored
210
211 @property
212 def is_browser_icon_visible(self):
c333cec Update advanced search page object and associated tests.
Zac authored
213 return self.is_element_visible(self._columns[1], *self._browser_icon_locator)
abbee15 refactor results table
Bebe authored
214
215 @property
216 def plugin_filename(self):
217 return self._columns[2].text
218
219 @property
220 def number_of_crashes(self):
c333cec Update advanced search page object and associated tests.
Zac authored
221 return self._columns[-4].text
b827444 @AlinT Test that reports are filtered by plugin/browser type
AlinT authored
222
abbee15 refactor results table
Bebe authored
223 class ResultHeader(Page):
c333cec Update advanced search page object and associated tests.
Zac authored
224
225 _root_locator = (By.CSS_SELECTOR, '#signatureList thead')
226 _sort_by_filename_locator = (By.XPATH, "//th[text()='Plugin Filename']")
227 _sorted_column_locator = (By.CSS_SELECTOR, "th[class*='headerSort']")
09134c1 Create test for bug 562380
Zac authored
228
c333cec Update advanced search page object and associated tests.
Zac authored
229 def __init__(self, testsetup):
abbee15 refactor results table
Bebe authored
230 Page.__init__(self, testsetup)
c333cec Update advanced search page object and associated tests.
Zac authored
231 self._root_element = self.selenium.find_element(*self._root_locator)
abbee15 refactor results table
Bebe authored
232
c333cec Update advanced search page object and associated tests.
Zac authored
233 def click_sort_by_plugin_filename(self):
234 self._root_element.find_element(*self._sort_by_filename_locator).click()
abbee15 refactor results table
Bebe authored
235
236 @property
c333cec Update advanced search page object and associated tests.
Zac authored
237 def sort_order(self):
238 return self._root_element.find_element(*self._sorted_column_locator).get_attribute('class').split()[1]
09134c1 Create test for bug 562380
Zac authored
239
c333cec Update advanced search page object and associated tests.
Zac authored
240 @property
241 def sorted_column(self):
242 return self._root_element.find_element(*self._sorted_column_locator).text
159e6d3 @AlinT Verify search for a given BuildID
AlinT authored
243
ab5c082 Week's work on Sorocco. 2 new tests and minor changes to PO to accomodat...
Zac authored
244 class CrashStatsSignatureReport(CrashStatsBasePage):
0bf6130 @AlinT Ensure that links to topcrasher reports work
AlinT authored
245
ab5c082 Week's work on Sorocco. 2 new tests and minor changes to PO to accomodat...
Zac authored
246 # https://crash-stats.allizom.org/report/list?
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
247
99c60d5 @AlinT Just a preview
AlinT authored
248 _total_items = (By.CSS_SELECTOR, 'span.totalItems')
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
249 _reports_page_locator = (By.CSS_SELECTOR, '.ui-state-default.ui-corner-top:nth-of-type(4) > a > span')
250
251 def click_reports(self):
252 self.selenium.find_element(*self._reports_page_locator).click()
ab5c082 Week's work on Sorocco. 2 new tests and minor changes to PO to accomodat...
Zac authored
253
254 @property
255 def total_items_label(self):
99c60d5 @AlinT Just a preview
AlinT authored
256 return self.selenium.find_element(*self._total_items).text.replace(",", "")
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
257
258
259 class CrashStatsPerActiveDailyUser(CrashStatsBasePage):
260
f3a3a65 Added test for bug 630991
unknown authored
261 _page_title = 'Crashes per Active Daily User for Firefox'
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
262
99c60d5 @AlinT Just a preview
AlinT authored
263 _product_select_locator = (By.ID, 'daily_search_version_form_products')
264 _date_start_locator = (By.CSS_SELECTOR, '.daily_search_body .date[name="date_start"]')
265 _generate_button_locator = (By.ID, 'daily_search_version_form_submit')
266 _table_locator = (By.ID, 'crash_data')
267 _row_table_locator = (By.CSS_SELECTOR, '#crash_data > tbody > tr')
268 _last_row_date_locator = (By.CSS_SELECTOR, '#crash_data > tbody > tr > td:nth-child(1):not(:last):last')
269
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
270 @property
271 def product_select(self):
99c60d5 @AlinT Just a preview
AlinT authored
272 element = self.selenium.find_element(*self._product_select_locator)
273 select = Select(element)
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
274 return select.first_selected_option.text
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
275
10e04b4 @AlinT Modified according to comments
AlinT authored
276 def type_start_date(self, date):
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
277 date_element = self.selenium.find_element(*self._date_start_locator)
278 date_element.clear()
279 date_element.send_keys(date)
2d84cf9 @AlinT Bug 607875 - Filtering the list for a date range with start date being i...
AlinT authored
280
281 def click_generate_button(self):
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
282 self.selenium.find_element(*self._generate_button_locator).click()
2d84cf9 @AlinT Bug 607875 - Filtering the list for a date range with start date being i...
AlinT authored
283
284 @property
f3a3a65 Added test for bug 630991
unknown authored
285 def is_mixed_content_warning_shown(self):
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
286 return self.is_alert_present()
f3a3a65 Added test for bug 630991
unknown authored
287
288 @property
2d84cf9 @AlinT Bug 607875 - Filtering the list for a date range with start date being i...
AlinT authored
289 def is_table_visible(self):
1245595 Change is_visible, use None where parent element not valid
Zac authored
290 return self.is_element_visible(None, *self._table_locator)
2d84cf9 @AlinT Bug 607875 - Filtering the list for a date range with start date being i...
AlinT authored
291
10e04b4 @AlinT Modified according to comments
AlinT authored
292 @property
293 def table_row_count(self):
99c60d5 @AlinT Just a preview
AlinT authored
294 return len(self.selenium.find_elements(self._row_table_locator))
10e04b4 @AlinT Modified according to comments
AlinT authored
295
296 @property
297 def last_row_date_value(self):
99c60d5 @AlinT Just a preview
AlinT authored
298 return self.selenium.find_element(*self._last_row_date_locator).text
10e04b4 @AlinT Modified according to comments
AlinT authored
299
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
300
301 class CrashStatsTopCrashers(CrashStatsBasePage):
302
4e09ab1 Renamed properties
Zac authored
303 _page_heading_product_locator = (By.ID, 'current-product')
304 _page_heading_version_locator = (By.ID, 'current-version')
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
305
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
306 _filter_by_locator = (By.CSS_SELECTOR, '.tc-duration-type.tc-filter > li > a')
307 _filter_days_by_locator = (By.CSS_SELECTOR, '.tc-duration-days.tc-filter > li > a')
99c60d5 @AlinT Just a preview
AlinT authored
308 _current_days_filter_locator = (By.CSS_SELECTOR, 'ul.tc-duration-days li a.selected')
5d19215 Merge CrashReportList and CrashStatsTopCrasher page objects
Zac authored
309 _current_filter_type_locator = (By.CSS_SELECTOR, 'ul.tc-duration-type li a.selected')
310
311 _data_table = (By.ID, 'signatureList')
312 _signature_table_row_locator = (By.CSS_SELECTOR, '#signatureList tbody tr')
ab5c082 Week's work on Sorocco. 2 new tests and minor changes to PO to accomodat...
Zac authored
313
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
314 @property
4e09ab1 Renamed properties
Zac authored
315 def page_heading_product(self):
316 return self.selenium.find_element(*self._page_heading_product_locator).text
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
317
318 @property
4e09ab1 Renamed properties
Zac authored
319 def page_heading_version(self):
320 return self.selenium.find_element(*self._page_heading_version_locator).text
0bf6130 @AlinT Ensure that links to topcrasher reports work
AlinT authored
321
ab5c082 Week's work on Sorocco. 2 new tests and minor changes to PO to accomodat...
Zac authored
322 @property
5d19215 Merge CrashReportList and CrashStatsTopCrasher page objects
Zac authored
323 def results_count(self):
324 return len(self.selenium.find_elements(*self._signature_table_row_locator))
325
326 @property
327 def results_found(self):
328 try:
329 return self.results_count > 0
330 except NoSuchElementException:
331 return False
0bf6130 @AlinT Ensure that links to topcrasher reports work
AlinT authored
332
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
333 def click_filter_by(self, option):
334 for element in self.selenium.find_elements(*self._filter_by_locator):
335 if element.text == option:
336 element.click()
337 return CrashStatsTopCrashers(self.testsetup)
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
338
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
339 def click_filter_days_by(self, days):
df17b76 Added test for bug 655506.
unknown authored
340 '''
341 Click on the link with the amount of days you want to filter by
342 '''
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
343 for element in self.selenium.find_elements(*self._filter_days_by_locator):
344 if element.text == days:
345 element.click()
346 return CrashStatsTopCrashers(self.testsetup)
df17b76 Added test for bug 655506.
unknown authored
347
8824794 @AlinT Bug 691842 - ensure results are returned for all releases
AlinT authored
348 @property
71dd153 @AlinT updated according to zac's comment
AlinT authored
349 def current_days_filter(self):
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
350 return self.selenium.find_element(*self._current_days_filter_locator).text
6e7245b @AlinT Test that 7 days is selected default for nightly builds
AlinT authored
351
5d19215 Merge CrashReportList and CrashStatsTopCrasher page objects
Zac authored
352 @property
353 def current_filter_type(self):
354 return self.selenium.find_element(*self._current_filter_type_locator).text
355
356 @property
357 def signature_items(self):
358 return [self.SignatureItem(self.testsetup, i) for i in self.selenium.find_elements(*self._signature_table_row_locator)]
359
360 @property
361 def valid_signature_items(self):
362 return [self.SignatureItem(self.testsetup, i) for i in self.selenium.find_elements(*self._signature_table_row_locator) if i.text != 'empty signature']
363
364 def click_first_valid_signature(self):
365 return self.valid_signature_items[0].click()
366
367 @property
368 def first_valid_signature_text(self):
369 return self.valid_signature_items[0].text
370
371 class SignatureItem(Page):
372 _signature_link_locator = (By.CSS_SELECTOR, 'a.signature')
0bd7b69 Revise locators and failure messages
Zac authored
373 _browser_icon_locator = (By.CSS_SELECTOR, 'div img.browser')
374 _plugin_icon_locator = (By.CSS_SELECTOR, 'div img.plugin')
5d19215 Merge CrashReportList and CrashStatsTopCrasher page objects
Zac authored
375
376 def __init__(self, testsetup, element):
377 Page.__init__(self, testsetup)
378 self._root_element = element
379
380 def click(self):
381 self._root_element.find_element(*self._signature_link_locator).click()
382 return CrashReport(self.testsetup)
383
384 @property
385 def text(self):
386 return self._root_element.find_element(*self._signature_link_locator).text
387
388 @property
389 def is_plugin_icon_visible(self):
390 return self.is_element_visible(self._root_element, *self._plugin_icon_locator)
391
392 @property
393 def is_browser_icon_visible(self):
394 return self.is_element_visible(self._root_element, *self._browser_icon_locator)
159e6d3 @AlinT Verify search for a given BuildID
AlinT authored
395
0bd7b69 Revise locators and failure messages
Zac authored
396
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
397 class CrashStatsTopCrashersBySite(CrashStatsBasePage):
398
99c60d5 @AlinT Just a preview
AlinT authored
399 _product_header_locator = (By.ID, 'tcburl-product')
400 _product_version_header_locator = (By.ID, 'tcburl-version')
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
401
402 @property
403 def product_header(self):
99c60d5 @AlinT Just a preview
AlinT authored
404 return self.selenium.find_element(*self._product_header_locator).text
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
405
406 @property
407 def product_version_header(self):
99c60d5 @AlinT Just a preview
AlinT authored
408 return self.selenium.find_element(self._product_version_header_locator).text
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
409
410
b8e4323 @AlinT Work in Progress
AlinT authored
411 class CrashStatsNightlyBuilds(CrashStatsBasePage):
412
99c60d5 @AlinT Just a preview
AlinT authored
413 _link_to_ftp_locator = (By.CSS_SELECTOR, '.notitle > p > a')
b8e4323 @AlinT Work in Progress
AlinT authored
414
415 @property
a3768ba @AlinT Ensure that nightly builds are shown and links work
AlinT authored
416 def link_to_ftp(self):
99c60d5 @AlinT Just a preview
AlinT authored
417 return self.selenium.find_element(*self._link_to_ftp_locator).get_attribute('href')
a3768ba @AlinT Ensure that nightly builds are shown and links work
AlinT authored
418
419 def click_link_to_ftp(self):
99c60d5 @AlinT Just a preview
AlinT authored
420 self.selenium.find_element(*self._link_to_ftp_locator).click()
58e9c8d @AlinT splitting test into tests
AlinT authored
421
b8e4323 @AlinT Work in Progress
AlinT authored
422
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
423 class CrashStatsStatus(CrashStatsBasePage):
424
99c60d5 @AlinT Just a preview
AlinT authored
425 _at_a_glance_locator = (By.CSS_SELECTOR, 'div.panel > div > table.server_status')
426 _graphs_locator = (By.CSS_SELECTOR, 'div.panel > div > div.server-status-graph')
427 _latest_raw_stats_locator = (By.CSS_SELECTOR, 'div.panel > div > table#server-stats-table')
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
428
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
429 @property
be5496c Update locators for server status page test, refactor at the same time.
Zac authored
430 def is_at_a_glance_present(self):
0436892 Change to is_element_visible
Zac authored
431 return self.is_element_visible(None, *self._at_a_glance_locator)
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
432
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
433 @property
be5496c Update locators for server status page test, refactor at the same time.
Zac authored
434 def are_graphs_present(self):
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
435 return len(self.selenium.find_elements(*self._graphs_locator)) == 4
00a5f89 Bug 612938 Initial commit of tests
dburns@mozilla.com authored
436
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
437 @property
be5496c Update locators for server status page test, refactor at the same time.
Zac authored
438 def is_latest_raw_stats_present(self):
0436892 Change to is_element_visible
Zac authored
439 return self.is_element_visible(None, *self._latest_raw_stats_locator)
4e7d5bd @teodosia Test for bug Bug 603561-"Top Changers" option isn't highlighted when cho...
teodosia authored
440
441
9c75d0b @AlinT Bug 638111 - Make sure links from Product pages work
AlinT authored
442 class ProductsLinksPage(CrashStatsBasePage):
443
f6501e7 Tidy up ProductLinksPage page object
Zac authored
444 _heading_locator = (By.CSS_SELECTOR, '.title h2')
9c75d0b @AlinT Bug 638111 - Make sure links from Product pages work
AlinT authored
445
446 def __init__(self, testsetup):
447 CrashStatsBasePage.__init__(self, testsetup)
afbc0cd @AlinT Migration of Socorro-tests to Webdriver
AlinT authored
448 self.selenium.get(self.base_url + '/products/')
9c75d0b @AlinT Bug 638111 - Make sure links from Product pages work
AlinT authored
449
450 @property
f6501e7 Tidy up ProductLinksPage page object
Zac authored
451 def page_heading(self):
452 return self.selenium.find_element(*self._heading_locator).text
9c75d0b @AlinT Bug 638111 - Make sure links from Product pages work
AlinT authored
453
454 def click_product(self, product):
f6501e7 Tidy up ProductLinksPage page object
Zac authored
455 self.selenium.find_element(By.LINK_TEXT, product).click()
456 return CrashStatsHomePage(self.testsetup, product)
d8fad11 @AlinT resolved the confilts.
AlinT authored
457
4e7d5bd @teodosia Test for bug Bug 603561-"Top Changers" option isn't highlighted when cho...
teodosia authored
458 class CrashStatsTopChangers(CrashStatsBasePage):
459
901de60 move Top Changers proprety into header where it belongs
Zac authored
460 pass
Something went wrong with that request. Please try again.