def test_01_transfer_order(self): '''订单转移''' BaseSteps.search_goods_by_id(self.test_data['normal_goods_id']) BaseSteps.buy_goods_with_attr(self.test_data['normal_goods_attr']) BaseSteps.checkout_without_coupon() BaseSteps.ensure_needed_country_and_address('Indonesia') BaseSteps.checkout_to_change_payment_method('Credit') self.press_back_until_special_element(self.d( resourceId="com.vova.android:id/order_support_type", text='OTHER DETAILS'), timeout=5) order_details.order_details_page().wait_page() a = order_details.order_details_page().get_order_id() log.i('待转移的订单号:%s' % a) BasePage().press_back_to_home() BaseSteps.user_login(self.test_data['user_name_02'], self.test_data['password_02']) user_center.user_page().click_my_orders_button() my_orders.my_orders_page().wait_page() my_orders.my_orders_page().click_unpaid_button() order_details.order_details_page().wait_page() b = order_details.order_details_page().get_order_id() log.i('订单转移账户最新订单号:%s' % b) self.assertEqual(a, b, '待转移的订单号和订单转移账户最新订单号不一致,疑订单转移有误')
def test_02_change_new_address_pay(self): '''波兰dotpay-地址切换为新增地址支付''' BaseSteps.one_step_to_checkout_without_coupon( "Poland", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr']) BaseSteps.ensure_needed_country_and_address('Poland') checkout_v2.checkout_page().click_default_address() shipping_address.shipping_address_page().wait_page() shipping_address.shipping_address_page( ).click_setting_add_address_button() BaseSteps.add_shipping_address_in_order('dotpay') self.assertTrue( self.d(resourceId="com.vova.android:id/addressDesTv", textContains='dotpay').exists(timeout=2)) BaseSteps.checkout_to_change_payment_method('Dotpay') payment.payment_page().click_confirm_to_pay() if self.test_env == "test": self.wait_element_then_screenshot( self.d(resourceId="com.vova.android:id/failure_tip_text")) else: self.wait_element_then_screenshot( self.d(resourceId="com.vova.android:id/channelLabelTv")) BasePage().press_back_to_home() BaseSteps.go_shipping_address_edit_page("Poland") add_address_v2.add_address_page().click_del_button_for_address_v2()
def test_03_change_exists_address_pay(self): '''印度net-banking-切换为已存在的地址支付''' BaseSteps.one_step_to_checkout_without_coupon( "India", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr']) BaseSteps.ensure_needed_country_and_address('India') a = self.d(resourceId="com.vova.android:id/countryDesTv").get_text() log.i('原地址为:%s' % a) checkout_v2.checkout_page().click_default_address() shipping_address.shipping_address_page().wait_page() shipping_address.shipping_address_page( ).select_needed_address_with_text_and_index('India') checkout_v2.checkout_page().wait_page() self.d(resourceId="com.vova.android:id/countryDesTv", text=a).wait_gone(timeout=10.0) b = self.d(resourceId="com.vova.android:id/countryDesTv").get_text() log.i('新地址为:%s' % b) self.assertNotEqual(a, b) BaseSteps.checkout_to_change_payment_method("India Net Banking") payment.payment_page().input_pay_code("India Net Banking", self.PAN) payment.payment_page().click_confirm_to_pay() if self.test_env == "test": self.wait_element_then_screenshot(self.d(resourceId="root")) else: self.wait_element_then_screenshot(self.d(resourceId="bank"))
def test_05_modify_address_pay(self): '''荷兰ideal-修改原地址支付''' if self.test_env == "test": attrs = None else: attrs = self.test_data['netherlands_goods_attr'] BaseSteps.one_step_to_checkout_without_coupon( "Netherlands", self.test_data['netherlands_goods_id'], attrs=attrs) BaseSteps.ensure_needed_country_and_address('Netherlands') checkout_v2.checkout_page().click_default_address() shipping_address.shipping_address_page().wait_page() shipping_address.shipping_address_page( ).click_edit_button_for_address_v2() add_address_v2.add_address_page().input_address('updated') add_address_v2.add_address_page().click_save_button() checkout_v2.checkout_page().wait_page() self.assertTrue( self.d(resourceId="com.vova.android:id/addressDesTv", textContains='updated').exists(timeout=2)) BaseSteps.checkout_to_change_payment_method("iDeal") payment.payment_page().click_confirm_to_pay() if self.test_env == "test": self.wait_element_then_screenshot( self.d(resourceId="android:id/message")) else: payment.payment_page().wait_payment_methods() payment.payment_page().click_ideal_pay() self.wait_element_then_screenshot( self.d(resourceId="nl.rabomobiel:id/message")) BasePage().press_back_to_home() BaseSteps.go_shipping_address_edit_page("Netherlands") add_address_v2.add_address_page().input_address( self.test_data['detail_address']) add_address_v2.add_address_page().click_save_button() self.assertTrue( self.d(resourceId="com.vova.android:id/addressDesTv", textContains=self.test_data['detail_address']).exists( timeout=15))
def test_04_login_to_checkout_pay(self): '''印度UPI-登录后支付''' BaseSteps.user_logout() BaseSteps.search_goods_by_id(self.test_data['normal_goods_id']) BaseSteps.buy_goods_with_attr(self.test_data['normal_goods_attr']) bag.bag_page().click_checkout_button() login.login_page().wait_page() login.login_page().login(self.test_data['user_name_02'], self.test_data['password_02']) checkout_v2.checkout_page().wait_page() BaseSteps.ensure_needed_country_and_address('India') BaseSteps.checkout_to_change_payment_method('UPI') payment.payment_page().input_pay_code("UPI", self.PAN) payment.payment_page().click_confirm_to_pay() if self.test_env == "test": self.wait_element_then_screenshot(self.d(resourceId="root")) else: self.wait_element_then_screenshot(self.d(resourceId="tab-title"))