forked from malini/gaia-ui-tests-1
/
app_details.py
38 lines (29 loc) · 1.5 KB
/
app_details.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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 gaiatest.apps.base import Base
class Details(Base):
_write_review_locator = ('id', 'add-review')
_app_details_locator = ('css selector', '.detail')
_first_review_locator = ('css selector', 'li:first-child .review-inner > span')
_first_review_body_locator = ('css selector', 'li:first-child .body')
def __init__(self, marionette):
Base.__init__(self, marionette)
self.wait_for_element_present(*self._app_details_locator)
@property
def is_app_details_displayed(self):
return self.is_element_displayed(*self._app_details_locator)
@property
def first_review_body(self):
return self.marionette.find_element(*self._first_review_body_locator).text
@property
def first_review_rating(self):
return int(self.marionette.find_element(*self._first_review_locator).get_attribute('class')[-1])
def tap_write_review(self):
self.wait_for_element_present(*self._write_review_locator)
write_review_button = self.marionette.find_element(*self._write_review_locator)
# element.tap() isn't working here
# Bug 878750 - el.tap() and click() do not work on "Write a review" button
write_review_button.tap()
from gaiatest.apps.marketplace.regions.review_box import AddReview
return AddReview(self.marionette)