Пример #1
0
def the_product_page_loads_properly(context):
    page = ProductDetails(context)
    assert page.get_title == f"{context.product} – QA Playground", "The title of the page is not the expected!!"
    assert context.product in page.get_current_url, "The current url of the page is not the expected!!"
    assert page.title.is_displayed(
    ), "The title of the product is not displayed!!"
    assert page.price.is_displayed(
    ), "The price of the product is not displayed!!"
Пример #2
0
def the_product_is_added_to_the_cart(context):
    page = ProductDetails(context)
    items = page.form_shop_table_items
    assert "cart" in page.get_current_url, "The user was not taken to the cart page!!"
    assert len(items) == 1, "The are more than 1 product in the cart"
    assert float(page.shop_table_item_cells(items[0])[3].text.replace('$', "")) == float(context.product_json['price']), \
        "The are more than 1 product in the cart"
    assert page.shop_table_item_cell_input(page.shop_table_item_cells(items[0])[4]).get_attribute('value') == context.quantity, \
        "The are more than 1 product in the cart"
    assert float(page.shop_table_item_cells(items[0])[5].text.replace('$', "")) == int(context.quantity) * float(context.product_json['price']), \
        "The are more than 1 product in the cart"
Пример #3
0
def the_user_goes_to_product_in_the_ui(context, product):
    page = ProductDetails(context)
    page.navigate(product)
    context.product = product
Пример #4
0
def the_user_clicks_on_the_cart_icon(context):
    page = ProductDetails(context)
    page.cart_icon.click()
Пример #5
0
def count_of_cart_icon_gets_updated(context):
    page = ProductDetails(context)
    assert page.cart_count.text.split()[0] == page.quantity.get_attribute(
        'value'), "The quantity and the cart amount are different!!"
    assert float(page.cart_amount.text.replace("$", "")) == int(page.quantity.get_attribute('value')) * float(page.price.text.replace("$", "")), \
        "The quantity and the cart amount are different!!"
Пример #6
0
def the_user_clicks_on_the_add_to_cart_button(context):
    page = ProductDetails(context)
    page.add_to_cart.click()
Пример #7
0
def the_user_increase_the_quantity_to(context, quantity):
    page = ProductDetails(context)
    assert page.quantity.get_attribute(
        'value'
    ) == quantity, 'The quantity in the page was not set correctly!!'
    context.quantity = quantity
Пример #8
0
def the_user_increase_the_quantity_to(context, quantity):
    page = ProductDetails(context)
    page.quantity.clear()
    page.quantity.send_keys(quantity)