Skip to content

Commit

Permalink
Merge pull request #3705 from magento/mikhaelbois/PWA-2471-cypress-mu…
Browse files Browse the repository at this point in the history
…lti-store-update

[PWA-2471] automate Venia Multi store test (Task 2 of 2)
  • Loading branch information
jeremycharron authored Feb 25, 2022
2 parents d58e2aa + 84b0397 commit e3f5fd5
Show file tree
Hide file tree
Showing 55 changed files with 13,573 additions and 5,007 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ indent_style = space

[*.md]
trim_trailing_whitespace = false

[*.json]
indent_size = 2
insert_final_newline = false
2 changes: 2 additions & 0 deletions packages/pagebuilder/lib/ContentTypes/Image/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const Image = props => {

return (
<figure
data-cy="PageBuilder-Image-root"
style={figureStyles}
className={[classes.root, ...cssClasses].join(' ')}
>
Expand All @@ -129,6 +130,7 @@ const Image = props => {
} else {
return (
<figure
data-cy="PageBuilder-Image-root"
style={figureStyles}
className={[classes.root, ...cssClasses].join(' ')}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const Product = props => {
}}
width={IMAGE_SIZE}
resource={image}
data-cy="Product-image"
/>
</Link>
<div className={classes.details}>
Expand Down
2 changes: 1 addition & 1 deletion venia-integration-tests/cypress.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
"retries": {
"runMode": 2
}
}
}
11 changes: 11 additions & 0 deletions venia-integration-tests/src/assertions/app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const assertUrlSuffix = () => {
cy.location()
.its('pathname')
.should('match', /\.html$/);
};

export const assertNoUrlSuffix = () => {
cy.location()
.its('pathname')
.should('not.match', /\.html$/);
};
15 changes: 15 additions & 0 deletions venia-integration-tests/src/assertions/cartPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
cartPageProductOption,
cartPageProductQuantity,
cartPageProductPrice,
cartPageProductImageLink,
productListingProductName,
cartPagePriceSummaryDiscountSummary,
cartPagePriceSummaryGiftCardSummary,
Expand Down Expand Up @@ -216,6 +217,20 @@ export const assertPrintedCard = () => {
cy.get(giftOptionsIncludePrintedCardCheckbox).should('exist');
};

/**
* Utility function to assert product in Cart Page displays correct image.
*
* @param {String} src -- fragment of image src
* @param {Number} index -- index of product in MiniCart
*/
export const assertProductImageDisplayedInCartPage = (src, index) => {
cy.get(cartPageProductImageLink)
.filter(':odd')
.eq(index)
.should('have.attr', 'src')
.should('contain', src);
};

/**
* Utility function assert Gift Options from Cart
*
Expand Down
2 changes: 2 additions & 0 deletions venia-integration-tests/src/assertions/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
export * as accountAccess from './accountAccess';
export * as accountInformationPage from './accountInformationPage';
export * as addressBookPage from './addressBookPage';
export * as app from './app';
export * as cartPage from './cartPage';
export * as categoryPage from './categoryPage';
export * as checkoutPage from './checkoutPage';
export * as header from './header';
export * as myAccountMenu from './myAccountMenu';
export * as notFoundPage from './notFoundPage';
export * as orderHistoryPage from './orderHistoryPage';
export * as pageBuilder from './pageBuilder';
export * as productPage from './productPage';
export * as wishlist from './wishlist';
export * as miniCart from './miniCart';
Expand Down
15 changes: 15 additions & 0 deletions venia-integration-tests/src/assertions/pageBuilder/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { pageBuilderImage } from '../../fields/pageBuilder';

/**
* Utility function to assert image url contains base url
*/
export const assertImageUrlContainsBaseUrl = () => {
cy.get(pageBuilderImage)
.first()
.should('be.visible')
.find('img')
.should('exist')
.then($img => {
expect($img[0].src).contains(Cypress.config().baseUrl);
});
};
3 changes: 3 additions & 0 deletions venia-integration-tests/src/fields/cartPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export const saveForLaterButton = '[data-cy="addToListButton-root"]';

export const cartPageProductLink = '[data-cy="Product-imageContainer"]';

export const cartPageProductImageLink =
'[data-cy="Product-imageContainer"] [data-cy="Product-image"]';

export const kebabMenuEditButton = '[data-cy="Product-Section-editItem"]';

export const editMenuSizeButton = '[data-cy="Tile-button"]';
Expand Down
2 changes: 2 additions & 0 deletions venia-integration-tests/src/fields/pageBuilder/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export const pageBuilderBanner = '[data-cy="PageBuilder-Banner-root"]';

export const pageBuilderImage = '[data-cy="PageBuilder-Image-root"]';
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export const getCartDetailsCall = '**/graphql?query=query+GetCartDetails*';

export const getCategoriesCall = '**/graphql?query=query+GetCategories*';

export const getCategoryAvailableSortMethodsCall =
'**/graphql?query=query+getCategoryAvailableSortMethods*';

export const getCategoryDataCall = '**/graphql?query=query+getCategoryData*';

export const getCheckoutDetailsCall =
Expand All @@ -33,6 +36,9 @@ export const getCountriesCall = '**/graphql?query=query+GetCountries*';

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

export const getConfigurableThumbnailSourceCall =
'**/graphql?query=query+getConfigurableThumbnailSource*';

export const getContactPageEnabledCall =
'**/graphql?query=query+GetStoreConfigForContactUs*';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"data": {
"products": {
"sort_fields": {
"options": [
{
"label": "Position",
"value": "position",
"__typename": "SortField"
},
{
"label": "Product Name",
"value": "name",
"__typename": "SortField"
},
{
"label": "Price",
"value": "price",
"__typename": "SortField"
}
],
"__typename": "SortFields"
},
"__typename": "Products"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"default_display_currency_code": "USD",
"locale": "en_US",
"product_url_suffix": ".html",
"secure_base_media_url": "https:\/\/venia.magento.com\/media\/",
"secure_base_media_url": "https:\/\/develop.pwa-venia.com\/media\/",
"store_code": "default",
"store_group_code": "main_website_store",
"store_group_name": "Main Website Store",
Expand All @@ -19,7 +19,7 @@
"default_display_currency_code": "USD",
"locale": "en_US",
"product_url_suffix": ".html",
"secure_base_media_url": "https:\/\/venia.magento.com\/media\/",
"secure_base_media_url": "https:\/\/develop.pwa-venia.com\/media\/",
"store_code": "view_1",
"store_group_code": "main_website_store",
"store_group_name": "Main Website Store",
Expand All @@ -28,11 +28,11 @@
"__typename": "StoreConfig"
},
{
"category_url_suffix": ".html",
"category_url_suffix": "",
"default_display_currency_code": "USD",
"locale": "en_US",
"product_url_suffix": ".html",
"secure_base_media_url": "https:\/\/venia.magento.com\/media\/",
"product_url_suffix": "",
"secure_base_media_url": "https:\/\/develop.pwa-venia.com\/media\/",
"store_code": "view_1_b",
"store_group_code": "store_b",
"store_group_name": "Store B",
Expand All @@ -45,7 +45,7 @@
"default_display_currency_code": "USD",
"locale": "en_US",
"product_url_suffix": ".html",
"secure_base_media_url": "https:\/\/venia.magento.com\/media\/",
"secure_base_media_url": "https:\/\/develop.pwa-venia.com\/media\/",
"store_code": "view_2",
"store_group_code": "main_website_store",
"store_group_name": "Main Website Store",
Expand All @@ -54,11 +54,11 @@
"__typename": "StoreConfig"
},
{
"category_url_suffix": ".html",
"category_url_suffix": "",
"default_display_currency_code": "USD",
"locale": "en_US",
"product_url_suffix": ".html",
"secure_base_media_url": "https:\/\/venia.magento.com\/media\/",
"product_url_suffix": "",
"secure_base_media_url": "https:\/\/develop.pwa-venia.com\/media\/",
"store_code": "view_2_b",
"store_group_code": "store_b",
"store_group_name": "Store B",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@
"product": {
"uid": "NA==",
"name": "Augusta Necklace",
"sku": "VA14-SI-NA",
"url_key": "augusta-necklace",
"thumbnail": {
"url": "https:\/\/master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud\/media\/catalog\/product\/cache\/d3ba9f7bcd3b0724e976dc5144b29c7d\/v\/a\/va14-ts_main.jpg",
"__typename": "ProductImage"
},
"small_image": {
"url": "https:\/\/master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud\/media\/catalog\/product\/cache\/d3ba9f7bcd3b0724e976dc5144b29c7d\/v\/a\/va14-ts_main.jpg",
"__typename": "ProductImage"
},
"stock_status": "IN_STOCK",
"__typename": "SimpleProduct"
},
Expand All @@ -35,6 +40,7 @@
"__typename": "CartItemPrices"
},
"quantity": 1,
"errors": null,
"__typename": "SimpleCartItem"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@
"product": {
"uid": "NA==",
"name": "Augusta Necklace",
"sku": "VA14-SI-NA",
"url_key": "augusta-necklace",
"thumbnail": {
"url": "https:\/\/master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud\/media\/catalog\/product\/cache\/d3ba9f7bcd3b0724e976dc5144b29c7d\/v\/a\/va14-ts_main.jpg",
"__typename": "ProductImage"
},
"small_image": {
"url": "https:\/\/master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud\/media\/catalog\/product\/cache\/d3ba9f7bcd3b0724e976dc5144b29c7d\/v\/a\/va14-ts_main.jpg",
"__typename": "ProductImage"
},
"stock_status": "IN_STOCK",
"__typename": "SimpleProduct"
},
Expand All @@ -35,18 +40,24 @@
"__typename": "CartItemPrices"
},
"quantity": 1,
"errors": null,
"__typename": "SimpleCartItem"
},
{
"uid": "MTI5MDU2",
"product": {
"uid": "Mw==",
"name": "Carmina Necklace",
"sku": "VA13-GO-NA",
"url_key": "carmina-necklace",
"thumbnail": {
"url": "https:\/\/master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud\/media\/catalog\/product\/cache\/d3ba9f7bcd3b0724e976dc5144b29c7d\/v\/a\/va13-sg_main.jpg",
"__typename": "ProductImage"
},
"small_image": {
"url": "https:\/\/master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud\/media\/catalog\/product\/cache\/d3ba9f7bcd3b0724e976dc5144b29c7d\/v\/a\/va13-sg_main.jpg",
"__typename": "ProductImage"
},
"stock_status": "IN_STOCK",
"__typename": "SimpleProduct"
},
Expand All @@ -59,6 +70,7 @@
"__typename": "CartItemPrices"
},
"quantity": 1,
"errors": null,
"__typename": "SimpleCartItem"
}
],
Expand Down
Loading

0 comments on commit e3f5fd5

Please sign in to comment.