Esempio n. 1
0
 def test_13_exit_play(self):
     """退出播放"""
     base(self.driver).sign_out()
     homepage(self.driver).stream_CCTV1()
     common.delayed_get_element(self.driver, 17, ("id", "dopool.player:id/backImage")).click()
     page_name = common.delayed_get_element(self.driver, 3, ("id", "dopool.player:id/common_page_title")).text
     self.assertEqual("央视", page_name, "从直播页面返回的上级页面应该是央视页")
Esempio n. 2
0
 def test_02_switching_clarity(self):
      """
     在我的页面,查看观看历史
      """
      common.delayed_get_element(self.driver, 5, ("xpath", "//*[@text='查看更多']")).click()
      common.delayed_get_element(self.driver, 5, ("id", "dopool.player:id/imageView")).click()
      base(self.driver).click_play_float_button("backImage", [(53, 91)])
      self.assertTrue(common.delayed_get_element(self.driver, 5, ("id", "dopool.player:id/imageView")), "观看历史中无已播放过的视频")
Esempio n. 3
0
 def switch_home_tabs(self, tab):
     """在首页推荐页面,点击顶部tabs列表按钮,在列表中点击要切换的tab,等待页面刷新完成后,点击顶部tabs列表按钮,循环以上操作"""
     base(self.driver).switch_home_tab(tab)
     common.delayed_get_element(self.driver, 60,
                                ("id", "dopool.player:id/image"))
     page_elements = self.driver.find_elements_by_class_name(
         "android.widget.ImageView")
     self.assertTrue(len(page_elements) > 1, f"首页-{tab}页面的元素未刷新出来")
Esempio n. 4
0
 def test_12_watch_history(self):
     """直播的观看历史"""
     homepage(self.driver).clear_watch_history("直播")
     live_title = "CCTV1"
     homepage(self.driver).stream_CCTV1(live_title)
     common.delayed_get_element(self.driver, 3, ("id", "dopool.player:id/backImage")).click()
     common.delayed_get_element(self.driver, 3, ("id", "dopool.player:id/common_page_finish")).click()
     base(self.driver).bottom_navigation("我的")
     self.assertTrue(common.isElementExist("xpath", self.driver, f"//*[@text='{live_title}']"), f"观看历史中应显示{live_title}")
Esempio n. 5
0
 def test_02_try_watch(self):
     """
     点击会员视频,试看
     """
     base(self.driver).watch_vip_video()
     video_element = common.delayed_get_element(
         self.driver, 5,
         ("id", "dopool.player:id/tv_hd_buy_memberships")).text
     self.assertEqual(video_element, "购买VIP会员", "购买VIP会员按钮未出现,VIP视频试看异常。")
Esempio n. 6
0
 def test_04_my_appointment(self):
     """
     在我的页面,查看我的预约
     """
     common.delayed_get_element(self.driver, 5, ("xpath", "//android.widget.TextView[@text='我的预约']")).click()
     common.delayed_get_element(self.driver, 5, ("id", "dopool.player:id/tv_epg_name")).click()
     base(self.driver).click_play_float_button("backImage", [(53, 91)])
     switch_stream_element = common.delayed_get_element(self.driver, 10,("id", "dopool.player:id/tv_switch_channel")).text
     self.assertEqual(switch_stream_element, "切换频道 >", "预约页面未刷新出来")
Esempio n. 7
0
 def test_10_switch_screen_ratio(self):
     """切换屏幕比例"""
     homepage(self.driver).stream_CCTV1(is_full_screen=True)
     time.sleep(1)
     base(self.driver).click_play_float_button("iv_collapsing", [(2166, 175)])
     definition = "tv_definition_4_3" if self.driver.find_element_by_id("dopool.player:id/tv_definition_16_9").get_attribute("selected") \
         else "tv_definition_16_9"
     homepage(self.driver).switch_attributes(f"dopool.player:id/{definition}", "iv_collapsing", [(2166, 177)])
     self.assertTrue(self.driver.find_element_by_id(f"dopool.player:id/{definition}").get_attribute("selected"), "切换屏幕比例失败")
     common.click_screen_point(self.driver, 1 / 2, 1 / 2, 20)
