Beispiel #1
0
class TestCamera(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

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

    def test_capture_a_video(self):
        # https://moztrap.mozilla.org/manage/case/2477/

        self.camera = Camera(self.marionette)
        self.camera.launch()

        self.camera.tap_switch_source()

        self.camera.tap_capture()
        self.camera.wait_for_video_capturing()

        # Wait for 3 seconds of recording
        self.wait_for_condition(lambda m: self.camera.video_timer >= time.strptime('00:03', '%M:%S'))

        # Stop recording
        self.camera.tap_capture()
        self.camera.wait_for_video_timer_not_visible()

        # Wait for image to be added in to filmstrip
        self.camera.wait_for_filmstrip_visible()

        # Find the new film thumbnail in the film strip
        self.assertTrue(self.camera.is_filmstrip_visible)
class TestCamera(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

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

    def test_capture_a_video(self):
        # https://moztrap.mozilla.org/manage/case/2477/

        self.camera = Camera(self.marionette)
        self.camera.launch()

        self.camera.tap_switch_source()

        self.camera.tap_capture()
        self.camera.wait_for_video_capturing()

        # Wait for 3 seconds of recording
        self.wait_for_condition(lambda m: self.camera.video_timer >= time.
                                strptime('00:03', '%M:%S'))

        # Stop recording
        self.camera.tap_capture()
        self.camera.wait_for_video_timer_not_visible()

        # Wait for image to be added in to filmstrip
        self.camera.wait_for_filmstrip_visible()

        # Find the new film thumbnail in the film strip
        self.assertTrue(self.camera.is_filmstrip_visible)

        # Check that video saved to sdcard
        videos_after_test = self.get_video_files()
        self.assertEqual(len(videos_after_test), 1)

    def get_video_files(self):
        # camera app doesn't have permissions to access
        # all media files on device, so switch to system app
        self.marionette.switch_to_frame()
        videos = []
        for f in self.data_layer.media_files:
            try:
                match = re.search('(.*[.]3gp)', f)
                videos.append(match.group(1))
            except AttributeError:
                pass
        return videos