Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Scenario 3
- @given('on product creation popup')
- def step_on_add_new_product_popup(context):
- # from time import sleep
- # sleep(3)
- elem = context.browser.find_element_by_id("add-new-product-title").is_displayed()
- assert elem is True
- @when (u'I fill the name field with {name}')
- def step_enter_product_name(context, name):
- context.browser.find_element_by_id('product-name').send_keys(name)
- @when(u'I fill the description field with {description}')
- def step_enter_product_(context, description):
- context.browser.find_element_by_id('product-description').send_keys(description)
- @when(u'I fill the price field with {price}')
- def enter_password(context, price):
- # context.browser.find_element_by_id('product-price').send_keys(price)
- WebDriverWait(context.browser, 30).until(EC.presence_of_element_located((By.ID, "product-price"))).send_keys(price)
- @when(u'I choose an {image} to upload')
- def enter_first(context, image):
- context.browser.find_element_by_id('product-image').send_keys(image)
- @when(u'I click on Add new product')
- def subscribe_click(context):
- context.browser.find_element_by_id('add-submit').click()
- # WebDriverWait(context.browser, 30).until(EC.presence_of_element_located((By.ID, "add-submit"))).click()
- @then('product {name} should be displayed in the products table')
- def step_check_if_product_was_added_to_table(context, name):
- # products_table = context.browser.find_elements_by_xpath("//td[contains(@class, 'bdd_class')]")
- products_table = context.browser.find_elements_by_tag_name('td')
- products_names = []
- for product in products_table:
- products_names.append(product.text)
- print("This is it: ", products_names)
- assert_that(products_names, contains(name))
Add Comment
Please, Sign In to add comment