Esempio n. 8
0
 def test_06_lock_screen(self):
     """锁屏"""
     homepage(self.driver).play_video(video_title, True)
     base(self.driver).click_play_float_button("iv_screen_lock",
                                               [(177, 468)])
     base(self.driver).click_play_float_button("third_tv", [(2153, 1008)])
     self.assertFalse(
         common.isElementExist("id", self.driver,
                               "dopool.player:id/tv_definition"),
         "锁屏以后无法点击清晰度按钮")
Esempio n. 9
0
 def test_07_switching_clarity(self):
     """切换清晰度"""
     homepage(self.driver).stream_CCTV1(True)
     base(self.driver).click_play_float_button("third_tv", [(2099, 1008)])
     tv_definition = self.driver.find_elements_by_id("dopool.player:id/tv_definition")
     definition = tv_definition[1].text if self.driver.find_element_by_id(f"//*[@text='{tv_definition[0].text}']").get_attribute("selected") \
         else tv_definition[0].text
     self.driver.find_element_by_xpath(f"//*[@@text='{definition}']").click()
     base(self.driver).click_play_float_button("third_tv", [(2099, 1008)])
     self.assertTrue(self.driver.find_element_by_xpath(f"//*[@@text='{definition}']").get_attribute("selected"),"切换清晰度失败")
     common.click_screen_point(self.driver, 1 / 2, 1 / 8, 20)
Esempio n. 10
0
 def test_04_change_station_vertical_screen(self):
     """竖屏换台"""
     homepage(self.driver).stream_CCTV1()
     common.delayed_get_element(self.driver, 15, ("xpath", "//*[@text='换台']")).click()
     self.driver.find_element_by_xpath("//*[@text='CIBN']").click()
     self.driver.find_element_by_xpath("//*[@resource-id='dopool.player:id/recyclerView']/android.view.View[1]").click()
     start_time = common.delayed_get_element(self.driver, 15, ("id", "dopool.player:id/portrait_current_duration")).text
     self.assertEqual("分", start_time[-1:], "启播时间显示**时**分即播放正常")
     self.driver.find_element_by_id("dopool.player:id/backImage").click()  # 返回
     self.driver.find_element_by_id("dopool.player:id/common_page_finish").click()  # 返回首页
     base(self.driver).bottom_navigation("首页")
Esempio n. 11
0
 def test_03_full_screen(self):
     """播放视频,全屏"""
     homepage(self.driver).stream_CCTV1()
     self.driver.find_element_by_id("dopool.player:id/iv_full_screen").click()
     common.delayed_get_element(self.driver, 10, ("id", "dopool.player:id/iv_full_screen"))
     # 点击屏幕中心
     time_text = self.driver.find_element_by_id("dopool.player:id/tv_time").text
     self.assertEqual("分", time_text[-1:], "启播时间显示**时**分即正常播放")
     self.driver.find_element_by_id("dopool.player:id/backImage").click()    #退出全屏
     self.driver.find_element_by_id("dopool.player:id/backImage").click()    #退出播放
     self.driver.find_element_by_id("dopool.player:id/common_page_finish").click()  # 返回首页
     base(self.driver).bottom_navigation("首页")
Esempio n. 12
0
 def test_11_one_click_live(self):
     """一键直播"""
     #1.查看直播中的节目名称 2.回看 3.一键直播 4.查看是否在播放直播中的节目
     homepage(self.driver).stream_CCTV1()
     living_title = common.delayed_get_element(self.driver, 3, ("id", "dopool.player:id/live_title")).text
     common.swipeDown(self.driver, 1/2)
     self.driver.find_element_by_xpath("//*[@resource-id='dopool.player:id/epgListRV']/android.view.ViewGroup[1]/android.widget.TextView[3]").click()
     common.delayed_get_element(self.driver, 10, ("id", "dopool.player:id/iv_full_screen"))
     base(self.driver).click_play_float_button("civ_to_live", [(87, 388)])
     common.delayed_get_element(self.driver, 10, ("id", "dopool.player:id/iv_full_screen"))
     actual_living_title = common.delayed_get_element(self.driver, 3, ("id", "dopool.player:id/live_title")).text
     self.assertEqual(living_title, actual_living_title, f"一键直播播放的节目应该是{living_title}")
