{"id":23091,"date":"2023-09-12T10:19:21","date_gmt":"2023-09-12T08:19:21","guid":{"rendered":"https:\/\/www.codemotion.com\/magazine\/?p=23091"},"modified":"2023-10-25T11:20:43","modified_gmt":"2023-10-25T09:20:43","slug":"how-to-set-up-a-cypress-typescript-project","status":"publish","type":"post","link":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/","title":{"rendered":"How to Set Up a Cypress TypeScript Project"},"content":{"rendered":"\n<p>Ensuring that your web applications work flawlessly across different browsers has become paramount. This is where Cypress comes into play. That end-to-end testing framework has gained popularity thanks to its simplicity, real-time feedback, and robust testing capabilities. Follow this guide to learn how to set up a Cypress TypeScript project and make your test scripts even more reliable.<\/p>\n\n\n\n<p>We will start from scratch and walk you through the process of creating a Cypress project and integrating it with TypeScript. Let\u2019s dive in!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-cypress\">What Is Cypress?<\/h2>\n\n\n\n<p><a aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.cypress.io\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">Cypress<\/a>\u00a0is a <a aria-label=\"JavaScript-based framework (opens in a new tab)\" href=\"https:\/\/www.codemotion.com\/magazine\/frontend\/javascript\/javascript-frameworks-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">JavaScript-based framework<\/a> for end-to-end and component testing. This open-source technology is built for the modern web. In detail, it is designed to simplify and streamline the process of <strong>writing, running, and debugging tests for web applications<\/strong>. If you are familiar with these technologies, it is something like <a href=\"https:\/\/writech.run\/blog\/how-to-set-up-playwright-in-python-79bc6c34113e\/\" class=\"ek-link\">Playwright<\/a>.<\/p>\n\n\n\n<p>Cypress provides a testing API that makes it easier to write cross-browser tests in both JavaScript and <a aria-label=\"TypeScript (opens in a new tab)\" href=\"https:\/\/www.codemotion.com\/magazine\/backend\/why-you-should-use-typescript-for-your-next-project\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">TypeScript<\/a>. Write test scripts once and execute them on Chrome, Safari, Edge, Opera, Firefox, and many other popular browsers! <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"why-write-cypress-test-scripts-in-typescript\">Why Write Cypress Test Scripts in TypeScript<\/h2>\n\n\n\n<p>There are at least three good reasons to use Cypress with TypeScript:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Greater robustness thanks to type safety<\/strong>: Types reduce the chance of introducing subtle bugs into your tests, making them less flaky and more robust. This leads to higher reliability, as tests are less likely to fail due to issues in the code such as type mismatches.<\/li>\n\n\n\n<li><strong>Improved code maintainability<\/strong>: TypeScript enhances code readability and maintainability by providing a better coding experience than JavaScript. Plus, auto-completion and type inference offered by modern IDEs make it easier to write and understand test code. As your test suite grows, maintaining a clear and organized codebase becomes crucial.<\/li>\n\n\n\n<li><strong>Enhanced collaboration and documentation<\/strong>: A strongly typed language like TypeScript encourages a more structured and documented coding style. When multiple team members collaborate on the same tests, type definitions help ensure that everyone understands the expected inputs and outputs for functions and components, reducing errors and communication overhead.<\/li>\n<\/ul>\n\n\n\n<p>While TypeScript offers several benefits, it also introduces a few challenges. Its learning curve is steeper than JavaScript\u2019s and can make writing tests a bit slower. The main problem, however, is that adding TypeScript to the Cypress test environment requires some initial effort. Avoid that headache with our complete Cypress TypeScript setup guide!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"initializing-a-cypress-typescript-project\">Initializing a Cypress TypeScript Project<\/h2>\n\n\n\n<p>Follow this step-by-step tutorial and learn how to create a Cypress project for TypeScript E2E testing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-1-initialize-an-npm-project\">Step 1: Initialize an npm Project<\/h3>\n\n\n\n<p>Open the terminal and create a&nbsp;<code>cypress-typescript-demo<\/code>&nbsp;folder for your Cypress project:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">mkdir cypress-typescript-demo<\/code><\/span><\/pre>\n\n\n<p>In a real-world example, give the directory a more appropriate name.<\/p>\n\n\n\n<p>Enter it:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">cd cypress-typescript-demo<\/code><\/span><\/pre>\n\n\n<p>And launch the command below to initialize an npm project:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">npm init -y <\/code><\/span><\/pre>\n\n\n<p>Great! Your&nbsp;<code>cypress-typescript-demo<\/code>&nbsp;folder will now contain a&nbsp;<code>package.json<\/code>&nbsp;file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-2-set-up-cypress\">Step 2: Set Up Cypress<\/h3>\n\n\n\n<p>Make sure to meet the&nbsp;<a href=\"https:\/\/docs.cypress.io\/guides\/getting-started\/installing-cypress#System-requirements\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">Cypress system requirements<\/a>&nbsp;before proceeding.<\/p>\n\n\n\n<p>Now, add Cypress to your project\u2019s dependencies with:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">npm install cypress --save-dev<\/code><\/span><\/pre>\n\n\n<p>The above command will install&nbsp;<a href=\"https:\/\/www.npmjs.com\/package\/cypress\"><code>cypress<\/code><\/a>&nbsp;locally as a dev dependency in the project. It may take a while, so be patient.<\/p>\n\n\n\n<p>Open Cypress with:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">npx cypress open<\/code><\/span><\/pre>\n\n\n<p>The first time you launch this command, it will start a setup wizard:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"684\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-1024x684.png\" alt=\"The &quot;What's New in Cypress&quot; view\" class=\"wp-image-23092\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-1024x684.png 1024w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-300x201.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-768x513.png 768w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-600x400.png 600w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image.png 1360w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">The &#8220;What&#8217;s New in Cypress&#8221; view<\/figcaption><\/figure>\n\n\n\n<p>Here you can see the new features available in the latest version of Cypress. Click \u201cContinue &gt;\u201d to move on.<\/p>\n\n\n\n<p>In the next view, select the type of testing project you want to initialize:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"684\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-1-1024x684.png\" alt=\"Selecting &quot;E2E Testing&quot;\" class=\"wp-image-23094\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-1-1024x684.png 1024w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-1-300x201.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-1-768x513.png 768w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-1-600x400.png 600w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-1.png 1360w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Selecting &#8220;E2E Testing&#8221;<\/figcaption><\/figure>\n\n\n\n<p>In this example, go for \u201cE2E testing,\u201d which is the most common scenario.<\/p>\n\n\n\n<p>This will initialize the following file structure in the root folder of your project:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\">\u251c\u2500\u2500 <span class=\"hljs-selector-tag\">cypress<\/span><span class=\"hljs-selector-class\">.config<\/span><span class=\"hljs-selector-class\">.js<\/span>\n\u2514\u2500\u2500 <span class=\"hljs-selector-tag\">cypress<\/span>\n    \u251c\u2500\u2500 <span class=\"hljs-selector-tag\">downloads<\/span>\n    \u251c\u2500\u2500 <span class=\"hljs-selector-tag\">e2e<\/span>\n    \u251c\u2500\u2500 <span class=\"hljs-selector-tag\">fixtures<\/span>\n    \u2514\u2500\u2500 <span class=\"hljs-selector-tag\">support<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>You will be notified of that operation by the window below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"684\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-2-1024x684.png\" alt=\"The files created by Cypress\" class=\"wp-image-23095\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-2-1024x684.png 1024w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-2-300x201.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-2-768x513.png 768w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-2-600x400.png 600w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-2.png 1360w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">The files created by Cypress<\/figcaption><\/figure>\n\n\n\n<p>Again, click the \u201cContinue\u201d button.<\/p>\n\n\n\n<p>You will now be asked to select the browser you want to launch your tests on. Ignore that and close all the open windows.<\/p>\n\n\n\n<p>Fantastic! You now have a Cypress project in place. Time to add TypeScript.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-3-configure-typescript\">Step 3: Configure TypeScript<\/h3>\n\n\n\n<p>First, add TypeScript to your project\u2019s dependencies with:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">npm install typescript --save-dev<\/code><\/span><\/pre>\n\n\n<p>This will install&nbsp;<a href=\"https:\/\/www.npmjs.com\/package\/typescript\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\"><code>typescript<\/code><\/a>&nbsp;locally as a dev dependency in the project.<\/p>\n\n\n\n<p>Nest, initialize a TypeScript configuration file with:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">npx tsc --init<\/code><\/span><\/pre>\n\n\n<p>That will create a&nbsp;<code>tsconfig.json<\/code>&nbsp;in the root of your project. Open it and replace its content with:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JSON \/ JSON with Comments\" data-shcb-language-slug=\"json\"><span><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"compilerOptions\"<\/span>: {\n    <span class=\"hljs-attr\">\"target\"<\/span>: <span class=\"hljs-string\">\"es5\"<\/span>,\n    <span class=\"hljs-attr\">\"lib\"<\/span>: &#91;<span class=\"hljs-string\">\"es5\"<\/span>, <span class=\"hljs-string\">\"dom\"<\/span>],\n    <span class=\"hljs-attr\">\"types\"<\/span>: &#91;<span class=\"hljs-string\">\"cypress\"<\/span>, <span class=\"hljs-string\">\"node\"<\/span>]\n  },\n  <span class=\"hljs-attr\">\"include\"<\/span>: &#91;<span class=\"hljs-string\">\"**\/*.ts\"<\/span>]\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JSON \/ JSON with Comments<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">json<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><code>target<\/code>&nbsp;instructs the TypeScript compiler to compile the TS application into an ECMAScript 5 JavaScript application. Instead,&nbsp;<code>\"types\"<\/code>&nbsp;tells the compiler to include only Cypress and Node.js type definitions.<\/p>\n\n\n\n<p><strong>Note<\/strong>: You may need to restart your IDE\u2019s TypeScript server after adding&nbsp;<code>tsconfig.json<\/code>.<\/p>\n\n\n\n<p>Wonderful! You have everything required to write your first Cypress Typescript script.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-4-create-your-first-cypress-typescript-script\">Step 4: Create Your First Cypress TypeScript Script<\/h3>\n\n\n\n<p>Open Cypress again:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">npx cypress open<\/code><\/span><\/pre>\n\n\n<p>Choose \u201cE2E Testing\u201d and reach the browser selection view again:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"684\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-3-1024x684.png\" alt=\"Selecting the browser\" class=\"wp-image-23096\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-3-1024x684.png 1024w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-3-300x201.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-3-768x513.png 768w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-3-600x400.png 600w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-3.png 1360w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Selecting the browser<\/figcaption><\/figure>\n\n\n\n<p>In this example, we are going to choose \u201cChrome,\u201d but any other browser will do. Click \u201cStart E2E Testing in Chrome.\u201d<\/p>\n\n\n\n<p>This will open the Cypress spec file creation modal:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"877\" height=\"428\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-4.png\" alt=\"Giving the test a name\" class=\"wp-image-23097\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-4.png 877w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-4-300x146.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-4-768x375.png 768w\" sizes=\"auto, (max-width: 877px) 100vw, 877px\" \/><figcaption class=\"wp-element-caption\">Giving the test a name<\/figcaption><\/figure>\n\n\n\n<p>Give your test a name, being careful to specify&nbsp;<code>.ts<\/code>&nbsp;as the extension so that it will be treated as a TypeScript file by your IDE. Then, click \u201cCreate spec.\u201d<\/p>\n\n\n\n<p><strong>Note<\/strong>: If you are not familiar with Cypress,&nbsp;<a href=\"https:\/\/docs.cypress.io\/guides\/core-concepts\/writing-and-organizing-tests#Spec-files\" class=\"ek-link\"><code>.spec<\/code><\/a>&nbsp;<a href=\"https:\/\/docs.cypress.io\/guides\/core-concepts\/writing-and-organizing-tests#Spec-files\" class=\"ek-link\">files<\/a>&nbsp;are the test files that contain the testing logic.<\/p>\n\n\n\n<p>Cypress will initialize the following sample spec for you inside the&nbsp;<code>.\/cypress\/e2e<\/code>&nbsp;folder:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">describe(<span class=\"hljs-string\">'template spec'<\/span>, () =&gt; {\n  it(<span class=\"hljs-string\">'passes'<\/span>, () =&gt; {\n    cy.visit(<span class=\"hljs-string\">'https:\/\/example.cypress.io'<\/span>)\n  })\n})<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>It will also launch it by default. So, you will see:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-5-1024x547.png\" alt=\"The test gets executed automatically\" class=\"wp-image-23098\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-5-1024x547.png 1024w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-5-300x160.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-5-768x410.png 768w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-5-1536x821.png 1536w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-5.png 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">The test gets executed automatically<\/figcaption><\/figure>\n\n\n\n<p>Here, you can verify that the Cypress TypeScript test simply tries to visit an example page.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-5-customize-your-test-logic-in-typescript\">Step 5: Customize Your Test Logic in TypeScript<\/h3>\n\n\n\n<p>Update your script with some testing logic:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">describe(<span class=\"hljs-string\">'template spec'<\/span>, () =&gt; {\n  it(<span class=\"hljs-string\">'Contains \"Kitchen Sink\"'<\/span>, () =&gt; {\n    cy.visit(<span class=\"hljs-string\">'https:\/\/example.cypress.io'<\/span>)\n\n    <span class=\"hljs-comment\">\/\/ verify that the h1 element contains the expected string<\/span>\n    <span class=\"hljs-keyword\">const<\/span> title = <span class=\"hljs-string\">'Kitchen Sink'<\/span>\n    <span class=\"hljs-keyword\">const<\/span> titleElement = cy.get(<span class=\"hljs-string\">'h1'<\/span>).first()\n    titleElement.should(<span class=\"hljs-string\">'include.text'<\/span>, title)\n  })\n})<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>This simple test verifies that the&nbsp;<code>&lt;h1&gt;<\/code>&nbsp;element of the test page seen earlier contains the \u201cKitchen Sink\u201d string.<\/p>\n\n\n\n<p>Cypress will automatically detect the changes and run the new testing logic for you:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-6-1024x547.png\" alt=\"The test completes successfully\" class=\"wp-image-23099\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-6-1024x547.png 1024w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-6-300x160.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-6-768x410.png 768w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-6-1536x821.png 1536w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-6.png 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">The test completes successfully<\/figcaption><\/figure>\n\n\n\n<p>Perfect, the test works as expected.<\/p>\n\n\n\n<p>Now, suppose you get confused between&nbsp;<code>title<\/code>&nbsp;and&nbsp;<code>titleElement<\/code>. You may end up writing some broken code:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"783\" height=\"336\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-7.png\" alt=\"The IDE reports the error\" class=\"wp-image-23100\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-7.png 783w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-7-300x129.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-7-768x330.png 768w\" sizes=\"auto, (max-width: 783px) 100vw, 783px\" \/><figcaption class=\"wp-element-caption\">The IDE reports the error<\/figcaption><\/figure>\n\n\n\n<p>Thanks to the TypeScript integration, the IDE will immediately warn you about the error. This helps make the test more robust and saves time waiting for Cypress to report the error:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"585\" height=\"661\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-8.png\" alt=\"Cypress reports the error\" class=\"wp-image-23101\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-8.png 585w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/09\/image-8-266x300.png 266w\" sizes=\"auto, (max-width: 585px) 100vw, 585px\" \/><figcaption class=\"wp-element-caption\">Cypress reports the error<\/figcaption><\/figure>\n\n\n\n<p>Et voil\u00e0! You just learned how to use Cypress with TypeScript to take your E2E testing process to the next level!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"bonus-define-custom-cypress-commands-and-assertions-in-typescript\">Bonus: Define Custom Cypress Commands and Assertions in TypeScript<\/h2>\n\n\n\n<p>Cypress offers full TypeScript integration, also supporting the definition of custom commands and assertions.<\/p>\n\n\n\n<p>For new commands, all you have to do is specify the custom logic&nbsp;<a href=\"https:\/\/docs.cypress.io\/api\/cypress-api\/custom-commands\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">as explained in the docs<\/a>&nbsp;and then add the required TypeScript type declaration files inside the&nbsp;<code>.\/cypress\/support<\/code>&nbsp;folder. Check out the&nbsp;<a href=\"https:\/\/docs.cypress.io\/guides\/tooling\/typescript-support#Types-for-Custom-Commands\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">\u201dTypes for Custom Commands\u201d<\/a>&nbsp;chapter from the official documentation for complete examples.<\/p>\n\n\n\n<p>As for custom assertions, you need to&nbsp;<a href=\"https:\/\/github.com\/cypress-io\/cypress-example-recipes\/tree\/master\/examples\/extending-cypress__chai-assertions\">define them through the Chai language<\/a>&nbsp;and then extend the TypeScript assertion types to make the compiler understand the new methods.&nbsp;<a href=\"https:\/\/docs.cypress.io\/guides\/tooling\/typescript-support#Types-for-custom-assertions\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">Find out more in the doc<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>In this article, you looked at what Cypress is and how to integrate it with TypeScript. As seen here, writing E2E tests in TypeScript brings several benefits, and setting up a Cypress TypeScript is not complex.<\/p>\n\n\n\n<p>Through a step-by-step guide, you had the opportunity to learn how to use TypeScript in your Cypress scripts. Robust testing has never been easier!<\/p>\n\n\n\n<p>Thanks for reading! We hope you found this article helpful!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let\u2019s see how to integrate Cypress with TypeScript in this guided tutorial!<\/p>\n","protected":false},"author":160,"featured_media":20256,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[31],"tags":[],"collections":[],"class_list":{"0":"post-23091","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-web-developer","8":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Set Up a Cypress TypeScript Project - Codemotion Magazine<\/title>\n<meta name=\"description\" content=\"Let\u2019s see what benefits TypeScript can bring to Cypress tests and how to configure a Cypress TypeScript project!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Set Up a Cypress TypeScript Project\" \/>\n<meta property=\"og:description\" content=\"Let\u2019s see what benefits TypeScript can bring to Cypress tests and how to configure a Cypress TypeScript project!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/\" \/>\n<meta property=\"og:site_name\" content=\"Codemotion Magazine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Codemotion.Italy\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-12T08:19:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-25T09:20:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1194\" \/>\n\t<meta property=\"og:image:height\" content=\"878\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Antonello Zanini\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:site\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Antonello Zanini\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/how-to-set-up-a-cypress-typescript-project\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/how-to-set-up-a-cypress-typescript-project\\\/\"},\"author\":{\"name\":\"Antonello Zanini\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/1fd4f55ec0d9743347559c715b9edf4a\"},\"headline\":\"How to Set Up a Cypress TypeScript Project\",\"datePublished\":\"2023-09-12T08:19:21+00:00\",\"dateModified\":\"2023-10-25T09:20:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/how-to-set-up-a-cypress-typescript-project\\\/\"},\"wordCount\":1251,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/how-to-set-up-a-cypress-typescript-project\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/iStock-1288800172.jpg\",\"articleSection\":[\"Web Developer\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/how-to-set-up-a-cypress-typescript-project\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/how-to-set-up-a-cypress-typescript-project\\\/\",\"name\":\"How to Set Up a Cypress TypeScript Project - Codemotion Magazine\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/how-to-set-up-a-cypress-typescript-project\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/how-to-set-up-a-cypress-typescript-project\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/iStock-1288800172.jpg\",\"datePublished\":\"2023-09-12T08:19:21+00:00\",\"dateModified\":\"2023-10-25T09:20:43+00:00\",\"description\":\"Let\u2019s see what benefits TypeScript can bring to Cypress tests and how to configure a Cypress TypeScript project!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/how-to-set-up-a-cypress-typescript-project\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/how-to-set-up-a-cypress-typescript-project\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/how-to-set-up-a-cypress-typescript-project\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/iStock-1288800172.jpg\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/iStock-1288800172.jpg\",\"width\":1194,\"height\":878,\"caption\":\"3D Web Vector Illustrations. Computer and account login and password form page on screen. Sign in to account, user authorization, login authentication page concept. Username, password fields.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/how-to-set-up-a-cypress-typescript-project\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Frontend\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Web Developer\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/frontend\\\/web-developer\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"How to Set Up a Cypress TypeScript Project\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"name\":\"Codemotion Magazine\",\"description\":\"We code the future. Together\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\",\"name\":\"Codemotion\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"width\":225,\"height\":225,\"caption\":\"Codemotion\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Codemotion.Italy\\\/\",\"https:\\\/\\\/x.com\\\/CodemotionIT\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/1fd4f55ec0d9743347559c715b9edf4a\",\"name\":\"Antonello Zanini\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8df9ffe2e0d01ee1cf62c1307c69fd078041934eefd24c47eda05b4f57b4550e?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8df9ffe2e0d01ee1cf62c1307c69fd078041934eefd24c47eda05b4f57b4550e?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8df9ffe2e0d01ee1cf62c1307c69fd078041934eefd24c47eda05b4f57b4550e?s=96&d=mm&r=g\",\"caption\":\"Antonello Zanini\"},\"description\":\"I'm a software engineer, but I prefer to call myself a Technology Bishop. Spreading knowledge through writing is my mission.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/antonello-zanini?originalSubdomain=it\"],\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/author\\\/antonello-zanini\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Set Up a Cypress TypeScript Project - Codemotion Magazine","description":"Let\u2019s see what benefits TypeScript can bring to Cypress tests and how to configure a Cypress TypeScript project!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/","og_locale":"en_US","og_type":"article","og_title":"How to Set Up a Cypress TypeScript Project","og_description":"Let\u2019s see what benefits TypeScript can bring to Cypress tests and how to configure a Cypress TypeScript project!","og_url":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/","og_site_name":"Codemotion Magazine","article_publisher":"https:\/\/www.facebook.com\/Codemotion.Italy\/","article_published_time":"2023-09-12T08:19:21+00:00","article_modified_time":"2023-10-25T09:20:43+00:00","og_image":[{"width":1194,"height":878,"url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172.jpg","type":"image\/jpeg"}],"author":"Antonello Zanini","twitter_card":"summary_large_image","twitter_creator":"@CodemotionIT","twitter_site":"@CodemotionIT","twitter_misc":{"Written by":"Antonello Zanini","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/#article","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/"},"author":{"name":"Antonello Zanini","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/1fd4f55ec0d9743347559c715b9edf4a"},"headline":"How to Set Up a Cypress TypeScript Project","datePublished":"2023-09-12T08:19:21+00:00","dateModified":"2023-10-25T09:20:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/"},"wordCount":1251,"publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172.jpg","articleSection":["Web Developer"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/","url":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/","name":"How to Set Up a Cypress TypeScript Project - Codemotion Magazine","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/#primaryimage"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172.jpg","datePublished":"2023-09-12T08:19:21+00:00","dateModified":"2023-10-25T09:20:43+00:00","description":"Let\u2019s see what benefits TypeScript can bring to Cypress tests and how to configure a Cypress TypeScript project!","breadcrumb":{"@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/#primaryimage","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172.jpg","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172.jpg","width":1194,"height":878,"caption":"3D Web Vector Illustrations. Computer and account login and password form page on screen. Sign in to account, user authorization, login authentication page concept. Username, password fields."},{"@type":"BreadcrumbList","@id":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/how-to-set-up-a-cypress-typescript-project\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codemotion.com\/magazine\/"},{"@type":"ListItem","position":2,"name":"Frontend","item":"https:\/\/www.codemotion.com\/magazine\/frontend\/"},{"@type":"ListItem","position":3,"name":"Web Developer","item":"https:\/\/www.codemotion.com\/magazine\/frontend\/web-developer\/"},{"@type":"ListItem","position":4,"name":"How to Set Up a Cypress TypeScript Project"}]},{"@type":"WebSite","@id":"https:\/\/www.codemotion.com\/magazine\/#website","url":"https:\/\/www.codemotion.com\/magazine\/","name":"Codemotion Magazine","description":"We code the future. Together","publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codemotion.com\/magazine\/#organization","name":"Codemotion","url":"https:\/\/www.codemotion.com\/magazine\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","width":225,"height":225,"caption":"Codemotion"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Codemotion.Italy\/","https:\/\/x.com\/CodemotionIT"]},{"@type":"Person","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/1fd4f55ec0d9743347559c715b9edf4a","name":"Antonello Zanini","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8df9ffe2e0d01ee1cf62c1307c69fd078041934eefd24c47eda05b4f57b4550e?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8df9ffe2e0d01ee1cf62c1307c69fd078041934eefd24c47eda05b4f57b4550e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8df9ffe2e0d01ee1cf62c1307c69fd078041934eefd24c47eda05b4f57b4550e?s=96&d=mm&r=g","caption":"Antonello Zanini"},"description":"I'm a software engineer, but I prefer to call myself a Technology Bishop. Spreading knowledge through writing is my mission.","sameAs":["https:\/\/www.linkedin.com\/in\/antonello-zanini?originalSubdomain=it"],"url":"https:\/\/www.codemotion.com\/magazine\/author\/antonello-zanini\/"}]}},"featured_image_src":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172-600x400.jpg","featured_image_src_square":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172-600x600.jpg","author_info":{"display_name":"Antonello Zanini","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/antonello-zanini\/"},"uagb_featured_image_src":{"full":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172.jpg",1194,878,false],"thumbnail":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172-150x150.jpg",150,150,true],"medium":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172-300x221.jpg",300,221,true],"medium_large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172-768x565.jpg",768,565,true],"large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172-1024x753.jpg",1024,753,true],"1536x1536":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172.jpg",1194,878,false],"2048x2048":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172.jpg",1194,878,false],"small-home-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172.jpg",100,74,false],"sidebar-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172-180x128.jpg",180,128,true],"genesis-singular-images":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172-896x504.jpg",896,504,true],"archive-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172-400x225.jpg",400,225,true],"gb-block-post-grid-landscape":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172-600x400.jpg",600,400,true],"gb-block-post-grid-square":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/02\/iStock-1288800172-600x600.jpg",600,600,true]},"uagb_author_info":{"display_name":"Antonello Zanini","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/antonello-zanini\/"},"uagb_comment_info":0,"uagb_excerpt":"Let\u2019s see how to integrate Cypress with TypeScript in this guided tutorial!","lang":"en","_links":{"self":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/23091","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/users\/160"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/comments?post=23091"}],"version-history":[{"count":2,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/23091\/revisions"}],"predecessor-version":[{"id":24080,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/23091\/revisions\/24080"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media\/20256"}],"wp:attachment":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media?parent=23091"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/categories?post=23091"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/tags?post=23091"},{"taxonomy":"collections","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/collections?post=23091"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}