コード例 #1
0
 def test_all_order_link(self):
     '''
     点击全部订单跳转
     '''
     print("**我的页面元素是否展示**")
     PersonalPage(self.driver).click_all_order_link()
     BasePage(self.driver).check_exist_in_string('我的订单', self.driver.title)
     BasePage(self.driver).check_exist_in_string('myOrders',
                                                 self.driver.current_url)
     delivery_method_tab_classname = BasePage(
         self.driver).get_element_attribute(
             OrderPage(self.driver).get_delivery_method_tab(1), 'className')
     time.sleep(5)
     delivery_method_tab_innertext = BasePage(
         self.driver).get_element_attribute(
             OrderPage(self.driver).get_delivery_method_tab(1), 'innerText')
     order_state_tab_classname = BasePage(
         self.driver).get_element_attribute(
             OrderPage(self.driver).get_order_state_tab(1), 'className')
     order_state_tab_innertext = BasePage(
         self.driver).get_element_attribute(
             OrderPage(self.driver).get_order_state_tab(1), 'innerText')
     BasePage(self.driver).check_exist_in_string(
         'switchLeft', delivery_method_tab_classname)
     BasePage(self.driver).check_exist_in_string(
         '快递配送', delivery_method_tab_innertext)
     BasePage(self.driver).check_exist_in_string('seletTitle',
                                                 order_state_tab_classname)
     BasePage(self.driver).check_exist_in_string('全部',
                                                 order_state_tab_innertext)
コード例 #2
0
 def test_orders_info_check(self):
     '''
     检查订单列表的商品信息是否展示
     '''
     res = BasePage(self.driver).is_element_present(
         OrderPage(self.driver)._order_code)
     if res is True:
         print('订单编号模块已展示')
     else:
         TestCase().fail("订单编号模块未展示")
     res = BasePage(self.driver).is_element_present(
         OrderPage(self.driver)._order_product_spec)
     if res is True:
         print('订单商品规格模块已展示')
     else:
         TestCase().fail("订单商品规格模块未展示")
     BasePage(self.driver).is_element_present(
         OrderPage(self.driver)._order_product_name)
     if res is True:
         print('订单商品名称模块已展示')
     else:
         TestCase().fail("订单商品名称模块未展示")
     BasePage(self.driver).is_element_present(
         OrderPage(self.driver)._order_product_price)
     if res is True:
         print('订单商品价格模块已展示')
     else:
         TestCase().fail("订单商品价格模块未展示")
     BasePage(self.driver).is_element_present(
         OrderPage(self.driver)._order_product_num)
     if res is True:
         print('订单商品数量模块已展示')
     else:
         TestCase().fail("订单商品数量模块未展示")
コード例 #3
0
 def test_state_order_link(self, n):
     '''
     点击待支付、待自提等跳转到对应的订单列表中
     '''
     print("**我的订单模块点击进入不同tab页**")
     expected_deliver_class_name = 'switchLeft'
     expected_deliver_inner_text = ['快递配送', '门店自提']
     expected_order_state_class_name = 'seletTitle'
     expected_order_state_inner_text = [['全部', '全部'], ['待支付', '待支付'],
                                        ['待成团', '待成团'], ['待发货', '待自提'],
                                        ['待收货', '已完成']]
     if n == 1 or n == 2 or n == 3 or n == 4:
         m = 1
         x = n + 1
     if n == 5:
         m = 2
         x = 4
     PersonalPage(self.driver).click_state_order_link(n)
     BasePage(self.driver).check_exist_in_string('我的订单', self.driver.title)
     BasePage(self.driver).check_exist_in_string('myOrders',
                                                 self.driver.current_url)
     delivery_method_tab_classname = BasePage(
         self.driver).get_element_attribute(
             OrderPage(self.driver).get_delivery_method_tab(m), 'className')
     delivery_method_tab_innertext = BasePage(
         self.driver).get_element_attribute(
             OrderPage(self.driver).get_delivery_method_tab(m), 'innerText')
     order_state_tab_classname = BasePage(
         self.driver).get_element_attribute(
             OrderPage(self.driver).get_order_state_tab(x), 'className')
     order_state_tab_innertext = BasePage(
         self.driver).get_element_attribute(
             OrderPage(self.driver).get_order_state_tab(x), 'innerText')
     BasePage(self.driver).check_exist_in_string(
         expected_order_state_class_name, order_state_tab_classname)
     BasePage(self.driver).assert_equal(
         order_state_tab_innertext,
         expected_order_state_inner_text[x - 1][m - 1])
     if n == 1 or n == 2 or n == 3 or n == 4:
         BasePage(self.driver).assert_equal(delivery_method_tab_classname,
                                            expected_deliver_class_name)
         BasePage(self.driver).check_exist_in_string(
             expected_deliver_inner_text[0], delivery_method_tab_innertext)
         BasePage(self.driver).assert_equal(
             order_state_tab_innertext,
             expected_order_state_inner_text[x - 1][m - 1])
     if n == '5':
         BasePage(self.driver).assert_equal(delivery_method_tab_classname,
                                            expected_deliver_class_name)
         BasePage(self.driver).check_exist_in_string(
             expected_deliver_inner_text[1], delivery_method_tab_innertext)
