예제 #1
0
    def test0120_new_video(self):
        # 登录
        Login(self.driver, adminLogin, admin['name'], admin['pwd'])
        self.assertTrue(self.driver.title == '视频管理-云上国学',
                        msg='验证失败,页面未跳转到视频管理 page redirect failed')
        sleep(ave)

        # 进入新建页面
        self.driver.find_element_by_id('spgl_tj').click()
        try:
            self.driver.find_element_by_id('uploadbtn_upload').click()
        except NoSuchElementException:
            self.assertTrue(False, msg="上传按钮未找到,页面切换不成功")

        # 上传操作
        sleep(ave)
        util_methods.uploadFile('mp4')
        sleep(long)
        # 通过视频名是否为空判断是否上传成功
        self.assertIsNotNone(self.driver.find_element_by_id('videoname').text,
                             msg='视频未上传成功 video upload failed')

        # 自定义文件名
        self.driver.find_element_by_id('wd_checkBox_isused_1').click()
        sleep(ave)
        coursename = self.driver.find_element_by_id('coursename')
        coursename.clear()
        coursename.send_keys(util_methods.getPoem())
        sleep(long)
예제 #2
0
    def test0121_new_video(self):
        Login(self.driver, adminLogin, admin['name'], admin['pwd'])
        sleep(ave)

        # 进入新建页面
        self.driver.find_element_by_id('spgl_tj').click()

        # 上传封面
        self.driver.find_element_by_id('sp_scfm_upload').click()
        sleep(short)
        util_methods.uploadFile('jpg')
        sleep(long)
        # 通过封面按钮变化判断是否上传成功
        self.assertTrue(
            self.driver.find_element_by_id('spgl_fmcz').text == '删除',
            msg='视频未上传成功 video upload failed')
        sleep(ave)
예제 #3
0
    def test0151_new_training(self):
        # 获取随机名字
        name_str = util_methods.getPoem()
        name_str_ls = util_methods.splitPoem(name_str)
        sleep(ave)
        global name
        name['broadcast'] = name_str_ls[0]

        # 登录
        Login(self.driver, adminLogin, admin['name'], admin['pwd'])
        sleep(ave)
        self.driver.find_element_by_id('pxgl').click()
        sleep(ave)
        print("进入培训管理ok")

        # 点击新建
        self.driver.find_element_by_id('px_add').click()
        sleep(ave)

        # 输入直播名字
        self.driver.find_element_by_id('pxjs_mc').send_keys(name_str_ls[0])
        sleep(short)
        print('输入培训名字')

        # 上传封面
        self.driver.find_element_by_id('pxjs_sc_upload').click()
        sleep(short)
        util_methods.uploadFile('jpg')
        sleep(long)
        print("上传封面ok")

        # 输入介绍内容
        self.driver.find_element_by_id('wd-editeditbox_pxjs').send_keys(
            name_str)
        # 上传内容介绍的图片
        self.driver.find_element_by_id('pxjs_insertimage').click()
        sleep(short)
        util_methods.uploadFile('jpg')
        sleep(long)
        print("输入介绍内容格ok")

        # 输入课程体系
        self.driver.find_element_by_id('wd-editeditbox_kctx').send_keys(
            name_str)
        # 上传内容介绍的图片
        self.driver.find_element_by_id('kctx_insertimage').click()
        sleep(short)
        util_methods.uploadFile('jpg')
        sleep(long)
        print("输入介绍内容格ok")

        # 选择讲师
        self.driver.find_element_by_id('px_tjjs').click()
        sleep(ave)
        teachers = self.driver.find_elements_by_class_name('js-yxz-box')
        teachers[0].click()
        self.driver.find_element_by_id('xzjs_qd').click()
        sleep(short)

        # 点击保存
        self.driver.find_element_by_id('px_bc').click()
        sleep(long)

        # 点击返回列表
        self.driver.find_element_by_class_name('hp-ret').click()
        sleep(ave)

        # 验证课程是否创建成功
        table = self.driver.find_element_by_id('pxgl_table')
        # 第一行是标题, 正文从tr 1 开始。 td是列。
        name_exp = table.find_element_by_class_name('pxgl-mc').text

        self.assertEqual(
            name_exp, name_str,
            "培训 未被查询到创建失败 book created failed, exp:%s, act:%s" %
            (name_exp, name_str))
