def test_login1(self): '''用户名,密码为空登录''' self.user_login_verify() k = Login(self.driver) self.assertEqual(k.user_error_tip(), '账号不能为空') self.assertEqual(k.pwd_error_tip(), '密码不能为空') screenshot_img.insert_img(self.driver, 'user_pwd_empty.jpg')
def test_login4(self): '''用户名与密码不匹配''' self.user_login_verify(useraccount='*****@*****.**', userpassword='******') k = Login(self.driver) self.assertEqual(k.pwd_error_tip(), '密码与账号不匹配') screenshot_img.insert_img(self.driver, 'user_pwd_error.jpg')
def test_decorate(self, x): info = { 'company_name': function.ran_char(random.randint(5, 15)), 'contact_name': function.ran_char(random.randint(2, 6)), 'mobile': '138' + str(random.randint(11111111, 99999999)), 'phone': '0755-' + str(random.randint(11111111, 99999999)), 'email': '*****@*****.**' } Login(self.driver).decorate_coopration(info)
def test_zhanzhuang(self, x): info = { 'canzhanbao_name': function.ran_char(random.randint(2, 6)), 'canzhanbao_phone': '138' + str(random.randint(11111111, 99999999)), 'service_type': random.sample(self.service_types, 1)[0], 'exhibition_name': function.ran_char(random.randint(5, 15)), 'area': str(random.randint(9, 500)), 'time': '2017-12-30', 'price': random.sample(self.prices, 1)[0], 'company_name': function.ran_char(random.randint(5, 15)) } Login(self.driver).canzhanbao_zhanzhuang(info)
def test_zhanhui(self, x): info = { 'canzhanbao_name': function.ran_char(random.randint(2, 6)), 'canzhanbao_phone': '138' + str(random.randint(11111111, 99999999)), 'canzhanbao_company_name': function.ran_char(random.randint(5, 15)), 'canzhanbao_exhibit': function.ran_char(random.randint(5, 15)), 'canzhanbao_first': str(random.randint(1, 2)), 'canzhanbao_intent_city': function.ran_char(random.randint(2, 6)), 'time': '2017-12', 'canzhanbao_area': random.sample(self.areas, 1)[0], 'canzhanbao_intent_exhibition': function.ran_char(random.randint(5, 15)) } Login(self.driver).canzhanbao_zhanhui(info)
def test_login8(self): '''监理正常登陆''' self.user_login_verify(username='******', password='******') po = Login(self.driver) self.assertTrue('监理' in po.user_login_success())
def test_login7(self): '''搭建商正常登陆''' self.user_login_verify(username='******', password='******') po = Login(self.driver) self.assertTrue('搭建商' in po.user_login_success())
def test_login6(self): '''主办方正常登陆''' self.user_login_verify(username='******', password='******') po = Login(self.driver) self.assertTrue('主办方' in po.user_login_success())
def test_login5(self): '''参展商正常登陆''' self.user_login_verify(username='******', password='******') po = Login(self.driver) self.assertTrue('参展商' in po.user_login_success())
def test_login4(self): '''观察员正常登陆''' self.user_login_verify(username='******', password='******') po = Login(self.driver) self.assertTrue('观察员' in po.user_login_success())
def test_login1(self): '''用户名、密码为空登录''' self.user_login_verify() po = Login(self.driver) self.assertTrue('请输入手机号/邮箱' in po.user_error_hint()) self.assertTrue('请输入密码' in po.password_error_hint())
def test_login3(self): '''用户名为空,密码正确''' self.user_login_verify(userpassword='******') k = Login(self.driver) self.assertEqual(k.user_error_tip(), '账号不能为空') screenshot_img.insert_img(self.driver, 'user_empty.jpg')
def test_login2(self): '''用户名正确,密码为空登录''' self.user_login_verify(useraccount='*****@*****.**') k = Login(self.driver) self.assertEqual(k.pwd_error_tip(), '密码不能为空') screenshot_img.insert_img(self.driver, 'pwd_empty.jpg')
def user_login_verify(self, useraccount='', userpassword=''): Login(self.driver).iframe_switch_login()
def test_login9(self): '''工厂正常登陆''' self.user_login_verify(username='******', password='******') po = Login(self.driver) self.assertTrue('工厂' in po.user_login_success())
def user_login_verify(self, username='', password=''): Login(self.driver).user_login(username, password)
def test_login2(self): '''用户名正确,密码为空''' self.user_login_verify(username='******') po = Login(self.driver) self.assertTrue('请输入密码' in po.password_error_hint())
def search_verify(self, type=0, keyword=''): Login(self.driver).search(type, keyword)
def test_login3(self): '''用户名或密码不正确''' self.user_login_verify(username='******', password='******') po = Login(self.driver) self.assertTrue('用户名或密码错误' in po.user_or_password_error_hint())