def test_envelope_livemode(self): red_id = GetCharge.GetRedEnvelope_sent(0) self.home_page.search_charge(red_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) red_id_detail = order_page.detail_red_envelope() order_page.close_detail() assert red_id == red_id_detail
def test_transfer_testmode(self): tr_id = GetCharge.GetTransfer_received(1) self.home_page.search_charge(tr_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) tr_id_detail = order_page.detail_transfer() order_page.close_detail() print tr_id_detail print tr_id assert tr_id == tr_id_detail
def test_chargeId_testmode(self): ch_id = GetCharge.GetCharge_Refunded(1) self.home_page.search_charge(ch_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) detail_actual_amount, detail_refunded, detail_refund_history = order_page.detail_paid_refunded() order_page.close_detail() detail_actual_amount = detail_actual_amount[1:] detail_refund_amount = detail_refunded[1:] assert float(detail_actual_amount) >= 0 assert float(detail_refund_amount) > 0 while detail_refund_history.find(u'加载中') >= 0: helper.wait_seconds(1) assert detail_refund_history[1:] <= detail_refund_amount
def test_refund_charge_Link_alipay_Test(self): ch_id = BatchPayment_Test.Alipay() BatchPayment_Test.notify(ch_id) time.sleep(2) self.home_page.search_charge(ch_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) order_page.click_refund_Button() order_page.input_password_confirm(True) order_page.refund_by_link() order_page.close_detail()
def test_refund_charge_Link_alipay(self): current_env = datagen.get_env_name() if current_env == "Pingxx": pass else: ch_id,result = BatchPayment.alipay() print "test_refund_charge_Link_alipay: "+ ch_id if result == "Fail": logging.info("Failed to pay alipay successfully, no alipay charge can be refunded.") print "test_refund_charge_Link_alipay: no alipay charge can be refunded." return else: self.home_page.search_charge(ch_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) order_page.click_refund_Button() order_page.input_password_confirm(True) order_page.refund_by_link() order_page.close_detail()
class Search(BaseTest): @classmethod def setUpClass(cls): BaseTest.initEnvironment(cls) # log in BaseTest.login(cls) # wait for home page loaded cls.home_page = HomePage(cls.driver) cls.home_page.check_if_loaded() @classmethod def tearDownClass(cls): BaseTest.clearUp(cls) # got charge which is paid and refunded, and search by chargeid in global search # in live mode def test_chargeId_livemode(self): ch_id = GetCharge.GetCharge_Refunded(0) self.home_page.search_charge(ch_id) self.home_page.search_charge_button() self.order_page = OrderPage(self.driver) detail_actual_amount, detail_refunded, detail_refund_history = self.order_page.detail_paid_refunded() self.order_page.close_detail() detail_actual_amount = detail_actual_amount[1:] detail_refund_amount = detail_refunded[1:] assert float(detail_actual_amount) >= 0 assert float(detail_refund_amount) >= 0 while detail_refund_history.find(u'加载中') >= 0: helper.wait_seconds(1) assert detail_refund_history[1:] > 0 # got charge which is paid and refunded, and search by order number in global search # in live mode def test_charge_order_livemode(self): order_id = GetCharge.GetOrder_Refunded(0) self.home_page.search_charge(order_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) detail_actual_amount, detail_refunded, detail_refund_history = order_page.detail_paid_refunded() order_page.close_detail() detail_actual_amount = detail_actual_amount[1:] detail_refund_amount = detail_refunded[1:] assert float(detail_actual_amount) >= 0 assert float(detail_refund_amount) >= 0 while detail_refund_history.find(u'加载中') >= 0: helper.wait_seconds(1) assert detail_refund_history[1:] > 0 # got charge which is paid and refunded from DB, and search by chargeid in # test mode def test_chargeId_testmode(self): ch_id = GetCharge.GetCharge_Refunded(1) self.home_page.search_charge(ch_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) detail_actual_amount, detail_refunded, detail_refund_history = order_page.detail_paid_refunded() order_page.close_detail() detail_actual_amount = detail_actual_amount[1:] detail_refund_amount = detail_refunded[1:] assert float(detail_actual_amount) >= 0 assert float(detail_refund_amount) > 0 while detail_refund_history.find(u'加载中') >= 0: helper.wait_seconds(1) assert detail_refund_history[1:] <= detail_refund_amount # got charge which is paid and refunded, and search by order number in # test mode def test_charge_order_testmode(self): ch_id = GetCharge.GetOrder_Refunded(1) print "test_charge_order_testmode"+ch_id self.home_page.search_charge(ch_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) detail_actual_amount, detail_refunded, detail_refund_history = order_page.detail_paid_refunded() order_page.close_detail() detail_actual_amount = detail_actual_amount[1:] detail_refund_amount = detail_refunded[1:] assert float(detail_actual_amount) >= 0 assert float(detail_refund_amount) > 0 while detail_refund_history.find(u'加载中') >= 0: helper.wait_seconds(1) assert detail_refund_history[1:] <= detail_refund_amount # got transfer which is sent from DB, and search it in global in live mode def test_transfer_livemode(self): tr_id = GetCharge.GetTransfer_received(0) self.home_page.search_charge(tr_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) tr_id_detail = order_page.detail_transfer() order_page.close_detail() print tr_id_detail print tr_id assert tr_id == tr_id_detail # got transfer which is sent from DB, and search it in global in test mode def test_transfer_testmode(self): tr_id = GetCharge.GetTransfer_received(1) self.home_page.search_charge(tr_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) tr_id_detail = order_page.detail_transfer() order_page.close_detail() print tr_id_detail print tr_id assert tr_id == tr_id_detail # got red envelope which is received from DB, and search it in global in # live mode def test_envelope_livemode(self): red_id = GetCharge.GetRedEnvelope_sent(0) self.home_page.search_charge(red_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) red_id_detail = order_page.detail_red_envelope() order_page.close_detail() assert red_id == red_id_detail # got red envelope which is received from DB, and search it in global in # test mode def test_envelope_testmode(self): red_id = GetCharge.GetRedEnvelope_sent(1) self.home_page.search_charge(red_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) red_id_detail = order_page.detail_red_envelope() order_page.close_detail() print red_id print red_id_detail assert red_id == red_id_detail
def test_refund_charge_partial_Test(self): ch_id = BatchPayment_Test.bfb() BatchPayment_Test.notify(ch_id) time.sleep(2) self.home_page.search_charge(ch_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) order_page.click_refund_Button() order_page.input_password_confirm(True) order_page.refund_partial() order_page.confirm_refund() order_page.check_refund_success() order_page.close_detail()
def test_refund_charge_all(self): ch_id = BatchPayment.wx_pub() # wait for seconds, it runs too fast that notify status cannot update immediately. time.sleep(2) self.home_page.search_charge(ch_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) order_page.click_refund_Button() order_page.input_password_confirm(True) order_page.refund_all() order_page.confirm_refund() order_page.check_refund_success() order_page.close_detail()
def test_refund_amount_alert(self): ch_id = BatchPayment.wx_pub() # wait for seconds, it runs too fast that notify status cannot update immediately. time.sleep(2) self.home_page.search_charge(ch_id) self.home_page.search_charge_button() order_page = OrderPage(self.driver) order_page.click_refund_Button() order_page.input_password_confirm(True) # test_refund_amount_greater order_page.refund_greater() order_page.confirm_refund() alert_message = order_page.verify_alert() order_page.close_alert() self.assertIn(u"退款金额超过可退金额",alert_message) #test_refund_amount_minus order_page.refund_minus() order_page.confirm_refund() alert_message = order_page.verify_alert() order_page.close_alert() self.assertIn(u"无效的退款金额",alert_message) #test_refund_amount_not_number order_page.refund_not_number() order_page.confirm_refund() alert_message = order_page.verify_alert() order_page.close_alert() self.assertIn(u"无效的值 amount",alert_message) # refund_comment_toolong order_page.refund_comment_toolong() order_page.confirm_refund() alert_message = order_page.verify_alert() order_page.close_alert() order_page.close_refund() self.assertIn(u"退款描述过长", alert_message) #close detail page order_page.close_detail()
def test_order_page(self): order = OrderPage(self.driver) res = order.user_info("时玉祥", "412726199005045859", "18538187569") self.assertIn('orderDetail', res)