コード例 #1
0
ファイル: test_99999.py プロジェクト: owdqa/OWD_TEST_TOOLKIT
class test_main(GaiaTestCase):

    test_msg = "Welcome to the September Checkpoint. See this: https://www.youtube.com/watch?v=jAHlQ77lm10"
    video_container_locator = (By.CSS_SELECTOR, 'div[style^="background-image"]')
    video_element_locator = (By.TAG_NAME, 'video')

    def setUp(self):
        #
        # Set up child objects...
        #
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.gallery = Gallery(self)
        self.browser = Browser(self)

        self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom")
        self.UTILS.reporting.logComment("Sending mms to telephone number " + self.phone_number)
        self.data_layer.connect_to_cell_data()

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

    def test_run(self):
        #
        # Load files into the device.
        #
        self.UTILS.general.addFileToDevice('./tests/_resources/300x300.png', destination='DCIM/100MZLLA')

        #
        # Launch messages app.
        #
        self.messages.launch()

        #
        # Create a new SMS
        #
        self.messages.startNewSMS()

        #
        # Insert the phone number in the To field
        #
        self.messages.addNumbersInToField([self.phone_number])

        #
        # Create MMS.
        #
        self.messages.enterSMSMsg(self.test_msg)

        self.messages.createMMSImage()
        self.gallery.clickThumbMMS(0)

        #
        # Click send and wait for the message to be received
        #
        self.messages.sendSMS()

        self.UTILS.statusbar.wait_for_notification_toaster_detail(self.test_msg, timeout=120)
        self.UTILS.statusbar.click_on_notification_detail(self.test_msg, DOM.Messages.frame_locator)

        text = self.UTILS.element.getElement(DOM.Messages.last_message_mms_text, "Message text").text
        last_msg = self.messages.lastMessageInThisThread()
        self.UTILS.element.scroll_into_view(last_msg)
        self.UTILS.test.TEST(text == self.test_msg, u"[{}] received. Expected [{}]".format(text, self.test_msg), True)

        url = self.marionette.find_element("css selector", "a[data-url*=youtube]", id=last_msg.id)
        url.tap()

        #
        # Tap the video container
        #
        self.UTILS.iframe.switchToFrame(*DOM.Browser.frame_locator)
        self.browser.switch_to_content()
        self.wait_for_element_present(*self.video_container_locator, timeout=30)
        self.marionette.find_element(*self.video_container_locator).tap()

        #
        # Wait HTML5 player appear
        #
        self.wait_for_element_present(*self.video_element_locator, timeout=30)
        video = self.marionette.find_element(*self.video_element_locator)

        #
        # Check that video is playing
        #
        time.sleep(5)
        player = HTML5Player(self.marionette, video)
        player.wait_for_video_loaded()
        self.assertTrue(player.is_video_playing())
