@faststore/core 2.2.0-alpha.5 → 2.2.0-alpha.7

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 (180) hide show
  1. package/.turbo/turbo-build.log +13 -13
  2. package/.turbo/turbo-test.log +10 -10
  3. package/README.md +3 -3
  4. package/cms/faststore/sections.json +12 -0
  5. package/cypress/global.js +8 -0
  6. package/cypress/integration/a11y.test.js +7 -24
  7. package/cypress/integration/analytics.test.js +78 -87
  8. package/cypress/integration/cart.test.js +4 -4
  9. package/cypress/integration/plp.test.js +6 -6
  10. package/cypress/integration/search.test.js +1 -1
  11. package/cypress/integration/seo.test.js +14 -14
  12. package/cypress.config.ts +19 -0
  13. package/faststore.config.js +1 -0
  14. package/package.json +13 -12
  15. package/src/components/cart/CartSidebar/CartSidebar.tsx +41 -27
  16. package/src/components/product/NotAvailableButton/NotAvailableButton.tsx +13 -0
  17. package/src/components/product/NotAvailableButton/index.ts +1 -0
  18. package/src/components/sections/Newsletter/Overrides.tsx +4 -0
  19. package/src/components/sections/ProductDetails/Overrides.tsx +4 -0
  20. package/src/components/sections/ProductDetails/ProductDetails.tsx +21 -15
  21. package/src/components/ui/Newsletter/Newsletter.tsx +6 -44
  22. package/src/components/ui/Newsletter/NewsletterAddendum.tsx +86 -0
  23. package/src/components/ui/Newsletter/index.ts +1 -1
  24. package/src/components/ui/ProductDetails/ProductDetailsSettings.tsx +88 -68
  25. package/src/experimental/index.ts +0 -2
  26. package/src/pages/[...slug].tsx +1 -0
  27. package/src/pages/[slug]/p.tsx +1 -0
  28. package/src/typings/overrides.ts +3 -0
  29. package/.next/BUILD_ID +0 -1
  30. package/.next/build-manifest.json +0 -129
  31. package/.next/cache/.tsbuildinfo +0 -1
  32. package/.next/cache/config.json +0 -7
  33. package/.next/cache/eslint/.cache_1gneedd +0 -1
  34. package/.next/cache/next-server.js.nft.json +0 -1
  35. package/.next/cache/webpack/client-production/0.pack +0 -0
  36. package/.next/cache/webpack/client-production/index.pack +0 -0
  37. package/.next/cache/webpack/server-production/0.pack +0 -0
  38. package/.next/cache/webpack/server-production/index.pack +0 -0
  39. package/.next/export-marker.json +0 -1
  40. package/.next/images-manifest.json +0 -1
  41. package/.next/next-server.js.nft.json +0 -1
  42. package/.next/package.json +0 -1
  43. package/.next/prerender-manifest.json +0 -1
  44. package/.next/react-loadable-manifest.json +0 -44
  45. package/.next/required-server-files.json +0 -1
  46. package/.next/routes-manifest.json +0 -1
  47. package/.next/server/chunks/112.js +0 -2078
  48. package/.next/server/chunks/177.js +0 -120
  49. package/.next/server/chunks/183.js +0 -94
  50. package/.next/server/chunks/184.js +0 -61
  51. package/.next/server/chunks/186.js +0 -113
  52. package/.next/server/chunks/289.js +0 -242
  53. package/.next/server/chunks/312.js +0 -697
  54. package/.next/server/chunks/350.js +0 -200
  55. package/.next/server/chunks/483.js +0 -651
  56. package/.next/server/chunks/52.js +0 -4007
  57. package/.next/server/chunks/53.js +0 -61
  58. package/.next/server/chunks/530.js +0 -626
  59. package/.next/server/chunks/574.js +0 -145
  60. package/.next/server/chunks/576.js +0 -94
  61. package/.next/server/chunks/647.js +0 -437
  62. package/.next/server/chunks/676.js +0 -32
  63. package/.next/server/chunks/693.js +0 -58
  64. package/.next/server/chunks/71.js +0 -1293
  65. package/.next/server/chunks/74.js +0 -4084
  66. package/.next/server/chunks/753.js +0 -554
  67. package/.next/server/chunks/779.js +0 -58
  68. package/.next/server/chunks/817.js +0 -4007
  69. package/.next/server/chunks/825.js +0 -4039
  70. package/.next/server/chunks/854.js +0 -72
  71. package/.next/server/chunks/859.js +0 -959
  72. package/.next/server/chunks/98.js +0 -163
  73. package/.next/server/chunks/988.js +0 -211
  74. package/.next/server/chunks/font-manifest.json +0 -1
  75. package/.next/server/font-manifest.json +0 -1
  76. package/.next/server/middleware-build-manifest.js +0 -1
  77. package/.next/server/middleware-manifest.json +0 -6
  78. package/.next/server/middleware-react-loadable-manifest.js +0 -1
  79. package/.next/server/pages/404.js +0 -386
  80. package/.next/server/pages/404.js.nft.json +0 -1
  81. package/.next/server/pages/500.js +0 -388
  82. package/.next/server/pages/500.js.nft.json +0 -1
  83. package/.next/server/pages/[...slug].js +0 -1128
  84. package/.next/server/pages/[...slug].js.nft.json +0 -1
  85. package/.next/server/pages/[slug]/p.js +0 -2271
  86. package/.next/server/pages/[slug]/p.js.nft.json +0 -1
  87. package/.next/server/pages/_app.js +0 -281
  88. package/.next/server/pages/_app.js.nft.json +0 -1
  89. package/.next/server/pages/_document.js +0 -374
  90. package/.next/server/pages/_document.js.nft.json +0 -1
  91. package/.next/server/pages/_error.js +0 -164
  92. package/.next/server/pages/_error.js.nft.json +0 -1
  93. package/.next/server/pages/account.js +0 -363
  94. package/.next/server/pages/account.js.nft.json +0 -1
  95. package/.next/server/pages/api/graphql.js +0 -450
  96. package/.next/server/pages/api/graphql.js.nft.json +0 -1
  97. package/.next/server/pages/api/health/live.js +0 -31
  98. package/.next/server/pages/api/health/live.js.nft.json +0 -1
  99. package/.next/server/pages/api/health/ready.js +0 -31
  100. package/.next/server/pages/api/health/ready.js.nft.json +0 -1
  101. package/.next/server/pages/api/preview.js +0 -148
  102. package/.next/server/pages/api/preview.js.nft.json +0 -1
  103. package/.next/server/pages/checkout.js +0 -363
  104. package/.next/server/pages/checkout.js.nft.json +0 -1
  105. package/.next/server/pages/en-US/404.html +0 -81
  106. package/.next/server/pages/en-US/404.json +0 -1
  107. package/.next/server/pages/en-US/500.html +0 -81
  108. package/.next/server/pages/en-US/500.json +0 -1
  109. package/.next/server/pages/en-US/account.html +0 -81
  110. package/.next/server/pages/en-US/account.json +0 -1
  111. package/.next/server/pages/en-US/checkout.html +0 -81
  112. package/.next/server/pages/en-US/checkout.json +0 -1
  113. package/.next/server/pages/en-US/login.html +0 -81
  114. package/.next/server/pages/en-US/login.json +0 -1
  115. package/.next/server/pages/en-US/s.html +0 -81
  116. package/.next/server/pages/en-US/s.json +0 -1
  117. package/.next/server/pages/en-US.html +0 -81
  118. package/.next/server/pages/en-US.json +0 -1
  119. package/.next/server/pages/index.js +0 -439
  120. package/.next/server/pages/index.js.nft.json +0 -1
  121. package/.next/server/pages/login.js +0 -368
  122. package/.next/server/pages/login.js.nft.json +0 -1
  123. package/.next/server/pages/s.js +0 -548
  124. package/.next/server/pages/s.js.nft.json +0 -1
  125. package/.next/server/pages-manifest.json +0 -18
  126. package/.next/server/webpack-api-runtime.js +0 -229
  127. package/.next/server/webpack-runtime.js +0 -229
  128. package/.next/static/63Mec0cKi1kSycIPG6y8Z/_buildManifest.js +0 -1
  129. package/.next/static/63Mec0cKi1kSycIPG6y8Z/_ssgManifest.js +0 -1
  130. package/.next/static/chunks/148.3bb7e05cc5d1c1c4.js +0 -1
  131. package/.next/static/chunks/238-0ea98e053285c8dd.js +0 -1
  132. package/.next/static/chunks/243-4d96f27ed60bcbe7.js +0 -1
  133. package/.next/static/chunks/530.848b014622932b93.js +0 -1
  134. package/.next/static/chunks/548-ab84e9e8b49413ab.js +0 -1
  135. package/.next/static/chunks/574.70612be06fd1365f.js +0 -1
  136. package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
  137. package/.next/static/chunks/709.daf1eddebf1e7952.js +0 -1
  138. package/.next/static/chunks/721-42caacad18f27d0c.js +0 -1
  139. package/.next/static/chunks/738-67a288ca3569cdbb.js +0 -1
  140. package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
  141. package/.next/static/chunks/98.40c7e17d9de4eb8f.js +0 -1
  142. package/.next/static/chunks/988.d10040040cdfebbb.js +0 -1
  143. package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
  144. package/.next/static/chunks/main-fd466221927468fd.js +0 -1
  145. package/.next/static/chunks/pages/404-af78f7cd1d3c1f60.js +0 -1
  146. package/.next/static/chunks/pages/500-f6346ca5f9dc4fef.js +0 -1
  147. package/.next/static/chunks/pages/[...slug]-97d48d75131c2a0e.js +0 -1
  148. package/.next/static/chunks/pages/[slug]/p-37a30953f761128f.js +0 -1
  149. package/.next/static/chunks/pages/_app-6d0e6ab9a4dd8106.js +0 -1
  150. package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
  151. package/.next/static/chunks/pages/account-05bd79fb78365e88.js +0 -1
  152. package/.next/static/chunks/pages/checkout-c973786e68f25a39.js +0 -1
  153. package/.next/static/chunks/pages/index-79b05b0071c02fff.js +0 -1
  154. package/.next/static/chunks/pages/login-8deb9243376b6aa1.js +0 -1
  155. package/.next/static/chunks/pages/s-45d23ec628d8832f.js +0 -1
  156. package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
  157. package/.next/static/chunks/webpack-00c7bb6e48f23dff.js +0 -1
  158. package/.next/static/css/527e334fa69cf40a.css +0 -1
  159. package/.next/static/css/6e1a7434f061d0ef.css +0 -1
  160. package/.next/static/css/7ca374e5534a3f68.css +0 -1
  161. package/.next/static/css/9e76fef1c9ca89af.css +0 -1
  162. package/.next/static/css/a2eefb25a4608343.css +0 -1
  163. package/.next/static/css/cb7d1fcea42fab9c.css +0 -1
  164. package/.next/static/css/d5a515091be5db82.css +0 -1
  165. package/.next/static/css/df588bb98c0b0ca6.css +0 -1
  166. package/.next/static/css/e3b039e8f5daf95f.css +0 -1
  167. package/.next/static/css/f0e2d1b8832e935d.css +0 -1
  168. package/.next/trace +0 -80
  169. package/cypress.json +0 -9
  170. package/public/~partytown/debug/partytown-atomics.js +0 -556
  171. package/public/~partytown/debug/partytown-media.js +0 -374
  172. package/public/~partytown/debug/partytown-sandbox-sw.js +0 -543
  173. package/public/~partytown/debug/partytown-sw.js +0 -59
  174. package/public/~partytown/debug/partytown-ww-atomics.js +0 -1789
  175. package/public/~partytown/debug/partytown-ww-sw.js +0 -1781
  176. package/public/~partytown/debug/partytown.js +0 -72
  177. package/public/~partytown/partytown-atomics.js +0 -2
  178. package/public/~partytown/partytown-media.js +0 -2
  179. package/public/~partytown/partytown-sw.js +0 -2
  180. package/public/~partytown/partytown.js +0 -2
