Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
0
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/__init__.py
Executable file
0
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/__init__.py
Executable file
318
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/app.py
Executable file
318
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/app.py
Executable file
|
|
@ -0,0 +1,318 @@
|
|||
# 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_driver import expected, By, Wait
|
||||
|
||||
from gaiatest.apps.base import Base
|
||||
from gaiatest.apps.base import PageRegion
|
||||
from gaiatest.apps.email.regions.setup import SetupEmail
|
||||
from gaiatest.apps.email.regions.setup import ManualSetupEmail
|
||||
from gaiatest.apps.email.regions.settings import Settings
|
||||
from gaiatest.apps.email.regions.google import GoogleLogin
|
||||
|
||||
|
||||
class Email(Base):
|
||||
|
||||
name = 'E-Mail'
|
||||
|
||||
_email_locator = (By.CSS_SELECTOR, '#cardContainer .msg-header-item:not([data-index="-1"])')
|
||||
_syncing_locator = (By.CSS_SELECTOR, '#cardContainer .msg-messages-syncing > .small')
|
||||
_manual_setup_locator = (By.CSS_SELECTOR, '#cardContainer .sup-manual-config-btn')
|
||||
_message_list_locator = (By.CSS_SELECTOR, 'cards-message-list')
|
||||
_setup_account_info = (By.TAG_NAME, 'cards-setup-account-info')
|
||||
_setup_manual_config = (By.TAG_NAME, 'cards-setup-manual-config')
|
||||
_folder_picker_locator = (By.TAG_NAME, 'cards-folder-picker')
|
||||
_settings_main_locator = (By.TAG_NAME, 'cards-settings-main')
|
||||
_settings_account_locator = (By.TAG_NAME, 'cards-settings-account')
|
||||
_confirm_dialog_locator = (By.TAG_NAME, 'cards-confirm-dialog')
|
||||
_refresh_button_locator = (By.CLASS_NAME, 'msg-refresh-btn')
|
||||
_search_textbox_locator = (By.CSS_SELECTOR, 'form[role="search"]')
|
||||
_email_subject_locator = (By.XPATH, '//a[@data-index!="-1"]/div/span[text()="%s"]')
|
||||
_back_button_locator = (By.CLASS_NAME, 'sup-back-btn')
|
||||
emails_list_header_locator = (By.CSS_SELECTOR, '.msg-list-header')
|
||||
|
||||
def basic_setup_email(self, name, email, password):
|
||||
|
||||
setup = SetupEmail(self.marionette)
|
||||
setup.type_name(name)
|
||||
setup.type_email(email)
|
||||
|
||||
setup.tap_next()
|
||||
|
||||
google_login = GoogleLogin(self.marionette)
|
||||
|
||||
# check if the google autocomplete on email field works as expected
|
||||
assert google_login.email == email
|
||||
|
||||
# dismiss the keyboard and return to the correct frame
|
||||
google_login.keyboard.dismiss()
|
||||
google_login.switch_to_frame()
|
||||
|
||||
google_login.tap_next()
|
||||
google_login.type_password(password)
|
||||
google_login.tap_sign_in()
|
||||
|
||||
# approve access to your account
|
||||
google_login.wait_for_approve_access()
|
||||
google_login.tap_approve_access()
|
||||
|
||||
self.apps.switch_to_displayed_app()
|
||||
|
||||
setup.tap_account_prefs_next()
|
||||
|
||||
setup.wait_for_setup_complete()
|
||||
|
||||
setup.tap_continue()
|
||||
self.wait_for_message_list()
|
||||
|
||||
def setup_IMAP_email(self, imap, smtp):
|
||||
basic_setup = SetupEmail(self.marionette)
|
||||
basic_setup.type_name('IMAP account')
|
||||
basic_setup.type_email(imap['email'])
|
||||
|
||||
setup = self.tap_manual_setup()
|
||||
|
||||
setup.select_account_type('IMAP+SMTP')
|
||||
|
||||
setup.type_imap_hostname(imap['hostname'])
|
||||
setup.type_imap_name(imap['username'])
|
||||
setup.type_imap_password(imap['password'])
|
||||
setup.type_imap_port(imap['port'])
|
||||
|
||||
setup.type_smtp_hostname(smtp['hostname'])
|
||||
setup.type_smtp_name(smtp['username'])
|
||||
setup.type_smtp_password(smtp['password'])
|
||||
setup.type_smtp_port(smtp['port'])
|
||||
|
||||
setup.tap_next()
|
||||
setup.check_for_emails_interval('20000')
|
||||
|
||||
setup.tap_account_prefs_next()
|
||||
|
||||
setup.wait_for_setup_complete()
|
||||
setup.tap_continue()
|
||||
self.wait_for_message_list()
|
||||
|
||||
def setup_active_sync_email(self, active_sync):
|
||||
basic_setup = SetupEmail(self.marionette)
|
||||
basic_setup.type_name('ActiveSync account')
|
||||
basic_setup.type_email(active_sync['email'])
|
||||
|
||||
setup = self.tap_manual_setup()
|
||||
|
||||
setup.select_account_type('ActiveSync')
|
||||
|
||||
setup.type_password(active_sync['password'])
|
||||
setup.type_activesync_hostname(active_sync['hostname'])
|
||||
setup.type_activesync_name(active_sync['username'])
|
||||
|
||||
setup.tap_next()
|
||||
|
||||
setup.check_for_emails_interval('20000')
|
||||
setup.tap_account_prefs_next()
|
||||
|
||||
setup.wait_for_setup_complete()
|
||||
setup.tap_continue()
|
||||
self.wait_for_message_list()
|
||||
|
||||
def delete_email_account(self, index):
|
||||
|
||||
toolbar = self.header.tap_menu()
|
||||
toolbar.tap_settings()
|
||||
settings = Settings(self.marionette)
|
||||
account_settings = settings.email_accounts[index].tap()
|
||||
delete_confirmation = account_settings.tap_delete()
|
||||
delete_confirmation.tap_delete()
|
||||
|
||||
def tap_manual_setup(self):
|
||||
manual_setup = Wait(self.marionette).until(
|
||||
expected.element_present(*self._manual_setup_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(manual_setup))
|
||||
manual_setup.tap()
|
||||
return ManualSetupEmail(self.marionette)
|
||||
|
||||
def a11y_click_manual_setup(self):
|
||||
manual_setup = Wait(self.marionette).until(
|
||||
expected.element_present(*self._manual_setup_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(manual_setup))
|
||||
self.accessibility.click(manual_setup)
|
||||
return ManualSetupEmail(self.marionette)
|
||||
|
||||
def a11y_navigate_to_manual_setup(self, name, email):
|
||||
setup = SetupEmail(self.marionette)
|
||||
setup.type_name(name)
|
||||
setup.type_email(email)
|
||||
setup = self.a11y_click_manual_setup()
|
||||
|
||||
@property
|
||||
def header(self):
|
||||
return Header(self.marionette, self.marionette.find_element(*self.emails_list_header_locator))
|
||||
|
||||
@property
|
||||
def toolbar(self):
|
||||
return ToolBar(self.marionette)
|
||||
|
||||
@property
|
||||
def mails(self):
|
||||
return [Message(self.marionette, mail) for mail in self.marionette.find_elements(*self._email_locator)]
|
||||
|
||||
def wait_for_emails_to_sync(self):
|
||||
element = self.marionette.find_element(*self._refresh_button_locator)
|
||||
Wait(self.marionette, timeout=60).until(
|
||||
lambda m: element.get_attribute(
|
||||
'data-state') == 'synchronized')
|
||||
|
||||
def wait_for_message_list(self):
|
||||
element = self.marionette.find_element(*self._message_list_locator)
|
||||
Wait(self.marionette).until(
|
||||
lambda m: element.is_displayed() and
|
||||
element.location['x'] == 0)
|
||||
|
||||
def wait_for_search_textbox_displayed(self):
|
||||
Wait(self.marionette).until(expected.element_displayed(*self._search_textbox_locator))
|
||||
|
||||
def tap_email_subject(self, subject):
|
||||
subject_locator = (
|
||||
self._email_subject_locator[0],
|
||||
self._email_subject_locator[1] % subject
|
||||
)
|
||||
self.marionette.find_element(*subject_locator).tap()
|
||||
from gaiatest.apps.email.regions.read_email import ReadEmail
|
||||
return ReadEmail(self.marionette)
|
||||
|
||||
def wait_for_email(self, subject, timeout=120):
|
||||
Wait(self.marionette, timeout, interval=5).until(
|
||||
self.email_exists(self, subject))
|
||||
|
||||
class email_exists(object):
|
||||
|
||||
def __init__(self, app, subject):
|
||||
self.app = app
|
||||
self.subject = subject
|
||||
|
||||
def __call__(self, marionette):
|
||||
if self.subject in [mail.subject for mail in self.app.mails]:
|
||||
return True
|
||||
else:
|
||||
self.app.toolbar.tap_refresh()
|
||||
self.app.wait_for_emails_to_sync()
|
||||
self.app.mails[0].scroll_to_message()
|
||||
return False
|
||||
|
||||
|
||||
class Header(PageRegion):
|
||||
|
||||
_menu_button_locator = (By.CSS_SELECTOR, '.msg-folder-list-btn')
|
||||
_compose_button_locator = (By.CSS_SELECTOR, '.msg-compose-btn')
|
||||
_label_locator = (By.CSS_SELECTOR, '.msg-list-header-folder-label.header-label')
|
||||
|
||||
def a11y_click_menu(self):
|
||||
self.accessibility.click(self.root_element.find_element(*self._menu_button_locator))
|
||||
toolbar = ToolBar(self.marionette)
|
||||
Wait(self.marionette).until(lambda m: toolbar.is_a11y_visible)
|
||||
return toolbar
|
||||
|
||||
def tap_menu(self):
|
||||
self.root_element.find_element(*self._menu_button_locator).tap()
|
||||
toolbar = ToolBar(self.marionette)
|
||||
Wait(self.marionette).until(lambda m: toolbar.is_visible)
|
||||
return toolbar
|
||||
|
||||
def tap_compose(self):
|
||||
self.root_element.find_element(*self._compose_button_locator).tap()
|
||||
from gaiatest.apps.email.regions.new_email import NewEmail
|
||||
return NewEmail(self.marionette)
|
||||
|
||||
@property
|
||||
def label(self):
|
||||
return self.root_element.find_element(*self._label_locator).text
|
||||
|
||||
@property
|
||||
def is_menu_visible(self):
|
||||
return self.is_element_displayed(*self._menu_button_locator)
|
||||
|
||||
@property
|
||||
def is_compose_visible(self):
|
||||
return self.is_element_displayed(*self._compose_button_locator)
|
||||
|
||||
|
||||
class ToolBar(Base):
|
||||
_toolbar_locator = (By.CSS_SELECTOR, '#cardContainer .card.center .fld-nav-toolbar')
|
||||
_refresh_locator = (By.CSS_SELECTOR, '#cardContainer .card.center .msg-refresh-btn')
|
||||
_search_locator = (By.CSS_SELECTOR, '#cardContainer .card.center .msg-search-btn')
|
||||
_edit_locator = (By.CSS_SELECTOR, '#cardContainer .card.center .msg-edit-btn')
|
||||
_settings_locator = (By.CSS_SELECTOR, '#cardContainer .card.center .fld-nav-settings-btn')
|
||||
_settings_a11y_locator = (By.CSS_SELECTOR,
|
||||
'#cardContainer .card.center .fld-nav-toolbar.bottom-toolbar')
|
||||
|
||||
def tap_refresh(self):
|
||||
refresh = Wait(self.marionette).until(
|
||||
expected.element_present(*self._refresh_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(refresh))
|
||||
refresh.tap()
|
||||
|
||||
def tap_search(self):
|
||||
search = Wait(self.marionette).until(
|
||||
expected.element_present(*self._search_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(search))
|
||||
search.tap()
|
||||
|
||||
def tap_edit(self):
|
||||
edit = Wait(self.marionette).until(
|
||||
expected.element_present(*self._edit_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(edit))
|
||||
edit.tap()
|
||||
|
||||
def a11y_click_settings(self):
|
||||
settings = Wait(self.marionette).until(
|
||||
expected.element_present(*self._settings_a11y_locator))
|
||||
Wait(self.marionette).until(lambda m: self.accessibility.is_visible(settings))
|
||||
self.accessibility.click(settings)
|
||||
return Settings(self.marionette)
|
||||
|
||||
def tap_settings(self):
|
||||
settings = Wait(self.marionette).until(
|
||||
expected.element_present(*self._settings_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(settings))
|
||||
settings.tap()
|
||||
|
||||
@property
|
||||
def is_visible(self):
|
||||
return self.marionette.find_element(*self._toolbar_locator).location['x'] == 0
|
||||
|
||||
@property
|
||||
def is_a11y_visible(self):
|
||||
return self.accessibility.is_visible(self.marionette.find_element(*self._toolbar_locator))
|
||||
|
||||
@property
|
||||
def is_refresh_visible(self):
|
||||
return self.is_element_displayed(*self._refresh_locator)
|
||||
|
||||
@property
|
||||
def is_search_visible(self):
|
||||
return self.is_element_displayed(*self._search_locator)
|
||||
|
||||
@property
|
||||
def is_edit_visible(self):
|
||||
return self.is_element_displayed(*self._edit_locator)
|
||||
|
||||
@property
|
||||
def is_settings_visible(self):
|
||||
return self.is_element_displayed(*self._settings_locator)
|
||||
|
||||
|
||||
class Message(PageRegion):
|
||||
_subject_locator = (By.CSS_SELECTOR, '.msg-header-subject')
|
||||
_senders_email_locator = (By.CSS_SELECTOR, '.msg-header-author')
|
||||
|
||||
@property
|
||||
def subject(self):
|
||||
return self.root_element.find_element(*self._subject_locator).text
|
||||
|
||||
@property
|
||||
def senders_email(self):
|
||||
return self.root_element.find_element(*self._senders_email_locator).text
|
||||
|
||||
def scroll_to_message(self):
|
||||
self.marionette.execute_script("arguments[0].scrollIntoView(false);", [self.root_element])
|
||||
0
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/regions/__init__.py
Executable file
0
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/regions/__init__.py
Executable file
56
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/regions/google.py
Executable file
56
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/regions/google.py
Executable file
|
|
@ -0,0 +1,56 @@
|
|||
# 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_driver import expected, By, Wait
|
||||
|
||||
from gaiatest.apps.base import Base
|
||||
|
||||
|
||||
class GoogleLogin(Base):
|
||||
_iframe_locator = (By.CSS_SELECTOR, "iframe.sup-oauth2-browser[src *= 'google']")
|
||||
_email_locator = (By.ID, 'Email')
|
||||
_password_locator = (By.ID, 'Passwd')
|
||||
_sign_in_locator = (By.ID, 'signIn')
|
||||
_approve_access_locator = (By.CSS_SELECTOR, '#submit_approve_access.goog-buttonset-action')
|
||||
_next_locator = (By.ID, 'next')
|
||||
|
||||
def __init__(self, marionette):
|
||||
Base.__init__(self, marionette)
|
||||
self.switch_to_frame()
|
||||
# wait for the page to load
|
||||
email = Wait(self.marionette).until(
|
||||
expected.element_present(*self._email_locator))
|
||||
Wait(self.marionette).until(lambda m: email.get_attribute('value') != '')
|
||||
|
||||
@property
|
||||
def email(self):
|
||||
return self.marionette.find_element(*self._email_locator).get_attribute('value')
|
||||
|
||||
def type_password(self, password):
|
||||
element = Wait(self.marionette).until(expected.element_present(*self._password_locator))
|
||||
Wait(self.marionette).until(expected.element_displayed(element))
|
||||
element.send_keys(password)
|
||||
|
||||
def tap_sign_in(self):
|
||||
self.marionette.find_element(*self._sign_in_locator).tap()
|
||||
|
||||
def tap_next(self):
|
||||
self.marionette.find_element(*self._next_locator).tap()
|
||||
|
||||
def wait_for_approve_access(self):
|
||||
Wait(self.marionette).until(expected.element_displayed(
|
||||
Wait(self.marionette).until(expected.element_present(
|
||||
*self._approve_access_locator))))
|
||||
|
||||
def tap_approve_access(self):
|
||||
approve_access = Wait(self.marionette).until(
|
||||
expected.element_present(*self._approve_access_locator))
|
||||
Wait(self.marionette).until(expected.element_enabled(approve_access))
|
||||
approve_access.tap()
|
||||
|
||||
def switch_to_frame(self):
|
||||
# wait for the pop up screen to open
|
||||
view = Wait(self.marionette).until(
|
||||
expected.element_present(*self._iframe_locator))
|
||||
self.marionette.switch_to_frame(view)
|
||||
56
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/regions/new_email.py
Executable file
56
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/regions/new_email.py
Executable file
|
|
@ -0,0 +1,56 @@
|
|||
# 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_driver import By, Wait
|
||||
|
||||
from gaiatest.apps.base import Base
|
||||
|
||||
|
||||
class NewEmail(Base):
|
||||
# Write new email
|
||||
|
||||
_view_locator = (By.CSS_SELECTOR, '#cardContainer cards-compose')
|
||||
_to_locator = (By.CSS_SELECTOR, '#cardContainer .card.center .cmp-to-text.cmp-addr-text')
|
||||
_cc_locator = (By.CSS_SELECTOR, '#cardContainer .card.center .cmp-cc-text.cmp-addr-text')
|
||||
_bcc_locator = (By.CSS_SELECTOR, '#cardContainer .card.center .cmp-bcc-text.cmp-addr-text')
|
||||
_subject_locator = (By.CSS_SELECTOR, '#cardContainer .card.center .cmp-subject-text')
|
||||
_body_locator = (By.CSS_SELECTOR, '#cardContainer .card.center .cmp-body-text')
|
||||
_send_locator = (By.CSS_SELECTOR, '#cardContainer .card.center .icon.icon-send')
|
||||
|
||||
def __init__(self, marionette):
|
||||
Base.__init__(self, marionette)
|
||||
view = self.marionette.find_element(*self._view_locator)
|
||||
Wait(self.marionette).until(lambda m: view.location['x'] == 0)
|
||||
|
||||
def type_to(self, value):
|
||||
self.marionette.find_element(*self._to_locator).tap()
|
||||
self.keyboard.send(value)
|
||||
self.keyboard.dismiss()
|
||||
|
||||
def type_cc(self, value):
|
||||
self.marionette.find_element(*self._cc_locator).tap()
|
||||
self.keyboard.send(value)
|
||||
self.keyboard.dismiss()
|
||||
|
||||
def type_bcc(self, value):
|
||||
self.marionette.find_element(*self._bcc_locator).tap()
|
||||
self.keyboard.send(value)
|
||||
self.keyboard.dismiss()
|
||||
|
||||
def type_subject(self, value):
|
||||
self.marionette.find_element(*self._subject_locator).tap()
|
||||
self.keyboard.send(value)
|
||||
self.keyboard.dismiss()
|
||||
|
||||
def type_body(self, value):
|
||||
self.marionette.find_element(*self._body_locator).tap()
|
||||
self.keyboard.send(value)
|
||||
self.keyboard.dismiss()
|
||||
|
||||
def tap_send(self):
|
||||
self.marionette.find_element(*self._send_locator).tap()
|
||||
from gaiatest.apps.email.app import Email
|
||||
email = Email(self.marionette)
|
||||
email.wait_for_message_list()
|
||||
return email
|
||||
69
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/regions/read_email.py
Executable file
69
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/regions/read_email.py
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
# 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_driver import By, Wait
|
||||
|
||||
from gaiatest.apps.base import Base
|
||||
|
||||
|
||||
class ReadEmail(Base):
|
||||
|
||||
manifest_url = '{}email{}/manifest.webapp'.format(Base.DEFAULT_PROTOCOL,Base.DEFAULT_APP_HOSTNAME)
|
||||
|
||||
_body_locator = (By.CSS_SELECTOR, '.card.center .msg-body-content')
|
||||
_subject_locator = (By.CSS_SELECTOR, '.card.center .msg-envelope-subject')
|
||||
_senders_email_locator = (By.CSS_SELECTOR, '.msg-reader-header-label')
|
||||
|
||||
_delete_button_locator = (By.CSS_SELECTOR, '.msg-reader-action-toolbar .icon.msg-delete-btn')
|
||||
_star_button_locator = (By.CSS_SELECTOR, '.msg-reader-action-toolbar .icon.msg-star-btn')
|
||||
_mark_button_locator = (By.CSS_SELECTOR, '.msg-reader-action-toolbar .icon.msg-mark-read-btn')
|
||||
_move_button_locator = (By.CSS_SELECTOR, '.msg-reader-action-toolbar .icon.msg-move-btn')
|
||||
_reply_button_locator = (By.CSS_SELECTOR, '.msg-reader-action-toolbar .icon.msg-reply-btn')
|
||||
|
||||
_delete_approve_button_locator = (By.ID, 'msg-delete-ok')
|
||||
_delete_cancel_button_locator = (By.ID, 'msg-delete-cancel')
|
||||
_move_cancel_button_locator = (By.CSS_SELECTOR, '.full')
|
||||
_reply_cancel_button_locator = (By.CSS_SELECTOR, '.msg-reply-menu-cancel')
|
||||
|
||||
@property
|
||||
def body(self):
|
||||
return self.marionette.find_element(*self._body_locator).text
|
||||
|
||||
@property
|
||||
def subject(self):
|
||||
return self.marionette.find_element(*self._subject_locator).text
|
||||
|
||||
def wait_for_senders_email_displayed(self):
|
||||
Wait(self.marionette).until(lambda m: m.find_element(*self._senders_email_locator).text != '')
|
||||
|
||||
@property
|
||||
def senders_email(self):
|
||||
return self.marionette.find_element(*self._senders_email_locator).text
|
||||
|
||||
def tap_delete_button(self):
|
||||
self.marionette.find_element(*self._delete_button_locator).tap()
|
||||
|
||||
def tap_star_button(self):
|
||||
self.marionette.find_element(*self._star_button_locator).tap()
|
||||
|
||||
def tap_mark_button(self):
|
||||
self.marionette.find_element(*self._mark_button_locator).tap()
|
||||
|
||||
def tap_move_button(self):
|
||||
self.marionette.find_element(*self._move_button_locator).tap()
|
||||
|
||||
def tap_reply_button(self):
|
||||
self.marionette.find_element(*self._reply_button_locator).tap()
|
||||
|
||||
def approve_delete(self):
|
||||
self.marionette.find_element(*self._delete_approve_button_locator).tap()
|
||||
|
||||
def cancel_delete(self):
|
||||
self.marionette.find_element(*self._delete_cancel_button_locator).tap()
|
||||
|
||||
def cancel_move(self):
|
||||
self.marionette.find_element(*self._move_cancel_button_locator).tap()
|
||||
|
||||
def cancel_reply(self):
|
||||
self.marionette.find_element(*self._reply_cancel_button_locator).tap()
|
||||
73
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/regions/settings.py
Executable file
73
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/regions/settings.py
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
# 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_driver import expected, By, Wait
|
||||
|
||||
from gaiatest.apps.base import Base
|
||||
from gaiatest.apps.base import PageRegion
|
||||
|
||||
|
||||
class Settings(Base):
|
||||
#general email settings
|
||||
_email_account_locator = (By.CSS_SELECTOR, '.tng-account-item')
|
||||
_account_add_locator = (By.CLASS_NAME, 'tng-account-add')
|
||||
|
||||
def __init__(self, marionette):
|
||||
Base.__init__(self, marionette)
|
||||
Wait(self.marionette).until(expected.element_displayed(
|
||||
Wait(self.marionette).until(expected.element_present(
|
||||
*self._email_account_locator))))
|
||||
|
||||
@property
|
||||
def email_accounts(self):
|
||||
return [self.Account(self.marionette, email_account) for email_account in self.marionette.find_elements(*self._email_account_locator)]
|
||||
|
||||
class Account(PageRegion):
|
||||
_name_locator = (By.CSS_SELECTOR, 'a.tng-account-item-label')
|
||||
|
||||
def tap(self):
|
||||
self.root_element.tap()
|
||||
return EmailAccountSettings(self.marionette)
|
||||
|
||||
def a11y_click(self):
|
||||
self.accessibility.click(self.root_element)
|
||||
return EmailAccountSettings(self.marionette)
|
||||
|
||||
|
||||
class EmailAccountSettings(Base):
|
||||
#settings for a specific email account
|
||||
|
||||
_delete_account_locator = (By.CSS_SELECTOR, '.tng-account-delete')
|
||||
|
||||
def __init__(self, marionette):
|
||||
Base.__init__(self, marionette)
|
||||
Wait(self.marionette).until(expected.element_displayed(
|
||||
Wait(self.marionette).until(expected.element_present(
|
||||
*self._delete_account_locator))))
|
||||
|
||||
def tap_delete(self):
|
||||
self.marionette.find_element(*self._delete_account_locator).tap()
|
||||
return DeleteConfirmation(self.marionette)
|
||||
|
||||
def a11y_click_delete(self):
|
||||
self.accessibility.click(self.marionette.find_element(*self._delete_account_locator))
|
||||
return DeleteConfirmation(self.marionette)
|
||||
|
||||
|
||||
class DeleteConfirmation(Base):
|
||||
_delete_locator = (By.CSS_SELECTOR, '.tng-account-delete-confirm #account-delete-ok')
|
||||
_cancel_locator = (By.CSS_SELECTOR, '.tng-account-delete-confirm #account-delete-cancel')
|
||||
_message_locator = (By.CSS_SELECTOR, '.tng-account-delete-confirm > section > p')
|
||||
|
||||
def __init__(self, marionette):
|
||||
Base.__init__(self, marionette)
|
||||
Wait(self.marionette).until(expected.element_displayed(
|
||||
Wait(self.marionette).until(expected.element_present(
|
||||
*self._delete_locator))))
|
||||
|
||||
def tap_delete(self):
|
||||
self.marionette.find_element(*self._delete_locator).tap()
|
||||
|
||||
def a11y_click_delete(self):
|
||||
self.accessibility.click(self.marionette.find_element(*self._delete_locator))
|
||||
201
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/regions/setup.py
Executable file
201
gaia/tests/python/gaia-ui-tests/gaiatest/apps/email/regions/setup.py
Executable file
|
|
@ -0,0 +1,201 @@
|
|||
# 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_driver import expected, By, Wait
|
||||
|
||||
from gaiatest.apps.base import Base
|
||||
|
||||
|
||||
class SetupEmail(Base):
|
||||
|
||||
_name_locator = (By.CSS_SELECTOR, 'cards-setup-account-info input.sup-info-name')
|
||||
_email_locator = (By.CSS_SELECTOR, 'cards-setup-account-info input.sup-info-email')
|
||||
_next_locator = (By.CSS_SELECTOR, '.sup-info-next-btn')
|
||||
_continue_button_locator = ('class name', 'sup-show-mail-btn sup-form-btn recommend')
|
||||
_check_for_new_messages_locator = (By.CSS_SELECTOR, '.tng-account-check-interval.mail-select')
|
||||
_account_prefs_section_locator = (By.CSS_SELECTOR, 'cards-setup-account-prefs section')
|
||||
_account_prefs_next_locator = (By.CSS_SELECTOR, 'cards-setup-account-prefs .sup-info-next-btn')
|
||||
_done_section_locator = (By.CSS_SELECTOR, 'cards-setup-done section')
|
||||
|
||||
def __init__(self, marionette):
|
||||
Base.__init__(self, marionette)
|
||||
Wait(self.marionette).until(expected.element_displayed(
|
||||
Wait(self.marionette).until(expected.element_present(
|
||||
*self._name_locator))))
|
||||
|
||||
def type_name(self, value):
|
||||
self.marionette.find_element(*self._name_locator).send_keys(value)
|
||||
|
||||
def type_email(self, value):
|
||||
self.marionette.find_element(*self._email_locator).send_keys(value)
|
||||
|
||||
def tap_next(self):
|
||||
self.marionette.find_element(*self._next_locator).tap()
|
||||
|
||||
def tap_account_prefs_next(self):
|
||||
next = Wait(self.marionette, timeout=120).until(
|
||||
expected.element_present(*self._account_prefs_next_locator))
|
||||
Wait(self.marionette, timeout=120).until(
|
||||
expected.element_displayed(next))
|
||||
next.tap()
|
||||
|
||||
def wait_for_setup_complete(self):
|
||||
element = Wait(self.marionette).until(
|
||||
expected.element_present(*self._done_section_locator))
|
||||
Wait(self.marionette).until(lambda m: element.location['x'] == 0)
|
||||
|
||||
def tap_continue(self):
|
||||
self.marionette.find_element(*self._continue_button_locator).tap()
|
||||
|
||||
|
||||
class ManualSetupEmail(Base):
|
||||
|
||||
name = 'E-Mail' # hack to be able to use select
|
||||
|
||||
_name_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config input.sup-info-name')
|
||||
_email_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config input.sup-info-email')
|
||||
_password_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config input.sup-info-password')
|
||||
|
||||
_account_type_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config .sup-manual-account-type')
|
||||
|
||||
_imap_username_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config .sup-manual-composite-username')
|
||||
_imap_password_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config .sup-manual-composite-password')
|
||||
_imap_hostname_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config .sup-manual-composite-hostname')
|
||||
_imap_port_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config .sup-manual-composite-port')
|
||||
|
||||
_smtp_username_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config .sup-manual-smtp-username')
|
||||
_smtp_password_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config .sup-manual-smtp-password')
|
||||
_smtp_hostname_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config .sup-manual-smtp-hostname')
|
||||
_smtp_port_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config .sup-manual-smtp-port')
|
||||
|
||||
_activesync_hostname_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config .sup-manual-activesync-hostname')
|
||||
_activesync_username_locator = (By.CSS_SELECTOR, 'cards-setup-manual-config .sup-manual-activesync-username')
|
||||
|
||||
_next_locator = (By.CSS_SELECTOR, '.sup-manual-next-btn')
|
||||
_continue_button_locator = (By.CLASS_NAME, 'sup-show-mail-btn sup-form-btn recommend')
|
||||
|
||||
_check_for_new_messages_locator = (By.CSS_SELECTOR, '.tng-account-check-interval.mail-select')
|
||||
_account_prefs_section_locator = (By.CSS_SELECTOR, 'cards-setup-account-prefs')
|
||||
_account_prefs_next_locator = (By.CSS_SELECTOR, 'cards-setup-account-prefs .sup-info-next-btn')
|
||||
_done_section_locator = (By.CSS_SELECTOR, 'cards-setup-done section')
|
||||
|
||||
def __init__(self, marionette):
|
||||
Base.__init__(self, marionette)
|
||||
Wait(self.marionette).until(expected.element_displayed(
|
||||
Wait(self.marionette).until(expected.element_present(
|
||||
*self._name_locator))))
|
||||
|
||||
def type_name(self, value):
|
||||
el = self.marionette.find_element(*self._name_locator)
|
||||
el.clear()
|
||||
el.send_keys(value)
|
||||
self.keyboard.dismiss()
|
||||
|
||||
def type_email(self, value):
|
||||
el = self.marionette.find_element(*self._email_locator)
|
||||
el.clear()
|
||||
el.send_keys(value)
|
||||
self.keyboard.dismiss()
|
||||
|
||||
def type_password(self, value):
|
||||
el = self.marionette.find_element(*self._password_locator)
|
||||
el.clear()
|
||||
el.send_keys(value)
|
||||
self.keyboard.dismiss()
|
||||
|
||||
def select_account_type(self, value):
|
||||
account_type = self.marionette.find_element(*self._account_type_locator)
|
||||
account_type.click()
|
||||
self.marionette.switch_to_frame()
|
||||
self.select(value)
|
||||
|
||||
def type_imap_name(self, value):
|
||||
el = self.marionette.find_element(*self._imap_username_locator)
|
||||
el.clear()
|
||||
el.send_keys(value)
|
||||
|
||||
def type_imap_hostname(self, value):
|
||||
el = self.marionette.find_element(*self._imap_hostname_locator)
|
||||
el.clear()
|
||||
el.send_keys(value)
|
||||
|
||||
def type_imap_password(self, value):
|
||||
el = self.marionette.find_element(*self._imap_password_locator)
|
||||
el.clear()
|
||||
el.send_keys(value)
|
||||
|
||||
def type_imap_port(self, value):
|
||||
el = self.marionette.find_element(*self._imap_port_locator)
|
||||
el.clear()
|
||||
el.send_keys(value)
|
||||
|
||||
def type_smtp_name(self, value):
|
||||
el = self.marionette.find_element(*self._smtp_username_locator)
|
||||
el.clear()
|
||||
el.send_keys(value)
|
||||
|
||||
def type_smtp_hostname(self, value):
|
||||
el = self.marionette.find_element(*self._smtp_hostname_locator)
|
||||
el.clear()
|
||||
el.send_keys(value)
|
||||
|
||||
def type_smtp_password(self, value):
|
||||
el = self.marionette.find_element(*self._smtp_password_locator)
|
||||
el.clear()
|
||||
el.send_keys(value)
|
||||
|
||||
def type_smtp_port(self, value):
|
||||
el = self.marionette.find_element(*self._smtp_port_locator)
|
||||
el.clear()
|
||||
el.send_keys(value)
|
||||
self.keyboard.dismiss()
|
||||
|
||||
def type_activesync_name(self, value):
|
||||
el = self.marionette.find_element(*self._activesync_username_locator)
|
||||
el.clear()
|
||||
el.send_keys(value)
|
||||
self.keyboard.dismiss()
|
||||
|
||||
def type_activesync_hostname(self, value):
|
||||
el = self.marionette.find_element(*self._activesync_hostname_locator)
|
||||
el.clear()
|
||||
el.send_keys(value)
|
||||
|
||||
def tap_next(self):
|
||||
next = Wait(self.marionette).until(expected.element_present(*self._next_locator))
|
||||
Wait(self.marionette).until(lambda m: next.get_attribute('disabled') != 'true')
|
||||
next.tap()
|
||||
|
||||
account = Wait(self.marionette).until(
|
||||
expected.element_present(*self._account_prefs_section_locator))
|
||||
Wait(self.marionette).until(lambda m: account.location['x'] == 0)
|
||||
|
||||
Wait(self.marionette, timeout=120).until(expected.element_displayed(
|
||||
Wait(self.marionette, timeout=120).until(expected.element_present(
|
||||
*self._account_prefs_next_locator))))
|
||||
|
||||
def check_for_emails_interval(self, value):
|
||||
# The following pref change allows us to check the mail within 1 second or longer,
|
||||
# rather than the default value of 100 seconds
|
||||
# The UI data layer of the UI is changed, because the minimum check mail time value is 5 min,
|
||||
# which is far too long to check for in a test. This allows us to check earlier
|
||||
with self.marionette.using_context('chrome'):
|
||||
self.marionette.execute_script(
|
||||
"Services.prefs.setIntPref('dom.requestSync.minInterval', 1);")
|
||||
self.marionette.execute_script("""
|
||||
document.querySelector("[data-l10n-id = settings-check-every-5min]").value = '%s';
|
||||
""" % value)
|
||||
self.marionette.find_element(*self._check_for_new_messages_locator).tap()
|
||||
self.select('Every 5 minutes')
|
||||
|
||||
def tap_account_prefs_next(self):
|
||||
self.marionette.find_element(*self._account_prefs_next_locator).tap()
|
||||
|
||||
def wait_for_setup_complete(self):
|
||||
done = Wait(self.marionette).until(
|
||||
expected.element_present(*self._done_section_locator))
|
||||
Wait(self.marionette).until(lambda m: done.location['x'] == 0)
|
||||
|
||||
def tap_continue(self):
|
||||
self.marionette.find_element(*self._continue_button_locator).tap()
|
||||
Loading…
Reference in a new issue