This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
settings.py
61 lines (46 loc) · 2.36 KB
/
settings.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# 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 marionette.by import By
from gaiatest.apps.base import Base
class Settings(Base):
name = 'Marketplace Dev'
_email_account_field_locator = (By.ID, 'email')
_save_locator = (By.CSS_SELECTOR, 'footer > p > button')
_sign_in_button_locator = (By.CSS_SELECTOR, 'a.button.persona')
_sign_out_button_locator = (By.CSS_SELECTOR, 'a.button.logout')
_back_button_locator = (By.ID, 'nav-back')
_region_select_locator = (By.ID, 'region')
_region_select_value_locator = (By.CSS_SELECTOR, '#region option[selected]')
_save_changes_button_locator = (By.XPATH, "//section[@id='account-settings']//button[text()='Save Changes']")
def __init__(self, marionette):
Base.__init__(self, marionette)
self.wait_for_element_displayed(*self._save_locator)
def tap_back(self):
self.marionette.find_element(*self._back_button_locator).tap()
from gaiatest.apps.marketplace.app import Marketplace
return Marketplace(self.marionette)
def wait_for_sign_in_displayed(self):
self.wait_for_element_displayed(*self._sign_in_button_locator)
def tap_sign_in(self):
self.marionette.find_element(*self._sign_in_button_locator).tap()
from gaiatest.apps.persona.app import Persona
return Persona(self.marionette)
def wait_for_sign_out_button(self):
self.wait_for_element_displayed(*self._sign_out_button_locator)
def tap_sign_out(self):
sign_out_button = self.marionette.find_element(*self._sign_out_button_locator)
# TODO: remove scrollIntoView hack
self.marionette.execute_script("arguments[0].scrollIntoView(false);", [sign_out_button])
sign_out_button.tap()
def select_region(self, region):
self.marionette.find_element(*self._region_select_locator).tap()
self.select(region)
def tap_save_changes(self):
self.marionette.find_element(*self._save_changes_button_locator).tap()
@property
def region(self):
return self.marionette.find_element(*self._region_select_value_locator).text
@property
def email(self):
return self.marionette.find_element(*self._email_account_field_locator).get_attribute('value')