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

Cypress multiple wishlist #3218

Merged
merged 33 commits into from
Jun 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e1ebeb6
wip
dpatil-magento Jun 2, 2021
37d2d97
add mock data
dpatil-magento Jun 4, 2021
f0e822c
update
dpatil-magento Jun 4, 2021
4f73a2c
update
dpatil-magento Jun 4, 2021
b494c9c
Merge branch 'develop' into dev/multi-wishlist-cypress
revanth0212 Jun 4, 2021
25f8e1c
Load default wishlistpage
dpatil-magento Jun 4, 2021
266532f
Merge branch 'dev/multi-wishlist-cypress' of https://github.com/magen…
dpatil-magento Jun 4, 2021
65fb903
Load dialog on category page
dpatil-magento Jun 4, 2021
c2fd5c2
category page assert
dpatil-magento Jun 4, 2021
3fc43f2
update test
dpatil-magento Jun 4, 2021
2645cf0
update
dpatil-magento Jun 4, 2021
72cf48c
Using custom should assertion.
revanth0212 Jun 7, 2021
1299b10
update
dpatil-magento Jun 7, 2021
96fcfe9
prettier fix
dpatil-magento Jun 7, 2021
a058a7c
Merge branch 'develop' into dev/multi-wishlist-cypress
dpatil-magento Jun 8, 2021
4f791d9
Update index.js
dpatil-magento Jun 9, 2021
37919b6
Merge branch 'develop' into dev/multi-wishlist-cypress
supernova-at Jun 14, 2021
1f6b1c0
Apply suggestions from code review
dpatil-magento Jun 15, 2021
04aa427
update review comments
dpatil-magento Jun 15, 2021
2a14585
Merge branch 'dev/multi-wishlist-cypress' of https://github.com/magen…
dpatil-magento Jun 15, 2021
3f63f5b
update typo
dpatil-magento Jun 15, 2021
c306b7b
update comments
dpatil-magento Jun 15, 2021
2edabbf
fix prettier
dpatil-magento Jun 15, 2021
e56c9a8
Merge branch 'develop' into dev/multi-wishlist-cypress
revanth0212 Jun 16, 2021
2dbf23f
update feedback
dpatil-magento Jun 16, 2021
8d48f53
Merge branch 'develop' into dev/multi-wishlist-cypress
dpatil-magento Jun 17, 2021
623a8c0
Merge branch 'develop' into dev/multi-wishlist-cypress
dpatil-magento Jun 24, 2021
c34f0b7
update test based on recent change
dpatil-magento Jun 24, 2021
739e033
typo fix
dpatil-magento Jun 25, 2021
8eef00d
fix lint prettier
dpatil-magento Jun 25, 2021
58cc442
Merge branch 'develop' into dev/multi-wishlist-cypress
dpatil-magento Jun 25, 2021
dcc7b92
fix typo
dpatil-magento Jun 25, 2021
74bc078
Fix prettier
dpatil-magento Jun 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions venia-integration-tests/src/actions/categoryPage/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {
categoryPageAddToWishListButton,
categoryPageSelectedWishlistButton
createWishlistButton,
wishlistNameField,
createWishlistConfirmButton
} from '../../fields/categoryPage';

/**
Expand All @@ -12,10 +14,20 @@ export const addProductToWishlistFromCategoryPage = productToAdd => {
.siblings()
.find(categoryPageAddToWishListButton)
.click();
};

// assert product selected indicator
cy.contains(productToAdd)
.siblings()
.find(categoryPageSelectedWishlistButton)
.should('exist');
/**
* Utility function to create wishlist
*
* @param {String} wishlistName wishlist name
*/
export const createWishlistViaDialog = wishlistName => {
// click on Create a List link
cy.get(createWishlistButton).click();

// enter wishlist name
cy.get(wishlistNameField).type(wishlistName);

// Create wishlist
cy.get(createWishlistConfirmButton).click();
};
1 change: 1 addition & 0 deletions venia-integration-tests/src/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * as categoryPage from './categoryPage';
export * as myAccountMenu from './myAccountMenu';
export * as productPage from './productPage';
export * as wishlistPage from './wishlistPage';
15 changes: 11 additions & 4 deletions venia-integration-tests/src/actions/productPage/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import {
productPageAddToWishListButton,
productPageSelectedWishlistButton
addProductToWishlist
} from '../../fields/productPage';

/**
* Utility function to add product to wishlist from product page
* Utility function to add product to wishlist from product page
*/
export const addProductToWishlistFromProductPage = () => {
// add product to wishlist
cy.get(productPageAddToWishListButton).click();
};

