@faststore/core 2.1.94 → 2.1.96

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.
Files changed (92) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +44 -44
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/config.json +3 -3
  5. package/.next/cache/eslint/.cache_1gneedd +1 -1
  6. package/.next/cache/next-server.js.nft.json +1 -1
  7. package/.next/cache/webpack/client-production/0.pack +0 -0
  8. package/.next/cache/webpack/client-production/index.pack +0 -0
  9. package/.next/cache/webpack/server-production/0.pack +0 -0
  10. package/.next/cache/webpack/server-production/index.pack +0 -0
  11. package/.next/next-server.js.nft.json +1 -1
  12. package/.next/prerender-manifest.json +1 -1
  13. package/.next/react-loadable-manifest.json +3 -3
  14. package/.next/routes-manifest.json +1 -1
  15. package/.next/server/chunks/183.js +1 -0
  16. package/.next/server/chunks/350.js +1 -1
  17. package/.next/server/chunks/530.js +58 -36
  18. package/.next/server/chunks/574.js +42 -23
  19. package/.next/server/chunks/576.js +1 -0
  20. package/.next/server/chunks/74.js +31 -9
  21. package/.next/server/chunks/907.js +25 -3
  22. package/.next/server/chunks/98.js +42 -23
  23. package/.next/server/middleware-build-manifest.js +1 -1
  24. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  25. package/.next/server/pages/404.js.nft.json +1 -1
  26. package/.next/server/pages/500.js.nft.json +1 -1
  27. package/.next/server/pages/[...slug].js.nft.json +1 -1
  28. package/.next/server/pages/[slug]/p.js.nft.json +1 -1
  29. package/.next/server/pages/_app.js.nft.json +1 -1
  30. package/.next/server/pages/account.js.nft.json +1 -1
  31. package/.next/server/pages/api/graphql.js +1 -1
  32. package/.next/server/pages/checkout.js.nft.json +1 -1
  33. package/.next/server/pages/en-US/404.html +2 -2
  34. package/.next/server/pages/en-US/500.html +2 -2
  35. package/.next/server/pages/en-US/account.html +2 -2
  36. package/.next/server/pages/en-US/checkout.html +2 -2
  37. package/.next/server/pages/en-US/login.html +2 -2
  38. package/.next/server/pages/en-US/s.html +2 -2
  39. package/.next/server/pages/en-US.html +2 -2
  40. package/.next/server/pages/index.js.nft.json +1 -1
  41. package/.next/server/pages/login.js.nft.json +1 -1
  42. package/.next/server/pages/s.js.nft.json +1 -1
  43. package/.next/server/pages-manifest.json +4 -4
  44. package/.next/static/8EkJazrZDz4rsTIa4IP5R/_buildManifest.js +1 -0
  45. package/.next/static/chunks/148.3bb7e05cc5d1c1c4.js +1 -0
  46. package/.next/static/chunks/238-2ad31f382e7c6f14.js +1 -0
  47. package/.next/static/chunks/243-8c394e91ccf75fdb.js +1 -0
  48. package/.next/static/chunks/{530.ec68de379130c11e.js → 530.da3ec94477af00a4.js} +1 -1
  49. package/.next/static/chunks/548-ab84e9e8b49413ab.js +1 -0
  50. package/.next/static/chunks/{574.d13dd0afe15cd635.js → 574.70612be06fd1365f.js} +1 -1
  51. package/.next/static/chunks/603-be78b9dfb8fa6c49.js +1 -0
  52. package/.next/static/chunks/{738-a5ff304828f20cbf.js → 738-67a288ca3569cdbb.js} +1 -1
  53. package/.next/static/chunks/98.40c7e17d9de4eb8f.js +1 -0
  54. package/.next/static/chunks/988.d10040040cdfebbb.js +1 -0
  55. package/.next/static/chunks/pages/{[...slug]-3f4e5f74ff9436ec.js → [...slug]-ca533c74c22cb787.js} +1 -1
  56. package/.next/static/chunks/pages/[slug]/p-3383e9b97bffafdd.js +1 -0
  57. package/.next/static/chunks/pages/{_app-6d0e6ab9a4dd8106.js → _app-40cff0982559d0b8.js} +1 -1
  58. package/.next/static/chunks/pages/{index-73110361a184aa10.js → index-d521ce4f4e2b89a6.js} +1 -1
  59. package/.next/static/chunks/pages/s-1f885639c2605ace.js +1 -0
  60. package/.next/static/chunks/{webpack-92f756189996e763.js → webpack-fac5a4eeea429971.js} +1 -1
  61. package/.next/trace +80 -80
  62. package/.turbo/turbo-build.log +5 -5
  63. package/@generated/graphql/index.ts +8 -0
  64. package/@generated/graphql/persisted.json +3 -3
  65. package/README.md +3 -3
  66. package/cypress/global.js +8 -0
  67. package/cypress/integration/a11y.test.js +7 -24
  68. package/cypress/integration/analytics.test.js +78 -87
  69. package/cypress/integration/cart.test.js +4 -4
  70. package/cypress/integration/plp.test.js +6 -6
  71. package/cypress/integration/search.test.js +1 -1
  72. package/cypress/integration/seo.test.js +14 -14
  73. package/cypress.config.ts +19 -0
  74. package/faststore.config.js +1 -0
  75. package/package.json +8 -8
  76. package/src/components/cart/CartSidebar/CartSidebar.tsx +41 -27
  77. package/src/components/sections/ProductGallery/useGalleryQuery.ts +31 -2
  78. package/src/sdk/analytics/platform/vtex/search.ts +53 -21
  79. package/src/sdk/analytics/types.ts +14 -0
  80. package/src/sdk/search/useSuggestions.ts +41 -7
  81. package/.next/static/chunks/148.582eaa81293ee470.js +0 -1
  82. package/.next/static/chunks/238-15fad228a6c8b1b5.js +0 -1
  83. package/.next/static/chunks/243-b4f8e506d156ee41.js +0 -1
  84. package/.next/static/chunks/548-4ee971bf7bdb3e81.js +0 -1
  85. package/.next/static/chunks/603-072c8fb73ac35775.js +0 -1
  86. package/.next/static/chunks/98.1632997dfd4d3a52.js +0 -1
  87. package/.next/static/chunks/988.afda042dd9ba11d1.js +0 -1
  88. package/.next/static/chunks/pages/[slug]/p-c36fb1ebf1df3462.js +0 -1
  89. package/.next/static/chunks/pages/s-51ec424952b59bd0.js +0 -1
  90. package/.next/static/i157UtW0mfErYKy2acCzJ/_buildManifest.js +0 -1
  91. package/cypress.json +0 -9
  92. /package/.next/static/{i157UtW0mfErYKy2acCzJ → 8EkJazrZDz4rsTIa4IP5R}/_ssgManifest.js +0 -0
