Skip to content

Commit

Permalink
enabling run in firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
nareshnavinash committed Jan 22, 2020
1 parent 1504f88 commit 8b57421
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
13 changes: 6 additions & 7 deletions Data/DynamicData/amazon_book_search_result_dynamic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,21 +269,20 @@ amazon_product_details: 'Product details
2 customer reviews
Amazon Bestsellers Rank: #1,78,801 in Books (See Top 100 in Books)
Amazon Bestsellers Rank: #1,80,171 in Books (See Top 100 in Books)
#2333 in Industries & Business Sectors (Books)
#2352 in Industries & Business Sectors (Books)
#154 in Algorithms
#156 in Algorithms
#190 in Programming Algorithms
#193 in Programming Algorithms
Would you like to tell us about a lower price?
If you are a seller for this product, would you like to suggest updates through
seller support?'
amazon_product_formats: "Hide other formats and editions\nPrice\nNew from\nKindle\
\ Edition\n\u20B9 281.20\n\u2014\nHardcover\n\u20B9 370.00\n\u20B9 370.00\nHardcover,\
\ 12 Mar 2019\n\u20B9 1,664.00\n\u20B9 1,478.00"
amazon_product_formats: "See all 3 formats and editions\nKindle Edition\n\u20B9 281.20\n\
Read with Our Free App\nHardcover\n\u20B9 1,664.00\n13 New from \u20B9 1,478.00"
amazon_product_offers: "Save Extra with 4 offers\nCashback: Flat Rs.50 back on minimum\
\ order of Rs.50 using Amazon Pay UPI. For Android App customers only. Applicable\
\ on 1st ever transaction on Amazon Pay UPI. Cashback within 5 days. Set up Amazon\
Expand Down
2 changes: 2 additions & 0 deletions Locators/amazon_home_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class AmazonHomePageLocator:
# TAG NAME - 'tag name'
# CLASS NAME - 'class name'
amazon_logo = Locator("css selector", "div#nav-logo a[aria-label='Amazon']")
# In chrome amazon_search_categories works fine for select
# In firefox we have an open issue with the
amazon_search_categories = Locator("css selector", "div.nav-search-scope select.nav-search-dropdown")
amazon_search_categories_text = Locator("css selector", "div.nav-search-facade span")
amazon_search_textbox = Locator("css selector", "div.nav-search-field input.nav-input")
Expand Down
2 changes: 2 additions & 0 deletions Pages/amazon_product_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def is_product_page_displayed(cls):

@classmethod
def set_delivery_pincode(cls, string):
AmazonProductPageLocator.amazon_deliver_to_link.wait_till_displayed()
AmazonProductPageLocator.amazon_deliver_to_link.click()
AmazonProductPageLocator.amazon_deliver_to_pincode.wait_till_displayed()
AmazonProductPageLocator.amazon_deliver_to_pincode.send_keys(string)
Expand All @@ -22,4 +23,5 @@ def set_delivery_pincode(cls, string):

@classmethod
def get_delivery_pincode(cls):
AmazonProductPageLocator.amazon_deliver_to_link.wait_till_displayed()
return AmazonProductPageLocator.amazon_deliver_to_link.text()
7 changes: 4 additions & 3 deletions Tests/amazon.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ def test_amazon_book_search_001():
dynamic_variable = Var("amazon_book_search_result_dynamic.yml", "dynamic")

with allure.step("Initialize the driver and navigate to the url"):
driver = Driver() # Initialize the driver. Driver configurations will be taken from the global_data.yml file
driver = Driver() # Initialize the driver. Driver configurations will be taken from the global_data.yml file
driver.get(static_variable.static_value_for("url"))
assert (AmazonHomePage.is_home_page_displayed() is True), "Amazon home page is not displayed"

with allure.step("Select the categories as books in the search dropdown"):
AmazonHomePage.select_category_drop_down(static_variable.static_value_for("category"))
assert (AmazonHomePage.get_selected_category() == static_variable.static_value_for("category")), \
"Category is not selected properly"

with allure.step("Search for the text which is needed in this"):
search_text = static_variable.static_value_for("search_text")
AmazonHomePage.search_in_the_search_box(search_text)
assert (AmazonHomePage.get_selected_category() == static_variable.static_value_for("category")), \
"Category is not selected properly"
assert (AmazonSearchResultPage.is_search_result_page_displayed() is True), "Search result page is not displayed"
assert (AmazonSearchResultPage.is_filter_set_in_head_liner(search_text) is True), "Searched text is not " \
"displayed in the result page"
Expand Down Expand Up @@ -75,6 +75,7 @@ def test_amazon_book_search_001():
AmazonSearchResultPage.select_a_product_from_search_result(static_variable.static_value_for("select_product"))
assert (driver.window_handles_count() == 2), "New tab is not opened after clicking a product"
driver.switch_to_new_tab()
driver.wait_till_page_loads(30)
assert (AmazonProductPage.is_product_page_displayed() is True), "Product page is not displayed after selecting"

with allure.step("Set the delivery pincode in the product page"):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ ipdb == 0.12.3
pyyaml == 5.3
flake8 == 3.7.9
webdriver-manager == 2.3.0
selpy==0.0.8
selpy==0.1.0

0 comments on commit 8b57421

Please sign in to comment.