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 init_app_operation(): welcome.welcome_page().wait_page() welcome.welcome_page().select_gender('male') welcome.welcome_page().choose_age('31_to_45') home.home_page().click_account_button() user_center.user_page().wait_page() user_center.user_page().wait_get_it_gone()
def add_address_in_setting(): home.home_page().wait_page() home.home_page().click_account_button() user_center.user_page().wait_page() user_center.user_page().click_setting_button() account_setting.account_setting_page().wait_page() account_setting.account_setting_page().open_address_list() shipping_address.shipping_address_page().wait_page() # 判断是否第一次加地址 if shipping_address.shipping_address_page().is_first_add_address_button(): log.i('首次新增') shipping_address.shipping_address_page( ).click_add_first_address_button() else: log.i('非首次新增') shipping_address.shipping_address_page( ).click_setting_add_address_button() add_address_v2.add_address_page().wait_add_page() add_address_v2.add_address_page().input_first_name(test_data['first_name']) add_address_v2.add_address_page().input_last_name(test_data['last_name']) add_address_v2.add_address_page().input_phone(test_data['phone']) add_address_v2.add_address_page().input_state(test_data['state']) add_address_v2.add_address_page().input_city(test_data['city']) add_address_v2.add_address_page().input_address( test_data['detail_address']) add_address_v2.add_address_page().input_zip_code(test_data['zip_code']) add_address_v2.add_address_page().click_default_address_button() add_address_v2.add_address_page().click_default_billing_button() add_address_v2.add_address_page().click_save_button()
def change_country(country_name): user_center.user_page().wait_page() user_center.user_page().click_setting_button() account_setting.account_setting_page().wait_page() account_setting.account_setting_page().open_country_list() account_setting.account_setting_page().search_country(country_name) account_setting.account_setting_page().select_country(country_name)
def user_logout(): home.home_page().wait_page() home.home_page().click_account_button() user_center.user_page().wait_page() user_center.user_page().click_setting_button() account_setting.account_setting_page().wait_page() account_setting.account_setting_page().click_sign_out_button()
def del_all_cards(): user_center.user_page().click_setting_button() account_setting.account_setting_page().wait_page() account_setting.account_setting_page().open_cards_list() cards_list.cards_list_page().wait_page() while cards_list.cards_list_page().is_card_exists() is False: cards_list.cards_list_page().click_card() cards_list.cards_list_page().wait_delete_button() cards_list.cards_list_page().click_delete_button() cards_list.cards_list_page().wait_card_miss() BasePage().press_back_to_home()
def user_login(name, password): home.home_page().click_account_button() user_center.user_page().wait_page() user_center.user_page().wait_get_it_gone() user_center.user_page().click_signin_button() login.login_page().wait_page() BasePage.set_fastinput_ime() login.login_page().input_username(name) login.login_page().input_password(password) login.login_page().click_login_btn() user_center.user_page().discover_user_name() user_center.user_page().wait_is_login_page()
def test_01_login(self): home.home_page().wait_page() home.home_page().click_account_button() user_center.user_page().wait_page() user_center.user_page().clear_GetIt() user_center.user_page().click_signin_button() login.login_page().wait_page() self.set_fastinput_ime() login.login_page().input_username(self.test_data['user_name']) login.login_page().input_password(self.test_data['password']) login.login_page().click_login_btn() self.back()
def user_register(): home.home_page().click_account_button() user_center.user_page().wait_page() user_center.user_page().wait_get_it_gone() user_center.user_page().click_signin_button() login.login_page().wait_page() login.login_page().click_register_btn() BasePage.set_fastinput_ime() login.login_page().input_first_name(test_data['first_name']) login.login_page().input_last_name(test_data['last_name']) login.login_page().input_email(creat_random_email()) login.login_page().input_register_password(test_data['register_password']) login.login_page().input_confirm_register_password( test_data['register_password']) login.login_page().click_login_btn() home.home_page().click_home_button()
def test_02_register(self): home.home_page().wait_page() home.home_page().click_account_button() user_center.user_page().wait_page() user_center.user_page().clear_GetIt() user_center.user_page().click_signin_button() login.login_page().wait_page() login.login_page().click_register_btn() self.set_fastinput_ime() login.login_page().input_first_name(self.test_data['first_name']) login.login_page().input_last_name(self.test_data['last_name']) login.login_page().input_email(creat_random_email()) login.login_page().input_register_password( self.test_data['register_password']) login.login_page().input_confirm_register_password( self.test_data['register_password']) login.login_page().click_login_btn() self.watch_device("Shop Now") self.unwatch_device() time.sleep(10)
def step_to_open_address_list(): home.home_page().click_account_button() user_center.user_page().wait_page() user_center.user_page().click_setting_button() account_setting.account_setting_page().wait_page() account_setting.account_setting_page().open_address_list()