def test2_capacity_inquiry(self): time.sleep(1) Logout().logout(self.dr) globals()['capacity_url'] = capacity_url.replace('www', 'beta2019') self.dr.get_url(capacity_url) buyerusr = Config().get('BUSR') buyerpsw = Config().get('BPSW') self.btn.capacity_inquiry() self.dr.jump_off() Login().login(self.dr, buyerusr, buyerpsw) CapacityInquiry().page(self.dr) # 获取订单号 globals()['inq_num'] = self.dr.text( 'css', '#htCheck > div:nth-child(1) > ul.content-title.row > li.col-md-11 > span:nth-child(2) > span' ) # 获取询价主题 globals()['inq_them'] = self.dr.text( 'css', '#htCheck > div:nth-child(1) > ul.content-title.row > li.col-md-11 > span:nth-child(1)' ) # 判断是否有云端营销标签 label = self.dr.text('css', '[class="label label-warning"]') self.assertEqual('云端营销', label, label)
def test2_product_inquiry(self): time.sleep(1) Logout().logout(self.dr) self.dr.get_url(product_url) buyerusr = Config().get('BUSR') buyerpsw = Config().get('BPSW') self.btn.buy() Login().login(self.dr, buyerusr, buyerpsw) while True: if self.dr.current_url() == product_url: break else: self.dr.back() self.btn.product_inquiry() ProductInquiry().page(self.dr) # 获取订单号 globals()['inq_num'] = self.dr.text( 'css', '#htCheck > div:nth-child(1) > ul.content-title.row > li.col-md-11 > span:nth-child(2) > span' ) # 获取询价主题 globals()['inq_them'] = self.dr.text( 'css', '#htCheck > div:nth-child(1) > ul.content-title.row > li.col-md-11 > span:nth-child(1)' ) # 判断是否有云端营销标签 label = self.dr.text('css', '[class="label label-warning"]') self.assertEqual('云端营销', label, label)
def test5_approve_sell_pact(self): time.sleep(1) Logout().logout(self.dr) url = Config().get('PACT_YWX_URL') self.dr.get_url(url) sellerusr = Config().get('SUSR') sellerpsw = Config().get('SPSW') Login().login(self.dr, sellerusr, sellerpsw) self.flow.sell_unapprove_flow()
def test6_approve_buy_pact(self): time.sleep(1) Logout().logout(self.dr) url = Config().get('PACT_GWX_URL') self.dr.get_url(url) buyerusr = Config().get('BUSR') buyerpsw = Config().get('BPSW') Login().login(self.dr, buyerusr, buyerpsw) self.flow.buy_unapprove_unsign_flow()
def test8_payment(self): time.sleep(1) Logout().logout(self.dr) url = Config().get('SETTLE_YWX_URL') self.dr.get_url(url) sellerusr = Config().get('SUSR') sellerpsw = Config().get('SPSW') Login().login(self.dr, sellerusr, sellerpsw) self.flow.sure_settle_flow() self.flow.payment_flow()
def test3_capacity_quote(self): time.sleep(1) Logout().logout(self.dr) url = Config().get('QUOTE_WX_URL') self.dr.get_url(url) sellerusr = Config().get('SUSR') sellerpsw = Config().get('SPSW') Login().login(self.dr, sellerusr, sellerpsw) self.dr.click('css', '[class="confirmCash btn btn-primary btn-outline"]') CapacityQuote().page(self.dr, 100)
def test6_approve_buy_pact(self): time.sleep(1) Logout().logout(self.dr) url = Config().get('PACT_GWG_URL') self.dr.get_url(url) buyerusr = Config().get('BUSR') buyerpsw = Config().get('BPSW') Login().login(self.dr, buyerusr, buyerpsw) self.flow.buy_unapprove_unsign_flow() pact_ID = self.dr.get_attribute('css', '[class="content-detail row cm"]', 'data-id') if pact_id != pact_ID: print('审批合同不是购买的签单合同,合同编号是:%s' % pact_ID)
def test1_share_product(self): method = int(self.tp['method']) marketusr = Config().get('MKTUSR') marketpsw = Config().get('MKTPSW') url = Config().get('HOME_URL') self.dr.get_url(url) Login().login(self.dr, marketusr, marketpsw) time.sleep(1) if method == 1: self.flow.team_share_product_flow('航天云网') else: self.flow.share_product_flow('航天云网') globals()['product_url'] = self.dr.get_attribute( 'id', 'firstProduct', 'value')
def test4_pact_page(self): time.sleep(1) Logout().logout(self.dr) url = Config().get('PACT_GWX_URL') self.dr.get_url(url) buyerusr = Config().get('BUSR') buyerpsw = Config().get('BPSW') Login().login(self.dr, buyerusr, buyerpsw) self.dr.click('link', '我要采购') self.dr.click('link', '所有外协需求') self.dr.jump_off() self.flow.youxuan_flow() self.flow.add_buy_capacity_pact_flow() Pact().page(self.dr, 40000, ' 能力询价')
def test2_product_buy(self): time.sleep(1) Logout().logout(self.dr) self.dr.get_url(product_url) buyerusr = Config().get('BUSR') buyerpsw = Config().get('BPSW') self.btn.buy() Login().login(self.dr, buyerusr, buyerpsw) self.btn.buy() try: self.dr.click('id', 'save') except Exception: pass globals()['product_price'] = self.dr.text('class', 'price') ProductBuy().page(self.dr)
def test3_product_quote(self): time.sleep(1) Logout().logout(self.dr) url = Config().get('QUOTE_WG_URL') self.dr.get_url(url) sellerusr = Config().get('SUSR') sellerpsw = Config().get('SPSW') Login().login(self.dr, sellerusr, sellerpsw) self.dr.input('id', 'query-1', inq_them) time.sleep(1) self.dr.click('id', 'search-btn') self.dr.click('css', '[class="confirmCash btn btn-primary btn-outline"]') ProductQuote().page(self.dr)
def test5_approve_sell_pact(self): time.sleep(1) Logout().logout(self.dr) url = Config().get('PACT_YWG_URL') self.dr.get_url(url) sellerusr = Config().get('SUSR') sellerpsw = Config().get('SPSW') Login().login(self.dr, sellerusr, sellerpsw) time.sleep(1) pact_ID = self.dr.get_attribute('css', '[class="content-detail row cm"]', 'data-id') self.flow.sell_unapprove_flow() if pact_id != pact_ID: print('审批合同不是购买的签单合同,合同编号是:%s' % pact_ID)
def test9_cash(self): time.sleep(1) Logout().logout(self.dr) url = Config().get('CASH_URL') self.dr.get_url(url) sellerusr = Config().get('SUSR') sellerpsw = Config().get('SPSW') Login().login(self.dr, sellerusr, sellerpsw) self.dr.input('name', 'cash-code', cash_num) self.dr.click('id', 'filter') self.dr.click('class', 'confirmCash') self.btn.surebtn() i = self.dr.text('class', 'ht-modal-default-text') self.assertEqual('确认兑付成功', i, i) self.btn.surebtn()
def test4_pact_page(self): time.sleep(1) Logout().logout(self.dr) url = Config().get('PACT_GWG_URL') self.dr.get_url(url) buyerusr = Config().get('BUSR') buyerpsw = Config().get('BPSW') Login().login(self.dr, buyerusr, buyerpsw) self.dr.click('link', '我要采购') time.sleep(1) self.dr.click('link', '所有外购需求') time.sleep(1) self.dr.input('id', 'inputText', inq_them) time.sleep(1) self.dr.click( 'css', '[class="btn btn-primary btn-sm btn-outline hidden-xs btnSearch"]') self.flow.youxuan_flow() self.flow.add_buy_product_pact_flow() Pact().page(self.dr, inq_num, '40000', self.tp['pact_name'], self.tp['num']) globals()['pact_id'] = self.dr.get_attribute( 'css', '[class="content-detail row cm"]', 'data-id')
def test8_payment(self): time.sleep(1) Logout().logout(self.dr) url = Config().get('SETTLE_YWG_URL') self.dr.get_url(url) sellerusr = Config().get('SUSR') sellerpsw = Config().get('SPSW') Login().login(self.dr, sellerusr, sellerpsw) self.flow.sure_settle_flow(pactNum, int(self.tp['num'])) self.flow.payment_flow() self.dr.input('name', 'contractCode', pactNum) self.dr.click('id', 'filter') time.sleep(2) # pact_id = "\"" + pactNum + "\"" self.dr.click('css', '[class="ht-table-btn confirmCash"]') self.btn.surebtn() i = self.dr.text('class', 'ht-modal-default-text') self.assertEqual('兑付成功', i, i) globals()['cash_num'] = self.dr.text( 'css', '#htTable > div > div:nth-child(1) > ul.content-detail.row > li.col-md-2.content-other > div > span' ) self.btn.surebtn()
'xpath', '//*[@id="table-time"]/tbody/tr[' + str( (int(i) + 2)) + ']/td[3]/div/input', '付款' + str( (int(i) + 2))) driver.input( 'xpath', '//*[@id="table-time"]/tbody/tr[' + str( (int(i) + 2)) + ']/td[4]/div/input', '1') driver.input('name', 'cont_name', NOW + pact_name) driver.input('name', 'target_name', DAY) driver.input('name', 'singDate', DAY) driver.input('name', 'Intr_code', DAY) try: driver.click('id', 'submit-final') i = driver.text('class', 'ht-modal-default-text') assert i == '请确认合同信息是否填写正确!' driver.click('css', '[class="btn btn-primary sureBtn"]') print('合同成功') except Exception: driver.save_screenshot(SCREENSHOT_PATH) print('合同失败') if __name__ == '__main__': driver = browser() dr = Basic(driver) url = Config().get('PACT_URL') dr.get_url(url) username = '******' password = '******' Login().login(dr, username, password) Pact().page(dr, 476, '合同')
driver.input('name', 'address', '底密尔') driver.click( 'css', '#popup-address > div.filter-attribute > div.filter_confirm > a') try: driver.click('id', 'confirm-btn') time.sleep(40) i = driver.text('class','ht-modal-default-text') assert i == '提交成功' driver.click('css', '[class ="btn btn-primary sureBtn"]') except Exception: driver.save_screenshot(SCREENSHOT_PATH) print('购买失败') if __name__ == '__main__': driver = browser() dr = Basic(driver) btn = Button(dr) url = Config().get('PRODUCT_BUY') dr.get_url(url) buyerusr = Config().get('BUSR') buyerpsw = Config().get('BPSW') btn.buy() Login().login(dr, buyerusr, buyerpsw) btn.buy() try: dr.click('id', 'save') except Exception: pass ProductBuy().page(dr)
driver.click( 'css', '#bankListTable > table > tbody > tr > td:nth-child(1) > label > span') driver.click('id', 'btnChooseBankConfirm') time.sleep(1) driver.click( 'css', '#paymentForm > div > div:nth-child(3) > div > div.ibox-content > div > div > ul > li:nth-child(9) > div > div.col-md-5 > div') time.sleep(1) driver.click('css', '[title="中国银行"]') try: driver.click('id', 'confirm') driver.click('css', '[class="btn btn-primary sureBtn"]') i = driver.text('class', 'ht-modal-default-text') assert i == '支付成功!' driver.click('css', '[class="btn btn-primary sureBtn"]') except Exception: driver.save_screenshot(SCREENSHOT_PATH) print('支付失败') time.sleep(1) if __name__ == '__main__': driver = browser() dr = Basic(driver) url = Config().get('SETTLE_URL') dr.get_url(url) username = '******' password = '******' Login().login(dr, username, password) Settle().page(dr)
driver.input('id', 'explainTextarea', NOW) driver.clear('id', 'user_mobile') driver.input('id', 'user_mobile', 15542286637) driver.clear('id', 'user_email') driver.input('id', 'user_email', '*****@*****.**') driver.input('id', 'endtime', DAY) try: driver.click('id', 'btnConfirm') driver.click('css', '[class="btn btn-primary sureBtn"]') ii = driver.text('class', 'ht-modal-default-text') assert ii == '报价成功!' driver.click('css', '[class="btn btn-primary sureBtn"]') except Exception: driver.save_screenshot(SCREENSHOT_PATH) print('报价失败') if __name__ == '__main__': driver = browser() dr = Basic(driver) url = Config().get('CAPACITY_QUOTE_URL') dr.get_url(url) username = '******' password = '******' Login().login(dr, username, password) dr.click( 'css', '#block3 > div.ibox-content.ibox-height312 > ul.list-box.list-box-first > li:nth-child(2) > a > span.left' ) dr.jump_off() CapacityQuote().page(dr, 100)
driver.input('id', 'explainTextarea', NOW) driver.input('id', 'endtime', DAY) driver.input('id', 'deliTime', DAY) driver.clear('id', 'user_mobile') driver.input('id', 'user_mobile', 15542286637) driver.clear('id', 'user_email') driver.input('id', 'user_email', '*****@*****.**') try: driver.click('id', 'btnConfirm') driver.click('css', '[class="btn btn-primary sureBtn"]') time.sleep(60) ii = driver.text('class', 'ht-modal-default-text') assert ii == '报价成功!' driver.click('css', '[class="btn btn-primary sureBtn"]') except Exception: driver.save_screenshot(SCREENSHOT_PATH) print('报价失败') if __name__ == '__main__': driver = browser() dr = Basic(driver) url = Config().get('PRODUCT_QUOTE_URL') dr.get_url(url) username = '******' password = '******' Login().login(dr, username, password) dr.click('css', '#quoteHandler > li:nth-child(2) > a > span.left') dr.jump_off() ProductQuote().page(dr)
# driver.click('css', '[data-id="10302"]') driver.click('css', '[class="cascade-confirm"]') driver.input('name', 'capandproname', '能力' + NOW + random_str(1, 2)) driver.input('name', 'chargeunit', '台') driver.input('name', 'price', random.randint(100, 1000000)) driver.input('name', 'certificate_id1', self.Type(random.randint(1, 7))['certificate_id1']) time.sleep(1) driver.click('id', 'clipBtn') driver.input('id', 'editor', random_str(22, 88)) driver.clear('name', 'address') driver.input('name', 'address', '北京') driver.click('id', 'editor') driver.click('id', 'inq-publish') Button(driver).surebtn() if __name__ == '__main__': driver = browser() dr = Basic(driver) url = Config().get('CAPACITY_RELEASE_URL') dr.get_url(url) username = '******' password = '******' Login().login(dr, username, password) CapacityRelease().page(dr) for i in range(20): dr.click('id', 'addBtn') dr.jump_off() CapacityRelease().page(dr)
driver.input('id', 'editor', NOW + '自动化商品询价单测试自动化商品询价单测试') driver.click('css', '[class="filter_confirm_btn filter_btn"]') driver.input('id', 'price', 40000) driver.clear('id', 'contact-num') driver.input('id', 'contact-num', 15132004444) driver.input('id', 'createTime1', DAY) try: time.sleep(1) driver.click('id', 'confirm-btn') except Exception: driver.save_screenshot(SCREENSHOT_PATH) print('询价失败') time.sleep(30) driver.click('css', '[class="btn btn-primary sureBtn"]') if __name__ == '__main__': driver = browser() dr = Basic(driver) url = Config().get('PRODUCT_INQUIRY') dr.get_url(url) dr.click('class','inquiry-order') dr.jump_off() username = '******' password = '******' Login().login(dr,username,password) time.sleep(2) dr.back() print(1) dr.refresh() dr.click('class','inquiry-order') ProductInquiry().page(dr)
def test1_login(self): sellerusr = Config().get('SUSR') sellerpsw = Config().get('SPSW') url = Config().get('PRODUCT_RELEASE_URL') self.dr.get_url(url) Login().login(self.dr, sellerusr, sellerpsw)
driver.input('name', 'remitBackNum', '422060100100135825') try: driver.click('id', 'finalSubmit') i = driver.text('class', 'ht-modal-default-text') assert i == '添加成功!' driver.click('css', '[class="btn btn-primary sureBtn"]') print('添加付款成功') except Exception: print('添加付款失败') try: driver.click('class', 'btnFinish') driver.click('css', '[class="btn btn-primary sureBtn"]') i = driver.text('class', 'ht-modal-default-text') assert i == '合同付款流程通过!' driver.click('css', '[class="btn btn-primary sureBtn"]') print('合同付款流程通过') except Exception: driver.save_screenshot(SCREENSHOT_PATH) print('合同付款流程失败') if __name__ == '__main__': driver = browser() dr = Basic(driver) url = Config().get('PAYFOR_URL') dr.get_url(url) username = '******' password = '******' Login().login(dr, username, password) Payfor().page(dr)