Example #1
0
 def test_page_show_check(self):
     '''
     商品分类页面元素展示
     '''
     print('**验证分类页面的元素是否已经展示**')
     res = BasePage(self.driver).is_element_present(
         CategoryPage(self.driver)._search_box)
     if res is True:
         print('搜索框展示在页面上')
     else:
         print('搜索框未出现在页面上')
     res = BasePage(self.driver).is_element_present(
         CategoryPage(self.driver)._cate)
     if res is True:
         print('左侧前端分类展示在页面上')
     else:
         TestCase().fail('左侧前端分类未出现在页面上')
     res = BasePage(self.driver).is_element_present(
         CategoryPage(self.driver)._child_cate_region)
     if res is True:
         print('右侧商品分类展示在页面上')
     else:
         TestCase().fail('右侧商品分类未出现在页面上')
     print(self.driver.title)
     BasePage(self.driver).check_exist_in_string('分类', self.driver.title)
Example #2
0
 def test_click_cate(self):
     '''
     分类点击,切换选中
     '''
     print('**分类是否可点击**')
     CategoryPage(self.driver).click_cate()
     res = BasePage(self.driver).is_element_present(
         CategoryPage(self.driver)._child_cate_region)
     if res is True:
         print('右侧商品分类展示在页面上')
     else:
         TestCase().fail('右侧商品分类未出现在页面上')
Example #3
0
    def test_prices_analysis(self, open_review_page):
        review_page = open_review_page
        SCORE = "5.0"
        prices_lists = []
        cards = []

        for card in review_page.product_cards:
            if review_page.get_score(card) == SCORE:
                cards.append(card)

        splitted_title = review_page.get_title(cards[0]).split()
        brand = splitted_title[0]
        model = splitted_title[-3]
        year = splitted_title[-1]

        review_page._driver.get("https://auto.ria.com/uk/")

        home_page = HomePage(review_page._driver)

        home_page.year_to_dropdown.choose_dropdown_option(year)
        home_page.year_from_dropdown.choose_dropdown_option(year)

        home_page.choose_brand(brand)
        home_page.choose_model(model)
        home_page.click_search_button()

        category_page = CategoryPage(home_page._driver)

        break_loop = True
        while break_loop:
            prices_lists.append(category_page.get_prices())
            category_page.scroll_to_end()
            if not category_page.is_disabled_navigation_link("next"):
                category_page.click_next_page_link()
            else:
                break_loop = False

        prices = []
        for lists in prices_lists:
            for item in lists:
                prices.append(item)

        min_price = min(prices)
        max_price = max(prices)
        average_price = sum(prices) / len(prices)
        price_fluctuation = (average_price-min(prices))/10, \
                            (average_price-max(prices))/10

        print(
            f'Min price: {min_price} $. '
            f'Max price: {max_price} $. '
            f'Average price: {average_price} $. '
            f'Price fluctuation: {price_fluctuation}', prices_lists)
Example #4
0
class App:

    wd = driver
    product_page = ProductPage()
    checkout_page = CheckoutPage()
    cart_page = CartPage()
    category_page = CategoryPage()
    index_page = IndexPage()
    search_page = SearchPage()
    screenshooter = Screenshooter()

    def __init__(self):
        self.wd.maximize_window()
      #  self.wd.implicitly_wait(60)
       # self.wd.set_page_load_timeout(60)


    def order(self, billing_equal_shipping = True):
        get(product)

        self.product_page.add_to_cart()
        Wait.visible(self.product_page.minicart_popup_lo)
        self.product_page.minicart_popup.view_cart_link.click()

        # *****************************on cart page
        Wait.invisible(self.cart_page.full_page_loader_lo)

        self.cart_page.enter_zip(10001)

        Wait.invisible(self.cart_page.full_page_loader_lo)

        self.cart_page.checkout_button.click()

        Wait.invisible(self.cart_page.full_page_loader_lo)

        self.checkout_page.fill_shipping_form()

        Wait.invisible(self.cart_page.full_page_loader_lo)
        #sleep(5)
        self.checkout_page.fill_billing_form(billing_equal_shipping)
        self.checkout_page.fill_cc_form()

        self.checkout_page.billing.place_order_button.click()


    def destroy(self):
        self.wd.quit()
Example #5
0
 def test_click_search_box(self, value):
     '''
     商品分类页面搜索框
     '''
     print('**搜索框是否可用**')
     CategoryPage(self.driver).click_search_box()
     res = BasePage(self.driver).is_element_present(
         SearchPage(self.driver)._cancel_button)
     if res is True:
         print('搜索取消按钮展示在页面上')
     else:
         print('搜索取消按钮未出现在页面上')
     res = BasePage(self.driver).is_element_present(
         SearchPage(self.driver)._search_box)
     if res is True:
         print('搜索输入框展示在页面上')
     else:
         TestCase().fail('搜索输入框未出现在页面上')
     SearchPage(self.driver).send_key_search_box(value)
Example #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)
Example #7
0
from pages.login_page import LoginPage
from pages.register_page import RegisterPage
from pages.credentials import Valid
from pages.credentials import Invalid

# Test Setup
browser = webdriver.Chrome()

# Items in Category Drop Down Menu test case
expected_category_options = [
    'Select Category', 'Actions  (1)', 'Selectors  (5)',
    'Special Elements  (5)', 'Tabs and Windows  (1)', 'Test Cases  (3)',
    'Test Scenarios  (2)'
]

category_page = CategoryPage(driver=browser)
category_page.go()

assert category_page.category_dropdown.dropdown_options == expected_category_options

# Login Form
expected_button_text = 'LOGIN'
expected_incorrect_username_alert = 'User Id should not be empty / length be between 5 to 12'
expected_incorrect_password_alert = 'Password should not be empty / length be between 5 to 12'
expected_different_passwords_alert = 'Passwords do not match!'
expected_successful_login_alert = 'Succesful login!'

login_page = LoginPage(driver=browser)
login_page.go()

# Login Button in Login Form test case
def open_category_page(init_driver):
    driver = init_driver
    driver.get(config['urls']['category_page'])
    time.sleep(3)
    return CategoryPage(driver)