@@ -1,7 +1,7 @@
1
1
  $ yarn partytown & yarn generate && next build
2
- $ faststore generate-graphql -c
3
2
  $ partytown copylib ./public/~partytown
4
3
  Partytown lib copied to: /home/runner/work/faststore/faststore/packages/core/public/~partytown
4
+ $ faststore generate-graphql -c
5
5
  success - GraphQL schema, types, and optimizations successfully generated 🎉
6
6
  warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
7
7
  Attention: Next.js now collects completely anonymous telemetry regarding usage.
@@ -23,27 +23,27 @@ info - Generating static pages (7/7)
23
23
  info - Finalizing page optimization...
24
24
 
25
25
  Route (pages) Size First Load JS
26
- ┌ ● / 3.19 kB 197 kB
26
+ ┌ ● / 8.27 kB 126 kB
27
27
  ├ /_app 0 B 77.9 kB
28
- ├ ● /[...slug] 4.84 kB 210 kB
28
+ ├ ● /[...slug] 4.29 kB 139 kB
29
29
  ├ └ css/527e334fa69cf40a.css 1.85 kB
30
- ├ ● /[slug]/p 11.4 kB 205 kB
31
- ├ └ css/7ca374e5534a3f68.css 11.3 kB
32
- ├ ○ /404 1.19 kB 114 kB
33
- ├ ● /500 1.21 kB 114 kB
34
- ├ ● /account 670 B 113 kB
30
+ ├ ● /[slug]/p 11 kB 135 kB
31
+ ├ └ css/1b48021b9c503e72.css 11.4 kB
32
+ ├ ○ /404 1.19 kB 110 kB
33
+ ├ ● /500 1.21 kB 110 kB
34
+ ├ ● /account 668 B 110 kB
35
35
  ├ λ /api/graphql 0 B 77.9 kB
