{"id":1095,"date":"2021-12-15T09:40:54","date_gmt":"2021-12-15T09:40:54","guid":{"rendered":"https:\/\/ethosspace.com\/programmers\/?p=1095"},"modified":"2022-03-23T08:18:30","modified_gmt":"2022-03-23T08:18:30","slug":"how-to-configure-cypress-with-microsoft-visual-editor-code","status":"publish","type":"post","link":"https:\/\/ethosspace.com\/programmers\/how-to-configure-cypress-with-microsoft-visual-editor-code\/","title":{"rendered":"How to Configure cypress with Microsoft Visual Editor Code"},"content":{"rendered":"\n<p>To configure or set up cypress with Microsoft Code Editor important prerequisite is machine should have cypress and visual editor code installed. Refer <a href=\"https:\/\/ethosspace.com\/programmers\/steps-to-install-cypress-on-windows-using-npm\/\" title=\"Steps to Install Cypress on Windows using npm\">Installation of cypress on windows<\/a> if not installed. You can <a href=\"https:\/\/code.visualstudio.com\/download\" title=\"https:\/\/code.visualstudio.com\/download\">download and setup Microsoft visual editor code <\/a>from the official website and perform the setup.<\/p>\n\n\n\n<p>Once both cypress and Editor are available on the machine then perform the below steps.<\/p>\n\n\n\n<p>Step 1) Open Visual Studio Code.<\/p>\n\n\n\n<p>Step 2) Create a new folder to store the project files or Open any existing project folder to store files.<\/p>\n\n\n\n<p>Step 3) Click on New File menu as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"483\" src=\"https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-4.png\" alt=\"Welcome window Code\" class=\"wp-image-1096\" srcset=\"https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-4.png 1024w, https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-4-300x142.png 300w, https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-4-768x362.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>New file Code<\/figcaption><\/figure>\n\n\n\n<p>Step 4) Type package.json and save it.<\/p>\n\n\n\n<p>Step 5) In Package.json file need to mention cypress for dev dependency. To do this we have multiple ways. From Terminal Menu Click on New Terminal Menu. We can use this terminal within IDE.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"680\" src=\"https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-5-1024x680.png\" alt=\"Open Terminal in Code editor\" class=\"wp-image-1097\" srcset=\"https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-5-1024x680.png 1024w, https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-5-300x199.png 300w, https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-5-768x510.png 768w, https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-5.png 1028w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Terminal within IDE<\/figcaption><\/figure>\n\n\n\n<p>Step 6) Type command &#8220;npm install &#8211;save-dev cypress&#8221; on Terminal and Wait because this will search for package.json file to install the dev dependencies. so add the below code in a package.json file (use IntelliSense if require to type) <\/p>\n\n\n\n<p>&nbsp; &nbsp;&#8220;devDependencies&#8221;: {&nbsp; &nbsp; &#8220;cypress&#8221;:&#8221;^9.1.1&#8243;&nbsp; &nbsp; }<\/p>\n\n\n\n<p>While writing this blog 9.1.1 was the latest version so use IntelliSense to get the latest version in place of copy-paste.<\/p>\n\n\n\n<p>Save the file and Hit the command &#8220;npm install &#8211;save-dev cypress&#8221; on the terminal.<\/p>\n\n\n\n<p>The terminal will display the below message after installation <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>PS E:\\Cypress Projects&gt; npm install &#8211;save-dev cypress<br>npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should<br>use the URLSearchParams API instead.<\/p><p>added 163 packages, and audited 164 packages in 49s<\/p><p>24 packages are looking for funding<br>run <code>npm fund<\/code> for details<\/p><p>found 0 vulnerabilities<br>PS E:\\Cypress Projects&gt;<\/p><\/blockquote>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1022\" height=\"726\" src=\"https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-6.png\" alt=\"devDependencies in package.json file\" class=\"wp-image-1098\" srcset=\"https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-6.png 1022w, https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-6-300x213.png 300w, https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-6-768x546.png 768w\" sizes=\"auto, (max-width: 1022px) 100vw, 1022px\" \/><figcaption>Installing Cypress Dev Dependencies from Termal using Code Editor.<\/figcaption><\/figure>\n\n\n\n<p>The above command will install the latest version of cypress within your project.<\/p>\n\n\n\n<p>All helpful methods after pressing dot in code editor are coming from node_modules -&gt; @types -&gt; index.d.ts file.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1014\" height=\"718\" src=\"https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-7.png\" alt=\"index.d.ts file from where intellisense is coming from\" class=\"wp-image-1099\" srcset=\"https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-7.png 1014w, https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-7-300x212.png 300w, https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-7-768x544.png 768w\" sizes=\"auto, (max-width: 1014px) 100vw, 1014px\" \/><figcaption>Successful installation of cypress with dev dependencies within the project folder using the code editor.<\/figcaption><\/figure>\n\n\n\n<p>Step 7) How to create Cypress package<\/p>\n\n\n\n<p>In Terminal type command &#8220;npx cypress open&#8221; and press enter.<\/p>\n\n\n\n<p>It will show a message like this <\/p>\n\n\n\n<p>It looks like this is your first time using Cypress: 9.1.1<\/p>\n\n\n\n<p>\u2714 Verified Cypress! C:\\Users\\Admin\\AppData\\Local\\Cypress\\Cache\\9.1.1\\Cypress<\/p>\n\n\n\n<p>Opening Cypress\u2026<\/p>\n\n\n\n<p>In any case, if you receive an error message like <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Cypress verification timed out.<\/p><p>This command failed with the following output:<\/p><p>C:\\Users\\Admin\\AppData\\Local\\Cypress\\Cache\\9.1.1\\Cypress\\Cypress.exe &#8211;smoke-test &#8211;ping=221<\/p><p>Command timed out after 30000 milliseconds: C:\\Users\\Admin\\AppData\\Local\\Cypress\\Cache\\9.1.1\\Cypress\\Cypress.exe &#8211;smoke-test &#8211;ping=221<br>Timed out<\/p><p>Platform: win32-x64 (10.0.19043)<br>Cypress Version: 9.1.1<\/p><\/blockquote>\n\n\n\n<p>Solution for the <strong>above error is <\/strong>Relaunch cypress one more time. If that doesn&#8217;t work then change<\/p>\n\n\n\n<p>VERIFY_TEST_RUNNER_TIMEOUT_MS value to 100000 Which is by default is 30000. &#8221; VERIFY_TEST_RUNNER_TIMEOUT_MS &#8221; is available under verify.js file located &#8220;node_modules\\cypress\\lib\\tasks\\verify.js&#8221; Save the changes and type command &#8220;npx cypress open&#8221; and press enter. <\/p>\n\n\n\n<p>After successful configuration, the user will see cypress Test runner window like below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-8.png\" alt=\"Example Specs by Cypress with industry standards\" class=\"wp-image-1100\" width=\"780\" height=\"530\" srcset=\"https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-8.png 780w, https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-8-300x204.png 300w, https:\/\/ethosspace.com\/programmers\/wp-content\/uploads\/2021\/12\/image-8-768x522.png 768w\" sizes=\"auto, (max-width: 780px) 100vw, 780px\" \/><figcaption>cypress window after successful configuration and installation with code<\/figcaption><\/figure>\n\n\n\n<p>Refer to use <a href=\"https:\/\/ethosspace.com\/programmers\/use-of-the-package-json-file\/\" title=\"Use of the package.json file?\">package.json<\/a> for more information.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To configure or set up cypress with Microsoft Code Editor important prerequisite is machine should have cypress and visual editor code installed. Refer Installation of cypress on windows if not installed. You can download and setup Microsoft visual editor code from the official website and perform the setup. Once both cypress and Editor are available [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[21,20],"tags":[],"class_list":["post-1095","post","type-post","status-publish","format-standard","hentry","category-cypress","category-software-automation-testing"],"aioseo_notices":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"sparkling-featured":false,"sparkling-featured-fullwidth":false,"tab-small":false},"uagb_author_info":{"display_name":"program45_-rt8nb","author_link":"https:\/\/ethosspace.com\/programmers\/author\/program45_-rt8nb\/"},"uagb_comment_info":0,"uagb_excerpt":"To configure or set up cypress with Microsoft Code Editor important prerequisite is machine should have cypress and visual editor code installed. Refer Installation of cypress on windows if not installed. You can download and setup Microsoft visual editor code from the official website and perform the setup. Once both cypress and Editor are available&hellip;","_links":{"self":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/1095","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/comments?post=1095"}],"version-history":[{"count":9,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/1095\/revisions"}],"predecessor-version":[{"id":1345,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/1095\/revisions\/1345"}],"wp:attachment":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/media?parent=1095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/categories?post=1095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/tags?post=1095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}