// assert product selected indicator
cy.get(productPageSelectedWishlistButton).should('exist');
/**
* Utility function to add product to wishlist from product page Dialog window
*/
export const addProductToExistingWishlistFromDialog = wishlistName => {
// add product to wishlist
cy.get(addProductToWishlist)
.contains(wishlistName)
.click();
};
21 changes: 21 additions & 0 deletions venia-integration-tests/src/actions/wishlistPage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {
createWishlistButton,
wishlistNameField,
createWishlistConfirmButton
} from '../../fields/wishlist';

/**
* Utility function to create wishlist
*
* @param {String} wishlistName wishlist name
*/
export const createWishlist = wishlistName => {
// click on Create a List link
cy.get(createWishlistButton).click();

// enter wishlist name
cy.get(wishlistNameField).type(wishlistName);

// Create wishlist
cy.get(createWishlistConfirmButton).click();
};
12 changes: 12 additions & 0 deletions venia-integration-tests/src/assertions/categoryPage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { categoryPageSelectedWishlistButton } from '../../fields/categoryPage';

/**
* Utility function to assert selected product in wishlist
*/
export const assertWishlistSelectedProductOnCategoryPage = selectedProduct => {
// assert product selected indicator
cy.contains(selectedProduct)
.siblings()
.find(categoryPageSelectedWishlistButton)
.should('exist');
};
2 changes: 2 additions & 0 deletions venia-integration-tests/src/assertions/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export * as myAccountMenu from './myAccountMenu';
export * as wishlist from './wishlist';
export * as categoryPage from './categoryPage';
export * as productPage from './productPage';
9 changes: 9 additions & 0 deletions venia-integration-tests/src/assertions/productPage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { productPageSelectedWishlistButton } from '../../fields/productPage';

/**
* Utility function to assert the product is in wishlist
*/
export const assertProductSelectIndicator = () => {
// assert product selected indicator
cy.get(productPageSelectedWishlistButton).should('exist');
};
31 changes: 22 additions & 9 deletions venia-integration-tests/src/assertions/wishlist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import {
wishlistPageHeading,
wishlistRoot,
wishlistItemPrice,
wishlistItemAddToCartButton
wishlistItemAddToCartButton,
createWishlistButton
} from '../../fields/wishlist';

import { emptyWishlistMessage } from '../../fixtures/wishlist';

/**
* Utility function to assert empty wishlist
* @param {String} wishlistHeaderText wishlist page header text
Expand All @@ -14,14 +17,6 @@ export const assertWishlistHeading = wishlistHeaderText => {
cy.get(wishlistPageHeading).contains(wishlistHeaderText);
};

/**
* Utility function to assert empty wishlist
*/
export const assertEmptyWishlist = () => {
// assert product container does not exists
cy.get(wishlistRoot).should('not.exist');
};

/**
* Utility function to assert product exists in wishlist
* @param {String} productName product to verify it exist in wishlist
Expand All @@ -43,3 +38,21 @@ export const assertProductInWishlist = productName => {
.children(wishlistItemAddToCartButton)
.should('exist');
};

/**
* Utility function to assert create wishlist link exists
*/
export const assertCreateWishlistLink = () => {
// assert create a list link exists
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider dropping this comment. You've already captured it in the function name and the function block comment.

cy.get(createWishlistButton).should('exist');
};

/**
* Utility function to assert empty wishlist for multiple wishlists
*/
export const assertEmptyWishlistExists = wishlistName => {
// assert wishlist exists and is empty
cy.get(wishlistRoot)
.should('contain.text', wishlistName)
.should('contain.text', emptyWishlistMessage);
};
8 changes: 8 additions & 0 deletions venia-integration-tests/src/fields/categoryPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ export const categoryPageSelectedWishlistButton =
'*[class^="galleryButton-root_selected"]';

export const filterButton = 'button[class^="category-filterButton"]';

export const createWishlistButton =
'button[class^="wishlistDialog-createListButton-"]';

export const wishlistNameField = 'input[id^="createWishlistForm-listname-"]';

export const createWishlistConfirmButton =
'button[class^="button-root_highPriority-"]';
2 changes: 2 additions & 0 deletions venia-integration-tests/src/fields/productPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ export const productPageAddToWishListButton =

export const productPageSelectedWishlistButton =
'*[class^="wishlistButton-wishlistButtonContent_disabled-"]';

export const addProductToWishlist = 'button[class^="wishlistLineItem-root-"]';
8 changes: 8 additions & 0 deletions venia-integration-tests/src/fields/wishlist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ export const wishlistItemPrice = '*[class^="wishlistItem-priceContainer-"]';

export const wishlistItemAddToCartButton =
'*[class^="wishlistItem-addToCart-"]';

export const createWishlistButton =
'button[class^="createWishlist-createButton-"]';

export const wishlistNameField = 'input[name="name"]';

export const createWishlistConfirmButton =
'button[class^="createWishlist-confirmButton-"]';
2 changes: 2 additions & 0 deletions venia-integration-tests/src/fixtures/categoryPage/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const categoryTops = 'venia-tops.html?page=1';