コード例 #4
0
 def __init__(self, headless, url):
     setup("INFO")
     logger.setLevel("INFO")
     options: Options = Options()
     if headless:
         options.add_argument("--headless")
     self.url = url
     try:
         self.driver = webdriver.Chrome(ChromeDriverManager().install(),
                                        options=options)
     except ValueError:
         self.driver = webdriver.Chrome(r"C:\chromedriver.exe",
                                        options=options)
     self.driver.implicitly_wait(10)
     self.login = LoginPage(self)
     self.my_addresses = MyAddressesPage(self)
     self.contact_us = ContactUsPage(self)
     self.personal_info = MyPersonalInfoPage(self)
     self.my_orders = MyOrdersPage(self)
     self.my_credit_slips = MyCreditSlipsPage(self)
     self.women_category_page = WomenCategoryPage(self)
     self.order_page = OrderPage(self)
     self.registration = RegistrationPage(self)
     self.filtering_women = FilteringWomenPage(self)
     self.shopping_cart = ShoppingCartPage(self)
     self.search = SearchGoods(self)
コード例 #5
0
class PaymentOneItemTest(BaseSetup, unittest.TestCase):
    def setUp(self):
        super(PaymentOneItemTest, self).setUp()
        self.home_page = HomePage(self.driver)
        self.home_page_logado = HomeLogadoPage(self.driver)
        self.login_page = LoginPage(self.driver)
        self.order_page = OrderPage(self.driver)

    def test_payment_one_item(self):
        self.home_page.clickLoginButton()
        self.login_page.loginSuccessful()
        self.home_page.addInCart()
        self.order_page.orderCreate()
        resultText = self.order_page.getTextLabelConfirmOrder()
        resultValue = self.order_page.getTextLabelValueOrder()
        resultShipping = self.order_page.shipping
        self.assertEqual(resultText, "Your order on My Store is complete.")
        self.assertEqual(self.home_page.cartValue + resultShipping,
                         resultValue)
コード例 #6
0
    def __init__(self, driver):
        self.base = Page(driver)

        self.onboarding_page = OnboardingPage(driver)

        self.popular_page = PopularPage(driver)
        self.category_page = CategoryPage(driver)
        self.search_page = SearchPage(driver)
        self.ticket_page = TicketPage(driver)
        self.profile_page = ProfilePage(driver)

        self.footer = Footer(driver)

        self.popular_detail_page = PopularDetailPage(driver)
        self.profile_support_page = ProfileSupportPage(driver)

        self.order_place_page = OrderPlacePage(driver)
        self.order_category_page = OrderCategoryPage(driver)
        self.order_products_page = OrderProductsPage(driver)
        self.order_page = OrderPage(driver)

        self.errors_pages = ErrorsPages(driver)
コード例 #7
0
 def setUp(self):
     super(PaymentOneItemTest, self).setUp()
     self.home_page = HomePage(self.driver)
     self.home_page_logado = HomeLogadoPage(self.driver)
     self.login_page = LoginPage(self.driver)
     self.order_page = OrderPage(self.driver)
コード例 #8
0
ファイル: order.py プロジェクト: kkkzzg/demo
 def order_dish(self, dish_type):
     order_page = OrderPage(self.selenium)
     try:
         self.prepare()
         func = {
             settings.DishType.lunch: order_page.select_lunch,
             settings.DishType.breakfast: order_page.select_breakfast,
         }
         func[dish_type]()
         order_page.click_random_dish()
         order_page.click_cart()
         order_page.select_deliver_floor()
         order_page.click_billing()
     finally:
         order_page.take_snapshot()
         close_browser(self.selenium)
コード例 #9
0
 def __init__(self, app):
     self.app = app
     self.driver = app.driver
     self.order_actions = OrderPage(driver=self.driver)
コード例 #10
0
class OrderActions(BasePage, BasePageObject):
    def __init__(self, app):
        self.app = app
        self.driver = app.driver
        self.order_actions = OrderPage(driver=self.driver)

    @allure.step("Choose payment method option")
    def select_payment_method_option(self, option_text):
        LOGGER.info("Choose payment method option")
        self.order_actions.click_payment_method_button()
        self.order_actions.choose_payment_method_option(
            option_text=option_text)

    @allure.step("Fill in specified PO number")
    def fill_in_po_number(self, po_number):
        LOGGER.info("Fill in specified PO number")
        self.order_actions.type_po_number(value=po_number)
        self.order_actions.click_submit_po_button()

    @allure.step("Set checkout options")
    def set_checkout_options(self):
        LOGGER.info("Set checkout options")
        self.order_actions.click_change_shipping_address_button()
        self.order_actions.click_address_option()
        self.order_actions.click_change_billing_address_button()
        self.order_actions.click_address_option()

    @allure.step("Accept order info")
    def accept_order_info(self):
        LOGGER.info("Accept order info")
        self.order_actions.click_place_order_button()

    @allure.step("Verify order confirmation")
    def verify_order_confirmation(self, url):
        LOGGER.info("Verify order confirmation")
        assert url in self.driver.current_url, f"Test create order failed." \
                                               f"Expected url: {url}, " \
                                               f"Actual url: {self.driver.current_url}"
        allure.attach(self.driver.get_screenshot_as_png(), "screenshot",
                      attachment_type.PNG)

    @allure.step("Wait for PDP loaded")
    def wait_for_pdp_loaded(self):
        LOGGER.info("Wait for PDP loaded")
        self.order_actions.wait_for_pdp_loaded()

    @allure.step("Wait for order confirmation")
    def wait_for_order_confirmation(self):
        LOGGER.info("Wait for order confirmation")
        self.order_actions.wait_for_order_confirmation()