class ReleaseCapacity(unittest.TestCase): @classmethod def setUpClass(self): self.driver = browser() self.dr = Basic(self.driver) self.btn = Button(self.dr) self.flow = Flow(self.dr) def test1_login(self): sellerusr = Config().get('SUSR') sellerpsw = Config().get('SPSW') url = Config().get('CAPACITY_RELEASE_URL') self.dr.get_url(url) Login().login(self.dr, sellerusr, sellerpsw) def test2_release(self): CapacityRelease().page(self.dr) @unittest.skip('跳过') def test3_release(self): for i in range(2): self.dr.click('id', 'addBtn') self.dr.jump_off() CapacityRelease().page(self.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)
class persen_marketing_share_product(unittest.TestCase): @classmethod def setUpClass(self): self.driver = browser() self.dr = Basic(self.driver) self.btn = Button(self.dr) self.flow = Flow(self.dr) self.tp = folwType(os.path.join(DATA_PATH, 'yx_flow.xlsx'), sheet=2) self.pact_num = None 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_capacity_flow('航天云网') else: self.flow.share_capacity_flow('航天云网') globals()['product_url'] = self.dr.get_attribute( 'id', 'firstProduct', 'value') 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 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 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 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 test7_settle(self): self.dr.click('link', '结算管理') self.btn.enter_wx_payfor() Payfor().page(self.dr) self.btn.enter_wx_settle() Settle().page(self.dr) 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() @classmethod def tearDownClass(cls): print('营销员账号:158015900000') print('买家账号:600022_system') print('卖家账号:600633_system')