36
36
  ├ λ /api/health/live 0 B 77.9 kB
37
37
  ├ λ /api/health/ready 0 B 77.9 kB
38
38
  ├ λ /api/preview 0 B 77.9 kB
39
- ├ ● /checkout 657 B 113 kB
40
- ├ ● /login 1.09 kB 114 kB
41
- └ ● /s 4.58 kB 129 kB
39
+ ├ ● /checkout 655 B 110 kB
40
+ ├ ● /login 1.09 kB 110 kB
41
+ └ ● /s 4.57 kB 124 kB
42
42
  + First Load JS shared by all 81 kB
43
43
  ├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
44
44
  ├ chunks/main-fd466221927468fd.js 23.9 kB
45
- ├ chunks/pages/_app-6d0e6ab9a4dd8106.js 6.45 kB
46
- ├ chunks/webpack-00c7bb6e48f23dff.js 2.29 kB
45
+ ├ chunks/pages/_app-7db7de3d205714be.js 6.45 kB
46
+ ├ chunks/webpack-bed5a9784a3af4e8.js 2.25 kB
47
47
  └ css/9e76fef1c9ca89af.css 3.06 kB
48
48
 
49
49
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
@@ -1,25 +1,25 @@
1
1
  $ tsdx test
2
2
  ts-jest[versions] (WARN) Version 29.1.0 of jest installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=25.0.0 <26.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
