예제 #1
0
class TestLogin(unittest.TestCase):
    # 物流云APP 货主登录
    def setUp(self):
        """前置条件准备"""
        self.logger = Log()
        self.logger.info('########################### TestLogin START ###########################')
        config = ReadYaml(FileUtil.getProjectObsPath() + '/config/config.yaml').getValue()
        app_package = config['appPackage_wuliuyun']
        app_activity = config['appActivity_wuliuyun']
        AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver()

        self.user = config['username_wuliuyun']
        self.password = config['password_wuliuyun']
        self.driver = AppUiDriver(appPackage=app_package, appActivity=app_activity).get_driver()
        self.driver_tool = DriverOperation(self.driver)
        self.driver.reset()
        pass

    def tearDown(self):
        """测试环境重置"""
        self.logger.info('########################### TestLogin END ###########################')
        pass

    def test_login(self):
        login = LoginWuLiuYun(self.driver)
        self.driver_tool.getScreenShot('login_wuliuyun')
        NotificationWuLiuYun(self.driver).guide_page()
        self.driver_tool.getScreenShot('login_wuliuyun')
        login_page = login.wait_login_page()
        self.assertTrue(login_page)
        login.user_login(user=self.user, pwd=self.password)
        self.driver_tool.getScreenShot('login_wuliuyun')
        main_page = WuLiuYunWaybillTab(self.driver).wait_main_page()
        self.assertTrue(main_page)
예제 #2
0
class TestLoginRegister(unittest.TestCase):
    """凯京车主APP 已认证司机登录"""
    def setUp(self):
        """前置条件准备"""
        self.logger = Log()
        self.logger.info(
            '########################### TestLoginRegister START ###########################'
        )
        config = ReadYaml(FileUtil.getProjectObsPath() +
                          '/config/config.yaml').getValue()  # 获取配置
        app_package = config['appPackage_chezhu']
        app_activity = config['appActivity_chezhu']
        # AppUiDriver(appPackage=app_package, appActivity=app_activity).app_ui_driver()  # 单例执行,创建driver
        self.mobile = config['mobile_register']
        self.driver = AppUiDriver(
            appPackage=app_package,
            appActivity=app_activity).get_driver()  # 获取appium driver
        self.driver_tool = DriverOperation(self.driver)
        RedisDb().del_key(name='CHK_ONE_DAY_LOGIN', key='all')  # 清除当日APP登录设备记录
        self.driver.reset()  # 初始化APP  清除用户数据
        pass

    def tearDown(self):
        """测试环境重置"""
        self.logger.info(
            '########################### TestLoginRegister END ###########################'
        )
        pass

    def test_bvt_login_register(self):
        """认证司机登录"""
        self.driver_tool.getScreenShot('login_register_chezhu')
        NotificationCheZhu(self.driver).guide_page()  # 引导页操作
        self.driver_tool.getScreenShot('login_register_chezhu')
        LoginCheZhu(self.driver).user_login(self.mobile)  # 登录操作
        self.driver_tool.getScreenShot('login_register_chezhu')
        page_state = MainTabCheZhu(self.driver).wait_main_page()
        self.assertTrue(page_state)  # 检查登录操作后页面activity是否切换为主列表页