Пример #1
0
    def test_Play(self):
        log.starttestcase("Test case starts")

        el = self.driver.find_element_by_xpath(
            "//android.widget.RelativeLayout[@index= '0']")
        actions = TouchAction(self.driver)
        actions.tap(el)
        actions.perform()
        log.info("Video Started Playing")
        sleep(5)
        self.driver.save_screenshot(log.screenshotpath("video playback"))
        el = self.driver.find_element_by_xpath(
            "//hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.View"
        )
        actions = TouchAction(self.driver)
        actions.tap(el)
        actions.perform()
        log.info("Touch Perform")

        current_time = self.driver.find_element_by_id(
            "com.google.android.youtube:id/time_bar_current_time").text
        log.info("Video playback time")

        if "0.00" != current_time:

            log.info("playback time matches")

        else:
            log.info("Plackback time not matches")
            self.driver.save_screenshot(log.screenshotpath("Failed"))
            log.markTestfail("test case failed")
            self.skipTest("play back testcase failed")
Пример #2
0
    def test_pause(self):

        log.starttestcase("Test case starts")

        el = self.driver.find_element_by_xpath(
            "//android.widget.RelativeLayout[@index= '0']")
        actions = TouchAction(self.driver)
        actions.tap(el)
        actions.perform()

        log.info("Video Started Playing")
        log.info(
            "Halting the Test Case for 35 Seconds Expected Displaying the Advertishment"
        )
        sleep(5)
        self.driver.save_screenshot(log.screenshotpath("video playback"))

        el = self.driver.find_element_by_xpath(
            "//hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.View"
        )
        actions = TouchAction(self.driver)
        actions.tap(el)
        actions.perform()
        log.info("Touch Perform")

        sub_el = self.driver.find_element_by_xpath(
            "//android.widget.ImageView[@content-desc='Pause video']")
        actions = TouchAction(self.driver)
        actions.tap(sub_el)
        actions.perform()
        log.info("Video Paused")
        sleep(3)
        self.driver.save_screenshot(log.screenshotpath("Paused video"))
Пример #3
0
    def test_HomeTab(self):
        log.starttestcase("test_HomeTab")
        sleep(5)

        log.debug("Home Screen Visiable")
        log.markTestPass("Marking Test Case is Passed")
        sleep(5)
        self.driver.save_screenshot(log.screenshotpath("hometab_TestCase"))
        pass
Пример #4
0
    def test_SubscriptionTab(self):
        log.starttestcase("test_SubscriptionTab")
        el = self.driver.find_element_by_xpath(
            "//android.widget.Button[@index='2']").click()
        self.driver.implicitly_wait(20)
        log.debug("Subscritpion Tab Visiable")
        sub_el = self.driver.find_element_by_xpath(
            "//android.widget.Button[@index='2']/android.widget.TextView").text
        self.driver.implicitly_wait(20)

        if sub_el == "Subscription":
            log.debug("Subscritpion Tab Element Matched")
        else:
            log.markTestfail("String Not matched , Test case failed")
            log.debug("Subscription test case failed")
        sleep(10)

        self.driver.save_screenshot(log.screenshotpath("Subscription Tab "))
        self.skipTest("String Not Maching")
Пример #5
0
    def test_InboxTab(self):
        log.starttestcase("test_InboxTab")

        el = self.driver.find_element_by_xpath(
            "//android.widget.Button[@index='3']").click()
        self.driver.implicitly_wait(15)
        log.debug("Inbox tab visiable")
        sub_el = self.driver.find_element_by_xpath(
            "//android.widget.Button[@index='3']/android.widget.TextView").text
        self.driver.implicitly_wait(15)
        log.debug("Inbox tab elemnt")

        if sub_el == "Inbox":
            log.debug("Inbox tab element found")
            log.markTestPass("Inbox test case marked as Passed")

        else:
            log.markTestfail("Inbox tab test case failed")
            self.driver.save_screenshot(log.screenshotpath("Inbox"))
            self.skipTest("String Not Maching")
Пример #6
0
    def test_LibraryTab(self):
        log.starttestcase("test_LibraryTab")

        el = self.driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='Library']").click()
        self.driver.implicitly_wait(10)
        log.debug("Library tab visiable")
        sub_el = self.driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='Library']/android.widget.TextView"
        ).text
        self.driver.implicitly_wait(10)
        log.debug("Library tab element ")
        if sub_el == "Library":
            log.debug("Library tab element matched")
            log.markTestPass("Library tab test case marked as passed")

        else:
            log.markTestfail("String not matched , test case failed")
            self.driver.save_screenshot(log.screenshotpath("Library"))
            self.skipTest("String Not Maching")
Пример #7
0
    def test_TrendingTab(self):

        log.starttestcase("test_TrentingTab")
        sleep(5)
        el = self.driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='Trending']").click()
        self.driver.implicitly_wait(15)
        sleep(5)
        log.debug("Trending Screen Visiable")
        sub_el = self.driver.find_element_by_xpath(
            "//android.widget.Button[@content-desc='Trending']/android.widget.TextView"
        ).text
        self.driver.implicitly_wait(15)
        log.debug("Trending Element founded")

        if sub_el == "Trending":
            log.markTestPass("Marking test Case Passed")
            self.driver.save_screenshot(log.screenshotpath("Trending tab"))
        else:
            log.markTestfail("Marking Test Case Fail")
            self.skipTest("String Not Maching")