3
3
  ts-jest[versions] (WARN) Version 4.9.4 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=3.4.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
4
- PASS test/server/index.test.ts (10.653s)
4
+ PASS test/server/index.test.ts (8.881s)
5
5
  FastStore GraphQL Layer
6
6
  @faststore/api
7
- ✓ should return a valid GraphQL schema (8ms)
8
- ✓ should return a valid GraphQL schema contain all expected types (21ms)
7
+ ✓ should return a valid GraphQL schema (6ms)
8
+ ✓ should return a valid GraphQL schema contain all expected types (12ms)
9
9
  ✓ should return a valid GraphQL schema contain all expected queries (1ms)
10
- ✓ should return a valid GraphQL schema contain all expected mutations (1ms)
10
+ ✓ should return a valid GraphQL schema contain all expected mutations
11
11
  VTEX API Extension
12
- ✓ getTypeDefsFromFolder function should return an Array (9ms)
13
- Third Party API Extension
14
12
  ✓ getTypeDefsFromFolder function should return an Array (7ms)
13
+ Third Party API Extension
14
+ ✓ getTypeDefsFromFolder function should return an Array (5ms)
15
15
  Final Schema after merging
16
- ✓ should return a valid merged GraphQL schema (41ms)
16
+ ✓ should return a valid merged GraphQL schema (35ms)
17
17
  Envelop
18
- ✓ should exist with its plugins (50ms)
19
- ✓ should handle options and execute (256ms)
18
+ ✓ should exist with its plugins (34ms)
19
+ ✓ should handle options and execute (548ms)
20
20
 
21
21
  Test Suites: 1 passed, 1 total
22
22
  Tests: 9 passed, 9 total
23
23
  Snapshots: 0 total
24
- Time: 11.664s
24
+ Time: 9.653s
25
25
  Ran all test suites.
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
 
@@ -1374,6 +1374,18 @@
1374
1374
  }
1375
1375
  }
1376
1376
  },
1377
+ "notAvailableButton": {
1378
+ "title": "Not Available Button",
1379
+ "description": "Shown when a SKU is not available",
1380
+ "type": "object",
1381
+ "properties": {
1382
+ "title": {
1383
+ "title": "Title",
1384
+ "type": "string",
1385
+ "default": "Not Available"
1386
+ }
1387
+ }
1388
+ },
1377
1389
  "shippingSimulator": {
1378
1390
  "title": "Shipping Simulation",
1379
1391
  "type": "object",
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)