Ejemplo n.º 1
0
    def test_wzpl(self):
        u'''app文章评论测试用例'''
        #登陆
        public.login(self.driver)
        #返回到排行
        homepage.ph_click(self.driver)
        #点击排行按钮
        self.driver.find_element_by_id(
            'tv.acfundanmaku.video:id/rank_popup').click()
        sleep(2)
        #选文章排行
        el = self.driver.find_elements_by_class_name(
            'android.widget.LinearLayout')
        el[8].click()
        sleep(2)
        #点击文章
        ele = self.driver.find_elements_by_class_name(
            'android.widget.LinearLayout')
        ele[0].click()
        #文章评论
        homepage.wz_pl(self.driver).click()
        #点击评论

        self.driver.find_element_by_name(u'评论').click()
        #输入评论
        self.driver.find_element_by_id(
            'tv.acfundanmaku.video:id/post_input').send_keys('thinks ok!')
        self.driver.find_element_by_name(u'发送').click()
        sleep(2)
        el = self.driver.find_element_by_name(u'评论')
        self.assertIsNotNone(el)
Ejemplo n.º 2
0
 def test_wzmhms(self):
     u'''app文章漫画模式测试用例'''
     #登陆
     public.login(self.driver)
     #返回到排行
     homepage.ph_click(self.driver)
     #点击排行按钮
     self.driver.find_element_by_id(
         'tv.acfundanmaku.video:id/rank_popup').click()
     sleep(2)
     #选文章排行
     el = self.driver.find_elements_by_class_name(
         'android.widget.LinearLayout')
     el[8].click()
     sleep(2)
     #点击文章
     ele = self.driver.find_elements_by_class_name(
         'android.widget.LinearLayout')
     ele[0].click()
     #点击漫画模式
     homepage.wz_mhms(self.driver).click()
     sleep(2)
     #断言 判断漫画模式变为文章模式按键是否为空
     el = self.driver.find_element_by_id(
         'tv.acfundanmaku.video:id/content_article_info_comic_articlemode')
     self.assertIsNotNone(el)
Ejemplo n.º 3
0
 def test_wzsc(self):
     u'''app文章收藏测试用例'''
     #登陆
     public.login(self.driver)
     #返回到排行
     homepage.ph_click(self.driver)
     #点击排行按钮
     self.driver.find_element_by_id(
         'tv.acfundanmaku.video:id/rank_popup').click()
     sleep(2)
     #选文章排行
     el = self.driver.find_elements_by_class_name(
         'android.widget.LinearLayout')
     el[8].click()
     sleep(2)
     #点击文章
     ele = self.driver.find_elements_by_class_name(
         'android.widget.LinearLayout')
     ele[0].click()
     #收藏
     homepage.wz_sc(self.driver).click()
     sleep(2)
     # #断言 收藏成功判断已收藏元素是否为空
     el = self.driver.find_element_by_name(u'取消收藏')
     # el[0] = self.driver.find_elements_by_class_name('android.widget.TextView')
     self.assertIsNotNone(el)
Ejemplo n.º 4
0
    def test_login(self):
        #u'''登录'''
        driver = self.driver
        public.login(self)
        self.assertEqual(driver.current_url,
                         'http://192.168.100.125:58088/vender/mainIndex.jsp')

        public.teardown(self)
Ejemplo n.º 5
0
 def test_manage_outgoing(self):
     #u'''出入库上报'''
     driver = self.driver
     public.login(self)
     driver.find_element_by_link_text(u"出入库上报").click()
     self.assertIsNotNone(
         driver.find_element_by_xpath(
             "//div[@id='tt']/div/div[3]/ul/li[2]/a/span"))
Ejemplo n.º 6
0
 def test_login(self):
     u"""app登陆用例"""
     public.login(self.driver)
     # el = self.driver.find_element_by_id('tv.acfundanmaku.video:id/main_pager_tab_more')
     el = self.driver.find_element_by_id(
         'tv.acfundanmaku.video:id/main_pager_tab_more')
     print el.text
     self.assertEqual(u'更多', el.text)
Ejemplo n.º 7
0
 def test_sc(self):
     u'''app收藏测试用例'''
     #登陆
     public.login(self.driver)
     #返回到频道
     homepage.pd_click(self.driver)
     #随机点击娱乐栏目
     homepage.yl_random_click(self.driver)
     #点击收藏
     homepage.play_sc(self.driver).click()
     #查找以已收藏元素
     el = self.driver.find_element_by_id(
         'tv.acfundanmaku.video:id/content_video_info_stows_remove')
     self.assertIsNotNone(el)