예제 #4
0
    def test0141_new_broadcast(self):
        # 获取随机名字
        name_str = util_methods.getPoem()
        name_str_ls = util_methods.splitPoem(name_str)
        sleep(ave)
        global name
        name['broadcast'] = name_str_ls[0]

        # 登录
        Login(self.driver, adminLogin, admin['name'], admin['pwd'])
        sleep(ave)
        self.driver.find_element_by_id('zbgl').click()
        sleep(ave)
        print("进入直播管理ok")

        # 点击新建
        self.driver.find_element_by_id('zbgl_xj').click()
        sleep(ave)

        # 输入直播名字
        self.driver.find_element_by_id('coursename').send_keys(name_str_ls[0])
        sleep(short)
        print('输入直播名字')

        # 选择标签
        tags = self.driver.find_element_by_class_name('lm-labelbox')
        taglist = tags.find_elements_by_class_name('lm-label')
        # 点击第一个
        taglist[0].click()
        print("标签的选择ok")

        # 输入价格
        self.driver.find_element_by_id('courseprice').send_keys('0.01')
        print("输入价格ok")

        # 输入介绍内容
        self.driver.find_element_by_id('wd-editeditbox_courseintro').send_keys(
            name_str)
        # 上传内容介绍的图片
        self.driver.find_element_by_id('courseintro_insertimage').click()
        sleep(short)
        util_methods.uploadFile('jpg')
        sleep(long)
        print("输入介绍内容格ok")

        # 输入作者
        self.driver.find_element_by_id('author').send_keys(name_str_ls[1])
        sleep(short)
        print('输入作者')

        # 点击保存
        self.driver.find_element_by_id('jcgl_bc').click()
        sleep(long)

        # 点击返回列表
        self.driver.find_element_by_id('hp-ret').click()
        sleep(ave)

        # 验证课程是否创建成功
        table = self.driver.find_element_by_id('spgl_table')
        # 每一行是一个tr
        trs = table.find_elements_by_tag_name('tr')
        # 第一行是标题, 正文从tr 1 开始。 td是列。
        tds = trs[1].find_elements_by_tag_name('td')
        name_exp = tds[1].text

        self.assertEqual(name_exp, name_str,
                         "直播 未被查询到创建失败 book created failed")
예제 #5
0
    def test0131_new_book(self):
        # 获取随机名字
        name_str = util_methods.getPoem()
        name_str_ls = util_methods.splitPoem(name_str)
        sleep(ave)
        global name
        name['book'] = name_str_ls[0]

        # 登录
        Login(self.driver, adminLogin, admin['name'], admin['pwd'])
        sleep(ave)
        self.driver.find_element_by_id('jcgl').click()
        sleep(ave)
        print("进入教材管理ok")

        # 点击新建
        self.driver.find_element_by_id('jc_tj').click()
        sleep(ave)

        # 上传教材
        self.driver.find_element_by_id('uploadbtn_upload').click()
        sleep(ave)
        util_methods.uploadFile('pdf')
        sleep(long)
        print('上传文件ok')

        # 输入教材名字
        self.driver.find_element_by_id('wd_checkBox_isused_1').click()
        self.driver.find_element_by_id('checkcoursename').send_keys(
            name_str_ls[0])
        sleep(short)
        print('输入教材名字')

        # 选择分类
        # 点击第一个分类框
        self.driver.find_element_by_id('code_coursecategory1').click()
        cat = self.driver.find_element_by_id('dmBody')
        options = cat.find_elements_by_tag_name('tr')
        options[0].click()
        # 第二个
        self.driver.find_element_by_id('code_coursecategory2').click()
        cat = self.driver.find_element_by_id('dmBody')
        options = cat.find_elements_by_tag_name('tr')
        options[0].click()
        # 第三个
        self.driver.find_element_by_id('code_coursecategory3').click()
        cat = self.driver.find_element_by_id('dmBody')
        options = cat.find_elements_by_tag_name('tr')
        options[0].click()

        # 选择标签
        tags = self.driver.find_element_by_class_name('lm-labelbox')
        taglist = tags.find_elements_by_class_name('lm-label')
        # 点击第一个
        taglist[0].click()
        print("标签的选择ok")

        # 输入价格
        self.driver.find_element_by_id('courseprice').send_keys('0.01')
        print("输入价格ok")

        # 输入介绍内容
        self.driver.find_element_by_id('wd-editeditbox_courseintro').send_keys(
            name_str)
        # 上传内容介绍的图片
        self.driver.find_element_by_id('courseintro_insertimage').click()
        sleep(short)
        util_methods.uploadFile('jpg')
        sleep(long)
        print("输入介绍内容格ok")

        # 输入作者
        self.driver.find_element_by_id('author').send_keys(name_str_ls[1])
        sleep(short)
        print('输入作者')

        # 点击保存
        self.driver.find_element_by_id('jcgl_bc').click()
        sleep(long)

        # 点击返回列表
        self.driver.find_element_by_id('hp-ret').click()
        sleep(ave)

        # 验证课程是否创建成功
        table = self.driver.find_element_by_id('spgl_table')
        # 每一行是一个tr
        trs = table.find_elements_by_tag_name('tr')
        # 第一行是标题, 正文从tr 1 开始。 td是列。
        tds = trs[1].find_elements_by_tag_name('td')
        name_exp = tds[1].text

        self.assertEqual(name_exp, name_str,
                         "教材 未被查询到创建失败 book created failed")
