def test_login1(self): '''用户名、密码为空登陆''' self.user_login_verify() po = login(self.driver) self.assertEqual(po.user_error_hint(), "请填写手机号码!") #self.assertEqual(po.pawd_error_hint(),"请填写登陆密码!") function.insert_img(self.driver, "user_pawd_empty.jpg")
def test_login7(self): '''超级管理员登录''' self.user_login_verify(username="******", password="******") po = login(self.driver) now_url = self.driver.current_url self.assertEqual(now_url, "http://admin.muggle-inc.com/desktop") function.insert_img(self.driver, 'super_user_success.png')
def test_login5(self): '''用户名、密码正确''' self.user_login_verify(username="******", password='******') sleep(2) po = login(self.driver) self.assertEqual(po.user_login_success(), '请确认要登录的企业') function.insert_img(self.driver, "use" "r_pawd_ture.jpg")
def test_login1(self): '''用户名、密码为空登录''' self.user_login_verify() po = login(self.driver) self.assertEqual(po.user_error_hint(),"请输入您的手机号码") self.assertEqual(po.pawd_error_hint(),"请输入您的密码") function.insert_img(self.driver,"user_pawd_empty.jpg")
def test_001(self): """ 三方商户创建超级商品: 有广告词;不限购;有市场价;卡币促销可用;不显示正品保证;可用优惠券;多张图片;有图文详情;有商品二级分类; 一级属性;二级属性;要邮寄;邮费为0;支持退货;需结算 扣点 """ loginPage(self.driver).login("admin", "admin", self.url) driver = self.driver po = goodsManagePage(self.driver) po.goodsNameInput(u"超级运动鞋") po.goodsDescInput(u"智能连接") po.goodsAdvInput(u"广告") po.skuDescInput(u"尺码") po.limitCountInput("0") po.marketPriceInput(99.99) po.promoteRulesRadio(True) po.showQualityRadio(False) po.couponRadio(True) po.picUploadButtom( 2, "C:\\Users\\yangweijia\\Pictures\\jpg\\9d3f07e61a790d50cc563fd8a28db5762271c535.jpg", "C:\\Users\\yangweijia\\Pictures\\jpg\\6630751106351088810.jpg") po.detailEdit() po.firstClassSelect(u"颜色") po.secondClassSelect(u"黑色") po.brandInput(u"阿迪达斯") js = "window.scrollTo(0,150);" driver.execute_script(js) po.newAssociateButtom() po.firstAttrNamInput(u"颜色") po.firstAttrAdd(u"红色", u"翠绿") po.secondAttrNamInput(u"尺码") po.secondAttrAdd(u"小", u"大") po.postRadio(True) po.postPriceInput(0) po.refundRadio(True, self.thirdManage) po.settleRadio(True, self.thirdManage) # driver.get("https://admin.codoon.com/admin/html/item-creator-test.html#!sku_table") po.nextSkuConfigButton() po.skuInfoInput(1, 2, 1, 2, 1, 20, None, True, None, 50) po.skuInfoBatchButton(1, 2, 1, 2, True) po.skuInfoBatchPrice_All() po.skuInfoBatchNum_All() po.skuInfoBatchRebate_All() po.skuInfoBatchConfirm() po.ConfirmEndButton() #验证创建了超级商品 supGoods = superGoodsManagePage(self.driver) print supGoods.getSupGoodsLNameOfEdit() try: self.assertEqual(supGoods.getSupGoodsLNameOfEdit(), u"超级运动鞋") except AssertionError as e: self.verificationErrors.append(str(e)) insert_img(self.driver, "goodsCreate_001.jpg")
def test_login5(self): """登录成功的测试""" self.user_login_verify(username="******", password="******") po = login(self.driver) sleep(4) self.assertEqual(po.user_login_success(), '139邮箱') function.insert_img(self.driver, "login_succeed.jpg")
def test_login5(self): """用户名、密码正确""" self.user_login_verify(username="******", password="******") sleep(2) po = login(self.driver) self.assertEqual(po.user_login_success(), "桌面") function.insert_img(self.driver, "user_pwd_true")
def test_login1(self): self.user_login_verify() po = Login(self.driver) self.assertEqual(po.user_error_hint(), "您还没有输入帐号!") function.insert_img(self.driver, "user_pawd_empty.jpg")
def test_login1(self): """用户名、密码为空登录""" self.user_login_verify() po = login(self.driver) self.assertEqual(po.user_error_hint(), "账号不能为空") self.assertEqual(po.pawd_error_hint(), "密码不能为空") function.insert_img(self.driver, "user_pawd_empty.jpg")
def test_send1(self): title = '' article = '' self.send_art_verify(title, article) po = SendArt(self.driver) self.assertEqual('抱歉,您尚未输入标题或内容', po.error_hint()) function.insert_img(self.driver, 'send_empty.png')
def test_login5(self): """用户名、密码正确""" self.user_login_verify(username="******", password="******") sleep(2) po = login(self.driver) self.assertEqual(po.user_login_success(), '张三') function.insert_img(self.driver, "user_pawd_ture.jpg")
def test_tenant_account(self): '''房客个人信息''' login_page.LoginPage(self.driver).login() sleep(2) tenant_nav_page.TenantNavPage(self.driver).Iamtenant() sleep(2) tenant_nav_page.TenantNavPage(self.driver).accountmanager() po = tenant_accountmanager_page.TenantAccountManagePage(self.driver) po.nickname() sleep(2) po.realname() po.sex() sleep(2) # po.email() # po.validemail() # sleep(2) # po.sendemail() # print(po.sendsuccess_text()) # sleep(5) # function.insert_img(self.driver,"send_email.png") # po.viewemaildivclose() # sleep(60) po.saveuser() sleep(2) # print(po.save_success_text()) # assert po.save_success_text()=="保存成功" function.insert_img(self.driver, "tenant_account.png")
def test_send2(self): title = '啥啥啥' * 100 article = '初来乍到' self.send_art_verify(title, article) po = SendArt(self.driver) self.assertIn('您的帖子长度不符合要求。', po.error_hint()) function.insert_img(self.driver, 'send_too_long.png')
def test_click_norelay(self): '''未登录点击全部tab的只看转载课按钮''' self.index.click_norelay() insert_img(self.driver, "5.未登录点击全部tab的只看未转载课按钮.jpg") sleep(1) # 断言 self.assertEqual(self.index.get_codeText(), "微信登录")
def test_login4(self): character = tandom.choice('zyxwvutsrqponmlkjihgfedcba') username = '******' + character self.user_login_verify(username = username, password = '******') po = login(self.driver) self.assertEqual(po.pawd_error_hint(), '密码与账号不匹配') function.insert_img(self.driver, 'user_pawd_error.jpg')
def test_click_saleBack(self): '''未登录点击导航栏分销后台''' self.index.click_salesBack() insert_img(self.driver, "4.未登录点击导航栏分销后台.jpg") sleep(1) # 断言 self.assertEqual(self.index.get_codeText(), "微信登录")
def test_click_login(self): '''未登录点击登录按钮''' self.index.click_login() insert_img(self.driver, "3.未登录点击登录按钮.jpg") sleep(1) # 断言 self.assertEqual(self.index.get_codeText(), "微信登录")
def test_click_myDraw(self): '''未登录点击我的画像''' self.index.click_myDraw() insert_img(self.driver, "2.未登录点击我的画像按钮.jpg") sleep(1) # 断言 self.assertEqual(self.index.get_codeText(), "微信登录")
def test_login3(self): '''用户名密码不匹配''' self.user_login_verify(username='******', password='******') po = Login(self.driver) sleep(2) self.assertEqual(po.login_error_hint(), '密码错误') function.insert_img(self.driver, "pwd_error.png")
def test_login5(self): '''用户名密码正确''' self.user_login_verify(username="******", password="******") sleep(2) po = login(self.driver) self.assertEqual(po.user_login_success(), '张三') function.insert_img(self.driver, "user_pawd_turn,jpg")
def test_searchForm_null(self): '''输入不存在的课程,点击搜索显示‘没有更多了’''' self.index.sendTextTosearchForm(text="jgfkldjasfljas") insert_img(self.driver, "1搜索不存在课程.jpg") sleep(1) # 断言 self.assertEqual(self.index.get_searchText(), "没有更多了")
def test_del_pic(self): '''修改房源图片——上传图片和删除图片''' login_page.LoginPage(self.driver).login() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).Iamlandlord() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).close_weiChat() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).roommanager() po = landlord_online_editdata.LandlordOnlineEditdata(self.driver) po.editdata() sleep(2) po.fy_picture() sleep(2) po.del_pic() sleep(2) po.SWFUpload_0() sleep(3) os.system("D:/python/mayi/data/up.exe") sleep(2) po.pic_save() print(po.editsuccess_text()) sleep(1) po.auditLodgeConfirmBtn() function.insert_img(self.driver, "del_up_pic.png")
def test_setcover(self): '''设为封面''' # login_page.LoginPage(self.driver).login() # sleep(2) landlord_nav_page.LandlordNavPage(self.driver).Iamlandlord() sleep(2) # landlord_nav_page.LandlordNavPage(self.driver).close_weiChat() # sleep(2) landlord_nav_page.LandlordNavPage(self.driver).roommanager() po = landlord_online_editdata.LandlordOnlineEditdata(self.driver) po.editdata() sleep(2) po.fy_picture() sleep(2) try: #报异常ElementNotVisibleException i = str(1) po.setcover(i) print("第" + i + "张为封面") except: po.setcover(i=str(2)) print("第二张为封面") #保存提交 po.pic_save() print(po.editsuccess_text()) sleep(2) function.insert_img(self.driver, "setcover.png") po.auditLodgeConfirmBtn()
def test_click_relayManage(self): '''已登录点击转载管理按钮''' self.index.click_relayManage() insert_img(self.driver,'3已登录点击转载管理按钮.jpg') sleep(1) # 断言 self.assertIn('/pc/knowledge-mall/manage',self.index.get_currentUrl())
def test_a_enterTopicList(self): '''进入单课列表''' self.dashboard.topicList() sleep(1) insert_img(self.driver,"7单课列表.jpg") # 断言 self.assertEqual(self.topicList.getTopicTitleText(),'单课')
def test_login4(self): '''用户名密码正确''' self.user_login_verify(username='******', password='******') sleep(2) po = Login(self.driver) self.assertEqual(po.user_login_success(), '哈哈111') function.insert_img(self.driver, "user_pwd_true.png")
def test_searchForm(self): '''输入存在的课程,点击搜索显示对应数据''' self.index.sendTextTosearchForm(text="优惠") insert_img(self.driver,"2搜索存在的课程.jpg") sleep(1) # 断言 self.assertEqual(self.index.get_searchResult(),True)
def test_login1(self): '''用户名密码为空''' self.user_login_verify() po = login(self.driver) self.assertEqual(po.user_error_hint(), "账号不能为空") self.assertEqual(po.pawd_error_hint(), "密码不能为空") function.insert_img(self.driver, "user_pawd_empty.jpg")
def test_update2(self): status1 = '啥啥' * 100 status2 = '初来乍到' self.update_sta_verify(status1 + status2) po = updateSta(self.driver) self.assertNotIn(status2, po.show_text()) function.insert_img(self.driver, 'update_too_long.png')
def test_update3(self): status = '今天天气真好,是个出游的好日子' self.update_sta_verify(status) po = updateSta(self.driver) self.assertEqual(status, po.show_text()) function.insert_img(self.driver, 'update_success.png')
def test_login5(self): '''login success''' self.user_login_verify(username="******", password="******") po = Login(self.driver) sleep(5) self.assertEqual(po.user_login_success(), "退出") function.insert_img(self.driver, "success.png")
def test_editprice(self): login_page.LoginPage(self.driver).login() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).Iamlandlord() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).close_weiChat() sleep(2) landlord_nav_page.LandlordNavPage(self.driver).roommanager() po = landlord_editprice_page.LandlordEditpricePage(self.driver) fb = fabu_room_page.FabuRoomPage(self.driver) po.roomfilter2() sleep(2) po.edit_price() sleep(2) fb.dayprice() sleep(2) fb.weekendtype() sleep(2) fb.weekpriceRet() sleep(2) fb.monthpriceRet() sleep(2) po.specialdiscount_yes() sleep(2) function.insert_img(self.driver,"editPrice.png") po.confirmModifyPriceBtn() print(po.editsuccess_text()) assert po.editsuccess_text()=="修改成功!" po.changePriceSuccessBtn()
def test_login1(self): """1.1.1 用户名和密码为空""" login(self.driver).login_verify() login(self.driver).login_button() self.assertEqual(login(self.driver).welcome_back(), "欢迎回来") self.assertNotEqual(login(self.driver).title_logo(), "Uface智能前台管理系统") function.insert_img(self.driver, "1.1.1_email_password_empty.jpg")
def test_login4(self): """ 用户名与密码不匹配""" character=random.choice('zyxwvutsrqponmlkjihgfedcba') username="******"+character self.user_login_verify(username=username,password=123456) po=login(self.driver) self.assertEqual(po.error_hint(),u'账户名或登录密码不正确,请重新输入') function.insert_img(self.driver,'user_psw_error.jpg')
def test_login4(self): '''用户名与密码不匹配''' #character = random.choice(1-9) username = "******" self.user_login_verify(username=username,password="******") po = login(self.driver) self.assertEqual(po.pawd_error_hint(),"密码输入错误") function.insert_img(self.driver,"user_pawd_error.jpg")
def test_login5(self): """ 用户名,密码正确登录""" self.user_login_verify(username='******',password='******') sleep(3) po=login(self.driver) po.switch_window() sleep(3) function.insert_img(self.driver,'user_pwd_ture.jpg')
def test3(self): '''禁用客户''' self.loginDo() self.po.forbiCustomer() # 禁用客户 username = self.po.offCusCode() self.oms_login_verify(username=username) self.assertEqual(omslogin(self.driver).error_message(), '该用户已被禁用!') function.insert_img(self.driver, 'forbiCustomer.jpg')
def test_login5(self): '''用户名、密码正确''' self.user_login_verify(username='******',password='******') sleep(2) po = login(self.driver) #print(po.user_login_success()[0:4]) self.assertEqual(po.user_login_success()[0:4],'test') function.insert_img(self.driver,"user_pawd_ture.jpg")
def test_login4(self): """用户名与密码不匹配""" character = random.choice('zyxwvutsrqponmlkjihgfedcba') username = "******" + character self.user_login_verify(username=username, password="******") po = login(self.driver) self.assertEqual(po.pawd_error_hint(), "密码与账号不匹配") function.insert_img(self.driver, "user_pawd_error.jpg")
def test1(self): '''新增客户,自动填充客户代码''' self.loginDo() self.po.iframe_page() # 客户资料iframe界面 self.po.newPage() # 点击新增 customerCode = self.po.cusCode() if customerCode == '' or self.db.isConsExist(customerCode): function.insert_img(self.driver, 'add_customer_exist.jpg') raise AssertionError("该客户代码已存在或者客户代码为空") # assert显示失败为F,其他异常为E
def test4(self): '''启用客户''' self.loginDo() self.po.usingCustomer() # 启用客户 username = self.po.offCusCode() # 返回刚禁用客户代码 self.oms_login_verify(username=username) if omslogin(self.driver).error_message() == '该用户已被禁用!': raise AssertionError('启用按钮无效') function.insert_img('startCustomer_err.jpg')
def test2(self): '''添加新客户''' self.loginDo() num1 = self.db.tableCount('tbl_customer') self.po.add_customer(self.newCus) sleep(0.3) num2 = self.db.tableCount('tbl_customer') self.assertEqual(num1 + 1, num2) function.insert_img(self.driver, 'add_customer_suc.jpg')
def test2(self): '''添加已存在商品sku''' '''必须是当前仓库已存在''' self.loginDo() omslogin(self.driver).warehouse_login('GZBY') # 选择仓库完全登录 sku = self.db.consOderBy('product_sku', 'tbl_product') # 刚新增产品的sku self.proList['product_sku'] = sku self.po.add_pro(self.proList) # 添加商品 self.assertEqual(self.po.existSku(), '商品SKU已存在!') function.insert_img(self.driver, 'exist_product_sku.jpg')
def test4(self): '''BC仓添加BC仓已存在商品''' '''HKSS添加GZBYBC已存在的商品sku,提示sku已存在''' self.loginDo() omslogin(self.driver).warehouse_login('HKSS') # 选择仓库完全登录 sku = self.db.consOderBy('product_sku', 'tbl_product') # 刚新增产品的sku self.proList['product_sku'] = sku self.po.add_pro(self.proList) # 添加商品 self.assertEqual(self.po.existSku(), '商品SKU已存在!') function.insert_img(self.driver, 'HKSS_add_exist_sku.jpg')
def test1(self): '''单条商品上传''' self.loginDo() excel = function.excel('product_import.xls') posVal = excel.getDataPosVal() posVal['商品SKU1'][1] = self.db.proStringNo('product_sku', 'tbl_product') excel.creatExcel(posVal) self.po.uploadLogin('product_import.xls') self.assertEqual(self.po.mesUpload(), '上传成功!') function.insert_img(self.driver, 'proUpSuc.jpg')
def test1(self): '''添加商品''' '''客户商品代备案''' self.loginDo() omslogin(self.driver).warehouse_login('GZBY') # 选择仓库完全登录 proNums1 = self.db.tableCount('tbl_product') # 添加前商品条数 self.proList['product_sku'] = self.db.proStringNo('product_sku', 'tbl_product') # 返回一个数据库不存在的sku self.po.add_pro(self.proList) # 添加商品 sleep(0.3) proNums2 = self.db.tableCount('tbl_product') # 添加后商品条数 self.assertEqual(proNums1 + 1, proNums2) sleep(0.5) # 等待打印出商品图片 function.insert_img(self.driver, 'oms_add_product.jpg')
def test3(self): '''BC仓添加BBC仓已存在商品''' '''GZBYBC添加GZBY已存在的商品sku,可添加成功,海关商品备案号为行邮税号''' self.loginDo() omslogin(self.driver).warehouse_login('GZBYBC') # 选择仓库完全登录 sku = self.db.consOderBy('product_sku', 'tbl_product') # 刚新增产品的sku proNums1 = self.db.tableCount('tbl_product_message') # 添加前商品条数 self.proList['product_sku'] = sku self.po.add_pro(self.proList) # 添加商品 sleep(0.3) proNums2 = self.db.tableCount('tbl_product_message') # 添加后商品条数 self.assertEqual(proNums1 + 1, proNums2) sleep(0.5) # 等待打印出商品图片 function.insert_img(self.driver, 'GZBYBC_add_exist_sku.jpg')
def test1(self): '''单个商品库存上传''' # 上传一个最新客户的最新商品10个库存 self.loginDo() excel = function.excel('product_inventory_import.xlsx') posVal = excel.getDataPosVal() posVal['客户代码1'][1] = self.customerCode posVal['商品SKU1'][1] = self.proSku num = self.db.InventoryNum() excel.creatExcel(posVal) self.po.inventoryUpload('product_inventory_import.xlsx') num1 = self.db.InventoryNum() self.assertEqual(num + 10, num1) function.insert_img(self.driver, 'addProInventory.jpg')
def test_login3(self): """ 用户名为空,密码正确登录""" self.user_login_verify(password='******') po=login(self.driver) self.assertEqual(po.error_hint(),u'账户名或登录密码不正确,请重新输入') function.insert_img(self.driver,'user_empty.jpg')
def test4(self): '''多商品上传相同sku''' self.loginDo() self.po.uploadLogin('product_import1.xls') assert('商品SKU' and '已存在' in self.po.mesUpload()) function.insert_img(self.driver, 'moreproUpExist.jpg')
def test_login2(self): """用户名正确,密码为空登录""" self.user_login_verify(username="******") po = login(self.driver) self.assertEqual(po.pawd_error_hint(), "密码不能为空") function.insert_img(self.driver, "pawd_empty.jpg")
def test_login2(self): '''用户名正确,密码为空登录''' self.user_login_verify(username='******') po = login(self.driver) self.assertEqual(po.pawd_error_hint(),"请输入您的密码") function.insert_img(self.driver,"pawd_empty.jpg")
def test_login2(self): """ 用户名正确,密码为空登录""" self.user_login_verify(username='******') po=login(self.driver) self.assertEqual(po.error_hint(),u'账户名或登录密码不正确,请重新输入') function.insert_img(self.driver,'psw_empty.jpg')
def test_login3(self): """用户名为空,密码正确""" self.user_login_verify(password="******") po = login(self.driver) self.assertEqual(po.user_error_hint(), "账号不能为空") function.insert_img(self.driver, "user_empty.jpg")
def test_login3(self): '''用户名为空,密码正确''' self.user_login_verify(password='******') po = login(self.driver) self.assertEqual(po.user_error_hint(),"请输入您的手机号码") function.insert_img(self.driver,"user_empty.jpg")
def test2(self): '''已存在商品sku上传''' self.loginDo() self.po.uploadLogin('product_import.xls') assert('商品SKU' and '已存在' in self.po.mesUpload()) function.insert_img(self.driver, 'proUpExist.jpg')