コード例 #1
0
    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()
コード例 #2
0
    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"))
コード例 #3
0
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()
コード例 #4
0
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()
コード例 #5
0
ファイル: test_07_special_goods.py プロジェクト: zlmone/auto
 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()
コード例 #6
0
    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))
コード例 #7
0
def add_shipping_address_in_order(text=''):
    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'])

    if add_address_v2.add_address_page().is_email_exists(
    ):  # 订单转移case用,so先写死转移用户
        add_address_v2.add_address_page().input_email(
            test_data['user_name_02'])

    add_address_v2.add_address_page().input_address(
        test_data['detail_address'] + text)
    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_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()
    checkout_v2.checkout_page().wait_page()
コード例 #8
0
    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"))
コード例 #9
0
def ensure_needed_country_and_address(country_name):
    # country
    if checkout_v2.checkout_page().get_current_country() != country_name:
        checkout_v2.checkout_page().click_change_country()
        country_list.country_list_page().wait_page()
        country_list.country_list_page().search_country(country_name)
        country_list.country_list_page().select_country(country_name)
        country_list.country_list_page().ensure_country()
        checkout_v2.checkout_page().wait_page()
    # address
    if checkout_v2.checkout_page().is_exists_default_address(
            country_name) is False:
        checkout_v2.checkout_page().click_add_shipping_address_in_order()
        add_shipping_address_in_order()
コード例 #10
0
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()
コード例 #11
0
def one_step_to_pay(country_name, goods_id, attrs, p_method, index=0):
    """
        one_step_to_pay: 'Credit' or 'PayPal' need coupon
        :param country_name: init country support payment
        :param goods_id: support country , some goods_id id forbidden to some country
        :param attrs: map goods_id's attrs
        :param p_method payment_method
        :param index search_results num
        :return: None
    """
    if p_method == 'Credit' or p_method == 'PayPal':
        one_step_to_checkout_with_needed_coupon(goods_id, attrs, index=index)
    else:
        one_step_to_checkout_without_coupon(country_name,
                                            goods_id,
                                            attrs,
                                            index=index)
    ensure_needed_country_and_address(country_name)

    if country_name == 'Kuwait':
        checkout_v2.checkout_page().click_place_order_button()
    else:
        checkout_to_change_payment_method(p_method)
コード例 #12
0
def checkout_to_change_payment_method(p_method):
    checkout_v2.checkout_page().click_place_order_button()
    payment.payment_page().wait_page()
    payment.payment_page().change_payment_method(p_method)