예제 #6
0
    def test0126_new_video(self):
        name_str = util_methods.getPoem()
        name_str_ls = util_methods.splitPoem(name_str)
        global name
        name['video'] = name_str_ls[0]

        Login(self.driver, adminLogin, admin['name'], admin['pwd'])
        sleep(ave)

        # 进入新建页面
        self.driver.find_element_by_id('spgl_tj').click()
        sleep(short)

        # 上传视频
        self.driver.find_element_by_id('uploadbtn_upload').click()
        sleep(ave)
        util_methods.uploadFile('mp4')
        sleep(long)
        print("上传视频ok")

        # 自定义文件名
        self.driver.find_element_by_id('wd_checkBox_isused_1').click()
        sleep(ave)
        coursename = self.driver.find_element_by_id('coursename')
        coursename.clear()
        coursename.send_keys(name_str_ls[0])
        sleep(long)
        print("自定义文件名ok")

        # 上传封面
        self.driver.find_element_by_id('sp_scfm_upload').click()
        sleep(short)
        util_methods.uploadFile('jpg')
        sleep(long)
        print("上传封面ok")

        # 系列的选择
        # 选择标签,
        tags = self.driver.find_element_by_class_name('lm-seriesbox')
        taglist = tags.find_elements_by_class_name('lm-series')
        # 点击第一个
        taglist[0].click()
        print("系列的选择ok")

        # 标签的选择
        # 选择标签,
        tags = self.driver.find_element_by_class_name('lm-labelbox')
        taglist = tags.find_elements_by_class_name('lm-label')
        # 点击第一个
        taglist[0].click()
        print("标签的选择ok")

        # 输入价格
        self.driver.find_element_by_id('courseprice').send_keys('0.01')
        print("输入价格ok")

        # 输入介绍内容
        self.driver.find_element_by_id('wd-editeditbox_courseintro').send_keys(
            name_str)
        # 上传内容介绍的图片
        self.driver.find_element_by_id('courseintro_insertimage').click()
        sleep(short)
        util_methods.uploadFile('jpg')
        sleep(long)
        print("输入介绍内容格ok")

        # 选择讲师
        # 点击添加讲师
        self.driver.find_element_by_id('spgl_tjjs').click()
        sleep(short)
        teacher = self.driver.find_elements_by_class_name('js-yxz-box')
        teacher[0].click()
        sleep(short)
        # 确定
        self.driver.find_element_by_id('xzjs_qd').click()
        print("点击添加讲师ok")
        sleep(ave)

        # 选择微课
        # self.driver.find_element_by_id('wd_checkBox_fbwk_01').click()
        # 选择免费
        # self.driver.find_element_by_id('wd_checkBox_nomoney_0').click()

        # 点击保存
        self.driver.find_element_by_id('spgl_bc').click()
        sleep(long)
        print('保存完毕')

        # 点击返回列表
        self.driver.find_element_by_id('hp-ret').click()
        sleep(ave)

        # 验证课程是否创建成功
        table = self.driver.find_element_by_id('spgl_table')
        # 每一行是一个tr
        trs = table.find_elements_by_tag_name('tr')
        # 第一行是标题, 正文从tr 1 开始。 td是列。
        tds = trs[1].find_elements_by_tag_name('td')
        name_exp = tds[1].text

        self.assertEqual(name_exp, name_str,
                         "视频未被查询到创建失败 video created failed")
