Ejemplo n.º 1
0
    def test0125_new_video(self):
        Login(self.driver, adminLogin, admin['name'], admin['pwd'])
        sleep(ave)
        # 第几个标签
        i = 0

        # 进入新建页面
        self.driver.find_element_by_id('spgl_tj').click()
        sleep(short)
        # 标签框div
        labelboxes = self.driver.find_elements_by_class_name(
            'wdLabelbox-qz-label')
        # 标签输入框
        labeltext = labelboxes[i].find_element_by_class_name(
            'wdLabelbox-qz-labeltext')
        # 获取随机字串
        labelname = util_methods.splitPoem(util_methods.getPoem())
        sleep(long)
        # 测试 “系列”
        labeltext.send_keys(labelname[i])
        sleep(short)
        # 输入标签名字之后,回车
        labeltext.send_keys(Keys.ENTER)
        # 验证是否成功
        try:
            text = labelboxes[i].find_element_by_class_name(
                'wdLabelbox-qz-labelspana').text
            self.assertEqual(text, labelname[i])
        except NoSuchElementException as e:
            print('标签%s未找到' % (labelname[i]))
Ejemplo n.º 2
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))
Ejemplo n.º 3
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")
Ejemplo n.º 4
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")
Ejemplo n.º 5
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")
Ejemplo n.º 6
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")
Ejemplo n.º 7
0
    def test0041_new_broadcast(self):
        # 获取随机名字
        name_str = util_methods.getPoem()
        name_str_ls = util_methods.splitPoem(name_str)
        today = datetime.datetime.now().strftime('%d')
        tomorrow = str(int(today) + 1)
        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['broadcast'])
        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")

        # 选择日期 -- 今天+1  -- 月末会有问题
        self.driver.find_element_by_id('zbgl_zbsj').click()
        self.driver.find_element_by_id('zbgl_zbsj_' + tomorrow).click()

        # 选择时间长度
        self.driver.find_element_by_id('code_TIMELENGTH').click()
        self.driver.find_element_by_id('dmBody').find_element_by_class_name(
            'DMRB2').click()

        # 输入人数
        self.driver.find_element_by_id('courseupperlimit').send_keys('10')

        # 添加授课者
        self.driver.find_element_by_id('zbgl_tjskz').click()
        sleep(ave)
        teacher_ls = self.driver.find_element_by_id(
            'skz_list').find_elements_by_tag_name('li')
        teacher_ls[1].click()
        # 翻页
        self.driver.find_element_by_id(
            'wdtable_pagecountnext_skz_list').click()
        sleep(short)
        teacher_ls = self.driver.find_element_by_id(
            'skz_list').find_elements_by_tag_name('li')
        teacher_ls[1].click()
        sleep(short)
        # 确定添加
        self.driver.find_element_by_id('xzskz_qd').click()
        sleep(short)
        # 点击保存
        self.driver.find_element_by_id('zbgl_bc').click()
        error_msg = self.driver.find_element_by_id('prompt-text-error').text
        sleep(long)
        print(error_msg)
        # 点击返回列表
        self.driver.find_element_by_class_name('hp-ret').click()
        sleep(ave)

        # 验证课程是否创建成功
        table = self.driver.find_element_by_id('zbgl_table')
        # 每一行是一个tr
        trs = table.find_elements_by_tag_name('tr')

        targetIsFound = False
        for tr in trs:
            tds = tr.find_elements_by_tag_name('td')
            name_exp = tds[1].text
            print(name_exp)
            if name_exp == name['broadcast']:
                targetIsFound = True
                break
        if targetIsFound:
            print("创建成功")
        else:
            self.assertTrue(False, "直播 未被查询到,确认是否在下一页? book created failed")
Ejemplo n.º 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()