def buy_goods_with_attr_by_cod(attrs): commodity_details.commodity_details_page().wait_page() commodity_details.commodity_details_page().click_bag_button() 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() while not bag.bag_page().is_cod(): commodity_details.commodity_details_page().click_add_amount_button() time.sleep(0.5)
def one_step_to_checkout_with_needed_coupon(goods_id, attrs, index=0): """ one_step_to_checkout_with_needed_coupon :param == one_step_to_pay ↓↓↓ """ search_goods_by_id(goods_id, index=index) buy_goods_with_attr(attrs) bag.bag_page().click_coupon_chose_button() bag.bag_page().wait_coupons_page() bag.bag_page().chose_needed_coupon_button(test_data['coupon_discount']) bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout_v2.checkout_page().wait_page()
def test_07_normal_goods_Russia(self): home.home_page().wait_page() home.home_page().click_account_button() change_country("Russian Federation") self.press_back_to_home() home.home_page().click_search_button() search_goods_by_id(self.test_data['normal_goods_id']) buy_goods_with_attr(self.test_data['normal_goods_attr']) bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout.checkout_page().wait_page() change_shipping_address_with_country("Russia") checkout.checkout_page().change_payment_method("QIWI Wallet ") checkout.checkout_page().click_place_order_button() time.sleep(10.0) self.screenshot() self.press_back_until_special_element( 'com.vova.android:id/check_button') search_goods_by_id(self.test_data['normal_goods_id']) buy_goods_with_attr(self.test_data['normal_goods_attr']) bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout.checkout_page().wait_page() checkout.checkout_page().change_payment_method("Yandex Money") checkout.checkout_page().click_place_order_button() time.sleep(10.0) self.screenshot()
def buy_goods_with_attr(attrs=None, add_num=0, del_num=0): commodity_details.commodity_details_page().wait_page() commodity_details.commodity_details_page().click_bag_button() if attrs: for attr in attrs: commodity_details.commodity_details_page().select_goods_attr(attr) for i in range(add_num): commodity_details.commodity_details_page().click_add_amount_button( ) for j in range(del_num): commodity_details.commodity_details_page( ).click_reduce_amount_button() commodity_details.commodity_details_page().click_add_to_bag_button() bag.bag_page().wait_page()
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()
def test_01_normal_goods_paid_by_card(self): home.home_page().wait_page() home.home_page().click_account_button() change_country("United States") self.press_back_to_home() home.home_page().click_search_button() search_goods_by_id(self.test_data['normal_goods_id']) buy_goods_with_attr(self.test_data['normal_goods_attr']) bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout.checkout_page().wait_page() change_shipping_address_with_country("United States") checkout.checkout_page().click_place_order_button() time.sleep(10.0) self.screenshot()
def test_03_normal_goods_paid_by_dotpay_Poland(self): home.home_page().wait_page() home.home_page().click_account_button() change_country("Poland") self.press_back_to_home() home.home_page().click_search_button() search_goods_by_id(self.test_data['normal_goods_id']) buy_goods_with_attr(self.test_data['normal_goods_attr']) bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout.checkout_page().wait_page() change_shipping_address_with_country("poland") checkout.checkout_page().change_payment_method("Dotpay") checkout.checkout_page().click_place_order_button() time.sleep(10.0) self.screenshot()
def test_10_normal_goods_COD(self): home.home_page().wait_page() home.home_page().click_account_button() change_country("Kuwait") self.press_back_to_home() home.home_page().click_search_button() search_goods_by_id(self.test_data['cod_goods_id']) buy_goods_with_attr_by_cod(self.test_data['cod_goods_attr']) bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout.checkout_page().wait_page() change_shipping_address_with_country("Kuwait") checkout.checkout_page().change_payment_method("Cash On Delivery") checkout.checkout_page().click_place_order_button() time.sleep(10.0) self.screenshot()
def test_04_normal_goods_paid_by_ideal_Netherlands(self): home.home_page().wait_page() home.home_page().click_account_button() change_country("Netherlands") self.press_back_to_home() home.home_page().click_search_button() search_goods_by_id(self.test_data['cod_goods_id']) buy_goods_with_attr(self.test_data['cod_goods_attr']) bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout.checkout_page().wait_page() change_shipping_address_with_country("netherlands") checkout.checkout_page().change_payment_method("iDeal") checkout.checkout_page().click_place_order_button() time.sleep(10.0) self.screenshot()
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_05_normal_goods_india(self): home.home_page().wait_page() home.home_page().click_account_button() change_country("India") self.press_back_to_home() home.home_page().click_search_button() search_goods_by_id(self.test_data['normal_goods_id']) buy_goods_with_attr(self.test_data['normal_goods_attr']) bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout.checkout_page().wait_page() change_shipping_address_with_country("india") checkout.checkout_page().change_payment_method("UPI") checkout.checkout_page().input_PAN(self.PAN) self.set_original_ime() checkout.checkout_page().click_place_order_button() time.sleep(10.0) self.screenshot() self.press_back_until_special_element( 'com.vova.android:id/check_button') search_goods_by_id(self.test_data['normal_goods_id']) buy_goods_with_attr(self.test_data['normal_goods_attr']) bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout.checkout_page().wait_page() checkout.checkout_page().change_payment_method("India Net Banking") checkout.checkout_page().input_PAN(self.PAN) self.set_original_ime() checkout.checkout_page().click_place_order_button() time.sleep(10.0) self.screenshot()
def test_06_normal_goods_indonesia(self): home.home_page().wait_page() home.home_page().click_account_button() change_country("Indonesia") self.press_back_to_home() home.home_page().click_search_button() search_goods_by_id(self.test_data['normal_goods_id']) buy_goods_with_attr(self.test_data['normal_goods_attr']) bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout.checkout_page().wait_page() change_shipping_address_with_country("Indonesia") checkout.checkout_page().change_payment_method("Bank Transfers") checkout.checkout_page().click_place_order_button() time.sleep(10.0) self.screenshot() self.press_back_until_special_element( 'com.vova.android:id/check_button') search_goods_by_id(self.test_data['normal_goods_id']) buy_goods_with_attr(self.test_data['normal_goods_attr']) bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout.checkout_page().wait_page() checkout.checkout_page().change_payment_method("Alfamart") checkout.checkout_page().click_place_order_button() time.sleep(10.0) self.screenshot() self.press_back_until_special_element( 'com.vova.android:id/check_button') search_goods_by_id(self.test_data['normal_goods_id']) buy_goods_with_attr(self.test_data['normal_goods_attr']) bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout.checkout_page().wait_page() checkout.checkout_page().change_payment_method("OVO CASH") checkout.checkout_page().click_place_order_button() time.sleep(10.0) self.screenshot()
def empty_shopping_bag(): home.home_page().click_bag_button() while bag.bag_page().is_empty_bag() is False: bag.bag_page().wait_page() bag.bag_page().long_click_goods_name() bag.bag_page().wait_delete_button() bag.bag_page().click_delete_button() bag.bag_page().wait_empty_status()
def one_step_to_checkout_without_coupon(country_name, goods_id, attrs, index=0): """ one_step_to_checkout :param == one_step_to_pay ↓↓↓ """ search_goods_by_id(goods_id, index=index) if country_name == 'Austria': buy_goods_with_attr(attrs, add_num=int(test_data['cod_num']), del_num=1) else: buy_goods_with_attr(attrs) if bag.bag_page().is_use_coupon(): bag.bag_page().click_coupon_chose_button() bag.bag_page().wait_coupons_page() bag.bag_page().click_no_use_coupon_button() bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout_v2.checkout_page().wait_page()
def checkout_without_coupon(): bag.bag_page().wait_page() if bag.bag_page().is_use_coupon(): bag.bag_page().click_coupon_chose_button() bag.bag_page().click_no_use_coupon_button() bag.bag_page().wait_page() bag.bag_page().click_checkout_button() checkout_v2.checkout_page().wait_page()