Skip to content
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

Open
wants to merge 1 commit into
base: action-classes-exercise
Choose a base branch
from

Conversation

juanduarte1927
Copy link

I would like to get feedback

@@ -6,4 +6,8 @@ public class InventoryPage extends PageObject {
public String getHeading() {
return $(".title").getText();
}

public String getShoppingCartBadge() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public Integer forAllAvailableItems() {
public int forAllAvailableItems() {

you usually use the primitive version


ProductList productList;
@Step("Add Products'")
public Integer forAllAvailableItems() {

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

Suggested change
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();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
List<String> productsAdded;

}

@Test
public void allTheItemsShouldAppearInTheCart() {

productsAdded = productList.titles();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
productsAdded = productList.titles();
List<String> visibleProductTitles = productList.titles();

productsAdded = productList.titles();
addProducts.forAllAvailableItems();
cartDetailsActions.openCart();
List<String> productsCart = productList.titles();

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants