-
Notifications
You must be signed in to change notification settings - Fork 44
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
Feat: add scenarios to check cart badge and content #2
base: action-classes-exercise
Are you sure you want to change the base?
Feat: add scenarios to check cart badge and content #2
Conversation
@@ -6,4 +6,8 @@ public class InventoryPage extends PageObject { | |||
public String getHeading() { | |||
return $(".title").getText(); | |||
} | |||
|
|||
public String getShoppingCartBadge() { |
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.
public String getShoppingCartBadge() { | |
public String numberShownOnCart() { |
i find the name not great, you are returning text, not a shoppingCartBadge
|
||
ProductList productList; | ||
@Step("Add Products'") | ||
public Integer forAllAvailableItems() { |
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.
public Integer forAllAvailableItems() { | |
public int forAllAvailableItems() { |
you usually use the primitive version
|
||
ProductList productList; | ||
@Step("Add Products'") | ||
public Integer forAllAvailableItems() { |
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.
returning the number of items added feels not good...
i'd rather have
public Integer forAllAvailableItems() { | |
public void addAllVisibleItems() { |
and later assert "visibleItems.size equals cartBadgeNumber"
ProductList productList; | ||
@Step("Add Products'") | ||
public Integer forAllAvailableItems() { | ||
List<WebElementFacade> itemsAdded = productList.availableItems(); |
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.
List<WebElementFacade> itemsAdded = productList.availableItems(); | |
List<WebElementFacade> addToCartButtons = productList.addToCartButtons(); |
name could be better i think. You are not returning the items you can buy but the button to click
ProductList productList; | ||
@Steps | ||
ViewCartDetailsActions cartDetailsActions; | ||
List<String> productsAdded; |
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.
List<String> productsAdded; |
} | ||
|
||
@Test | ||
public void allTheItemsShouldAppearInTheCart() { | ||
|
||
productsAdded = productList.titles(); |
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.
productsAdded = productList.titles(); | |
List<String> visibleProductTitles = productList.titles(); |
productsAdded = productList.titles(); | ||
addProducts.forAllAvailableItems(); | ||
cartDetailsActions.openCart(); | ||
List<String> productsCart = productList.titles(); |
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.
productList.titles();
this is the same as the first line of this test, though we are on a different page now, that a bit confusing to me. it works because the selector is the same.. but i'd create a new page object for that
I would like to get feedback