Example #1
0
class TestLogin(mytest.MyTest):
    """登录模块"""

    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_01_login'))
    # @unittest.skipIf(True, "原因")
    def test_01_login(self, data):
        """正常登录"""
        test_data = data['data']
        test_assert = data['assertion']
        # login = LoginPage.Login(self.dr)
        # ele = login.login(test_data['username'],test_data['pw'])
        # login.exist_loading()
        # username = ele.get_name()
        # url = ele.get_url()
        # self.assertIn(url,test_assert['title'])
        # self.assertIn(username, test_assert['username'])
        login = LoginPage.Login(self.dr)
        # login.input_account(test_data['username'])
        # login.input_pw(test_data['pw'])
        # login.click_box()
        work = login.login(test_data['username'], test_data['pw'])
        name = work.get_name()
        url = work.get_url()
        self.assertIn(test_assert['username'], name)
        self.assertIn(test_assert['title'], url)

    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_02_login'))
    def test_02_login(self, data):
        """错误密码登录"""
        test_data = data['data']
        test_assert = data['assertion']
        # login = LoginPage.Login(self.dr)
        # ele = login.login(test_data['username'],test_data['pw'])
        # login.exist_loading()
        # username = ele.get_name()
        # url = ele.get_url()
        # self.assertIn(url,test_assert['title'])
        # self.assertIn(username, test_assert['username'])
        login = LoginPage.Login(self.dr)
        login.input_account(test_data['username'])
        login.input_pw(test_data['pw'])
        login.click_box()
        work = login.click_login_btn()
        error_text = login.get_error_text()
        url = login.get_url()
        self.assertIn(test_assert['text'], error_text)
        self.assertIn(test_assert['url'], url)
Example #2
0
class TestWorkbench(mytest.MyAutologinTest):
    """工作台模块"""
    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_loginout'))
    def test_loginout(self, data):
        test_assert = data['assertion']
        self.workbench.close()
        loginpage = self.workbench.click_out()
        text = loginpage.get_title()
        url = loginpage.get_url()
        self.assertIn(text, test_assert['text'])
        self.assertIn(url, test_assert['url'])

    @screenshot_about_case
    def test_luandian(self):
        menus = {
            "平台管理": 1,
            "协议管理": 2,
            "机型管理": 3,
            "设备管理": 4,
            "客户管理": 5,
            "用户管理": 6,
            "权限管理": 7
        }
        for key, v in menus.items():
            self.workbench.click_menu(v)
            time.sleep(5)
Example #3
0
class TestLogin(mytest.MyTest):
    """登录模块"""
    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_01_login'))
    # @unittest.skipIf(True, "原因")
    def test_01_login(self, data):
        """正常登录"""
        test_data = data['data']
        test_assert = data['assertion']
        login = LoginPage.Login(self.dr)
        ele = login.login(test_data['username'], test_data['pw'])
        username = ele.get_name()
        url = ele.get_url()
        self.assertIn(test_assert['username'], username)
        self.assertIn(test_assert['url'], url)

    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_02_login'))
    # @unittest.skipIf(True, "原因")
    def test_02_login(self, data):
        """密码错误登录"""
        test_data = data['data']
        test_assert = data['assertion']
        login = LoginPage.Login(self.dr)
        ele = login.login(test_data['username'], test_data['pw'])
        error_text = login.get_error_text()
        url = ele.get_url()
        self.assertIn(test_assert['error_text'], error_text)
        self.assertIn(test_assert['url'], url)

    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_03_login'))
    # @unittest.skipIf(True, "原因")
    def test_03_login(self, data):
        """用户名不存在"""
        test_data = data['data']
        test_assert = data['assertion']

        login = LoginPage.Login(self.dr)
        ele = login.login(test_data['username'], test_data['pw'])
        error_text = login.get_error_text()
        url = ele.get_url()
        self.assertIn(test_assert['error_text'], error_text)
        self.assertIn(test_assert['url'], url)
Example #4
0
class TestWorkbench(mytest.MyAutologinTest):
    """工作台模块"""
    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_loginout'))
    def test_loginout(self, data):
        """退出登陆"""
        test_assert = data['assertion']
        self.workbench.click_center()
        loginpage = self.workbench.close()
        text = loginpage.get_title()
        url = loginpage.get_url()
        self.assertIn(test_assert['text'], text)
        self.assertIn(test_assert['url'], url)
Example #5
0
class TestLogin(mytest.MyTest):
    """登录模块"""
    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_01_login'))
    def test_01_login(self, data):
        """正常登录"""
        test_data = data['data']
        test_assert = data['assertion']
        login = LoginPage.Login(self.dr)
        ele = login.login(test_data['username'], test_data['pw'])
        username = ele.get_name()
        url = ele.get_url()
        self.assertIn(url, test_assert['title'])
        self.assertIn(username, test_assert['username'])
Example #6
0
class TestWorkbench(mytest.MyTest):
    """工作台模块"""
    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_loginout'))
    def test_loginout(self, data):
        """退出登陆"""
        workbench = Login(self.dr).login('*****@*****.**', 'q5310543')
        test_assert = data['assertion']
        workbench.exist_loading()
        workbench.close()
        loginpage = workbench.click_out()
        text = loginpage.get_title()
        url = loginpage.get_url()
        self.assertIn(text, test_assert['text'])
        self.assertIn(url, test_assert['url'])
Example #7
0
class TestLogin(mytest.MyTest):
    """登录模块"""
    @screenshot_about_case
    @data(*get_test_case_data(data_info, file, 'test_01_login'))
    def test_01_login(self, data):
        login = LoginPage.Login(self.dr)
        test_data = data['data']
        test_assert = data['assertion']
        ele = login.login(test_data['username'], test_data['pw'],
                          test_data['platform'])
        login.exist_loading()
        username = ele.get_name()
        url = ele.get_url()
        self.assertIn(url, test_assert['title'])
        self.assertIn(test_assert['username'], username)
        self.assertIn('2222', '21222')
