-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amazon feature #1
base: main
Are you sure you want to change the base?
Conversation
And User validates add to cart | ||
When User add product to cart | ||
And User opens cart | ||
Then User able to see added product in cart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scenario: User is able to add product to the cart
Given User is on the homepage
When User searches for product "iphone 13"
Then User should be able to see the product "iphone 13" in the results and add it to cart
public void userAbleToSeeAddedProductInCart() { | ||
new AmazonBL(SAMPLE_TEST_CONTEXT.ME,Runner.platform).verifyProductAddedToCart(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to make changes to all files according to the changes in the feature file
if(sponsoredLinkList.size()>20){ | ||
firstResultLink = By.xpath("//div[@data-cel-widget='search_result_2']//h2/a"); | ||
} else if (sponsoredLinkList.size()>15) { | ||
firstResultLink = By.xpath("//div[@data-cel-widget='search_result_1']//h2/a"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xpaths should be define above as
private final By sponsoredLink = By.xpath("//div[@data-cel-widget='search_result_2']//h2/a"");
} else if (sponsoredLinkList.size()>15) { | ||
firstResultLink = By.xpath("//div[@data-cel-widget='search_result_1']//h2/a"); | ||
} | ||
driver.findElement(firstResultLink).click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use waitFor methods instead of sleeps
if(driver.findElements(currentlyUnavailableElement).size()>0) | ||
return -2; | ||
else if(driver.findElement(addToCartButton).isDisplayed()) | ||
return 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can simply return boolean if present
} | ||
|
||
public void openCart() { | ||
waitFor(5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sleeps not recommenced
} | ||
|
||
public boolean verifyProductAddedToCart() { | ||
return totalProductsinCart+1==Integer.parseInt(driver.findElement(cartCurrentValueElement).getText()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should just return the number of products from here and put assertions in BL by comparing. Do not compare here
No description provided.