Skip to content

Commit

Permalink
Merge branch 'develop' into jcharron/PWA-1950-click-target-for-spinni…
Browse files Browse the repository at this point in the history
…ng-tabs
  • Loading branch information
Mikhaël Bois authored Jan 28, 2022
2 parents d23b69c + 8e9d60a commit 0700bf5
Show file tree
Hide file tree
Showing 53 changed files with 3,937 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/venia-ui/lib/components/Header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const Header = props => {
return (
<Fragment>
<div className={classes.switchersContainer}>
<div className={classes.switchers}>
<div className={classes.switchers} data-cy="Header-switchers">
<StoreSwitcher />
<CurrencySwitcher />
</div>
Expand Down
21 changes: 17 additions & 4 deletions packages/venia-ui/lib/components/Header/storeSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ const StoreSwitcher = props => {
label = `${storeGroupName} - ${storeName}`;
}
stores.push(
<li key={code} className={classes.menuItem}>
<li
key={code}
className={classes.menuItem}
data-cy="StoreSwitcher-view"
>
<SwitcherItem
active={isCurrent}
onClick={handleSwitchStore}
Expand All @@ -54,7 +58,11 @@ const StoreSwitcher = props => {
});

groups.push(
<ul className={classes.groupList} key={key}>
<ul
className={classes.groupList}
key={key}
data-cy="StoreSwitcher-group"
>
{stores}
</ul>
);
Expand All @@ -68,16 +76,21 @@ const StoreSwitcher = props => {
}

return (
<div className={classes.root}>
<div className={classes.root} data-cy="StoreSwitcher-root">
<button
className={classes.trigger}
aria-label={currentStoreName}
onClick={handleTriggerClick}
ref={storeMenuTriggerRef}
data-cy="StoreSwitcher-trigger"
>
{triggerLabel}
</button>
<div ref={storeMenuRef} className={menuClassName}>
<div
ref={storeMenuRef}
className={menuClassName}
data-cy="StoreSwitcher-menu"
>
<div className={classes.groups}>{groups}</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions venia-integration-tests/src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export * as myAccountMenu from './myAccountMenu';
export * as newsletter from './newsletter';
export * as pageBuilder from './pageBuilder';
export * as productPage from './productPage';
export * as storeSwitcher from './storeSwitcher';
export * as toast from './toast';
export * as wishlistPage from './wishlistPage';
export * as footer from './footer';
14 changes: 14 additions & 0 deletions venia-integration-tests/src/actions/storeSwitcher/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {
headerStoreSwitcherGroup,
headerStoreSwitcherTrigger
} from '../../fields/storeSwitcher';

export const toggleHeaderStoreSwitcher = () => {
cy.get(headerStoreSwitcherTrigger).click();
};

export const selectStoreView = label => {
cy.get(headerStoreSwitcherGroup)
.contains(label)
.click();
};
9 changes: 9 additions & 0 deletions venia-integration-tests/src/assertions/categoryPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ export const assertActiveSortItem = sortLabel => {
cy.get(productSortSortItemActive).should('contain', sortLabel);
};

/**
* Assert number of products listed
*
* @param {Number} number number of products
*/
export const assertNumberOfProductsListed = number => {
cy.get(productsGalleryItemName).should('have.length', number);
};

export const assertRatingSummary = productName => {
cy.contains(productName)
.children()
Expand Down
16 changes: 16 additions & 0 deletions venia-integration-tests/src/assertions/categoryTree/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {
categoryTreeListItem,
categoryTreeRoot
} from '../../fields/categoryTree';

export const assertNumberOfCategoriesInCategoryTree = number => {
cy.get(categoryTreeRoot).within(() => {
cy.get(categoryTreeListItem).should('have.length', number);
});
};

export const assertCategoryInCategoryTree = categoryText => {
cy.get(categoryTreeRoot).within(() => {
cy.get(categoryTreeListItem).contains(categoryText);
});
};
13 changes: 13 additions & 0 deletions venia-integration-tests/src/assertions/megaMenu/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { megaMenuRoot, megaMenuItem } from '../../fields/megaMenu';

export const assertCategoryInMegaMenu = categoryText => {
cy.get(megaMenuRoot).within(() => {
cy.get(megaMenuItem).contains(categoryText);
});
};

export const assertNumberOfCategoriesInMegaMenu = number => {
cy.get(megaMenuRoot).within(() => {
cy.get(megaMenuItem).should('have.length', number);
});
};
4 changes: 4 additions & 0 deletions venia-integration-tests/src/fields/categoryTree/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const categoryTreeRoot = '[data-cy="CategoryTree-root"]';

export const categoryTreeListItem =
'[data-cy^="CategoryTree-"][data-cy$="target"]';
3 changes: 3 additions & 0 deletions venia-integration-tests/src/fields/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ export * as accountInformationPage from './accountInformationPage';
export * as addressBookPage from './addressBookPage';
export * as cartPage from './cartPage';
export * as categoryPage from './categoryPage';
export * as categoryTree from './categoryTree';
export * as checkoutPage from './checkoutPage';
export * as forgotPasswordPage from './forgotPasswordPage';
export * as header from './header';
export * as megaMenu from './megaMenu';
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 storeSwitcher from './storeSwitcher';
export * as wishlist from './wishlist';
export * as miniCart from './miniCart';
export * as newsletter from './newsletter';
Expand Down
3 changes: 3 additions & 0 deletions venia-integration-tests/src/fields/megaMenu/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const megaMenuRoot = '[data-cy="MegaMenu-megaMenu"]';

export const megaMenuItem = '[data-cy="MegaMenu-MegaMenuItem-megaMenuItem"]';
14 changes: 14 additions & 0 deletions venia-integration-tests/src/fields/storeSwitcher/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const headerStoreSwitcherRoot =
'[data-cy="Header-switchers"] [data-cy="StoreSwitcher-root"]';

export const headerStoreSwitcherMenu =
'[data-cy="Header-switchers"] [data-cy="StoreSwitcher-root"] [data-cy="StoreSwitcher-menu"]';

export const headerStoreSwitcherGroup =
'[data-cy="Header-switchers"] [data-cy="StoreSwitcher-root"] [data-cy="StoreSwitcher-group"]';

export const headerStoreSwitcherTrigger =
'[data-cy="Header-switchers"] [data-cy="StoreSwitcher-root"] [data-cy="StoreSwitcher-trigger"]';

export const headerStoreSwitcherView =
'[data-cy="Header-switchers"] [data-cy="StoreSwitcher-root"] [data-cy="StoreSwitcher-view"]';
77 changes: 77 additions & 0 deletions venia-integration-tests/src/fixtures/graphqlMockedCalls/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
export const checkUserIsAuthedCall =
'**/graphql?query=query+checkUserIsAuthed*';

export const hitGraphqlPath = '**/graphql';

export const getAppliedCouponsCall =
Expand All @@ -9,6 +12,16 @@ export const getAppliedGiftCardsCall =
export const getAutocompleteResultsCall =
'**/graphql?query=query+getAutocompleteResults*';

export const getAvailableStoresDataCall =
'**/graphql?query=query+getAvailableStoresData*';

export const getBreadcrumbsCall = '**/graphql?query=query+GetBreadcrumbs*';

export const getBillingAddressCall =
'**/graphql?query=query+getBillingAddress*';

export const getCartDetailsCall = '**/graphql?query=query+GetCartDetails*';

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

export const getCategoryDataCall = '**/graphql?query=query+getCategoryData*';
Expand All @@ -23,6 +36,8 @@ export const getCMSPage = '**/graphql?query=query+GetCmsPage*';
export const getContactPageEnabledCall =
'**/graphql?query=query+GetStoreConfigForContactUs*';

export const getCurrencyDataCall = '**/graphql?query=query+getCurrencyData*';

export const getCustomerAfterCheckoutCall =
'**/graphql?query=query+GetCustomerAfterCheckout*';

Expand All @@ -32,19 +47,35 @@ export const getCustomerWishlistCall =
export const getDynamicBlocksCall =
'**/graphql?query=query+GetCmsDynamicBlocks*';

export const getFilterInputsForCategoryCall =
'**/graphql?query=query+GetFilterInputsForCategory*';

export const getGiftOptionsCall = '**/graphql?query=query+GetGiftOptions*';

export const getItemCountCall = '**/graphql?query=query+getItemCount*';

export const getItemsInCartCall = '**/graphql?query=query+getItemsInCart*';

export const getMegaMenuCall = '**/graphql?query=query+getMegaMenu*';

export const getLocaleCall = '**/graphql?query=query+getLocale*';

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

export const getNavigationMenuCall =
'**/graphql?query=query+GetNavigationMenu*';

export const getNewCustomerWishlistCall =
'**/graphql?query=query+getCustomerWishlist*';

export const getPageSizeCall = '**/graphql?query=query+getPageSize*';

export const getPaymentInformationCall =
'**/graphql?query=query+getPaymentInformation*';

export const getPriceSummaryCall = '**/graphql?query=query+getPriceSummary*';

export const getProductDetailForProductPageCall =
'**/graphql?query=query+getProductDetailForProductPage*';

Expand All @@ -59,23 +90,63 @@ export const getProductFiltersBySearchCall =

export const getProductSearchCall = '**/graphql?query=query+ProductSearch*';

export const getProductsByUrlKeyCall =
'**/graphql?query=query+getProductsByUrlKey*';

export const getReCaptchaV3ConfigCall =
'**/graphql?query=query+GetReCaptchaV3Config*';

export const getRegionsCall = '**/graphql?query=query+GetRegions*';

export const getRootCategoryIdCall =
'**/graphql?query=query+getRootCategoryId*';

export const getRouteDataCall = '**/graphql?query=query+getRouteData*';

export const getSelectedAndAvailableShippingMethodsCall =
'**/graphql?query=query+getSelectedAndAvailableShippingMethods*';

export const getShippingMethodsCall =
'**/graphql?query=query+GetShippingMethods*';

export const getShippingInformationCall =
'**/graphql?query=query+GetShippingInformation*';

export const getStoreConfigDataCall =
'**/graphql?query=query+getStoreConfigData*';

export const getStoreConfigForBreadcrumbsCall =
'**/graphql?query=query+GetStoreConfigForBreadcrumbs*';

export const getStoreConfigForCategoryTreeCall =
'**/graphql?query=query+GetStoreConfigForCategoryTree*';

export const getStoreConfigForCartPageCall =
'**/graphql?query=query+getStoreConfigForCartPage*';

export const getStoreConfigForCarouselEECall =
'**/graphql?query=query+GetStoreConfigForCarouselEE*';

export const getStoreConfigDataForGalleryEECall =
'**/graphql?query=query+GetStoreConfigDataForGalleryEE*';

export const getStoreConfigForGiftOptionsCall =
'**/graphql?query=query+GetStoreConfigForGiftOptions*';

export const getStoreConfigForMegaMenuCall =
'**/graphql?query=query+GetStoreConfigForMegaMenu*';

export const getStoreConfigForMiniCartCall =
'**/graphql?query=query+getStoreConfigForMiniCart*';

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

export const getStoreConfigForNewsletterCall =
'**/graphql?query=query+GetStoreConfigForNewsletter*';

export const getStoreNameCall = '**/graphql?query=query+getStoreName*';

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

Expand All @@ -93,3 +164,9 @@ export const getWishlistConfigForWishlistPageCall =

export const getIsEmailAvailableCall =
'**/graphql?query=query+IsEmailAvailable*';

export const miniCartQueryCall = '**/graphql?query=query+MiniCartQuery*';

export const resolveUrlCall = '**/graphql?query=query+ResolveURL*';

export const storeConfigDataCall = '**/graphql?query=query+storeConfigData*';
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 @@ -9,6 +9,7 @@ export * as forgotPasswordPage from './forgotPasswordPage';
export * as googleMapApi from './googleMapApi';
export * as googleReCaptchaApi from './googleReCaptchaApi';
export * as homePage from './homePage';
export * as multiStore from './multiStore';
export * as myAccountMenu from './myAccountMenu';
export * as notFoundPage from './notFoundPage';
export * as pageBuilder from './pageBuilder';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"data": {
"availableStores": [
{
"category_url_suffix": ".html",
"default_display_currency_code": "USD",
"locale": "en_US",
"product_url_suffix": ".html",
"secure_base_media_url": "https:\/\/venia.magento.com\/media\/",
"store_code": "default",
"store_group_code": "main_website_store",
"store_group_name": "Main Website Store",
"store_name": "Default Store View",
"store_sort_order": 0,
"__typename": "StoreConfig"
},
{
"category_url_suffix": ".html",
"default_display_currency_code": "USD",
"locale": "en_US",
"product_url_suffix": ".html",
"secure_base_media_url": "https:\/\/venia.magento.com\/media\/",
"store_code": "view_1",
"store_group_code": "main_website_store",
"store_group_name": "Main Website Store",
"store_name": "View One",
"store_sort_order": 1,
"__typename": "StoreConfig"
},
{
"category_url_suffix": ".html",
"default_display_currency_code": "USD",
"locale": "en_US",
"product_url_suffix": ".html",
"secure_base_media_url": "https:\/\/venia.magento.com\/media\/",
"store_code": "view_1_b",
"store_group_code": "store_b",
"store_group_name": "Store B",
"store_name": "View One B",
"store_sort_order": 1,
"__typename": "StoreConfig"
},
{
"category_url_suffix": ".html",
"default_display_currency_code": "USD",
"locale": "en_US",
"product_url_suffix": ".html",
"secure_base_media_url": "https:\/\/venia.magento.com\/media\/",
"store_code": "view_2",
"store_group_code": "main_website_store",
"store_group_name": "Main Website Store",
"store_name": "View Two",
"store_sort_order": 10,
"__typename": "StoreConfig"
},
{
"category_url_suffix": ".html",
"default_display_currency_code": "USD",
"locale": "en_US",
"product_url_suffix": ".html",
"secure_base_media_url": "https:\/\/venia.magento.com\/media\/",
"store_code": "view_2_b",
"store_group_code": "store_b",
"store_group_name": "Store B",
"store_name": "View Two B",
"store_sort_order": 10,
"__typename": "StoreConfig"
}
]
}
}
Loading

0 comments on commit 0700bf5

Please sign in to comment.