Пример #8
0
    def test_nextvideoplayback(self):

        log.starttestcase("Test case starts")
        #el = self.driver.find_element_by_xpath("//android.widget.ImageView[@content-desc='Go to video' and @index = '1']")
        #el = self.driver.find_element_by_xpath("//android.widget.ImageView[@content-desc='Go to video']")
        el = self.driver.find_element_by_xpath(
            "//android.widget.RelativeLayout[@index= '0']")
        actions = TouchAction(self.driver)
        actions.tap(el)
        actions.perform()
        log.info("Video Started Playing")
        sleep(10)
        self.driver.save_screenshot(log.screenshotpath("video playback"))

        ep = self.driver.find_element_by_xpath(
            "//hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[2]/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.support.v7.widget.RecyclerView/android.widget.FrameLayout[1]/android.widget.LinearLayout/android.widget.RelativeLayout[1]/android.widget.ImageView"
        )
        actions = TouchAction(self.driver)
        actions.tap(ep)
        actions.perform()
        log.info("Suggested video starts playing")
        sleep(10)

        el = self.driver.find_element_by_xpath(
            "//hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.View"
        )
        actions = TouchAction(self.driver)
        actions.tap(el)
        actions.perform()
        log.info("Touch Perform")

        nex = self.driver.find_element_by_accessibility_id("Next video")
        actions = TouchAction(self.driver)
        actions.tap(nex)
        actions.perform()
        log.info("Next Video played")
        self.driver.save_screenshot(log.screenshotpath("Next video played"))

        actions = TouchAction(self.driver)
        actions.tap(el)
        actions.perform()
        log.info("Touch Perform")

        current_time = self.driver.find_element_by_id(
            "com.google.android.youtube:id/time_bar_current_time").text
        log.info("Current time")

        if "0:00" != current_time:
            log.info("Matching current time")

        else:
            log.info("current time not matched")
            log.markTestfail("test case failed")
            self.skipTest("play back testcase failed")

        sleep(2)

        el = self.driver.find_element_by_xpath(
            "//hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup/android.view.View"
        )
        actions = TouchAction(self.driver)
        actions.tap(el)
        actions.perform()
        log.info("Touch Perform")

        ele = self.driver.find_element_by_xpath(
            "//android.widget.ImageView[@index= '5']")
        actions = TouchAction(self.driver)
        actions.tap(ele)
        actions.perform()
        log.info("Previous Video starts playing")
        self.driver.save_screenshot(log.screenshotpath("Previous video"))

        qw = self.driver.find_element_by_accessibility_id("Expand Mini Player")
        actions = TouchAction(self.driver)
        actions.tap(qw)
        actions.perform()
        log.info("Touch Perform for previous")

        current_time = self.driver.find_element_by_id(
            "com.google.android.youtube:id/time_bar_current_time").text
        log.info("Current time")

        if "0:00" != current_time:
            log.info("Matching current time")

        else:

            log.info("current time not matched")
            log.markTestfail("test case failed")
            self.skipTest("play back testcase failed")

        sleep(5)
Пример #9
0
    def test_login(self):
        log.starttestcase("test_login")
        ell = self.driver.find_element_by_xpath(
            "//android.widget.ImageView[@content-desc='Account']")
        actions = TouchAction(self.driver)
        actions.tap(ell)
        actions.perform()

        log.debug("Account page is Visiable")
        sleep(5)
        self.driver.save_screenshot(log.screenshotpath("Accoun page"))
        w = self.driver.find_element_by_xpath(
            "/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.support.v7.widget.RecyclerView"
        ).is_displayed()
        sleep(5)
        log.debug("Switch Account")
        self.driver.save_screenshot(log.screenshotpath("Switch account"))

        sw = self.driver.find_element_by_xpath(
            "	/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.support.v7.widget.RecyclerView/android.widget.LinearLayout[4]/android.widget.RelativeLayout/android.widget.TextView"
        )
        actions = TouchAction(self.driver)
        actions.tap(sw)
        actions.perform()
        sleep(5)
        log.debug("Added accounts visiable")
        self.driver.save_screenshot(log.screenshotpath("Added accounts"))
        #Select Added Account

        #(1) Atleast 2 Account should be added in You Tube app for account switching.
        #(2) Change the content-desc in xpath below with your Account channel name Ex: "Eshan varma"

        ac = self.driver.find_element_by_xpath(
            "//android.widget.LinearLayout[@content-desc='Eshan varma']")
        actions = TouchAction(self.driver)
        actions.tap(ac)
        actions.perform()
        log.debug("selected the added accout, account changed")
        sleep(5)
        self.driver.save_screenshot(
            log.screenshotpath("Account changed screenshot"))

        #Sign Out
        ell = self.driver.find_element_by_xpath(
            "//android.widget.ImageView[@content-desc='Account']")
        actions = TouchAction(self.driver)
        actions.tap(ell)
        actions.perform()
        log.debug("Switch Account")
        sleep(5)
        self.driver.save_screenshot(log.screenshotpath("Switch account"))
        w = self.driver.find_element_by_xpath(
            "/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.support.v7.widget.RecyclerView"
        ).is_displayed()
        log.debug("Account page displayed")
        sw = self.driver.find_element_by_xpath(
            "/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.support.v7.widget.RecyclerView/android.widget.LinearLayout[4]"
        )
        actions = TouchAction(self.driver)
        actions.tap(sw)
        actions.perform()
        sleep(5)
        sg = self.driver.find_element_by_xpath(
            "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.TextView"
        )
        actions = TouchAction(self.driver)
        actions.tap(sg)
        actions.perform()
        log.debug("Account is in sign out mode")
        sleep(5)
        self.driver.save_screenshot(log.screenshotpath("sign out mode"))
        log.stoptestcase(self)