export const categorySweaters = './venia-tops/venia-sweaters.html?page=1';

export const productCarinaCardigan = 'Carina Cardigan';
24 changes: 24 additions & 0 deletions venia-integration-tests/src/fixtures/graphqlMockedCalls/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export const hitGraphqlPath = '**/graphql';

export const getCMSPage = '**/graphql?query=query+GetCmsPage*';

export const getCustomerWishlistCall =
'**/graphql?query=query+GetCustomerWishlist*';

export const getMultipleWishlistConfigCall =
'**/graphql?query=query+getMultipleWishlistsEnabled*';

export const getWishlistDialogDataCall =
'**/graphql?query=query+getWishlistsDialogData*';

export const getWishlistitemsForLocalFieldsCall =
'**/graphql?query=query+GetWishlistItemsForLocalField*';
Copy link
Contributor

Choose a reason for hiding this comment

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

Slight discrepancy between the const and its value here. Is it LocalField or LocalFields?


export const getWishlistConfigForGalleryCall =
'**/graphql?query=query+GetWishlistConfigForGallery*';

export const getWishlistConfigForProductPageCall =
'**/graphql?query=query+wishlistConfig*';

export const getCustomerWishlist =
'**/graphql?query=query+GetCustomerWishlist*';
1 change: 1 addition & 0 deletions venia-integration-tests/src/fixtures/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * as homePage from './homePage';
export * as myAccountMenu from './myAccountMenu';
export * as productPage from './productPage';
export * as wishlist from './wishlist';
export * as graphqlMockedCalls from './graphqlMockedCalls';
10 changes: 8 additions & 2 deletions venia-integration-tests/src/fixtures/productPage/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
export const productValeriaTwoLayeredTankUrl = './valeria-two-layer-tank.html';
export const productAugustaEarrings = {
name: 'Augusta Earrings',
url: '/augusta-earrings.html'
};

export const productValeriaTwoLayeredTankName = 'Valeria Two-Layer Tank';
export const productValeriaTwoLayeredTank = {
name: 'Valeria Two-Layer Tank',
url: '/valeria-two-layer-tank.html'
};
8 changes: 7 additions & 1 deletion venia-integration-tests/src/fixtures/wishlist/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
export const wishistRoute = './wishlist';
export const wishlistRoute = 'wishlist';

export const wishlistRemove = 'Remove';

export const removeProductMessage =
'Are you sure you want to delete this product from the list?';

export const singleWishlistHeading = 'Remove';

export const multipleWishlistHeading = 'Remove';

export const emptyWishlistMessage = 'There are currently no items in this list';
dpatil-magento marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"data": {
"addProductsToWishlist": {
"user_errors": [],
"wishlist": {
"id": "31",
"name": "Test List1",
"__typename": "Wishlist"
},
"__typename": "AddProductsToWishlistOutput"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"data": {
"addProductsToWishlist": {
"user_errors": [],
"wishlist": {
"id": "32",
"name": "Test List2",
"__typename": "Wishlist"
},
"__typename": "AddProductsToWishlistOutput"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"data": {
"createWishlist": {
"wishlist": {
"id": "32",
Copy link
Contributor

Choose a reason for hiding this comment

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

These don't actually get created on the backend so these ids don't need to constantly be updated, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it does not needed. As soon as page reloads or test is complete the data is wiped.

"__typename": "Wishlist"
},
"__typename": "CreateWishlistOutput"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"data": {
"customer": {
"id": null,
"wishlists": [
{
"id": "31",
"items_v2": {
"items": [],
"page_info": {
"current_page": 1,
"total_pages": 1,
"__typename": "SearchResultPageInfo"
},
"__typename": "WishlistItems"
},
"__typename": "Wishlist"
}
],
"__typename": "Customer"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"data": {
"customer": {
"id": null,
"wishlists": [
{
"id": "31",
"items_v2": {
"items": [],
"page_info": {
"current_page": 1,
"total_pages": 1,
"__typename": "SearchResultPageInfo"
},
"__typename": "WishlistItems"
},
"__typename": "Wishlist"
},
{
"id": "32",
"items_v2": {
"items": [
{
"id": "70",
"product": {
"id": 1120,
"sku": "VSW01",
"__typename": "ConfigurableProduct"
},
"__typename": "ConfigurableWishlistItem"
}
],
"page_info": {
"current_page": 1,
"total_pages": 1,
"__typename": "SearchResultPageInfo"
},
"__typename": "WishlistItems"
},
"__typename": "Wishlist"
}
],
"__typename": "Customer"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"data": {
"storeConfig": {
"id": 1,
"magento_wishlist_general_is_enabled": "1",
"enable_multiple_wishlists": "1",
"__typename": "StoreConfig"
}
}
}
Loading