def test_Login_02(self): u'''UI-02 前提条件:手机号已经被注册 测试步骤:只输入账号,不输入密码,点击登录 ''' print("------只输入手机号测试------") self.driver.get(self.base_url) self.driver.implicitly_wait(10) login_page = LoginPage.Login(self.driver) login_page.input_phone(self.phone_num_right) login_page.click_login_button() result = self.driver.find_element_by_class_name( 'UserErrorTips').text.split()[0] print(result) except_result = u'请输入密码' self.assertEqual(result, except_result, msg="%s等于%s" % (result, except_result))
def test_Login_05(self): u'''UI-05 前提条件:手机号已经被注册 测试步骤:输入正确账号,输入正确密码,点击登录 ''' print("------输入正确手机号,错误密码测试------") self.driver.get(self.base_url) self.driver.implicitly_wait(10) login_page = LoginPage.Login(self.driver) login_page.input_phone(self.phone_num_right) login_page.input_pwd(self.phone_num_right) login_page.click_login_button() time.sleep(5) result = self.driver.current_url print(result) except_result = "https://www.kuaikanmanhua.com" self.assertEqual(result, except_result, msg="%s等于%s" % (result, except_result))
def action(self, case_id, case_summary, username, password): login_page = LoginPage.LoginPage(self.driver, self.url, u"网易") login_page.open() print u"========【" + case_id + u"】" + case_summary + u"=============" print username print password #调用用户名输入组件 login_page.input_username(username) login_page.input_password(password) login_page.click_submit() spanTF = True try: login_page.show_span() spanTF = True except: spanTF = False if spanTF: print login_page.show_span() else: print self.driver.title self.assertTrue(login_page.show_userid(), u"登录失败!")
def setUp(self): desired_caps = {} desired_caps['deviceName'] = DevicesList[DevicesDefault]['deviceName'] desired_caps['platformName'] = DevicesList[DevicesDefault][ 'platformName'] desired_caps['platformVersion'] = DevicesList[DevicesDefault][ 'platformVersion'] desired_caps['unicodeKeyboard'] = DevicesList[DevicesDefault][ 'unicodeKeyboard'] desired_caps['resetKeyBoard'] = DevicesList[DevicesDefault][ 'resetKeyBoard'] desired_caps['appPackage'] = config.appPackage desired_caps['appActivity'] = config.appActivity # desired_caps["automationName"] = DevicesList[DevicesDefault]['automationName'] if not config.Reset: desired_caps["noReset"] = DevicesList[DevicesDefault]['noReset'] desired_caps['app'] = PATH("apps/android/" + AppDefault) self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) LoginPage(self.driver).user_login()
def test_Login_04(self): u'''UI-04 前提条件:手机号已经被注册 测试步骤:输入正确账号,输入错误密码,点击登录 ''' print("------输入正确手机号,错误密码测试------") self.driver.get(self.base_url) self.driver.implicitly_wait(10) login_page = LoginPage.Login(self.driver) login_page.input_phone(self.phone_num_right) login_page.input_pwd(self.phone_num_wrong) login_page.click_login_button() result = self.driver.find_element_by_class_name( 'UserErrorTips').text.split()[0] print(result) except_result = u'用户名或者密码不正确' self.assertEqual(result, except_result, msg="%s等于%s" % (result, except_result))
def setUpClass(cls): print 'test start' cls.driver = webdriver.Ie() cls.url = 'https://www.mingdao.com/login.htm' cls.login = LoginPage.LoginPage(cls.driver, ) cls.title = u"明道"
def test_login_004(self): u"""大纲测试点:|登录|密码超过6位""" login = LoginPage(self.driver) login.bottom_go_mine_page() login.go_user_info() login.input_login_username(config.username + "2") login.input_login_password("1122332") login.login_confirm() # self.assertTrue(login.find_toast(u"用户不存在或者密码错误"), u"提示失败") # 暂时不能捕捉toast,采用替代方案 login.input_login_password("123123") self.assertTrue(True, u"测试通过")
def test_login_009(self): u"""大纲测试点:|登录|记住密码""" # 登录 login = LoginPage(self.driver) login.bottom_go_mine_page() login.go_user_info() login.input_login_username(config.username) login.input_login_password(config.password) login.remember_password() login.login_confirm() # 到我的图鉴 login.bottom_go_mine_page() # 个人信息 login.go_user_info() # 退出 user_info = UserInfoPage(self.driver) user_info.logout() # 登录 login.login_confirm() # 若能点击我的图鉴说明已经登录 login.bottom_go_mine_page() self.assertTrue(True, u"测试通过")
def test_Login(self): username = '******' password = '******' LoginPage.Login(BasePage).login_action(username, password)