def setUpClass(cls): cls.d.app_clear('com.vova.android') cls.d.app_start("com.vova.android") cls.test_data = get_test_data(cls.d) cls.watch_device("Pretty Sure|GET IT!|总是允许|Baik, saya paham.") BaseSteps.init_app_operation() cls.test_env = ReadConfig().get_test_env()
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_18_cod_goods_paid_by_COD(self): '''科威特COD支付(已去除该种支付方式)''' BaseSteps.one_step_to_pay("Kuwait", self.test_data['cod_goods_id'], self.test_data['cod_goods_attr'], "Cash On Delivery") self.wait_element_then_screenshot( self.d(resourceId="com.vova.android:id/ll_copy_bar_code"))
def test_05_login(self): '''用户登录''' home.home_page().wait_page() BaseSteps.user_login(self.test_data['user_name_01'], self.test_data['password_01']) self.wait_element_then_screenshot( self.d(resourceId="com.vova.android:id/tv_user_name"))
def test_06_normal_goods_paid_by_EPS_Austria(self): '''奥地利GiroPay支付(测试环境暂无)''' if self.test_env != "test": BaseSteps.one_step_to_pay("Austria", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "EPS") payment.payment_page().click_confirm_to_pay() self.wait_element_then_screenshot(self.d(resourceId="counter"))
def test_17_normal_goods_paid_by_boleto_Brazil(self): '''巴西Boleto支付''' BaseSteps.one_step_to_pay("Brazil", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "Boleto") payment.payment_page().input_pay_code("Boleto", self.CPF) payment.payment_page().click_confirm_to_pay() self.wait_element_then_screenshot( self.d(resourceId="com.vova.android:id/ll_copy_bar_code"))
def test_04_normal_goods_paid_by_Amanpay_Morocco(self): '''摩洛哥GiroPay支付(线上暂没配置)''' BaseSteps.one_step_to_pay("Morocco", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "Amanpay") payment.payment_page().click_confirm_to_pay() self.wait_element_then_screenshot( self.d(resourceId="com.vova.android:id/title_text", textContains='Confirmation'))
def test_15_normal_goods_paid_by_PayLater_Germany(self): '''德国PayLater支付''' BaseSteps.one_step_to_pay("Germany", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "Later") payment.payment_page().click_confirm_to_pay() if self.test_env == "test": self.wait_element_then_screenshot( self.d(resourceId="klarna-payments__payment-options")) else: self.wait_element_then_screenshot(self.d(resourceId="invoice"))
def test_07_normal_goods_paid_by_UPI_india(self): '''印度UPI支付''' BaseSteps.one_step_to_pay("India", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "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"))
def test_16_normal_goods_paid_by_SliceIt_Germany(self): '''德国SliceIt支付''' BaseSteps.one_step_to_pay("Germany", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "Slice") payment.payment_page().click_confirm_to_pay() if self.test_env == "test": self.wait_element_then_screenshot( self.d(resourceId="klarna-payments__payment-options")) else: self.wait_element_then_screenshot( self.d(resourceId="base-account-bullets__container"))
def test_04_logout(self): '''用户登出''' BaseSteps.user_logout() if BasePage.element_is_exists( self.d(resourceId="com.vova.android:id/tv_sign_in"), timeout=0) is False: self.find_element_by_swipe_down( self.d(resourceId="com.vova.android:id/tv_sign_in")) self.assertTrue( self.d(resourceId="com.vova.android:id/tv_sign_in", text='SIGN IN').exists(timeout=4))
def test_08_normal_goods_paid_by_Banking_india(self): '''印度net_banking支付''' BaseSteps.one_step_to_pay("India", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "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_10_normal_goods_paid_by_OVO_indonesia(self): '''印尼OVO_CASH支付''' BaseSteps.one_step_to_pay("Indonesia", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "OVO") payment.payment_page().click_confirm_to_pay() if self.test_env == "test": self.wait_element_then_screenshot(self.d(text="GO BACK")) else: self.wait_element_then_screenshot( self.d(resourceId="invoice-pending-left-content"))
def test_05_normal_goods_paid_by_dotpay_Poland(self): '''波兰dotpay支付''' BaseSteps.one_step_to_pay("Poland", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], '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"))
def setUpClass(cls): cls.d.app_clear('com.vova.android') cls.d.app_start("com.vova.android") # 无注册case别在watch中增加Shop Now,否则购物车为空时,会默认点击,返回上个页面在加车成功之前 cls.watch_device( "Pretty Sure|Sure|Baik, saya paham.|GET IT!|总是允许|始终允许") cls.test_data = get_test_data(cls.d) cls.test_env = ReadConfig().get_test_env() BaseSteps.init_app_operation() BaseSteps.user_login(cls.test_data['user_name_02'], cls.test_data['password_02']) cls.PAN = "EHFGA5967A" cls.CPF = '12649239700'
def test_13_normal_goods_paid_by_Sofort_Germany(self): '''德国Sofort支付''' BaseSteps.one_step_to_pay("Germany", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "SOFORT") 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_payment_methods() self.wait_element_then_screenshot( self.d(resourceId="android:id/content"))
def test_11_normal_goods_paid_by_Yandex_indonesia(self): '''俄罗斯Yandex_Money支付''' BaseSteps.one_step_to_pay("Russian Federation", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "Yandex Money") 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_payment_methods() self.wait_element_then_screenshot( self.d(resourceId="android:id/content"))
def test_01_install_apk(self): '''安装启动android_app_vova''' self.d.app_uninstall(pkg_name) # self.d.app_install(apk_url) if test_env == "test": self.local_install(test_apk_path) log.i("成功安装测试包") elif test_env == "pre": self.local_install(pre_apk_path) log.i("成功安装release包") else: log.i("Wrong test environment") return self.d.app_start(pkg_name) BaseSteps.init_app_operation()
def test_12_normal_goods_paid_by_QIWI_indonesia(self): '''俄罗斯QIWI_Wallet支付''' BaseSteps.one_step_to_pay("Russian Federation", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "QIWI Wallet") 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_payment_methods() self.wait_element_then_screenshot( self.d(resourceId="com.vova.android:id/button_continue"))
def test_03_normal_goods_paid_by_paypal_swipe(self): '''PayPal滑动支付(支持美国、印尼、西班牙)''' if self.test_env == "test": BaseSteps.one_step_to_pay("United States", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "PayPal") payment.payment_page().swipe_to_pay() self.assertTrue( self.d(resourceId="com.vova.android:id/title_text", textContains='Confirmation').exists(timeout=15)) self.wait_element_then_screenshot( self.d(resourceId="com.vova.android:id/title_text", textContains='Confirmation'))
def test_14_normal_goods_paid_by_GiroPay_Germany(self): '''德国GiroPay支付''' BaseSteps.one_step_to_pay("Germany", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "GiroPay") 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_payment_methods() self.wait_element_then_screenshot( self.d(resourceId="com.vova.android:id/button_continue"))
def test_02_add_new_address_first(self): '''add_address新版页面首次新增地址并编辑''' BaseSteps.add_address_in_setting() # 编辑地址 BasePage.wait_element_exists( self.d(resourceId='com.vova.android:id/addressModifyIv')) time.sleep(2) # 兼容刷新不完成时点击编辑无效,待完善 shipping_address.shipping_address_page( ).click_edit_button_for_address_v2() add_address_v2.add_address_page().wait_edit_page() add_address_v2.add_address_page().input_address( 'updated' + self.test_data['detail_address']) add_address_v2.add_address_page().click_save_button() a = self.d(resourceId="com.vova.android:id/addressDesTv", textContains='updated').exists(timeout=6) self.assertTrue(a)
def test_02_normal_goods_paid_by_paypal(self): '''PayPal支付-(测试环境沙盒支付)''' BaseSteps.one_step_to_pay("Angola", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], "PayPal") if self.test_env == "test": payment.payment_page().click_confirm_to_pay() paypal.paypal_sandbox_page().wait_page() paypal.paypal_sandbox_page().click_proceed_button() self.assertTrue( self.d(resourceId="com.vova.android:id/title_text", textContains='Confirmation').exists(timeout=15)) self.wait_element_then_screenshot( self.d(resourceId="com.vova.android:id/title_text", textContains='Confirmation')) else: self.screenshot() # 正式需要paypal账号
def test_03_add_new_address_no_first(self): '''add_address新版页面非首次新增地址并删除''' BaseSteps.add_address_in_setting() BasePage.wait_element_exists( self.d(resourceId='com.vova.android:id/addressModifyIv')[1]) time.sleep(2) # 兼容刷新不完成时点击编辑无效,待完善 # 删除地址 shipping_address.shipping_address_page( ).click_edit_button_for_address_v2() add_address_v2.add_address_page().wait_edit_page() add_address_v2.add_address_page().click_del_button_for_address_v2() BasePage.wait_element_exists( self.d(resourceId='com.vova.android:id/addressModifyIv')) self.d(resourceId="com.vova.android:id/addressDesTv", textContains='updated').wait_gone(timeout=4.0) self.assertFalse( self.d(resourceId="com.vova.android:id/addressDesTv", textContains='updated').exists())
def test_19_netherlands_goods_paid_by_ideal_Netherlands(self): '''荷兰ideal支付''' if self.test_env == "test": BaseSteps.one_step_to_pay("Netherlands", self.test_data['netherlands_goods_id'], None, "iDeal") else: BaseSteps.one_step_to_pay("Netherlands", self.test_data['netherlands_goods_id'], self.test_data['netherlands_goods_attr'], "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"))
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"))
def test_01_normal_goods_paid_by_card(self): '''信用卡支付''' BaseSteps.one_step_to_pay("Angola", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], 'Credit') payment.payment_page().click_confirm_to_pay() payment.payment_page().wait_confirm_page() self.assertTrue( self.d(resourceId="com.vova.android:id/try_again_btn", textContains='SHOP NOW').exists(timeout=2)) self.wait_element_then_screenshot( self.d(resourceId="com.vova.android:id/try_again_btn", textContains='SHOP NOW')) if self.test_env != "test": self.d( resourceId="com.vova.android:id/check_your_order_btn").click() order_details.order_details_page().wait_page() log.i( self.d( resourceId="com.vova.android:id/order_no_tv").get_text() + '记得退款')
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_01_add_address_and_card_pay(self): '''信用卡-新增地址-新增卡支付''' test_country = "Aruba" BaseSteps.del_all_address_and_cards(test_country) BaseSteps.one_step_to_pay(test_country, self.test_data['normal_goods_id'], self.test_data['normal_goods_attr'], 'Credit') payment.payment_page().click_confirm_to_pay() add_a_card.add_card_page().wait_page() add_a_card.add_card_page().input_card_number( self.test_data['card_number']) add_a_card.add_card_page().click_chose_date() add_a_card.add_card_page().swipe_to_chose_month( self.test_data['card_date_month']) add_a_card.add_card_page().swipe_to_chose_year( self.test_data['card_date_year']) add_a_card.add_card_page().click_date_confirm() add_a_card.add_card_page().input_card_cvv(self.test_data['card_cvv']) add_a_card.add_card_page().click_use_card() payment.payment_page().wait_confirm_page() self.assertTrue( self.d(resourceId="com.vova.android:id/try_again_btn", textContains='SHOP NOW').exists(timeout=2)) self.wait_element_then_screenshot( self.d(resourceId="com.vova.android:id/try_again_btn", textContains='SHOP NOW')) if self.test_env != "test": self.d( resourceId="com.vova.android:id/check_your_order_btn").click() order_details.order_details_page().wait_page() log.i( self.d( resourceId="com.vova.android:id/order_no_tv").get_text() + '记得退款')
def test_01_express_goods_flow(self): '''海外仓商品下单流程验证''' if self.test_env == "test": self.d.app_clear('com.vova.android') self.d.app_start("com.vova.android") BaseSteps.init_app_operation() BaseSteps.user_login(self.test_data['user_name_02'], self.test_data['password_02']) else: BaseSteps.change_country("France", self.test_data['normal_goods_id'], self.test_data['normal_goods_attr']) home.home_page().click_search_button() search.search_page().wait_page() search.search_page().click_search_box() search.search_page().wait_search_inner_page() search.search_page().click_inner_search_box() search.search_page().input_goods_id_to_search( self.test_data['express_good_id']) search.search_page().wait_goods_img() self.assertTrue( self.d( resourceId="com.vova.android:id/iv_over_sea_img").exists( timeout=4)) search.search_page().click_item_img() commodity_details.commodity_details_page().click_more_attr_button() commodity_details.commodity_details_page().wait_attr_pop_up() self.assertTrue( self.d(resourceId="com.vova.android:id/iv_select_fbv").exists( timeout=4)) commodity_details.commodity_details_page().chose_express_shipping() attrs = self.test_data['express_good_attr'] for attr in attrs: commodity_details.commodity_details_page().select_goods_attr( attr) commodity_details.commodity_details_page().click_add_to_bag_button( ) bag.bag_page().wait_page() self.assertTrue( self.d( resourceId="com.vova.android:id/cl_express_ship").exists( timeout=4)) bag.bag_page().click_checkout_button() checkout_v2.checkout_page().wait_page() self.assertTrue( self.d(resourceId="com.vova.android:id/goods_fast_img").exists( timeout=4)) BasePage().press_back_to_home() BaseSteps.empty_shopping_bag()