Esempio n. 13
0
 def clear_watch_history(self, page):
     base(self.driver).bottom_navigation("我的")
     common.delayed_get_element(self.driver, 3,
                                ("xpath", "//*[@text='查看更多']")).click()
     common.delayed_get_element(self.driver, 3,
                                ("xpath", f"//*[@text='{page}']")).click()
     self.driver.find_element_by_id(
         "dopool.player:id/managerTextView").click()
     common.delayed_get_element(self.driver, 3,
                                ("xpath", "//*[@text='全选']")).click()
     common.delayed_get_element(self.driver, 3,
                                ("xpath", "//*[@text='删除']")).click()
     self.driver.find_element_by_id("dopool.player:id/backImage").click()
Esempio n. 14
0
 def test_09_watch_history(self):
     """点播的观看历史"""
     homepage(self.driver).clear_watch_history("点播")
     homepage(self.driver).play_video(video_title)
     common.delayed_get_element(
         self.driver, 3, ("id", "dopool.player:id/backImage")).click()
     common.delayed_get_element(
         self.driver, 3, ("id", "dopool.player:id/cancel_text")).click()
     base(self.driver).bottom_navigation("我的")
     self.assertTrue(
         common.isElementExist("xpath", self.driver,
                               f"//*[@text='{video_title}']"),
         f"观看历史中应显示{video_title}")
Esempio n. 15
0
 def test_02_Reminisce(self):
     """播放直播视频,回看"""
     homepage(self.driver).stream_CCTV1()
     common.swipeDown(self.driver)
     common.swipeDown(self.driver)
     remimisce_text = self.driver.find_element_by_id("dopool.player:id/state_text").text
     self.assertEqual("回看",remimisce_text,"找到回看")
     self.driver.find_element_by_id("dopool.player:id/state_text").click()   #点击回看按钮
     start_time = self.driver.find_element_by_id("dopool.player:id/portrait_current_duration").text
     self.assertEqual("分", start_time[-1:], "启播时间显示**时**分即播放正常")
     self.driver.find_element_by_id("dopool.player:id/backImage").click()     #返回
     self.driver.find_element_by_id("dopool.player:id/common_page_finish").click()    #返回首页
     base(self.driver).bottom_navigation("首页")
Esempio n. 16
0
 def test_03_buy_pay_vip(self):
     """
     购买VIP会员 - 支付
     """
     base(self.driver).watch_vip_video()
     common.delayed_get_element(
         self.driver, 5,
         ("id", "dopool.player:id/tv_hd_buy_memberships")).click()
     common.delayed_get_element(self.driver, 5,
                                ("id", "dopool.player:id/btn_pay")).click()
     common.delayed_get_element(
         self.driver, 5, ("id", "dopool.player:id/backImage")).click()
     open_vip_element = common.delayed_get_element(
         self.driver, 5, ("id", "dopool.player:id/tv_vip_protocal")).text
     self.assertEqual(open_vip_element, "《会员服务协议》", "未正常返回到开通VIP页面")
Esempio n. 17
0
 def stream_CCTV1(self, live_title="CCTV1", is_full_screen=False):
     """在首页推荐页面,在icon组点央视,播放CCTV1,视频正常播放"""
     if not self.driver.find_element_by_id(
             "dopool.player:id/tabText").text == "首页":
         base(self.driver).bottom_navigation("首页")
     icon_xpath = f"//android.support.v7.widget.RecyclerView[@resource-id='dopool.player:id/common_rcy']/android." \
         f"widget.LinearLayout[1]/android.support.v7.widget.RecyclerView[1]/android.widget.LinearLayout[2]"
     common.delayed_get_element(self.driver, 60,
                                ("xpath", icon_xpath)).click()
     common.delayed_get_element(
         self.driver, 60, ("xpath", f"//*[@text='{live_title}']")).click()
     if is_full_screen:
         common.delayed_get_element(
             self.driver, 10,
             ("id", "dopool.player:id/iv_full_screen")).click()
