Пример #1
0
class test_main(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.camera = Camera(self)
        self.gallery = Gallery(self)

        self.UTILS.app.setPermission('Camera', 'geolocation', 'deny')

        self.gallery.launch()
        time.sleep(2)
        self.previous_thumbs = self.gallery.get_number_of_thumbnails()
        self.apps.kill_all()
        time.sleep(2)

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.camera.launch()
        self.camera.take_video(5)
        self.camera.open_preview()
        self.camera.delete_from_preview()

        self.gallery.launch()
        time.sleep(2)
        current_thumbs = self.gallery.get_number_of_thumbnails()

        self.UTILS.test.test(
            current_thumbs == self.previous_thumbs,
            "After taking a picture and delete it, we remain the same")
Пример #2
0
class test_main(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.gallery = Gallery(self)
        self.camera = Camera(self)
        self.UTILS.app.setPermission('Camera', 'geolocation', 'deny')
        self.UTILS.general.add_file_to_device('./tests/_resources/img1.jpg')

    def tearDown(self):
        self.UTILS.general.remove_files()
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.gallery.launch()

        self.gallery.wait_for_thumbnails_number(1)

        before_pics = len(self.UTILS.element.getElements(DOM.Gallery.thumbnail_items, "Gallery thumbnails"))
        self.UTILS.reporting.logResult("info", "Before photo taken, we have {} thumbnails.".format(before_pics))

        camera_btn = self.UTILS.element.getElement(DOM.Gallery.thumbnail_camera_button, "Camera button")
        camera_btn.tap()

        self.UTILS.iframe.switchToFrame(*DOM.Camera.frame_locator)
        self.camera.take_picture()
        self.camera.open_preview()
        self.camera.go_to_gallery()

        after_pics = len(self.UTILS.element.getElements(DOM.Gallery.thumbnail_items, "Gallery thumbnails"))
        self.UTILS.test.test(after_pics == before_pics + 1, "After photo taken, we have {} thunbnails".format(after_pics))
Пример #3
0
class test_main(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.gallery = Gallery(self)

        self.gallery.launch()
        time.sleep(2)
        self.previous_thumbs = self.gallery.get_number_of_thumbnails()
        self.apps.kill_all()
        time.sleep(2)

    def tearDown(self):
        self.UTILS.general.remove_files()
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.UTILS.general.add_file_to_device('./tests/_resources/img1.jpg')
        self.gallery.launch()
        self.gallery.wait_for_thumbnails_number(1)
        self.gallery.delete_thumbnails([0])

        current_thumbs = self.gallery.get_number_of_thumbnails()
        self.UTILS.test.test(
            current_thumbs == self.previous_thumbs + 1,
            "After taking a picture, there's one item more in the gallery")
Пример #4
0
class test_main(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.gallery = Gallery(self)
        self.camera = Camera(self)

        self.UTILS.app.setPermission('Camera', 'geolocation', 'deny')
        self.gallery.launch()
        time.sleep(2)
        self.previous_thumbs = self.gallery.get_number_of_thumbnails()
        self.apps.kill_all()
        time.sleep(2)
    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        self.camera.launch()
        self.camera.take_picture()
        self.camera.open_preview()
        self.camera.go_to_gallery()

        current_thumbs = self.gallery.get_number_of_thumbnails()
        self.UTILS.test.test(current_thumbs == self.previous_thumbs + 1,
                             "After taking a picture, there's one item more in the gallery")


        # Check Camera is running in the background.
        self.UTILS.home.holdHomeButton()
        x = self.UTILS.element.getElement((DOM.Home.app_card[0], DOM.Home.app_card[1].format("camera")),
                                  "When home button is held, camera 'card'", False)
Пример #5
0
class test_main(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.gallery = Gallery(self)
        self.camera = Camera(self)

        self.UTILS.app.setPermission('Camera', 'geolocation', 'deny')
        self.gallery.launch()
        time.sleep(2)
        self.previous_thumbs = self.gallery.get_number_of_thumbnails()
        self.apps.kill_all()
        time.sleep(2)

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):

        self.camera.launch()
        self.camera.take_picture()
        self.camera.open_preview()
        self.camera.go_to_gallery()

        current_thumbs = self.gallery.get_number_of_thumbnails()
        self.UTILS.test.test(
            current_thumbs == self.previous_thumbs + 1,
            "After taking a picture, there's one item more in the gallery")

        # Check Camera is running in the background.
        self.UTILS.home.holdHomeButton()
        x = self.UTILS.element.getElement(
            (DOM.Home.app_card[0], DOM.Home.app_card[1].format("camera")),
            "When home button is held, camera 'card'", False)
Пример #6
0
class test_main(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.gallery = Gallery(self)
        self.camera = Camera(self)

        self.UTILS.app.setPermission('Camera', 'geolocation', 'deny')

        self.gallery.launch()
        time.sleep(2)
        self.previous_thumbs = self.gallery.get_number_of_thumbnails()
        self.apps.kill_all()
        time.sleep(2)

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.camera.launch()
        self.camera.take_picture()
        self.camera.open_preview()

        self.gallery.launch()
        current_thumbs = self.gallery.get_number_of_thumbnails()
        self.UTILS.test.test(current_thumbs == self.previous_thumbs + 1,
                     "After taking a picture, there's one item more in the gallery")


        self.gallery.click_on_thumbnail_at_position(0)
Пример #7
0
class test_main(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.camera = Camera(self)
        self.gallery = Gallery(self)

        self.UTILS.app.setPermission('Camera', 'geolocation', 'deny')

        self.gallery.launch()
        time.sleep(2)
        self.previous_thumbs = self.gallery.get_number_of_thumbnails()
        self.apps.kill_all()
        time.sleep(2)

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.camera.launch()
        self.camera.take_video(5)
        self.camera.open_preview()
        self.camera.delete_from_preview()

        self.gallery.launch()
        time.sleep(2)
        current_thumbs = self.gallery.get_number_of_thumbnails()

        self.UTILS.test.test(current_thumbs == self.previous_thumbs,
                             "After taking a picture and delete it, we remain the same")
Пример #8
0
class test_main(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.gallery = Gallery(self)
        self.camera = Camera(self)

        self.UTILS.app.setPermission('Camera', 'geolocation', 'deny')

        self.gallery.launch()
        time.sleep(2)
        self.previous_thumbs = self.gallery.get_number_of_thumbnails()
        self.apps.kill_all()
        time.sleep(2)

    def tearDown(self):
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.camera.launch()
        self.camera.take_picture()
        self.camera.open_preview()

        self.gallery.launch()
        current_thumbs = self.gallery.get_number_of_thumbnails()
        self.UTILS.test.test(
            current_thumbs == self.previous_thumbs + 1,
            "After taking a picture, there's one item more in the gallery")

        self.gallery.click_on_thumbnail_at_position(0)
Пример #9
0
class test_main(GaiaTestCase):

    img_list = ('img1.jpg', 'img2.jpg', 'img3.jpg', 'img4.jpg', 'img5.jpg')

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.gallery = Gallery(self)

        self.length = len(self.img_list)

    def tearDown(self):
        self.UTILS.general.remove_files()
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        # Load sample images into the gallery.
        for i in self.img_list:
            self.UTILS.general.add_file_to_device('./tests/_resources/' + i)

        self.gallery.launch()
        self.gallery.wait_for_thumbnails_number(self.length)
        self.gallery.click_on_thumbnail_at_position(0)
        self.gallery.swipe_between_gallery_items(self.length)
Пример #10
0
class test_main(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.gallery = Gallery(self)
        self.camera = Camera(self)
        self.UTILS.app.setPermission('Camera', 'geolocation', 'deny')
        self.UTILS.general.add_file_to_device('./tests/_resources/img1.jpg')

    def tearDown(self):
        self.UTILS.general.remove_files()
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.gallery.launch()

        self.gallery.wait_for_thumbnails_number(1)

        before_pics = len(
            self.UTILS.element.getElements(DOM.Gallery.thumbnail_items,
                                           "Gallery thumbnails"))
        self.UTILS.reporting.logResult(
            "info",
            "Before photo taken, we have {} thumbnails.".format(before_pics))

        camera_btn = self.UTILS.element.getElement(
            DOM.Gallery.thumbnail_camera_button, "Camera button")
        camera_btn.tap()

        self.UTILS.iframe.switchToFrame(*DOM.Camera.frame_locator)
        self.camera.take_picture()
        self.camera.open_preview()
        self.camera.go_to_gallery()

        after_pics = len(
            self.UTILS.element.getElements(DOM.Gallery.thumbnail_items,
                                           "Gallery thumbnails"))
        self.UTILS.test.test(
            after_pics == before_pics + 1,
            "After photo taken, we have {} thunbnails".format(after_pics))
Пример #11
0
class test_main(GaiaTestCase):

    img_list = ('img1.jpg', 'img2.jpg', 'img3.jpg', 'img4.jpg', 'img5.jpg')

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.gallery = Gallery(self)

        self.length = len(self.img_list)
        # Load sample images into the gallery.
        for i in self.img_list:
            self.UTILS.general.add_file_to_device('./tests/_resources/' + i)

        self.gallery.launch()
        time.sleep(2)
        self.previous_thumbs = self.gallery.get_number_of_thumbnails()
        self.apps.kill_all()
        time.sleep(2)

    def tearDown(self):
        self.UTILS.general.remove_files()
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.gallery.launch()
        self.gallery.wait_for_thumbnails_number(self.length)

        positions_to_delete = (0, 1, 2)
        self.gallery.delete_thumbnails(positions_to_delete)

        current_thumbs = self.gallery.get_number_of_thumbnails()
        self.UTILS.reporting.logResult(
            'info', 'current_thumbs: {}'.format(current_thumbs))
        self.UTILS.reporting.logResult(
            'info', 'previous_thumbs: {}'.format(self.previous_thumbs))
        self.UTILS.test.test(
            current_thumbs == self.previous_thumbs - len(positions_to_delete),
            "After deleting {} picture/s we have the rest".format(
                len(positions_to_delete)))
Пример #12
0
class test_main(GaiaTestCase):

    img_list = ('img1.jpg', 'img2.jpg', 'img3.jpg', 'img4.jpg', 'img5.jpg')
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.gallery = Gallery(self)

        self.length = len(self.img_list)
        # Load sample images into the gallery.
        for i in self.img_list:
            self.UTILS.general.add_file_to_device('./tests/_resources/' + i)

        self.gallery.launch()
        time.sleep(2)
        self.previous_thumbs = self.gallery.get_number_of_thumbnails()
        self.apps.kill_all()
        time.sleep(2)

    def tearDown(self):
        self.UTILS.general.remove_files()
        self.UTILS.reporting.reportResults()
        GaiaTestCase.tearDown(self)

    def test_run(self):
        self.gallery.launch()
        self.gallery.wait_for_thumbnails_number(self.length)

        positions_to_delete = (0, 1, 2)
        self.gallery.delete_thumbnails(positions_to_delete)

        current_thumbs = self.gallery.get_number_of_thumbnails()
        self.UTILS.reporting.logResult('info', 'current_thumbs: {}'.format(current_thumbs))
        self.UTILS.reporting.logResult('info', 'previous_thumbs: {}'.format(self.previous_thumbs))
        self.UTILS.test.test(current_thumbs == self.previous_thumbs - len(positions_to_delete),
                             "After deleting {} picture/s we have the rest".format(len(positions_to_delete)))