@@ -23,9 +23,9 @@ info - Finalizing page optimization...
23
23
  Route (pages) Size First Load JS
24
24
  ┌ ● / 3.16 kB 197 kB
25
25
  ├ /_app 0 B 77.9 kB
26
- ├ ● /[...slug] 4.06 kB 208 kB
26
+ ├ ● /[...slug] 4.06 kB 209 kB
27
27
  ├ └ css/527e334fa69cf40a.css 1.85 kB
28
- ├ ● /[slug]/p 10.5 kB 204 kB
28
+ ├ ● /[slug]/p 10.5 kB 205 kB
29
29
  ├ └ css/7ca374e5534a3f68.css 11.3 kB
30
30
  ├ ○ /404 1.19 kB 114 kB
31
31
  ├ ● /500 1.21 kB 114 kB
@@ -36,12 +36,12 @@ Route (pages) Size First Load JS
36
36
  ├ λ /api/preview 0 B 77.9 kB
37
37
  ├ ● /checkout 657 B 113 kB
38
38
  ├ ● /login 1.09 kB 114 kB
39
- └ ● /s 4.6 kB 127 kB
39
+ └ ● /s 4.6 kB 128 kB
40
40
  + First Load JS shared by all 81 kB
41
41
  ├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
42
42
  ├ chunks/main-fd466221927468fd.js 23.9 kB
43
- ├ chunks/pages/_app-6d0e6ab9a4dd8106.js 6.45 kB
44
- ├ chunks/webpack-92f756189996e763.js 2.29 kB
43
+ ├ chunks/pages/_app-40cff0982559d0b8.js 6.46 kB
44
+ ├ chunks/webpack-fac5a4eeea429971.js 2.29 kB
45
45
  └ css/9e76fef1c9ca89af.css 3.06 kB
46
46
 
47
47
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
@@ -1058,6 +1058,11 @@ export type ProductDetailsFragment_ProductFragment = {
1058
1058
  }>
1059
1059
  }
1060
1060
 
1061
+ export type SearchEvent_MetadataFragment = {
1062
+ isTermMisspelled: boolean
1063
+ logicalOperator: string
1064
+ }
1065
+
1061
1066
  export type ProductGalleryQueryQueryVariables = Exact<{
1062
1067
  first: Scalars['Int']
1063
1068
  after: Scalars['String']
@@ -1089,6 +1094,7 @@ export type ProductGalleryQueryQuery = {
1089
1094
  max: { selected: number; absolute: number }
1090
1095
  }
1091
1096
  >
1097
+ metadata: { isTermMisspelled: boolean; logicalOperator: string } | null
1092
1098
  }
