Skip to content

Commit 8b57421

Browse files
enabling run in firefox
1 parent 1504f88 commit 8b57421

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

Data/DynamicData/amazon_book_search_result_dynamic.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,21 +269,20 @@ amazon_product_details: 'Product details
269269
270270
2 customer reviews
271271
272-
Amazon Bestsellers Rank: #1,78,801 in Books (See Top 100 in Books)
272+
Amazon Bestsellers Rank: #1,80,171 in Books (See Top 100 in Books)
273273
274-
#2333 in Industries & Business Sectors (Books)
274+
#2352 in Industries & Business Sectors (Books)
275275
276-
#154 in Algorithms
276+
#156 in Algorithms
277277
278-
#190 in Programming Algorithms
278+
#193 in Programming Algorithms
279279
280280
Would you like to tell us about a lower price?
281281
282282
If you are a seller for this product, would you like to suggest updates through
283283
seller support?'
284-
amazon_product_formats: "Hide other formats and editions\nPrice\nNew from\nKindle\
285-
\ Edition\n\u20B9 281.20\n\u2014\nHardcover\n\u20B9 370.00\n\u20B9 370.00\nHardcover,\
286-
\ 12 Mar 2019\n\u20B9 1,664.00\n\u20B9 1,478.00"
284+
amazon_product_formats: "See all 3 formats and editions\nKindle Edition\n\u20B9 281.20\n\
285+
Read with Our Free App\nHardcover\n\u20B9 1,664.00\n13 New from \u20B9 1,478.00"
287286
amazon_product_offers: "Save Extra with 4 offers\nCashback: Flat Rs.50 back on minimum\
288287
\ order of Rs.50 using Amazon Pay UPI. For Android App customers only. Applicable\
289288
\ on 1st ever transaction on Amazon Pay UPI. Cashback within 5 days. Set up Amazon\

Locators/amazon_home_page.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class AmazonHomePageLocator:
1313
# TAG NAME - 'tag name'
1414
# CLASS NAME - 'class name'
1515
amazon_logo = Locator("css selector", "div#nav-logo a[aria-label='Amazon']")
16+
# In chrome amazon_search_categories works fine for select
17+
# In firefox we have an open issue with the
1618
amazon_search_categories = Locator("css selector", "div.nav-search-scope select.nav-search-dropdown")
1719
amazon_search_categories_text = Locator("css selector", "div.nav-search-facade span")
1820
amazon_search_textbox = Locator("css selector", "div.nav-search-field input.nav-input")

Pages/amazon_product_page.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def is_product_page_displayed(cls):
1313

1414
@classmethod
1515
def set_delivery_pincode(cls, string):
16+
AmazonProductPageLocator.amazon_deliver_to_link.wait_till_displayed()
1617
AmazonProductPageLocator.amazon_deliver_to_link.click()
1718
AmazonProductPageLocator.amazon_deliver_to_pincode.wait_till_displayed()
1819
AmazonProductPageLocator.amazon_deliver_to_pincode.send_keys(string)
@@ -22,4 +23,5 @@ def set_delivery_pincode(cls, string):
2223

2324
@classmethod
2425
def get_delivery_pincode(cls):
26+
AmazonProductPageLocator.amazon_deliver_to_link.wait_till_displayed()
2527
return AmazonProductPageLocator.amazon_deliver_to_link.text()

Tests/amazon.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ def test_amazon_book_search_001():
2525
dynamic_variable = Var("amazon_book_search_result_dynamic.yml", "dynamic")
2626

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

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

3735
with allure.step("Search for the text which is needed in this"):
3836
search_text = static_variable.static_value_for("search_text")
3937
AmazonHomePage.search_in_the_search_box(search_text)
38+
assert (AmazonHomePage.get_selected_category() == static_variable.static_value_for("category")), \
39+
"Category is not selected properly"
4040
assert (AmazonSearchResultPage.is_search_result_page_displayed() is True), "Search result page is not displayed"
4141
assert (AmazonSearchResultPage.is_filter_set_in_head_liner(search_text) is True), "Searched text is not " \
4242
"displayed in the result page"
@@ -75,6 +75,7 @@ def test_amazon_book_search_001():
7575
AmazonSearchResultPage.select_a_product_from_search_result(static_variable.static_value_for("select_product"))
7676
assert (driver.window_handles_count() == 2), "New tab is not opened after clicking a product"
7777
driver.switch_to_new_tab()
78+
driver.wait_till_page_loads(30)
7879
assert (AmazonProductPage.is_product_page_displayed() is True), "Product page is not displayed after selecting"
7980

8081
with allure.step("Set the delivery pincode in the product page"):

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ ipdb == 0.12.3
1111
pyyaml == 5.3
1212
flake8 == 3.7.9
1313
webdriver-manager == 2.3.0
14-
selpy==0.0.8
14+
selpy==0.1.0

0 commit comments

Comments
 (0)