コード例 #2
0
ファイル: test_99999.py プロジェクト: owdqa/OWD_TEST_TOOLKIT
class test_main(GaiaTestCase):

    test_msg = "Welcome to the September Checkpoint. See this: https://www.youtube.com/watch?v=jAHlQ77lm10"
    video_container_locator = (By.CSS_SELECTOR,
                               'div[style^="background-image"]')
    video_element_locator = (By.TAG_NAME, 'video')

    def setUp(self):
        #
        # Set up child objects...
        #
        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)
        self.messages = Messages(self)
        self.gallery = Gallery(self)
        self.browser = Browser(self)

        self.phone_number = self.UTILS.general.get_config_variable(
            "phone_number", "custom")
        self.UTILS.reporting.logComment("Sending mms to telephone number " +
                                        self.phone_number)
        self.data_layer.connect_to_cell_data()

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

    def test_run(self):
        #
        # Load files into the device.
        #
        self.UTILS.general.addFileToDevice('./tests/_resources/300x300.png',
                                           destination='DCIM/100MZLLA')

        #
        # Launch messages app.
        #
        self.messages.launch()

        #
        # Create a new SMS
        #
        self.messages.startNewSMS()

        #
        # Insert the phone number in the To field
        #
        self.messages.addNumbersInToField([self.phone_number])

        #
        # Create MMS.
        #
        self.messages.enterSMSMsg(self.test_msg)

        self.messages.createMMSImage()
        self.gallery.clickThumbMMS(0)

        #
        # Click send and wait for the message to be received
        #
        self.messages.sendSMS()

        self.UTILS.statusbar.wait_for_notification_toaster_detail(
            self.test_msg, timeout=120)
        self.UTILS.statusbar.click_on_notification_detail(
            self.test_msg, DOM.Messages.frame_locator)

        text = self.UTILS.element.getElement(
            DOM.Messages.last_message_mms_text, "Message text").text
        last_msg = self.messages.lastMessageInThisThread()
        self.UTILS.element.scroll_into_view(last_msg)
        self.UTILS.test.TEST(
            text == self.test_msg,
            u"[{}] received. Expected [{}]".format(text, self.test_msg), True)

        url = self.marionette.find_element("css selector",
                                           "a[data-url*=youtube]",
                                           id=last_msg.id)
        url.tap()

        #
        # Tap the video container
        #
        self.UTILS.iframe.switchToFrame(*DOM.Browser.frame_locator)
        self.browser.switch_to_content()
        self.wait_for_element_present(*self.video_container_locator,
                                      timeout=30)
        self.marionette.find_element(*self.video_container_locator).tap()

        #
        # Wait HTML5 player appear
        #
        self.wait_for_element_present(*self.video_element_locator, timeout=30)
        video = self.marionette.find_element(*self.video_element_locator)

        #
        # Check that video is playing
        #
        time.sleep(5)
        player = HTML5Player(self.marionette, video)
        player.wait_for_video_loaded()
        self.assertTrue(player.is_video_playing())
コード例 #3
0
ファイル: test_33945.py プロジェクト: owdqa/owd_test_cases
class test_main(GaiaTestCase):

    def setUp(self):

        GaiaTestCase.setUp(self)
        self.UTILS = UTILS(self)

        self.browser = Browser(self)
        self.settings = Settings(self)
        self.download_manager = DownloadManager(self)
        self.test_url = self.UTILS.general.get_config_variable("download_url", "common")
        self.file_names = [
            "105MB.rar",
            "41MB.rar",
            "30MB.rar"
        ]
        self.data_urls = ["{}/{}".format(self.test_url, file_name) for file_name in self.file_names]

        # Progress trackers
        self.pre_progresses = []
        self.post_progresses = []

        self.data_layer.connect_to_cell_data()
        self.settings.launch()
        self.settings.downloads()
        self.download_manager.clean_downloads_list()

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

    def _download_multiple_files(self, file):
        self.download_manager.download_file(file)
        self.marionette.switch_to_frame()
        self.UTILS.statusbar.wait_for_notification_toaster_title(
            text="Download started", frame_to_change=DOM.Browser.frame_locator, timeout=15, notif_text="Downloading")
        self.UTILS.reporting.logResult('info', 'Looking for next link!!!!')
        self.browser.switch_to_content()
        time.sleep(5)

    def test_run(self):
        self.UTILS.statusbar.clearAllStatusBarNotifs()
        self.browser.launch()
        self.browser.open_url(self.test_url)

        map(self._download_multiple_files, self.file_names)

        self.apps.kill_all()
        time.sleep(2)

        self.settings.launch()
        self.settings.downloads()

        for data_url in self.data_urls:
            # Check the download is there
            self.download_manager.get_download_entry(data_url)
            # Check it is downloading
            self.download_manager.verify_download_status(data_url, "downloading")
            self.download_manager.verify_download_graphical_status(data_url, "downloading")
            # Append the progress
            self.pre_progresses.append(self.download_manager.get_download_progress(data_url))

        time.sleep(10)

        for data_url in self.data_urls:
            self.post_progresses.append(self.download_manager.get_download_progress(data_url))

        self.UTILS.reporting.logResult('info', "Initial progress array: {}".format(self.pre_progresses))
        self.UTILS.reporting.logResult('info', "Final progress array: {}".format(self.post_progresses))

        result = all([self.pre_progresses[i] < self.post_progresses[i]
                      for i in range(len(self.file_names))])
        self.UTILS.test.test(result, "The progress bar grows during the download.")