def test_homescreen_change_wallpaper_from_gallery(self): """ https://moztrap.mozilla.org/manage/case/1902/ """ homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() default_wallpaper_settings = self.data_layer.get_setting('wallpaper.image') contextmenu = homescreen.open_context_menu() activities = contextmenu.tap_change_wallpaper() # select gallery gallery = activities.tap_gallery() # go through the crop process gallery.wait_for_thumbnails_to_load() gallery.thumbnails[0].tap() from gaiatest.apps.gallery.regions.crop_view import CropView crop_view = CropView(self.marionette) # can't actually crop the element crop_view.tap_crop_done() # check that the wallpaper has changed new_wallpaper_settings = self.data_layer.get_setting('wallpaper.image') self.assertNotEqual(default_wallpaper_settings, new_wallpaper_settings)
def test_sms_cropped_picture(self): """ https://moztrap.mozilla.org/manage/case/10742/ """ messages = Messages(self.marionette) messages.launch() new_message = messages.create_new_message( recipients=[self.environment.phone_numbers[0]], message=self._text_message_content) activities_list = new_message.tap_attachment() gallery = activities_list.tap_gallery() # go through the crop process gallery.wait_for_thumbnails_to_load() gallery.thumbnails[0].tap() from gaiatest.apps.gallery.regions.crop_view import CropView crop_view = CropView(self.marionette) # can't actually crop the element crop_view.tap_crop_done() # back to messages app frame new_message.wait_for_resizing_to_finish() attachment_options = new_message.tap_image_attachment() view_image = attachment_options.tap_view_button() self.assertTrue(view_image.is_image_visible) view_image.tap_back_button() self.message_thread = new_message.tap_send(timeout=300) self.message_thread.wait_for_received_messages(timeout=300) last_received_message = self.message_thread.received_messages[-1] last_message = self.message_thread.all_messages[-1] self.assertEqual(self._text_message_content, last_received_message.text.strip('\n').strip()) self.assertEqual(last_received_message.id, last_message.id) self.assertTrue(last_message.has_attachments) view_image = last_message.tap_attachment() self.assertTrue(view_image.is_image_visible)
def test_homescreen_change_wallpaper_from_gallery(self): """ https://moztrap.mozilla.org/manage/case/1902/ reusing /functional/homescreen/test_homescreen_change_wallpaper.py script """ # wait until the homescreen is fully drawn self.take_screenshot(prewait=3) homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() default_wallpaper_settings = self.data_layer.get_setting( 'wallpaper.image') # open settings app and choose to change wallpaper, instead of opening context menu settings = Settings(self.marionette) settings.launch() homescreen_page = settings.open_homescreen() activities = homescreen_page.pick_wallpaper() # it is currently in system frame, but self.apps.switch_to_displayed_app() will return # a different value self.take_screenshot(top_frame=True) gallery = activities.tap_gallery() # go through the crop process gallery.wait_for_thumbnails_to_load() self.take_screenshot() gallery.thumbnails[0].tap() from gaiatest.apps.gallery.regions.crop_view import CropView crop_view = CropView(self.marionette) self.take_screenshot() # can't actually crop the element crop_view.tap_crop_done() # check that the wallpaper has changed new_wallpaper_settings = self.data_layer.get_setting('wallpaper.image') self.assertNotEqual(default_wallpaper_settings, new_wallpaper_settings) self.take_screenshot() self.device.touch_home_button() self.take_screenshot(prewait=3)
def test_sms_cropped_picture(self): """ https://moztrap.mozilla.org/manage/case/10742/ """ # launch the app messages = Messages(self.marionette) messages.launch() # click new message new_message = messages.tap_create_new_message() # type phone number new_message.type_phone_number(self.environment.phone_numbers[0]) # type text message new_message.type_message(self._text_message_content) # add attachment activities_list = new_message.tap_attachment() # select gallery gallery = activities_list.tap_gallery() # go through the crop process gallery.wait_for_thumbnails_to_load() gallery.thumbnails[0].tap() from gaiatest.apps.gallery.regions.crop_view import CropView crop_view = CropView(self.marionette) # can't actually crop the element crop_view.tap_crop_done() # back to messages app frame new_message.wait_for_resizing_to_finish() # Tap on attachment attachment_options = new_message.tap_image_attachment() view_image = attachment_options.tap_view_button() # Check that the attached image is displayed self.assertTrue(view_image.is_image_visible) view_image.tap_back_button() attachment_options.tap_cancel() # click send self.message_thread = new_message.tap_send(timeout=300) self.message_thread.wait_for_received_messages(timeout=300) # get the most recent listed and most recent received text message last_received_message = self.message_thread.received_messages[-1] last_message = self.message_thread.all_messages[-1] # Check the most recent received message has the same text content self.assertEqual(self._text_message_content, last_received_message.text.strip('\n').strip()) # Check that most recent message is also the most recent received message self.assertEqual(last_received_message.id, last_message.id) # Check that message has attachments self.assertTrue(last_message.has_attachments) # Tap on the attachment view_image = last_message.tap_attachment() # Check that the attached image is displayed self.assertTrue(view_image.is_image_visible)