@jetshop/template-trend 5.8.4 → 5.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.linaria-cache/packages/template-trend/src/components/Layout/Header/ChannelSelector/ChannelSelector.linaria.css +1 -1
- package/.linaria-cache/packages/template-trend/src/components/SearchPage/CategoryList.linaria.css +7 -0
- package/.linaria-cache/packages/template-trend/src/components/StartPage/CategoryList.linaria.css +6 -6
- package/.linaria-cache/packages/template-trend/src/components/StartPage/StartPage.linaria.css +0 -1
- package/.linaria-cache/packages/ui/ChannelSelector/Region.linaria.css +3 -0
- package/README.md +118 -1944
- package/cypress/integration/essentials.spec.js +50 -0
- package/package.json +5 -5
- package/schema.graphql +1 -0
- package/src/components/Auth/ForgotPassword.js +3 -8
- package/src/components/Auth/README.md +5 -0
- package/src/components/Cart/CartButton.js +40 -44
- package/src/components/Cart/CartFlyout.js +8 -5
- package/src/components/Cart/CartItem.js +12 -15
- package/src/components/Cart/{addMultipleToCart.gql → queries/addMultipleToCart.gql} +1 -1
- package/src/components/Cart/{addToCart.gql → queries/addToCart.gql} +1 -1
- package/src/components/Cart/{CartFragment.gql → queries/cartFragment.gql} +9 -0
- package/src/components/Cart/{CartQuery.gql → queries/cartQuery.gql} +1 -1
- package/src/components/Cart/{decrementQuantity.gql → queries/decrementQuantity.gql} +1 -1
- package/src/components/Cart/{incrementQuantity.gql → queries/incrementQuantity.gql} +1 -1
- package/src/components/Cart/{removeFromCart.gql → queries/removeFromCart.gql} +1 -1
- package/src/components/CategoryPage/CategoryPage.js +1 -0
- package/src/components/CategoryPage/Filters/ListFilters.js +1 -2
- package/src/components/CategoryPage/ProductCard.js +2 -0
- package/src/components/CategoryPage/ProductGrid.js +5 -0
- package/src/components/CategoryPage/ProductGridFragment.gql +8 -0
- package/src/components/CategoryPage/ProductGridWindow.js +19 -12
- package/src/components/CategoryPage/README.md +11 -0
- package/src/components/CategoryPage/WindowedCategoryPage.js +6 -5
- package/src/components/Forms/Input.js +3 -6
- package/src/components/Layout/Header/ChannelSelector/ChannelSelector.js +3 -0
- package/src/components/Layout/Header/ChannelSelector/ChannelSelectorModal.js +4 -3
- package/src/components/Layout/Header/ChannelSelector/Selector.js +2 -0
- package/src/components/Layout/Header/RecommendedChannel/RecommendedChannelSelector.js +3 -1
- package/src/components/Layout/Header/TopNav.js +13 -11
- package/src/components/LogOut.loadable.js +10 -0
- package/src/components/MyPages/MyPagesSidebar.js +0 -1
- package/src/components/PreviewRoute.loadable.js +10 -0
- package/src/components/ProductList/AddToCart.js +8 -5
- package/src/components/ProductList/Favourite.js +2 -2
- package/src/components/ProductList/FavouriteCount.js +2 -2
- package/src/components/ProductList/Favourites.js +17 -12
- package/src/components/ProductList/Lister.js +44 -0
- package/src/components/ProductList/Product.js +5 -4
- package/src/components/ProductList/ProductLists.gql +8 -5
- package/src/components/ProductList/SelectVariant.js +6 -10
- package/src/components/ProductList/productListQueries.js +5 -0
- package/src/components/ProductPage/AddToCart/AddToCartForm.js +19 -18
- package/src/components/ProductPage/AddToCart/ProductToast.js +7 -4
- package/src/components/ProductPage/PackageProduct/PackageProduct.js +8 -6
- package/src/components/ProductPage/VariantSelector.js +1 -1
- package/src/components/{StartPage → SearchPage}/CategoryList.js +6 -4
- package/src/components/SearchPage/EmptySearchResults.js +1 -1
- package/src/components/Shop.js +52 -76
- package/src/components/StartPage/Content/Row.js +0 -37
- package/src/components/StartPage/Content/StartPageHero.js +9 -1
- package/src/components/StartPage/StartPage.js +0 -13
- package/src/components/StartPage/StartPageProductGridFragment.gql +8 -0
- package/cypress/constants.js +0 -5
- package/cypress/integration/addToCart/addToCart.spec.js +0 -27
- package/cypress/integration/addToCart/disabledVariations.spec.js +0 -17
- package/cypress/integration/addToCart/newslettersubscriber.spec.js +0 -24
- package/cypress/integration/addToCart/notifyWhenBackInStock.spec.js +0 -20
- package/cypress/integration/addToCart/productConfigurations.spec.js +0 -35
- package/cypress/integration/addToCart/productVariations.spec.js +0 -42
- package/cypress/integration/addToCart/sizePriceChange.spec.js +0 -20
- package/cypress/integration/analytics/gtag.spec.js +0 -90
- package/cypress/integration/analytics/releware.spec.js +0 -95
- package/cypress/integration/auth/login.spec.js +0 -18
- package/cypress/integration/auth/signup.spec.js +0 -98
- package/cypress/integration/category_page_spec.js +0 -73
- package/cypress/integration/filters.spec.js +0 -103
- package/cypress/integration/getbyarticlenumber.spec.js +0 -28
- package/cypress/integration/packages.spec.js +0 -85
- package/cypress/integration/prefetch_headers_spec.js +0 -26
- package/cypress/integration/product_browsing_spec.js +0 -17
- package/cypress/integration/search/autocomplete.spec.js +0 -28
- package/cypress/integration/search/search_page.spec.js +0 -39
- package/cypress/integration/ssr/categorySSR.js +0 -9
- package/cypress/integration/ssr/productSSR.js +0 -9
- package/cypress/integration/ssr/startPageSSR.js +0 -5
- package/cypress/integration/start_page_spec.js +0 -5
- package/cypress/integration/stores_page.spec.js +0 -5
- package/src/components/StartPage/Campaign.js +0 -162
- package/src/components/StartPage/CampaignHeader.js +0 -101
- package/src/components/StartPage/ExtraDetails.js +0 -72
- package/src/components/StartPage/Readme.md +0 -88
- package/src/components/StartPage/campaign.json +0 -20
- package/src/components/StartPage/campaignHeader.json +0 -5
- package/src/components/StartPage/categoryList.json +0 -65
- package/src/components/StartPage/extraDetails.json +0 -6
- package/src/components/StartPage/title.json +0 -3
package/src/components/Shop.js
CHANGED
|
@@ -1,60 +1,53 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Helmet } from 'react-helmet-async';
|
|
3
|
+
import { Route, Switch } from 'react-router-dom';
|
|
4
|
+
|
|
2
5
|
import CustomFont from '@jetshop/core/components/Fonts/CustomFont';
|
|
6
|
+
import DynamicRoute from '@jetshop/core/components/DynamicRoute';
|
|
3
7
|
import PaginationProvider from '@jetshop/core/components/Pagination/PaginationProvider';
|
|
4
8
|
import { ProductListProvider } from '@jetshop/core/hooks/ProductList/ProductListContext';
|
|
5
9
|
import { useShopConfig } from '@jetshop/core/hooks/useShopConfig';
|
|
10
|
+
|
|
6
11
|
import GenericError from '@jetshop/ui/ErrorBoundary/Generic';
|
|
7
12
|
import LoadingBar from '@jetshop/ui/Loading/LoadingBar';
|
|
8
13
|
import ModalProvider from '@jetshop/ui/Modal/ModalProvider';
|
|
9
14
|
import ModalRoot from '@jetshop/ui/Modal/ModalRoot';
|
|
10
15
|
import ScrollRestorationHandler from '@jetshop/ui/ScrollRestorationHandler';
|
|
11
|
-
|
|
12
|
-
import { Helmet } from 'react-helmet-async';
|
|
13
|
-
import loadable from '@loadable/component';
|
|
14
|
-
import { Route, Switch } from 'react-router-dom';
|
|
15
|
-
import loadFontCss from '../fonts/loadFontCss';
|
|
16
|
-
import CategoryPreviewQuery from './CategoryPreviewQuery.gql';
|
|
17
|
-
import PagePreviewQuery from './PagePreviewQuery.gql';
|
|
16
|
+
|
|
18
17
|
import Container from './Layout/Container';
|
|
19
18
|
import Content from './Layout/Content';
|
|
20
19
|
import Footer from './Layout/Footer/Footer';
|
|
21
20
|
import Header from './Layout/Header/Header';
|
|
21
|
+
|
|
22
|
+
import ForgotPassword from './Auth/ForgotPassword.loadable';
|
|
23
|
+
import LogInPage from './Auth/LogInPage.loadable';
|
|
24
|
+
import ResetPassword from './Auth/ResetPassword.loadable';
|
|
25
|
+
import SignUpPage from './Auth/Signup/SignUpPage.loadable';
|
|
26
|
+
import CategoryPage from './CategoryPage/CategoryPage.loadable';
|
|
27
|
+
import ContentPage from './ContentPage/ContentPage.loadable';
|
|
28
|
+
import CookieConsent from './CookieConsent';
|
|
22
29
|
import LoadingPage from './LoadingPage';
|
|
30
|
+
import LogOutPage from './LogOut.loadable';
|
|
31
|
+
import MyPages from './MyPages/MyPages.loadable';
|
|
32
|
+
import NavTreePage from './NavigationTree/NavTreePage.loadable';
|
|
33
|
+
import NotFoundPage from './NotFoundPage.loadable';
|
|
34
|
+
import PreviewRoute from './PreviewRoute.loadable';
|
|
23
35
|
import { Favourites } from './ProductList/Favourites';
|
|
24
36
|
import { productListQueries } from './ProductList/productListQueries';
|
|
25
|
-
import ProductPreviewQuery from './ProductPreviewQuery.gql';
|
|
26
|
-
import routeQuery from './RouteQuery.gql';
|
|
27
|
-
import { theme } from './Theme';
|
|
28
|
-
import '../globalStyles';
|
|
29
|
-
import CookieConsent from './CookieConsent';
|
|
30
|
-
import Store from './Store/Store.loadable';
|
|
31
|
-
import StoreLocator from './StoreLocator/StoreLocator.loadable';
|
|
32
|
-
import NotFoundPage from './NotFoundPage.loadable';
|
|
33
|
-
import LogInPage from './Auth/LogInPage.loadable';
|
|
34
|
-
import NavTreePage from './NavigationTree/NavTreePage.loadable';
|
|
35
|
-
import StartPage from './StartPage/StartPage.loadable';
|
|
36
37
|
import ProductPage from './ProductPage/ProductPage.loadable';
|
|
37
|
-
import CategoryPage from './CategoryPage/CategoryPage.loadable';
|
|
38
|
-
import ContentPage from './ContentPage/ContentPage.loadable';
|
|
39
38
|
import SearchPage from './SearchPage/SearchPage.loadable';
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import MyPages from './MyPages/MyPages.loadable';
|
|
39
|
+
import StartPage from './StartPage/StartPage.loadable';
|
|
40
|
+
import Store from './Store/Store.loadable';
|
|
41
|
+
import StoreLocator from './StoreLocator/StoreLocator.loadable';
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
);
|
|
43
|
+
import categoryPreviewQuery from './CategoryPreviewQuery.gql';
|
|
44
|
+
import pagePreviewQuery from './PagePreviewQuery.gql';
|
|
45
|
+
import productPreviewQuery from './ProductPreviewQuery.gql';
|
|
46
|
+
import routeQuery from './RouteQuery.gql';
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
fallback: <LoadingPage />
|
|
56
|
-
}
|
|
57
|
-
);
|
|
48
|
+
import { theme } from './Theme';
|
|
49
|
+
import loadFontCss from '../fonts/loadFontCss';
|
|
50
|
+
import '../globalStyles';
|
|
58
51
|
|
|
59
52
|
function Shop() {
|
|
60
53
|
const { routes } = useShopConfig();
|
|
@@ -76,49 +69,32 @@ function Shop() {
|
|
|
76
69
|
<Content>
|
|
77
70
|
<PaginationProvider defaultProductsPerPage={24}>
|
|
78
71
|
<Switch>
|
|
79
|
-
<Route exact path="/"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
<Route path=
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<Route path={routes.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<Route path={routes.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<Route
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<StoreLocator />
|
|
99
|
-
</Route>
|
|
100
|
-
<Route path={`${routes.store.path}/:id`}>
|
|
101
|
-
<Store />
|
|
102
|
-
</Route>
|
|
103
|
-
<Route path={routes.tree.path}>
|
|
104
|
-
<NavTreePage />
|
|
105
|
-
</Route>
|
|
106
|
-
<Route path={routes.myPages.path}>
|
|
107
|
-
<MyPages />
|
|
108
|
-
</Route>
|
|
109
|
-
<Route exact path={routes.forgotPassword.path}>
|
|
110
|
-
<ForgotPassword />
|
|
111
|
-
</Route>
|
|
112
|
-
<Route path={`${routes.resetPassword.path}/:token`}>
|
|
113
|
-
<ResetPassword />
|
|
114
|
-
</Route>
|
|
72
|
+
<Route exact path="/" component={StartPage} />
|
|
73
|
+
<Route path="/favourites" component={Favourites} />
|
|
74
|
+
<Route path={routes.search.path} component={SearchPage} />
|
|
75
|
+
<Route path={routes.signup.path} component={SignUpPage} />
|
|
76
|
+
<Route path={routes.login.path} component={LogInPage} />
|
|
77
|
+
<Route path={routes.logout.path} component={LogOutPage} />
|
|
78
|
+
<Route path={routes.stores.path} component={StoreLocator} />
|
|
79
|
+
<Route path={`${routes.store.path}/:id`} component={Store} />
|
|
80
|
+
<Route path={routes.tree.path} component={NavTreePage} />
|
|
81
|
+
<Route path={routes.myPages.path} component={MyPages} />
|
|
82
|
+
<Route
|
|
83
|
+
exact
|
|
84
|
+
path={routes.forgotPassword.path}
|
|
85
|
+
component={ForgotPassword}
|
|
86
|
+
/>
|
|
87
|
+
<Route
|
|
88
|
+
path={`${routes.resetPassword.path}/:token`}
|
|
89
|
+
component={ResetPassword}
|
|
90
|
+
/>
|
|
115
91
|
<Route
|
|
116
92
|
path="/preview"
|
|
117
93
|
render={props => (
|
|
118
94
|
<PreviewRoute
|
|
119
|
-
productQuery={
|
|
120
|
-
categoryQuery={
|
|
121
|
-
pageQuery={
|
|
95
|
+
productQuery={productPreviewQuery}
|
|
96
|
+
categoryQuery={categoryPreviewQuery}
|
|
97
|
+
pageQuery={pagePreviewQuery}
|
|
122
98
|
productPage={ProductPage}
|
|
123
99
|
categoryPage={CategoryPage}
|
|
124
100
|
contentPage={ContentPage}
|
|
@@ -2,9 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import MaxWidth from '../../Layout/MaxWidth';
|
|
3
3
|
import { styled } from 'linaria/react';
|
|
4
4
|
import { theme } from '../../Theme';
|
|
5
|
-
import { ReactComponent as Caret } from '@jetshop/ui/svg/Carrot.svg';
|
|
6
|
-
import { Above } from '@jetshop/ui/Breakpoints';
|
|
7
|
-
import { useAnimation, swipeEffect } from '@jetshop/ui/hooks';
|
|
8
5
|
|
|
9
6
|
const Container = styled('div')`
|
|
10
7
|
position: relative;
|
|
@@ -37,40 +34,6 @@ const ItemsContainer = styled('div')`
|
|
|
37
34
|
}
|
|
38
35
|
`;
|
|
39
36
|
|
|
40
|
-
const Button = styled('button')`
|
|
41
|
-
position: absolute;
|
|
42
|
-
font-family: initial;
|
|
43
|
-
margin: 0 10px;
|
|
44
|
-
top: 50%;
|
|
45
|
-
transform: translateY(-50%);
|
|
46
|
-
z-index: 2;
|
|
47
|
-
width: 40px;
|
|
48
|
-
height: 40px;
|
|
49
|
-
border-radius: 50%;
|
|
50
|
-
background: rgba(255, 255, 255, 0.2);
|
|
51
|
-
|
|
52
|
-
&:focus,
|
|
53
|
-
&:active {
|
|
54
|
-
outline: none;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
&:hover {
|
|
58
|
-
background: rgba(255, 255, 255, 0.6);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
&.left svg {
|
|
62
|
-
transform: rotateZ(90deg);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&.right {
|
|
66
|
-
right: 0;
|
|
67
|
-
|
|
68
|
-
svg {
|
|
69
|
-
transform: rotateZ(-90deg);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
|
|
74
37
|
const Row = ({ header, children }) => {
|
|
75
38
|
return (
|
|
76
39
|
<MaxWidth>
|
|
@@ -66,12 +66,20 @@ const heroStyles = css`
|
|
|
66
66
|
justify-content: center;
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
|
-
const StartPageHero = ({
|
|
69
|
+
const StartPageHero = ({
|
|
70
|
+
header,
|
|
71
|
+
text,
|
|
72
|
+
buttonText,
|
|
73
|
+
buttonLink,
|
|
74
|
+
imageSrc,
|
|
75
|
+
isAboveFold
|
|
76
|
+
}) => (
|
|
70
77
|
<StartPageHeroWrapper>
|
|
71
78
|
<Image
|
|
72
79
|
fillAvailableSpace={true}
|
|
73
80
|
src={imageSrc.value}
|
|
74
81
|
className={heroStyles}
|
|
82
|
+
critical={isAboveFold.value}
|
|
75
83
|
>
|
|
76
84
|
<Container>
|
|
77
85
|
<Title>{header.value}</Title>
|
|
@@ -2,7 +2,6 @@ import StartPageRenderer from '@jetshop/ui/StartPageRenderer';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useQuery } from 'react-apollo';
|
|
4
4
|
import { styled } from 'linaria/react';
|
|
5
|
-
import MaxWidth from '../Layout/MaxWidth';
|
|
6
5
|
import LoadingPage from '../LoadingPage';
|
|
7
6
|
import StartPageCampaign from './Content/StartPageCampaign';
|
|
8
7
|
import StartPageCategories from './Content/StartPageCategories';
|
|
@@ -12,8 +11,6 @@ import StartPageProductGrid from './Content/StartPageProductGrid';
|
|
|
12
11
|
import startPageQuery from './StartPageQuery.gql';
|
|
13
12
|
import { StartPageCategoryItem } from './Content/StartPageCategories';
|
|
14
13
|
|
|
15
|
-
import { theme } from '../Theme';
|
|
16
|
-
|
|
17
14
|
const startPageComponents = {
|
|
18
15
|
HERO: StartPageHero,
|
|
19
16
|
HTML: StartPageHTMLContent,
|
|
@@ -29,16 +26,6 @@ const StartPageWrapper = styled('div')`
|
|
|
29
26
|
flex-direction: column;
|
|
30
27
|
`;
|
|
31
28
|
|
|
32
|
-
export const MainSectionWrapper = styled(MaxWidth)`
|
|
33
|
-
width: 100%;
|
|
34
|
-
align-self: center;
|
|
35
|
-
padding-left: 1.5rem;
|
|
36
|
-
padding-right: 1.5rem;
|
|
37
|
-
${theme.below.sm} {
|
|
38
|
-
padding-left: 0px;
|
|
39
|
-
padding-right: 0px;
|
|
40
|
-
}
|
|
41
|
-
`;
|
|
42
29
|
const StartPage = ({ startPageId }) => {
|
|
43
30
|
const result = useQuery(startPageQuery, {
|
|
44
31
|
variables: { startPageId: startPageId }
|
package/cypress/constants.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const PRODUCT_URL = 'se/accessories/watches/watch-classic-504';
|
|
2
|
-
export const OUT_OF_STOCK_PRODUCT_URL = 'se/preview?articlenumber=224733';
|
|
3
|
-
export const CATEGORY_URL = 'se/accessories/watches';
|
|
4
|
-
export const ARTICLENUMBER_URL = 'se/articlenumber/6952315';
|
|
5
|
-
export const US_ARTICLENUMBER_URL = 'int/articlenumber/6952315';
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { PRODUCT_URL, OUT_OF_STOCK_PRODUCT_URL } from '../../constants';
|
|
2
|
-
|
|
3
|
-
describe('Add to cart tests', () => {
|
|
4
|
-
it('Will add add a basic product to the cart', () => {
|
|
5
|
-
cy.visit(PRODUCT_URL);
|
|
6
|
-
cy.get('button[data-testid="add-to-cart"]').click();
|
|
7
|
-
cy.get('[data-testid="product-toast"]').should('exist');
|
|
8
|
-
cy.get('[data-testid="cart-button"]').click();
|
|
9
|
-
cy.get('[data-testid="item-name"]').should('not.be.empty');
|
|
10
|
-
cy.get('[data-testid="increment-quantity"]').click();
|
|
11
|
-
cy.get('[data-testid="item-quantity"]').should('contain', 2);
|
|
12
|
-
cy.get('[data-testid="remove-from-cart"]').click();
|
|
13
|
-
cy.get('[data-testid="item-name"]').should('not.exist');
|
|
14
|
-
});
|
|
15
|
-
it('Add to cart button is disabled if product is out of stock', () => {
|
|
16
|
-
cy.visit(OUT_OF_STOCK_PRODUCT_URL);
|
|
17
|
-
cy.get('button[data-testid="add-to-cart"]').should('be.disabled');
|
|
18
|
-
});
|
|
19
|
-
it('Checkout button is linked to the checkout', () => {
|
|
20
|
-
cy.visit(PRODUCT_URL);
|
|
21
|
-
cy.get('button[data-testid="add-to-cart"]').click();
|
|
22
|
-
cy.get('button[data-testid="cart-button"]').click();
|
|
23
|
-
cy.get('[data-testid="checkout-button"]')
|
|
24
|
-
.should('have.attr', 'href')
|
|
25
|
-
.and('include', 'externalcheckout');
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const PRODUCT_WITH_INVALID_VARIATIONS_URL = '/furniture/toldbod-pendant';
|
|
2
|
-
describe('Disabled variations', () => {
|
|
3
|
-
it('Will add a product with attributes if they have been selected', () => {
|
|
4
|
-
cy.visit(PRODUCT_WITH_INVALID_VARIATIONS_URL);
|
|
5
|
-
cy.get('button[data-testid="add-to-cart"]').click();
|
|
6
|
-
cy.get('[data-testid="product-toast"]').should('not.exist');
|
|
7
|
-
cy.findByText('Ø 250').click();
|
|
8
|
-
cy.get('#option-Color').click();
|
|
9
|
-
cy.findByText('White', { selector: 'li[role=menuitem]' }).click();
|
|
10
|
-
cy.get('button[data-testid="add-to-cart"]').should('be.disabled');
|
|
11
|
-
cy.get('#option-Color').click();
|
|
12
|
-
cy.findByText('Black', { selector: 'li[role=menuitem]' }).click();
|
|
13
|
-
cy.findByText('Ø 250').click();
|
|
14
|
-
cy.get('button[data-testid="add-to-cart"]').click();
|
|
15
|
-
cy.get('[data-testid="product-toast"]').should('exist');
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
describe('Notify when back test', () => {
|
|
2
|
-
it('Subscribes to newsletter with a random email', () => {
|
|
3
|
-
cy.visit('/');
|
|
4
|
-
cy.get(
|
|
5
|
-
'[data-testid="newsletter-subscription-input"]'
|
|
6
|
-
).type('edgardavids@glasses.com', { force: true });
|
|
7
|
-
cy.get('button[data-testid="newsletter-subscription-submit"]').click();
|
|
8
|
-
cy.get('p[data-testid="newsletter-subscription-success"]').should(
|
|
9
|
-
'contain',
|
|
10
|
-
'You are now subscribed'
|
|
11
|
-
);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('Cannot subscribe with an invalid email', () => {
|
|
15
|
-
cy.visit('/');
|
|
16
|
-
cy.get(
|
|
17
|
-
'[data-testid="newsletter-subscription-input"]'
|
|
18
|
-
).type('edgardavids.com', { force: true });
|
|
19
|
-
cy.get('button[data-testid="newsletter-subscription-submit"]').click();
|
|
20
|
-
cy.get('p[data-testid="newsletter-subscription-success"]').should(
|
|
21
|
-
'not.exist'
|
|
22
|
-
);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const PRODUCT_URL = 'accessories/glasses-black';
|
|
2
|
-
|
|
3
|
-
describe('Notify when back test', () => {
|
|
4
|
-
it('Will fill out notify when back with a test email', () => {
|
|
5
|
-
cy.visit(PRODUCT_URL);
|
|
6
|
-
cy.get('button[data-testid="add-to-cart"]').should('not.exist');
|
|
7
|
-
cy.get('button[data-testid="notify-when-back-button"]').click();
|
|
8
|
-
cy.get('input[data-testid="notify-when-back-input"]').type(
|
|
9
|
-
'test@example.com',
|
|
10
|
-
{
|
|
11
|
-
force: true
|
|
12
|
-
}
|
|
13
|
-
);
|
|
14
|
-
cy.get('button[data-testid="notify-when-back-ok"]').click({ force: true });
|
|
15
|
-
cy.get('p[data-testid="notify-when-back-success"]').should(
|
|
16
|
-
'contain',
|
|
17
|
-
'You are now subscribed'
|
|
18
|
-
);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const PRODUCT_URL = 'furniture/black-leather-sofa';
|
|
2
|
-
|
|
3
|
-
describe('Add to cart product configuration tests', () => {
|
|
4
|
-
it('Will add add a product with configurations', () => {
|
|
5
|
-
cy.visit(PRODUCT_URL);
|
|
6
|
-
|
|
7
|
-
cy.get('.price').should('contain', '420');
|
|
8
|
-
|
|
9
|
-
cy.get('#option-Head').click();
|
|
10
|
-
cy.findAllByRole('menuitem', { name: 'putter' }).click();
|
|
11
|
-
cy.get('#option-Head').should('contain', 'putter');
|
|
12
|
-
|
|
13
|
-
cy.get('.price').should('contain', '370');
|
|
14
|
-
|
|
15
|
-
cy.get('#option-stick').click();
|
|
16
|
-
cy.findAllByRole('menuitem', { name: 'shiny' }).click();
|
|
17
|
-
cy.get('#option-stick').should('contain', 'shiny');
|
|
18
|
-
|
|
19
|
-
cy.get('.price').should('contain', '470');
|
|
20
|
-
|
|
21
|
-
cy.get('#option-grip').click();
|
|
22
|
-
cy.findAllByRole('menuitem', { name: 'plastic' }).click();
|
|
23
|
-
cy.get('#option-grip').should('contain', 'plastic');
|
|
24
|
-
|
|
25
|
-
cy.get('.price').should('contain', '455');
|
|
26
|
-
|
|
27
|
-
cy.findByRole('button', { name: /add to cart/i }).click();
|
|
28
|
-
|
|
29
|
-
cy.get('[data-testid="product-toast"]').should('exist');
|
|
30
|
-
cy.get('[data-testid="cart-button"]').click();
|
|
31
|
-
cy.get('[data-testid="item-name"]').should('not.be.empty');
|
|
32
|
-
cy.get('[data-testid="item-price"]').should('contain', '455');
|
|
33
|
-
cy.get('[data-testid="cart-button"]').click();
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const PRODUCT_WITH_VARIATIONS_URL = 'furniture/armchair-lord';
|
|
2
|
-
|
|
3
|
-
describe('Product variants', () => {
|
|
4
|
-
it('can be successfully selected and added to cart', () => {
|
|
5
|
-
cy.visit(PRODUCT_WITH_VARIATIONS_URL);
|
|
6
|
-
|
|
7
|
-
cy.get('button[data-testid="add-to-cart"]').click();
|
|
8
|
-
cy.get('[data-testid="product-toast"]').should('not.exist');
|
|
9
|
-
cy.findByText('Small').click();
|
|
10
|
-
cy.findByText('JA').click();
|
|
11
|
-
cy.get('button[data-testid="add-to-cart"]').click();
|
|
12
|
-
cy.get('[data-testid="product-toast"]').should('not.exist');
|
|
13
|
-
cy.get('input[data-testid="Skriv in ditt önskade tryck här-input"]').type(
|
|
14
|
-
'Hello, World'
|
|
15
|
-
);
|
|
16
|
-
cy.get('button[data-testid="add-to-cart"]').click();
|
|
17
|
-
cy.get('[data-testid="product-toast"]').should('exist');
|
|
18
|
-
cy.get('[data-testid="cart-button"]').click();
|
|
19
|
-
cy.get('[data-testid="item-name"]').should('not.be.empty');
|
|
20
|
-
cy.get('[data-testid="increment-quantity"]').click();
|
|
21
|
-
cy.get('[data-testid="item-quantity"]').should('contain', 2);
|
|
22
|
-
cy.get('[data-testid="remove-from-cart"]').click();
|
|
23
|
-
cy.get('[data-testid="item-name"]').should('not.exist');
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe('Preselection', () => {
|
|
27
|
-
it('preselects variant when included in the url', () => {
|
|
28
|
-
cy.visit('accessories/belts/belt-light?att=Mzg=');
|
|
29
|
-
cy.get('[aria-pressed="true"]').should('contain', '38');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('preselects the cheapest variant by default', () => {
|
|
33
|
-
cy.visit('accessories/belts/belt-light');
|
|
34
|
-
cy.get('[aria-pressed="true"]').should('contain', '37');
|
|
35
|
-
|
|
36
|
-
cy.visit('/furniture/aj-floor-lamp');
|
|
37
|
-
cy.get('[aria-pressed="true"]')
|
|
38
|
-
.should('contain', 'Black')
|
|
39
|
-
.should('contain', '140');
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const PRODUCT_URL = 'accessories/belt-light';
|
|
2
|
-
|
|
3
|
-
describe('Produce price', () => {
|
|
4
|
-
it('changes when variant is changed', () => {
|
|
5
|
-
cy.visit(PRODUCT_URL);
|
|
6
|
-
cy.get('.new-price').should('contain', '499');
|
|
7
|
-
cy.findByText('36').click();
|
|
8
|
-
cy.get('.new-price').should('contain', '563');
|
|
9
|
-
cy.findByText('38').click();
|
|
10
|
-
cy.get('.new-price').should('contain', '500');
|
|
11
|
-
cy.get('button[data-testid="add-to-cart"]').click();
|
|
12
|
-
cy.get('[data-testid="product-toast"]').should('exist');
|
|
13
|
-
cy.get('[data-testid="cart-button"]').click();
|
|
14
|
-
cy.get('[data-testid="item-name"]').should('not.be.empty');
|
|
15
|
-
cy.get('.price')
|
|
16
|
-
.first()
|
|
17
|
-
.should('contain', '500');
|
|
18
|
-
cy.get('[data-testid="cart-button"]').click();
|
|
19
|
-
});
|
|
20
|
-
});
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { callsTo } from '../../support/dataLayer';
|
|
2
|
-
import { PRODUCT_URL, CATEGORY_URL } from '../../constants';
|
|
3
|
-
const eventMatcher = eventName => [
|
|
4
|
-
function eventMatcher(calls) {
|
|
5
|
-
return calls.find(call => call[0] === 'event' && call[1] === eventName);
|
|
6
|
-
},
|
|
7
|
-
`Event ${eventName} is pushed to dataLayer`
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
const pageviewMatcher = path => [
|
|
11
|
-
function pageviewMatcher(calls) {
|
|
12
|
-
const pageViewCall = calls.find(
|
|
13
|
-
call => call[0] === 'event' && call[1] === 'page_view'
|
|
14
|
-
);
|
|
15
|
-
return pageViewCall.length > 0;
|
|
16
|
-
},
|
|
17
|
-
`Page View for "${path}" is pushed to dataLayer`
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
describe('Analytics: GTAG – Google Analytics', () => {
|
|
21
|
-
it('Start Page: Should trigger view events', () => {
|
|
22
|
-
cy.visit('/');
|
|
23
|
-
cy.get('@gtm_dataLayer_push').should(push => {
|
|
24
|
-
expect(callsTo(push)).to.satisfy(...eventMatcher('view_item_list'));
|
|
25
|
-
expect(callsTo(push)).to.satisfy(...pageviewMatcher('/'));
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('Category Page: Should trigger view events', () => {
|
|
30
|
-
cy.visit(CATEGORY_URL);
|
|
31
|
-
cy.get('@gtm_dataLayer_push').should(push => {
|
|
32
|
-
expect(callsTo(push)).to.satisfy(...eventMatcher('view_item_list'));
|
|
33
|
-
expect(callsTo(push)).to.satisfy(...pageviewMatcher(CATEGORY_URL));
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('Category Page: Should trigger click events', () => {
|
|
38
|
-
cy.visit(CATEGORY_URL);
|
|
39
|
-
|
|
40
|
-
cy.findAllByTestId('product')
|
|
41
|
-
.first()
|
|
42
|
-
.click();
|
|
43
|
-
|
|
44
|
-
cy.get('@gtm_dataLayer_push').should(push => {
|
|
45
|
-
expect(callsTo(push)).to.satisfy(...eventMatcher('select_content'));
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('Product Page: Should trigger view events', () => {
|
|
50
|
-
cy.visit(PRODUCT_URL);
|
|
51
|
-
cy.get('@gtm_dataLayer_push').should(push => {
|
|
52
|
-
expect(callsTo(push)).to.satisfy(...eventMatcher('view_item'));
|
|
53
|
-
expect(callsTo(push)).to.satisfy(...pageviewMatcher(PRODUCT_URL));
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('Product Page: Should trigger cart events', () => {
|
|
58
|
-
cy.visit(PRODUCT_URL);
|
|
59
|
-
|
|
60
|
-
// Add to cart
|
|
61
|
-
cy.findByTestId('add-to-cart').click({ force: true });
|
|
62
|
-
cy.get('@gtm_dataLayer_push').should(push => {
|
|
63
|
-
expect(callsTo(push)).to.satisfy(...eventMatcher('add_to_cart'));
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
// Remove from to cart
|
|
67
|
-
cy.findByTestId('cart-button').click({ force: true });
|
|
68
|
-
cy.findByTestId('remove-from-cart')
|
|
69
|
-
.first()
|
|
70
|
-
.click();
|
|
71
|
-
cy.get('@gtm_dataLayer_push').should(push => {
|
|
72
|
-
expect(callsTo(push)).to.satisfy(...eventMatcher('remove_from_cart'));
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('Product Page: Attribute click events to the appropriate list and apppropriate currency', () => {
|
|
77
|
-
cy.visit(CATEGORY_URL);
|
|
78
|
-
|
|
79
|
-
cy.findAllByTestId('product')
|
|
80
|
-
.first()
|
|
81
|
-
.click();
|
|
82
|
-
|
|
83
|
-
cy.findByTestId('add-to-cart').click({ force: true });
|
|
84
|
-
cy.get('@gtm_dataLayer_push').should(push => {
|
|
85
|
-
expect(callsTo(push).pop()[2].currency).to.equal('SEK');
|
|
86
|
-
expect(callsTo(push).pop()[2].items[0].list_name).to.equal('Watches');
|
|
87
|
-
expect(callsTo(push)).to.satisfy(...eventMatcher('add_to_cart'));
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|