Example #8
0
class TestLogin(mytest.MyTest):
    """登录模块"""
    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_01_login'))
    def test_01_login(self, data):
        """正常登录"""

        test_data = data['data']
        test_assert = data['assertion']
        login = login_page.Login(self.dr)
        ele = login.login(test_data['username'], test_data['password'])
        # login.login(username,password)  # 不取表格数据直接传参
        login.exist_loading()
        username = login.get_name()
        url = login.get_url()
        self.assertIn(url, test_assert['title'])
        self.assertIn(username, test_assert['username'])
Example #9
0
class TestMaterial(mytest.MaterialloginTest):
    """素材库模块"""
    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_1_material'))
    # @unittest.skipIf(True, "原因")
    def test_1_material(self, data):
        """个人智慧空间"""
        test_assert = data['assertion']
        self.material.click_folder()
        self.material.input_foldername("素材")
        self.material.confirm_foldername()
        text = self.material.get_foldername()
        url = self.material.get_url()
        self.assertIn(text, test_assert['text'])
        self.assertIn(url, test_assert['url'])
        self.material.delete_icon()
        self.material.click_icon()
        self.material.secondary_confirmation()
        result = self.material.is_sucai()
        self.assertFalse(result)  #检查表达式是否为假
Example #10
0
class TestPersonalinfo(mytest.MyuserloginTest):
    """个人信息模块"""

    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_1_info'))
    # @unittest.skipIf(True, "原因")
    def test_1_info(self, data):
        """修改个人信息"""
        test_assert = data['assertion']
        self.user.nickname()
        name = self.user.get_old_name()
        logger.info('name==========={}'.format(name))
        self.user.input_username("HB")
        self.user.username_define()
        self.user.jianjie()
        self.user.input_jianjie("本人性格热情开朗")
        self.user.jianjie_define()
        WorkBench = self.user.kecheng_return()
        username = WorkBench.get_name()
        url = WorkBench.get_url()
        self.assertIn(test_assert['username'], username)
        self.assertIn(test_assert['url'], url)
Example #11
0
class TestInquire(mytest.MyTest):
    """运价查询模块"""

    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_01_login'))
    def test_01_inquire(self,data):
        """一键报价流程"""

        logger.info(data)
        test_data = data['data']
        login = login_page.Login(self.dr)
        ele = login.login(test_data['username'], test_data['password'])
        inquire = Inquire_page.Inquire(self.dr)
        inquire.click_shipment_address()
        inquire.click_adress(1, '广东省')
        inquire.click_adress(2, '清远市')
        inquire.click_adress(3, '连南瑶族自治县')
        inquire.click_adress(4, '大麦山镇')
        inquire.click_delivery_address()
        inquire.click_adress(1, '福建省')
        inquire.click_adress(2, '莆田市')
        inquire.click_adress(3, '城厢区')
        inquire.click_adress(4, '凤凰山街道')
        inquire.report_btn()
Example #12
0
class TestWorkbench(mytest.MyAutologinTest):
    """课程库模块"""

    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_1_loginout'))
    # @unittest.skipIf(True, "原因")
    def test_1_loginout(self, data):
        """退出登录"""
        test_assert = data['assertion']
        self.workbench.click_get_name()
        loginpage = self.workbench.close()
        text = loginpage.get_title()
        url = loginpage.get_url()
        self.assertIn(test_assert['text'], text)
        self.assertIn(test_assert['url'], url)

    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_2'))
    # @unittest.skipIf(True, "原因")
    def test_2(self, data):
        """新建课程"""
        test_assert = data['assertion']
        self.workbench.click_button()
        self.workbench.click_curriculum()
        self.workbench.js_code()
        self.workbench.upload()
        self.workbench.click_tag()
        self.workbench.input_tag("课程")
        self.workbench.input_name("自动化培训")
        self.workbench.input_student("大学生")
        self.workbench.input_target("完美")
        self.workbench.input_overview("优秀")
        self.workbench.click_determine()
        text = self.workbench.get_kecheng_name()
        url = self.workbench.get_url()
        self.assertIn(text, test_assert['text'])
        self.assertIn(url, test_assert['url'])

    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_3'))
    # @unittest.skipIf(True, "原因")
    def test_3(self, data):
        """删除课程"""
        test_assert = data['assertion']
        self.workbench.set_up()
        self.workbench.delete()
        text = self.workbench.get_delete_text()
        url = self.workbench.get_url()
        self.assertIn(test_assert['text'], text)
        self.assertIn(test_assert['url'], url)
        self.workbench.click_out()
        self.workbench.clear_icon()
        self.workbench.set_up()
        self.workbench.forever_delete()
        self.workbench.click_out()

    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_4'))
    # @unittest.skipIf(True, "原因")
    def test_4(self, data):
        """点击个人中心"""
        test_assert = data['assertion']
        self.workbench.click_get_name()
        info = self.workbench.personal_center()
        text = info.get_info()
        url = info.get_url()
        self.assertIn(test_assert['text'], text)
        self.assertIn(test_assert['url'], url)

    @screenshot_about_case
    @data(*get_test_case_data(data_info, 'test_5'))
    # @unittest.skipIf(True, "原因")
    def test_5(self, data):
        """点击个人智慧空间"""
        test_assert = data['assertion']
        material = self.workbench.personal_wisdomspace()
        text = material.get_video_text()
        url = material.get_url()
        self.assertIn(test_assert['text'], text)
        self.assertIn(test_assert['url'], url)