Beispiel #1
0
class TestEnduranceGalleryCamera(GaiaEnduranceTestCase):

    def setUp(self):
        GaiaEnduranceTestCase.setUp(self)

        # Turn off geolocation prompt
        self.apps.set_permission('Camera', 'geolocation', 'deny')

        # add photo to storage
        self.push_resource('IMG_0001.jpg')

        self.gallery = Gallery(self.marionette)
        self.gallery.launch()
        self.gallery.wait_for_files_to_load(1)

    def test_endurance_gallery_camera(self):
        self.drive(test=self.gallery_camera, app='gallery')

    def gallery_camera(self):
        # Test requested per bug 851626:
        # 1. open the Gallery app
        # 2. when the UI/Camera button appears, tap it to switch to the camera
        # 3. when the UI/Gallery button appears, tap it to switch back to the gallery
        # 4. repeat steps 2 and 3 until *crash*
        time.sleep(3)

        # From gallery app, switch to camera app
        self.camera = self.gallery.switch_to_camera()
        time.sleep(3)

        # From camera app, switch back to gallery again
        self.gallery = self.camera.tap_switch_to_gallery()
        self.gallery.wait_for_files_to_load(1)
        self.assertTrue(self.gallery.are_gallery_items_displayed)
    def test_gallery_view(self):
        """
        https://moztrap.mozilla.org/manage/case/2309/
        """

        gallery = Gallery(self.marionette)
        gallery.launch()
        gallery.wait_for_files_to_load(1)

        # From the main list view, click camera icon
        self.previous_number_of_pictures = len(self.data_layer.picture_files)
        camera = gallery.switch_to_camera()

        # Take the shot
        camera.take_photo()

        # Check that picture saved to SD card
        Wait(self.marionette).until(lambda m: len(self.data_layer.picture_files) ==
                                    self.previous_number_of_pictures + 1)

        # Verify the Camera app is still open, by checking for the presence of thumbnail
        self.assertTrue(camera.is_thumbnail_visible)
    def test_gallery_view(self):
        """
        https://moztrap.mozilla.org/manage/case/2309/
        """

        gallery = Gallery(self.marionette)
        gallery.launch()
        gallery.wait_for_files_to_load(1)

        # From the main list view, click camera icon
        self.previous_number_of_pictures = len(self.data_layer.picture_files)
        camera = gallery.switch_to_camera()

        # Take the shot
        camera.take_photo()

        # Check that picture saved to SD card
        Wait(
            self.marionette).until(lambda m: len(self.data_layer.picture_files)
                                   == self.previous_number_of_pictures + 1)

        # Verify the Camera app is still open, by checking for the presence of thumbnail
        self.assertTrue(camera.is_thumbnail_visible)