Esempio n. 18
0
    def test_10_exit_play(self):
        """退出播放"""
        base(self.driver).sign_out()
        homepage(self.driver).play_video(video_title)
        common.delayed_get_element(
            self.driver, 17, ("id", "dopool.player:id/backImage")).click()
        common.delayed_get_element(
            self.driver, 3, ("id", "dopool.player:id/btn_left")).click()
        time.sleep(1)
        self.assertTrue(
            common.isElementExist("xpath", self.driver, "//*[@text='点播']"),
            "退出点播后应显示搜索页面")


# if __name__ == "__main__":
#     Video().test_04_switching_clarity()
Esempio n. 19
0
 def test_06_reservation(self):
     """预约"""
     homepage(self.driver).stream_CCTV1()
     reservation_xpath = "//android.support.v7.widget.RecyclerView[@resource-id='dopool.player:id/epgListRV']/" \
                         "android.view.ViewGroup[6]/android.widget.TextView[3]"
     common.delayed_get_element(self.driver, 5, ("xpath", reservation_xpath)).click()
     time.sleep(3)
     self.assertTrue(common.isElementExist("xpath", self.driver, "//*[@text='已预约']"), "点击预约后按钮应变成已预约")
     item_xpath = "//*[@resource-id='dopool.player:id/epgListRV']/android.view.ViewGroup[6]/android.widget.TextView[2]"
     item_name = self.driver.find_element_by_xpath(item_xpath).text
     base(self.driver).click_play_float_button("backImage", [(79, 150)])
     common.delayed_get_element(self.driver, 3, ("id", "dopool.player:id/common_page_finish")).click()
     base(self.driver).bottom_navigation("我的")
     common.delayed_get_element(self.driver, 5, ("xpath", "//*[@text='我的预约']")).click()
     reservation_item = common.delayed_get_element(self.driver, 5, ("id", "dopool.player:id/tv_epg_name")).text
     self.assertEqual(item_name, reservation_item, "我的预约中显示已预约的节目和在竖屏播放节目单中预约的节目不一致")
Esempio n. 20
0
 def test_08_collection(self):
     """收藏点播视频"""
     homepage(self.driver).play_video(video_title)
     common.delayed_get_element(
         self.driver, 3,
         ("id", "dopool.player:id/collection_text")).click()
     common.delayed_get_element(
         self.driver, 3, ("id", "dopool.player:id/backImage")).click()
     common.delayed_get_element(
         self.driver, 3, ("id", "dopool.player:id/cancel_text")).click()
     base(self.driver).bottom_navigation("我的")
     common.delayed_get_element(self.driver, 3,
                                ("xpath", "//*[@text='我的收藏']")).click()
     common.delayed_get_element(self.driver, 3,
                                ("xpath", "//*[@text='点播']")).click()
     self.assertEqual(
         video_title,
         self.driver.find_element_by_id("dopool.player:id/tvTitle").text,
         f"我的收藏点播列表应该是{video_title}")
Esempio n. 21
0
 def play_video(self, video_title, is_full_screen=False):
     time.sleep(7)
     if not self.driver.find_element_by_id(
             "dopool.player:id/tabText").text == "首页":
         base(self.driver).bottom_navigation("首页")
     common.delayed_get_element(self.driver, 10,
                                ("id", "dopool.player:id/tv_tip")).click()
     common.delayed_get_element(
         self.driver, 10,
         ("id", "dopool.player:id/search_edit")).send_keys(video_title)
     video_title_xpath = "//android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout" \
                         "[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.view.ViewGroup[1]/android." \
                         "widget.FrameLayout[2]/android.widget.FrameLayout[1]/android.support.v7.widget.RecyclerView[1]/android." \
                         "widget.TextView[1]"
     common.delayed_get_element(self.driver, 3,
                                ("xpath", video_title_xpath)).click()
     common.delayed_get_element(
         self.driver, 3, ("id", "dopool.player:id/tv_watch")).click()
     if is_full_screen:
         common.delayed_get_element(
             self.driver, 10,
             ("id", "dopool.player:id/iv_full_screen")).click()