Ejemplo n.º 8
0
def login():
    global driver1
    driver1 = webdriver.Firefox()
    user_file = open('text/user_info.txt', 'r')
    values = user_file.readlines()
    user_file.close()
    i = []
    for search in values:
        i.append(search)
        #获取驱动打开网站
    base_url = 'http://123.206.57.62:7000'
    driver1.get(base_url)
    driver1.maximize_window()
    username = i[3].split(',')[0]
    password = i[3].split(',')[1]
    print("用户名是:%s" % username)
    print("密码是:%s" % password)
    #调用登陆方法
    public.login(driver1, username, password)
    driver1.implicitly_wait(10)
Ejemplo n.º 9
0
 def test_pl(self):
     u'''app评论测试用例'''
     #登陆
     public.login(self.driver)
     #返回到频道
     homepage.pd_click(self.driver)
     #随机点击娱乐栏目
     homepage.yl_random_click(self.driver)
     #点击评论进入评论界面
     homepage.play_pl(self.driver).click()
     #点击右上角评论按钮发布评论
     self.driver.find_element_by_name('评论').click()
     #输入评论内容
     el = self.driver.find_element_by_id(
         'tv.acfundanmaku.video:id/post_input')
     el.send_keys('thanks ok!')
     #点击发送
     self.driver.find_element_by_name(u'发送').click()
     #等页面自动跳转
     sleep(2)
     #断言 评论跳转后页面的评论元素是否为空
     self.assertIsNotNone('homepage.pl_pl(self.driver)')
Ejemplo n.º 10
0
 def test_liukang_login(self):
     username='******'
     password='******'
     login().user_login(self.driver,username,password)
     self.driver.quit()
Ejemplo n.º 11
0
 def test_liuxiao_login(self):
     username='******'
     password='******'
     login().user_login(self.driver,username,password)
     self.driver.quit()
Ejemplo n.º 12
0
# print "el ok"
# sleep(2)
#
# print el
# print el.text
#
# el = driver.find_element_by_id('tv.acfundanmaku.video:id/main_pager_tab_more')
# el = driver.find_element_by_name(u'更多')
# el = driver.find_elements_by_class_name('android.widget.RadioButton')
# print len(el)
# el[1].click()

# self.assertEqual(u'更多', el.text)

#登陆
public.login(driver)
sleep(3)
#返回到排行
homepage.ph_click(driver)
#点击排行按钮
driver.find_element_by_id('tv.acfundanmaku.video:id/rank_popup').click()
sleep(2)
#选文章排行
el = driver.find_elements_by_class_name('android.widget.LinearLayout')
el[8].click()
sleep(2)
#点击文章
ele = driver.find_elements_by_class_name('android.widget.LinearLayout')
ele[0].click()
#收藏
homepage.wz_sc(driver).click()
Ejemplo n.º 13
0
                        # 确定裁剪
                        self.driver.find_elements_by_class_name('ant-confirm-btns')[0].find_elements_by_tag_name('button')[1].click()
                        time.sleep(2)
                        # 选择一键裁图
                        self.driver.find_elements_by_css_selector('div.ue-btn-group')[3].find_elements_by_tag_name('span')[1].click()

                    time.sleep(3)
                    self.driver.find_elements_by_css_selector("div.ant-row>div.ant-col-3>button")[0].click()
        except Exception as e:
            return e


if __name__ == "__main__":

    from selenium import webdriver
    from public.login import *

    driver = webdriver.Chrome()
    driver.maximize_window()
    login(driver)
    mn = ManageNews(driver)
    channel = '天下'
    title = "alex测试"
    label = '无'
    content = "alex123456789打算的撒的"
    source = "新华网"
    img_list = ['C:/Alex/1564646.jpg']
    img_type = 0
    result = mn.create_news(channel, label, title, content, source, img_list, img_type=img_type)
    print(result)
    driver.quit()
Ejemplo n.º 14
0
from selenium import webdriver
from public import login
driver = webdriver.Chrome()
driver.implicitly_wait(10)
driver.get("http://www.126.com")
#调用登录模块
login().user_login(driver)
#调用退出登录
login().user_logout(driver)
Ejemplo n.º 15
0
# print "el ok"
# sleep(2)
#
# print el
# print el.text
#
# el = driver.find_element_by_id('tv.acfundanmaku.video:id/main_pager_tab_more')
# el = driver.find_element_by_name(u'更多')
# el = driver.find_elements_by_class_name('android.widget.RadioButton')
# print len(el)
# el[1].click()

# self.assertEqual(u'更多', el.text)

#登陆
public.login(driver)
sleep(3)
#返回到排行
homepage.ph_click(driver)
#点击排行按钮
driver.find_element_by_id('tv.acfundanmaku.video:id/rank_popup').click()
sleep(2)
#选文章排行
el = driver.find_elements_by_class_name('android.widget.LinearLayout')
el[8].click()
sleep(2)
#点击文章
ele = driver.find_elements_by_class_name('android.widget.LinearLayout')
ele[0].click()
#收藏
homepage.wz_sc(driver).click()