예제 #7
0
    def test0056_savePeixun(self):
        # 获取随机名字
        name_str = util_methods.getPoem()
        name_str_ls = util_methods.splitPoem(name_str)
        name['training'] = name_str_ls[0]
        # 登录并进入培训管理
        LoginAndOpen('pxgl', self.driver, adminLogin, admin['name'],
                     admin['pwd'])

        # 点击新建
        self.driver.find_element_by_id('px_add').click()

        # 输入名称
        self.driver.find_element_by_id('pxjs_mc').send_keys(name['training'])
        print('输入名称')

        # 上传封面
        self.driver.find_element_by_id('pxjs_sc_upload').click()
        util_methods.uploadFile('jpg')
        sleep(long)
        print('上传封面')

        # 上传介绍文字和图片
        self.driver.find_element_by_id('wd-editeditbox_pxjs').send_keys(
            name_str)
        # 上传内容介绍的图片
        self.driver.find_element_by_id('pxjs_insertimage').click()
        sleep(short)
        util_methods.uploadFile('jpg')
        sleep(long)
        print("输入介绍内容格")

        # 课程体系
        self.driver.find_element_by_id('wd-editeditbox_kctx').send_keys(
            name_str)
        # 上传内容介绍的图片
        self.driver.find_element_by_id('kctx_insertimage').click()
        sleep(ave)
        util_methods.uploadFile('png')
        sleep(long)
        print("输入课程体系")

        # 点击添加讲师
        self.driver.find_element_by_id('px_tjjs').click()
        sleep(short)
        teacher = self.driver.find_elements_by_class_name('js-yxz-box')
        teacher[0].click()
        sleep(short)
        # 确定
        self.driver.find_element_by_id('xzjs_qd').click()
        sleep(ave)
        print('添加讲师')

        # 保存
        self.driver.find_element_by_id('px_bc').click()
        sleep(long)
        error_msg = self.driver.find_element_by_id('prompt-text-error').text
        print(error_msg)
        print('保存')

        # 返回列表
        self.driver.find_element_by_class_name('hp-ret').click()
        sleep(long)
        print('返回列表')

        # 获取第一个培训的名字
        train_ls = self.driver.find_elements_by_class_name('pxgl-mc')
        name_exp = train_ls[0].text

        # 断言
        self.assertEqual(name_exp,
                         name['training'],
                         msg="培训名字未找到 training name not found")
예제 #8
0
    def build(self, type1 = None, type2 = None):
        name_str = util_methods.getPoem()
        name_str_ls = util_methods.splitPoem(name_str)

        Login(self.driver, adminLogin, admin['name'], admin['pwd'])
        sleep(ave)

        # 进入新建页面
        self.driver.find_element_by_id('spgl_tj').click()
        sleep(short)

        # 上传视频
        self.driver.find_element_by_id('uploadbtn_upload').click()
        sleep(ave)
        util_methods.uploadFile('mp4')
        sleep(long)
        print("上传视频ok")

        # 自定义文件名
        self.driver.find_element_by_id('wd_checkBox_isused_1').click()
        sleep(ave)
        coursename = self.driver.find_element_by_id('coursename')
        coursename.clear()
        coursename.send_keys(name_str_ls[0])
        sleep(long)
        print("自定义文件名ok")

        # 上传封面
        self.driver.find_element_by_id('sp_scfm_upload').click()
        sleep(short)
        util_methods.uploadFile('jpg')
        sleep(long)
        print("上传封面ok")

        # 系列的选择
        # 选择标签,
        tags = self.driver.find_element_by_class_name('lm-seriesbox')
        taglist = tags.find_elements_by_class_name('lm-series')
        # 点击第一个
        taglist[0].click()
        print("系列的选择ok")

        # 标签的选择
        # 选择标签,
        tags = self.driver.find_element_by_class_name('lm-labelbox')
        taglist = tags.find_elements_by_class_name('lm-label')
        # 点击第一个
        taglist[0].click()
        print("标签的选择ok")

        # 输入价格
        self.driver.find_element_by_id('courseprice').send_keys('0.01')
        print("输入价格ok")

        # 输入介绍内容
        self.driver.find_element_by_id('wd-editeditbox_courseintro').send_keys(name_str)
        # 上传内容介绍的图片
        self.driver.find_element_by_id('courseintro_insertimage').click()
        sleep(short)
        util_methods.uploadFile('jpg')
        sleep(long)
        print("输入介绍内容格ok")

        # 选择讲师
        # 点击添加讲师
        self.driver.find_element_by_id('spgl_tjjs').click()
        sleep(short)
        teacher = self.driver.find_elements_by_class_name('js-yxz-box')
        teacher[0].click()
        sleep(short)
        # 确定
        self.driver.find_element_by_id('xzjs_qd').click()
        print("点击添加讲师ok")

        if type1 == 'weike'or type2 == 'weike':
        # 选择微课
            self.driver.find_element_by_id('wd_checkBox_fbwk_01').click()
        if type1 == 'free' or type2 == 'free':
        # 选择免费
            self.driver.find_element_by_id('wd_checkBox_nomoney_0').click()

        # 点击保存
        self.driver.find_element_by_id('spgl_bc').click()
        print("点击保存ok")

        # 点击返回列表
        self.driver.find_element_by_id('hp-ret').click()