Esempio n. 22
0
 def setUpClass(cls):
     #打开应用,进入
     cls.driver = webDriver().get_driver()
     base(cls.driver).start_app()
     base(cls.driver).bottom_navigation("会员").click()
     pass
Esempio n. 23
0
 def switch_attributes(self, definition, attribute_id, bounds):
     self.driver.find_element_by_id(definition).click()
     base(self.driver).click_play_float_button(
         f"dopool.player:id/{attribute_id}", bounds)
Esempio n. 24
0
 def setUpClass(cls):
     #打开应用,进入首页
     cls.driver = webDriver().get_driver()
     base(cls.driver).start_app()
     pass
Esempio n. 25
0
 def setUpClass(cls):
     #打开应用,进入首页
     cls.driver = webDriver().get_driver()
     base(cls.driver).start_login_app()
     base(cls.driver).bottom_navigation("首页")
     pass
Esempio n. 26
0
 def setUpClass(cls):
     cls.driver = webDriver().get_driver()
     base(cls.driver).start_login_app()
     base(cls.driver).play_collect_appoint_stream()
     base(cls.driver).bottom_navigation("我的")
     pass
Esempio n. 27
0
# -*- coding:utf-8 -*-
#@Time  : 2019/9/2 16:23
#@Author: dongyani
#@Function: checkin

import unittest, time
import comm.common as common
from comm.webDriver import webDriver
from pageElement.base_element_operate import base
from pageElement.checkInPage import checkin_page

driver = webDriver().get_driver()
base = base(driver)
checkin_page = checkin_page()


class CheckIn(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        base.bottom_navigation_button("我的").click()

    @classmethod
    def tearDownClass(cls):
        pass

    def test_01_checkin_notloggedin(self):
        """未登录时,签到页面下显示未登录"""
        checkin_down_text = checkin_page.checkin_down_text()
        self.assertEqual("未登录", checkin_down_text, "未登录时,签到按钮下方应显示未登录")

    def test_02_clickcheckin_loginpage(self):
Esempio n. 28
0
 def test_02_upgrade(self):
     """点击立即升级,等待更新完毕,等待安装完毕,打开,进入首页"""
     base(self.driver).slide_guide_page()
     base(self.driver).enter_app()
     base(self.driver).close_privacy()
     common.delayed_get_element(
         self.driver, 6, ("id", "dopool.player:id/tv_update_now")).click()
     base(self.driver).permission_prompt()
     base(self.driver).enter_app()
     base(self.driver).close_privacy()
     base(self.driver).close_float()
     home_text = self.driver.find_element_by_id(
         "dopool.player:id/tabText").text
     self.assertEqual("首页", home_text, "打开app后,默认定位在首页")
Esempio n. 29
0
# -*- coding:utf-8 -*-
#@Time  : 2019/8/29 17:23
#@Author: pengjuan

import unittest
import comm.webDriver as driver
from pageElement.base_element_operate import base
from pageElement.loginPage import Login_Page

driver = driver().setUpClass()
base = base()
Login_Page = Login_Page


class Login(driver, unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        base.bottom_navigation_button("我的").click()

    @classmethod
    def tearDownClass(cls):
        pass

    def test_login(self):
        """输入正确的手机号和验证码,点击登录"""
        base.login("dopool.player:id/img_user_head")
        self.assertTrue(Login_Page().login_page_text(), "用户ID:7576640")
Esempio n. 30
0
 def test_01_startapp(self):
     """验证三个引导页面,点击立即体验,进入首页"""
     base(self.driver).start_login_app()
     home_text = self.driver.find_element_by_id(
         "dopool.player:id/tabText").text
     self.assertEqual("首页", home_text, "打开app后,默认定位在首页")