diff --git a/tests/python/gaia-ui-tests/gaiatest/apps/contacts/app.py b/tests/python/gaia-ui-tests/gaiatest/apps/contacts/app.py index ea3ec1cc5e7d..7a7f1a05be05 100644 --- a/tests/python/gaia-ui-tests/gaiatest/apps/contacts/app.py +++ b/tests/python/gaia-ui-tests/gaiatest/apps/contacts/app.py @@ -22,9 +22,6 @@ class Contacts(Base): _select_all_button_locator = (By.CSS_SELECTOR, 'button[data-l10n-id="selectAll"]') _export_button_locator = (By.ID, 'select-action') _status_message_locator = (By.ID, 'statusMsg') - _select_contacts_to_import_frame_locator = (By.ID, 'fb-extensions') - _import_locator = (By.ID, 'import-action') - _first_contact_locator = (By.CSS_SELECTOR, 'li.block-item label.pack-checkbox') # contacts _contact_locator = (By.CSS_SELECTOR, 'li.contact-item') @@ -42,20 +39,6 @@ def switch_to_contacts_frame(self): Wait(self.marionette, ignored_exceptions=JavascriptException).until( lambda m: m.execute_script('return window.wrappedJSObject.Contacts.asyncScriptsLoaded') is True) - def switch_to_select_contacts_frame(self): - self.switch_to_contacts_frame() - self.wait_for_element_displayed(*self._select_contacts_to_import_frame_locator) - select_contacts = self.marionette.find_element(*self._select_contacts_to_import_frame_locator) - self.marionette.switch_to_frame(select_contacts) - - def tap_first_contact(self): - self.marionette.find_element(*self._first_contact_locator).tap() - - def tap_import_button(self): - self.marionette.find_element(*self._import_locator).tap() - from gaiatest.apps.contacts.regions.settings_form import SettingsForm - return SettingsForm(self.marionette) - @property def contacts(self): return [self.Contact(marionette=self.marionette, element=contact) diff --git a/tests/python/gaia-ui-tests/gaiatest/apps/contacts/regions/contact_import_picker.py b/tests/python/gaia-ui-tests/gaiatest/apps/contacts/regions/contact_import_picker.py new file mode 100644 index 000000000000..d947d78db4de --- /dev/null +++ b/tests/python/gaia-ui-tests/gaiatest/apps/contacts/regions/contact_import_picker.py @@ -0,0 +1,31 @@ +# 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 ContactImportPicker(Base): + + _contact_import_picker_frame_locator = (By.ID, 'fb-extensions') + _import_button_locator = (By.ID, 'import-action') + + def __init__(self, marionette): + Base.__init__(self, marionette) + self.wait_for_element_displayed(*self._contact_import_picker_frame_locator) + select_contacts = self.marionette.find_element(*self._contact_import_picker_frame_locator) + self.marionette.switch_to_frame(select_contacts) + + def tap_import_button(self): + self.marionette.execute_script('window.wrappedJSObject.importer.ui.importAll()', special_powers=True) + # TODO uncomment this when Bug 932804 is resolved + # self.marionette.find_element(*self._import_button_locator).tap() + self.apps.switch_to_displayed_app() + self.wait_for_element_not_displayed(*self._contact_import_picker_frame_locator) + from gaiatest.apps.contacts.regions.settings_form import SettingsForm + return SettingsForm(self.marionette) + + def tap_select_all(self): + # TODO replace this with proper tap when Bug 932804 is resolved + self.marionette.execute_script('window.wrappedJSObject.importer.ui.selectAll()', special_powers=True) + self.wait_for_condition(lambda m : m.find_element(*self._import_button_locator).is_enabled()) diff --git a/tests/python/gaia-ui-tests/gaiatest/apps/contacts/regions/gmail.py b/tests/python/gaia-ui-tests/gaiatest/apps/contacts/regions/gmail.py index 8aa118667c3a..c122c9a363dd 100644 --- a/tests/python/gaia-ui-tests/gaiatest/apps/contacts/regions/gmail.py +++ b/tests/python/gaia-ui-tests/gaiatest/apps/contacts/regions/gmail.py @@ -8,7 +8,7 @@ class GmailLogin(Base): - _gmail_sign_in_frame_locator = (By.CSS_SELECTOR, '#frame-container > iframe[data-url*="google"]') + _gmail_sign_in_frame_locator = (By.CSS_SELECTOR, '.popupWindow.active iframe[data-url*="google"]') _email_locator = (By.ID, 'Email') _password_locator = (By.ID, 'Passwd') _sign_in_locator = (By.ID, 'signIn') @@ -32,5 +32,8 @@ def tap_grant_access(self): self.wait_for_condition(lambda m: grant_access_button.is_enabled()) self.marionette.execute_script("arguments[0].scrollIntoView(false);", [grant_access_button]) grant_access_button.tap() - from gaiatest.apps.contacts.app import Contacts - return Contacts(self.marionette) + # Go back to displayed Contacts app before waiting for the picker + self.wait_for_condition(lambda m: self.apps.displayed_app.name == 'Contacts') + self.apps.switch_to_displayed_app() + from gaiatest.apps.contacts.regions.contact_import_picker import ContactImportPicker + return ContactImportPicker(self.marionette) diff --git a/tests/python/gaia-ui-tests/gaiatest/tests/functional/contacts/manifest.ini b/tests/python/gaia-ui-tests/gaiatest/tests/functional/contacts/manifest.ini index 00b3aaaa3657..dc5fad987572 100644 --- a/tests/python/gaia-ui-tests/gaiatest/tests/functional/contacts/manifest.ini +++ b/tests/python/gaia-ui-tests/gaiatest/tests/functional/contacts/manifest.ini @@ -41,4 +41,3 @@ sdcard = true [test_import_contacts_from_gmail.py] online = true -disabled = Bug 932804 - Tapping on select all button doesn't work on Gmail or Outlook frame, before importing contacts diff --git a/tests/python/gaia-ui-tests/gaiatest/tests/functional/contacts/test_import_contacts_from_gmail.py b/tests/python/gaia-ui-tests/gaiatest/tests/functional/contacts/test_import_contacts_from_gmail.py index e26a89e06a9f..e8c925ed803c 100644 --- a/tests/python/gaia-ui-tests/gaiatest/tests/functional/contacts/test_import_contacts_from_gmail.py +++ b/tests/python/gaia-ui-tests/gaiatest/tests/functional/contacts/test_import_contacts_from_gmail.py @@ -37,12 +37,11 @@ def test_import_contacts_from_gmail(self): # Login to gmail account gmail.switch_to_gmail_login_frame() gmail.gmail_login(email, password) - contacts_import = gmail.tap_grant_access() + contact_import_picker = gmail.tap_grant_access() - # Import first contact - contacts_import.switch_to_select_contacts_frame() - contacts_import.tap_first_contact() - contacts_settings = contacts_import.tap_import_button() + # Import all contacts + contact_import_picker.tap_select_all() + contacts_settings = contact_import_picker.tap_import_button() contacts_settings.tap_back_from_import_contacts() contacts_settings.tap_done()