1093
1099
  }
1094
1100
 
@@ -1371,6 +1377,8 @@ export type SearchSuggestionsQueryQuery = {
1371
1377
  }
1372
1378
  }>
1373
1379
  }
1380
+ products: { pageInfo: { totalCount: number } }
1381
+ metadata: { isTermMisspelled: boolean; logicalOperator: string } | null
1374
1382
  }
1375
1383
  }
1376
1384
 
@@ -1,12 +1,12 @@
1
1
  {
2
- "ProductGalleryQuery": "query ProductGalleryQuery($first: Int!, $after: String!, $sort: StoreSort!, $term: String!, $selectedFacets: [IStoreSelectedFacet!]!) {\n search(\n first: $first\n after: $after\n sort: $sort\n term: $term\n selectedFacets: $selectedFacets\n ) {\n products {\n pageInfo {\n totalCount\n }\n }\n facets {\n ... on StoreFacetRange {\n key\n label\n min {\n selected\n absolute\n }\n max {\n selected\n absolute\n }\n __typename\n }\n ... on StoreFacetBoolean {\n key\n label\n values {\n label\n value\n selected\n quantity\n }\n __typename\n }\n }\n }\n}\n",
2
+ "ProductGalleryQuery": "query ProductGalleryQuery($first: Int!, $after: String!, $sort: StoreSort!, $term: String!, $selectedFacets: [IStoreSelectedFacet!]!) {\n search(\n first: $first\n after: $after\n sort: $sort\n term: $term\n selectedFacets: $selectedFacets\n ) {\n products {\n pageInfo {\n totalCount\n }\n }\n facets {\n ... on StoreFacetRange {\n key\n label\n min {\n selected\n absolute\n }\n max {\n selected\n absolute\n }\n __typename\n }\n ... on StoreFacetBoolean {\n key\n label\n values {\n label\n value\n selected\n quantity\n }\n __typename\n }\n }\n metadata {\n isTermMisspelled\n logicalOperator\n }\n }\n}\n",
3
3
  "ServerCollectionPageQuery": "query ServerCollectionPageQuery($slug: String!) {\n collection(slug: $slug) {\n seo {\n title\n description\n }\n breadcrumbList {\n itemListElement {\n item\n name\n position\n }\n }\n meta {\n selectedFacets {\n key\n value\n }\n }\n }\n}\n",
4
4
  "ServerProductPageQuery": "query ServerProductPageQuery($slug: String!) {\n product(locator: [{key: \"slug\", value: $slug}]) {\n id: productID\n seo {\n title\n description\n canonical\n }\n brand {\n name\n }\n sku\n gtin\n name\n description\n releaseDate\n breadcrumbList {\n itemListElement {\n item\n name\n position\n }\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n highPrice\n priceCurrency\n offers {\n availability\n price\n priceValidUntil\n priceCurrency\n itemCondition\n seller {\n identifier\n }\n listPrice\n }\n }\n isVariantOf {\n productGroupID\n name\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n}\n",
5
5
  "ValidateCartMutation": "mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) {\n validateCart(cart: $cart, session: $session) {\n order {\n orderNumber\n acceptedOffer {\n seller {\n identifier\n }\n quantity\n price\n listPrice\n itemOffered {\n sku\n name\n image {\n url\n alternateName\n }\n brand {\n name\n }\n isVariantOf {\n productGroupID\n name\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n gtin\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n }\n }\n messages {\n text\n status\n }\n }\n}\n",
6
6
  "SubscribeToNewsletter": "mutation SubscribeToNewsletter($data: IPersonNewsletter!) {\n subscribeToNewsletter(data: $data) {\n id\n }\n}\n",
7
- "BrowserProductQuery": "query BrowserProductQuery($locator: [IStoreSelectedFacet!]!) {\n product(locator: $locator) {\n id: productID\n sku\n name\n gtin\n description\n isVariantOf {\n name\n productGroupID\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n image {\n url\n alternateName\n }\n brand {\n name\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n seller {\n identifier\n }\n }\n }\n breadcrumbList {\n itemListElement {\n item\n name\n position\n }\n }\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n}\n",
7
+ "BrowserProductQuery": "query BrowserProductQuery($locator: [IStoreSelectedFacet!]!) {\n product(locator: $locator) {\n id: productID\n sku\n name\n gtin\n description\n isVariantOf {\n name\n productGroupID\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n image {\n url\n alternateName\n }\n brand {\n name\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n seller {\n identifier\n }\n }\n }\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n}\n",
8
8
  "ProductsQuery": "query ProductsQuery($first: Int!, $after: String, $sort: StoreSort!, $term: String!, $selectedFacets: [IStoreSelectedFacet!]!) {\n search(\n first: $first\n after: $after\n sort: $sort\n term: $term\n selectedFacets: $selectedFacets\n ) {\n products {\n pageInfo {\n totalCount\n }\n edges {\n node {\n id: productID\n slug\n sku\n brand {\n brandName: name\n name\n }\n name\n gtin\n isVariantOf {\n productGroupID\n name\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n quantity\n seller {\n identifier\n }\n }\n }\n }\n }\n }\n }\n}\n",
9
- "SearchSuggestionsQuery": "query SearchSuggestionsQuery($term: String!, $selectedFacets: [IStoreSelectedFacet!]) {\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n products {\n id: productID\n slug\n sku\n brand {\n brandName: name\n name\n }\n name\n gtin\n isVariantOf {\n productGroupID\n name\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n quantity\n seller {\n identifier\n }\n }\n }\n }\n }\n }\n}\n",
9
+ "SearchSuggestionsQuery": "query SearchSuggestionsQuery($term: String!, $selectedFacets: [IStoreSelectedFacet!]) {\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n products {\n id: productID\n slug\n sku\n brand {\n brandName: name\n name\n }\n name\n gtin\n isVariantOf {\n productGroupID\n name\n }\n image {\n url\n alternateName\n }\n offers {\n lowPrice\n offers {\n availability\n price\n listPrice\n quantity\n seller {\n identifier\n }\n }\n }\n }\n }\n products {\n pageInfo {\n totalCount\n }\n }\n metadata {\n isTermMisspelled\n logicalOperator\n }\n }\n}\n",
10
10
  "TopSearchSuggestionsQuery": "query TopSearchSuggestionsQuery($term: String!, $selectedFacets: [IStoreSelectedFacet!]) {\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n }\n }\n}\n",
11
11
  "ValidateSession": "mutation ValidateSession($session: IStoreSession!, $search: String!) {\n validateSession(session: $session, search: $search) {\n locale\n channel\n country\n addressType\n postalCode\n deliveryMode {\n deliveryChannel\n deliveryMethod\n deliveryWindow {\n startDate\n endDate\n }\n }\n geoCoordinates {\n latitude\n longitude\n }\n currency {\n code\n symbol\n }\n person {\n id\n email\n givenName\n familyName\n }\n }\n}\n",
12
12
  "ShippingSimulationQuery": "query ShippingSimulationQuery($postalCode: String!, $country: String!, $items: [IShippingItem!]!) {\n shipping(items: $items, postalCode: $postalCode, country: $country) {\n logisticsInfo {\n slas {\n carrier\n price\n availableDeliveryWindows {\n startDateUtc\n endDateUtc\n price\n listPrice\n }\n shippingEstimate\n localizedEstimates\n }\n }\n address {\n city\n neighborhood\n }\n }\n}\n"
package/README.md CHANGED
@@ -100,7 +100,7 @@ A quick look at the top-level files and directories you'll see in a NextJS proje
100
100
  ├── __generated__
101
101
  ├── babel.config.js
102
102
  ├── cypress
103
- ├── cypress.json
103
+ ├── cypress.config.ts
104
104
  ├── lighthouserc.js
105
105
  ├── public
106
106
  ├── pull_request_template.md
@@ -136,7 +136,7 @@ A quick look at the top-level files and directories you'll see in a NextJS proje
136
136
 
137
137
  15. **`cypress`**: End to End(e2e) tests using Cypress. Most of the scenarios are covered here. Add your custom flows to avoid regressions
138
138
 
139
- 16. **`cypress.json`**: [Cypress configuration file](https://docs.cypress.io/guides/references/configuration)
139
+ 16. **`cypress.config.ts`**: [Cypress configuration file](https://docs.cypress.io/guides/references/configuration)
140
140
 
141
141
  17. **`lighthouserc.js`**: Configures [Google Lighthouse CI](https://github.com/GoogleChrome/lighthouse-ci). This is where you can turn on/off lighthouse assertions to be used by Lighthouse CI Bot/hook
142
142
 
@@ -412,7 +412,7 @@ Looking for more guidance? Full documentation for FastStore lives [on this GitHu
412
412
 
413
413
  ## ⚡ Performance & QA
414
414
 
415
- This project has strict performance budgets. Right out of the box, this project performs around 95 on Google's Page Speed Insights website, which usually is way more strict than your laptop's chrome lighthouse. Every time you commit to the repository, our QA bots will run and evaluate your code quality. We recommend you NEVER put in production a code that breaks any of the bots. If a bot breaks and still you need to put the code into production, change the bot config (`lighthouserc.js`, `cypress.json`) to make it pass and merge. This way you ensure your website will keep performing well during the years to come.
415
+ This project has strict performance budgets. Right out of the box, this project performs around 95 on Google's Page Speed Insights website, which usually is way more strict than your laptop's chrome lighthouse. Every time you commit to the repository, our QA bots will run and evaluate your code quality. We recommend you NEVER put in production a code that breaks any of the bots. If a bot breaks and still you need to put the code into production, change the bot config (`lighthouserc.js`, `cypress.config.ts`) to make it pass and merge. This way you ensure your website will keep performing well during the years to come.
416
416
 
417
417
  ## Adding third party scripts
418
418
 
package/cypress/global.js CHANGED
@@ -13,3 +13,11 @@ export const options = {
13
13
  }
14
14
  },
15
15
  }
16
+
17
+ // TODO: Bring back these rules when the components with missing/wrong role is found.
18
+ export const disabledA11yRules = {
19
+ rules: {
20
+ region: { enabled: false },
21
+ 'aria-allowed-role': { enabled: false },
22
+ },
23
+ }
@@ -4,6 +4,7 @@
4
4
  * Cypress tests for a11y (accessibility)
5
5
  */
6
6
 
7
+ import { disabledA11yRules } from '../global'
7
8
  import { cypress } from '../../faststore.config'
8
9
 
9
10
  const { pages } = cypress
@@ -13,7 +14,7 @@ describe('Accessibility tests', () => {
13
14
  cy.clearIDB()
14
15
  })
15
16
 
16
- it.skip('checks a11y for collection page', () => {
17
+ it('checks a11y for collection page', () => {
17
18
  cy.visit(pages.collection)
18
19
  cy.waitForHydration()
19
20
 
@@ -21,16 +22,10 @@ describe('Accessibility tests', () => {
21
22
  cy.getById('product-link').should('exist')
22
23
 
23
24
  cy.injectAxe()
24
-
25
- // TODO: Bring back the `aria-allowed-role` when the component with the missing/wrong role is found.
26
- cy.checkA11y(null, {
27
- rules: {
28
- 'aria-allowed-role': { enabled: false },
29
- },
30
- })
25
+ cy.checkA11y(null, disabledA11yRules)
31
26
  })
32
27
 
33
- it.skip('checks a11y for product page', () => {
28
+ it('checks a11y for product page', () => {
34
29
  cy.visit(pages.pdp)
35
30
  cy.waitForHydration()
36
31
 
@@ -38,26 +33,14 @@ describe('Accessibility tests', () => {
38
33
  cy.getById('buy-button').should('exist')
39
34
 
40
35
  cy.injectAxe()
41
-
42
- // TODO: Bring back the `aria-allowed-role` when the component with the missing/wrong role is found.
43
- cy.checkA11y(null, {
44
- rules: {
45
- 'aria-allowed-role': { enabled: false },
46
- },
47
- })
36
+ cy.checkA11y(null, disabledA11yRules)
48
37
  })
49
38
 
50
- it.skip('checks a11y for home page', () => {
39
+ it('checks a11y for home page', () => {
51
40
  cy.visit(pages.home)
52
41
  cy.waitForHydration()
53
42
 
54
43
  cy.injectAxe()
55
-
56
- // TODO: Bring back the `aria-allowed-role` when the component with the missing/wrong role is found.
57
- cy.checkA11y(null, {
58
- rules: {
59
- 'aria-allowed-role': { enabled: false },
60
- },
61
- })
44
+ cy.checkA11y(null, disabledA11yRules)
62
45
  })
63
46
  })
@@ -65,68 +65,60 @@ describe('add_to_cart event', () => {
65
65
  }
66
66
 
67
67
  context('when adding a product to the cart', () => {
68
- it.skip('adds add_to_cart event in the data layer at product description page', () => {
68
+ it('adds add_to_cart event in the data layer at product description page', () => {
69
69
  cy.visit(pages.pdp, options)
70
70
  cy.waitForHydration()
71
71
 
72
72
  cy.itemsInCart(0)
73
73
 
74
74
  // Add to cart
75
- cy.getById('buy-button')
76
- .should('be.visible')
77
- .scrollIntoView({ duration: 500 })
78
- .then(() => {
79
- cy.getById('buy-button')
80
- .click({ force: true })
81
- .then(($btn) => {
82
- cy.itemsInCart(1)
83
- const skuId = $btn.attr('data-sku')
84
-
85
- testAddToCartEvent({ skuId, numberOfEvents: 1 })
86
- })
75
+ cy.getById('buy-button').as('buy-button')
76
+ cy.get('@buy-button').contains('Add to Cart').and('be.visible')
77
+ cy.get('@buy-button')
78
+ .trigger('click', { force: true, cancelable: false })
79
+ .then(($btn) => {
80
+ cy.itemsInCart(1)
81
+
82
+ const skuId = $btn.attr('data-sku')
83
+ testAddToCartEvent({ skuId, numberOfEvents: 1 })
87
84
  })
88
85
  })
89
86
  })
90
87
 
91
88
  context('when increasing product quantity', () => {
92
- it.skip('adds add_to_cart event in the data layer at quantity increase in the minicart', () => {
89
+ it('adds add_to_cart event in the data layer at quantity increase in the minicart', () => {
93
90
  cy.visit(pages.pdp, options)
94
91
  cy.waitForHydration()
95
92
 
96
93
  cy.itemsInCart(0)
97
94
 
98
95
  // Add to cart
99
- cy.getById('buy-button')
100
- .should('be.visible')
101
- .scrollIntoView({ duration: 500 })
102
- .then(() => {
103
- cy.getById('buy-button')
104
- .click({ force: true })
105
- .then(($btn) => {
106
- cy.itemsInCart(1)
107
- const skuId = $btn.attr('data-sku')
96
+ cy.getById('buy-button').as('buy-button')
97
+ cy.get('@buy-button').contains('Add to Cart').and('be.visible')
98
+ cy.get('@buy-button')
99
+ .trigger('click', { force: true, cancelable: false })
100
+ .then(($btn) => {
101
+ cy.itemsInCart(1)
102
+ const skuId = $btn.attr('data-sku')
103
+
104
+ testAddToCartEvent({ skuId, numberOfEvents: 1 })
105
+ })
108
106
 
109
- testAddToCartEvent({ skuId, numberOfEvents: 1 })
107
+ cy.get(
108
+ '[data-testid=fs-cart-item] [data-testid=fs-quantity-selector-right-button]'
109
+ ).trigger('click', { force: true, cancelable: false })
110
110
 
111
- cy.get(
112
- '[data-testid=fs-cart-item] [data-testid=fs-quantity-selector-right-button]'
113
- )
114
- .click()
115
- .then(() => {
116
- cy.itemsInCart(2)
111
+ cy.get('@buy-button').then(($btn) => {
112
+ cy.itemsInCart(2)
113
+ const skuId = $btn.attr('data-sku')
117
114
 
118
- testAddToCartEvent({ skuId, numberOfEvents: 2 })
119
- })
120
- })
121
- })
115
+ testAddToCartEvent({ skuId, numberOfEvents: 2 })
116
+ })
122
117
  })
123
118
  })
124
119
  })
125
120
 
126
121
  describe('remove_from_cart event', () => {
127
- beforeEach(() => {
128
- cy.clearIDB()
129
- })
130
122
  const testRemoveFromCartEvent = ({ skuId, numberOfEvents, quantity }) => {
131
123
  cy.window().then((window) => {
132
124
  const { dataLayer } = window
@@ -152,46 +144,41 @@ describe('remove_from_cart event', () => {
152
144
  }
153
145
 
154
146
  context('when removing a product from cart', () => {
155
- it.skip('adds remove_from_cart event in the data layer', () => {
147
+ it('adds remove_from_cart event in the data layer', () => {
156
148
  cy.visit(pages.pdp, options)
157
149
  cy.waitForHydration()
158
150
 
159
151
  cy.itemsInCart(0)
160
152
 
161
153
  // Add item to cart
162
- cy.getById('buy-button')
163
- .should('be.visible')
164
- .scrollIntoView({ duration: 500 })
165
- .then(() => {
166
- cy.getById('buy-button')
167
- .click({ force: true })
168
- .then(() => {
169
- cy.itemsInCart(1)
170
- cy.getById('checkout-button')
171
- .should('be.visible')
172
- .should('be.enabled')
173
- cy.itemsInCart(1)
154
+ cy.getById('buy-button').as('buy-button')
155
+ cy.get('@buy-button').contains('Add to Cart').should('be.visible')
156
+ cy.get('@buy-button').trigger('click')
174
157
 
175
- // Remove the added item
176
- cy.getById('remove-from-cart-button')
177
- .click({ force: true })
178
- .then(($btn) => {
179
- cy.itemsInCart(0)
180
- const skuId = $btn.attr('data-sku')
158
+ cy.getById('fs-cart-sidebar').should('be.visible')
181
159
 
182
- testRemoveFromCartEvent({
183
- skuId,
184
- numberOfEvents: 1,
185
- quantity: 1,
186
- })
187
- })
188
- })
160
+ cy.itemsInCart(1)
161
+
162
+ // Remove the added item
163
+ cy.getById('remove-from-cart-button').as('remove-from-cart-button')
164
+ cy.get('@remove-from-cart-button')
165
+ .click({ force: true })
166
+ .then(($btn) => {
167
+ cy.itemsInCart(0)
168
+
169
+ const skuId = $btn.attr('data-sku')
170
+
171
+ testRemoveFromCartEvent({
172
+ skuId,
173
+ quantity: 1,
174
+ numberOfEvents: 1,
175
+ })
189
176
  })
190
177
  })
191
178
  })
192
179
 
193
180
  context('when decreasing product quantity', () => {
194
- it.skip('adds remove_from_cart event in the data layer at quantity decrease in the minicart', () => {
181
+ it('adds remove_from_cart event in the data layer at quantity decrease in the minicart', () => {
195
182
  cy.visit(pages.pdp, options)
196
183
  cy.waitForHydration()
197
184
 
@@ -238,7 +225,7 @@ describe('remove_from_cart event', () => {
238
225
  })
239
226
 
240
227
  describe('view_item event', () => {
241
- it.skip('add view_item event in data layer', () => {
228
+ it('add view_item event in data layer', () => {
242
229
  cy.visit(pages.collection, options)
243
230
  cy.waitForHydration()
244
231
 
@@ -253,7 +240,7 @@ describe('view_item event', () => {
253
240
  })
254
241
 
255
242
  describe('select_item event', () => {
256
- it.skip('select_item has the right properties', () => {
243
+ it('select_item has the right properties', () => {
257
244
  cy.visit(pages.collection, options)
258
245
  cy.waitForHydration()
259
246
 
@@ -284,7 +271,7 @@ describe('select_item event', () => {
284
271
  })
285
272
 
286
273
  describe('view_item_list event', () => {
287
- it.skip('is sent when viewing the PLP', () => {
274
+ it('is sent when viewing the PLP', () => {
288
275
  cy.visit(pages.collection, options)
289
276
  cy.waitForHydration()
290
277
 
@@ -306,7 +293,7 @@ describe('view_item_list event', () => {
306
293
  })
307
294
  })
308
295
 
309
- it.skip('is sent when viewing a products shelf', () => {
296
+ it('is sent when viewing a products shelf', () => {
310
297
  cy.visit(pages.home, options)
311
298
  cy.waitForHydration()
312
299
 
@@ -325,7 +312,7 @@ describe('view_item_list event', () => {
325
312
  })
326
313
  })
327
314
 
328
- it.skip('is sent when viewing a product tiles', () => {
315
+ it('is sent when viewing a product tiles', () => {
329
316
  cy.visit(pages.home, options)
330
317
  cy.waitForHydration()
331
318
 
@@ -346,7 +333,7 @@ describe('view_item_list event', () => {
346
333
  })
347
334
 
348
335
  describe('search event', () => {
349
- it.skip('raises search', () => {
336
+ it('raises search', () => {
350
337
  cy.visit(pages.home, options)
351
338
  cy.waitForHydration()
352
339
 
@@ -366,7 +353,7 @@ describe('search event', () => {
366
353
  })
367
354
 
368
355
  describe('view_cart event', () => {
369
- it.skip('is fired when the minicart is opened (without items)', () => {
356
+ it('is fired when the minicart is opened (without items)', () => {
370
357
  cy.visit(pages.pdp, options)
371
358
  cy.waitForHydration()
372
359
 
@@ -375,6 +362,8 @@ describe('view_cart event', () => {
375
362
 
376
363
  dataLayerHasEvent('view_cart')
377
364
 
365
+ cy.itemsInCart(0)
366
+
378
367
  cy.window().then((window) => {
379
368
  const event = window.dataLayer.find(
380
369
  ({ event: eventName }) => eventName === 'view_cart'
@@ -385,27 +374,29 @@ describe('view_cart event', () => {
385
374
  })
386
375
  })
387
376
 
388
- it.skip('is fired when the minicart is opened (with items)', () => {
377
+ it('is fired when the minicart is opened (with items)', () => {
389
378
  cy.visit(pages.pdp, options)
390
379
  cy.waitForHydration()
391
380
 
392
- cy.getById('buy-button')
393
- .should('be.visible')
394
- .scrollIntoView({ duration: 500 })
395
- .then(() => {
396
- cy.getById('buy-button').click({ force: true })
397
- cy.getById('fs-cart-sidebar').should('be.visible')
381
+ cy.itemsInCart(0)
398
382
 
399
- dataLayerHasEvent('view_cart')
383
+ cy.getById('buy-button').as('buy-button')
384
+ cy.get('@buy-button').contains('Add to Cart').should('be.visible')
385
+ cy.get('@buy-button').trigger('click', { force: true, cancelable: false })
400
386
 
401
- cy.window().then((window) => {
402
- const event = window.dataLayer.find(
403
- ({ event: eventName }) => eventName === 'view_cart'
404
- )
387
+ cy.getById('fs-cart-sidebar').should('be.visible')
405
388
 
406
- expect(event.ecommerce.value).to.equal(950)
407
- expect(event.ecommerce.items.length).to.equal(1)
408
- })
409
- })
389
+ dataLayerHasEvent('view_cart')
390
+
391
+ cy.itemsInCart(1)
392
+
393
+ cy.window().then((window) => {
394
+ const event = window.dataLayer.find(
395
+ ({ event: eventName }) => eventName === 'view_cart'
396
+ )
397
+
398
+ expect(event.ecommerce.value).to.equal(950)
399
+ expect(event.ecommerce.items.length).to.equal(1)
400
+ })
410
401
  })
411
402
  })
@@ -14,7 +14,7 @@ describe('Cart Sidebar', () => {
14
14
  cy.clearIDB()
15
15
  })
16
16
 
17
- it.skip('toggles cart sidebar', () => {
17
+ it('toggles cart sidebar', () => {
18
18
  cy.visit(pages.home, options)
19
19
  cy.waitForHydration()
20
20
 
@@ -25,7 +25,7 @@ describe('Cart Sidebar', () => {
25
25
  })
26
26
 
27
27
  context('when opening the cart sidebar', () => {
28
- it.skip('should not scroll the background page', () => {
28
+ it('should not scroll the background page', () => {
29
29
  cy.visit(pages.home, options)
30
30
  cy.waitForHydration()
31
31
 
@@ -49,7 +49,7 @@ describe('On product description pages', () => {
49
49
  })
50
50
 
51
51
  context('when adding a product to cart', () => {
52
- it.skip('successfully adds the product', () => {
52
+ it('successfully adds the product', () => {
53
53
  cy.visit(pages.pdp, options)
54
54
  cy.waitForHydration()
55
55
 
@@ -85,7 +85,7 @@ describe('On product description pages', () => {
85
85
  })
86
86
 
87
87
  context('when removing a product from cart', () => {
88
- it.skip('successfully removes the product', () => {
88
+ it('successfully removes the product', () => {
89
89
  cy.visit(pages.pdp, options)
90
90
  cy.waitForHydration()
91
91
 
@@ -14,7 +14,7 @@ describe('Search page Filters and Sorting options', () => {
14
14
  cy.clearIDB()
15
15
  })
16
16
 
17
- it.skip('Applies filters after click', () => {
17
+ it('Applies filters after click', () => {
18
18
  cy.visit(pages.collection, options)
19
19
  cy.waitForHydration()
20
20
 
@@ -56,7 +56,7 @@ describe('Search page Filters and Sorting options', () => {
56
56
  })
57
57
  })
58
58
 
59
- it.skip('Sort products by price_asc', () => {
59
+ it('Sort products by price_asc', () => {
60
60
  cy.visit(pages.collection_2, options)
61
61
  cy.waitForHydration()
62
62
 
@@ -81,7 +81,7 @@ describe('Search page Filters and Sorting options', () => {
81
81
  })
82
82
  })
83
83
 
84
- it.skip('Sort products by price_desc', () => {
84
+ it('Sort products by price_desc', () => {
85
85
  cy.visit(pages.collection_2, options)
86
86
  cy.waitForHydration()
87
87
  const priceId = '[data-fs-product-grid] [data-testid="price"]'
@@ -111,7 +111,7 @@ describe('Infinite Scroll pagination', () => {
111
111
  cy.clearIDB()
112
112
  })
113
113
 
114
- it.skip('Shows more products when requested', () => {
114
+ it('Shows more products when requested', () => {
115
115
  cy.visit(pages.collection, options)
116
116
  cy.waitForHydration()
117
117
 
@@ -138,7 +138,7 @@ describe('Infinite Scroll pagination', () => {
138
138
  })
139
139
  })
140
140
 
141
- it.skip('Sticks to last seen page on plp pagination', () => {
141
+ it('Sticks to last seen page on plp pagination', () => {
142
142
  cy.visit(pages.collection, options)
143
143
  cy.waitForHydration()
144
144
 
@@ -209,7 +209,7 @@ describe('Infinite Scroll pagination', () => {
209
209
  })
210
210
 
211
211
  // Tests: https://developers.google.com/search/blog/2014/02/infinite-scroll-search-friendly
212
- it.skip('Changes the page being viewed on scroll', () => {
212
+ it('Changes the page being viewed on scroll', () => {
213
213
  cy.visit(pages.collection, options)
214
214
  cy.waitForHydration()
215
215
 
@@ -15,7 +15,7 @@ describe('Search input', () => {
15
15
  })
16
16
 
17
17
  context('when search for generic term', () => {
18
- it.skip('opens the search page', () => {
18
+ it('opens the search page', () => {
19
19
  const term = 'shirt'
20
20
 
21
21
  cy.visit(pages.home, options)