[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-504856-105":3,"detail-sidebar-cat-0-en-105":80,"doc-detail-504856-en":129,"doc-similar-504856":160},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":9,"keywords":10,"description":11,"schema_data":12,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","why-cypress-is-the-best-way-to-test","","Guide on end-to-end testing web apps using Cypress, describing why Cypress is an effective alternative to more setup-heavy approaches. Covers installing Cypress, opening the test runner, and inspecting the generated example suite. Demonstrates a practical login.spec.js workflow with cy.visit, cy.get, .type, .click, and assertions on UI state like login failure messages. Explains how Cypress automatically handles waiting and timeouts, and how interactive test runner usage helps diagnose failures visually.",{"@graph":13,"@context":72},[14,33,55],{"@type":15,"itemListElement":16},"BreadcrumbList",[17,22,26,30],{"item":18,"name":19,"@type":20,"position":21},"https://docshare.wps.com","Home","ListItem",1,{"item":23,"name":24,"@type":20,"position":25},"https://docshare.wps.com/document/","Document",2,{"item":27,"name":28,"@type":20,"position":29},"https://docshare.wps.com/document/technology/","Technology",3,{"item":31,"name":9,"@type":20,"position":32},"https://docshare.wps.com/document/why-cypress-is-the-best-way-to-test/504856/",4,{"url":31,"name":9,"@type":34,"image":35,"author":40,"headline":9,"publisher":43,"fileFormat":46,"inLanguage":8,"description":11,"dateModified":47,"datePublished":48,"encodingFormat":46,"isAccessibleForFree":49,"interactionStatistic":50},"DigitalDocument",{"url":36,"@type":37,"width":38,"height":39},"https://docshare.wps.com/thumbnails/why-cypress-is-the-best-way-to-test/504856.png","ImageObject",300,407,{"name":41,"@type":42},"Miles","Person",{"url":18,"name":44,"@type":45},"DocShare","Organization","application/pdf","2026-11-24","2026-10-04",true,{"@type":51,"interactionType":52,"userInteractionCount":54},"InteractionCounter",{"@type":53},"ViewAction",8,{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"Why choose Cypress for end-to-end testing?","Question",{"text":62,"@type":63},"Cypress is designed to be easy to set up, has no dependencies, and is straightforward to write and use, reducing setup hassle while keeping tests readable and maintainable.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"How does the example login test verify email and password input?",{"text":67,"@type":63},"The tests locate elements like #email and #password using cy.get, enter values with .type, and confirm expectations with .should checks on the input value.",{"name":69,"@type":60,"acceptedAnswer":70},"How does Cypress handle navigation timing when checking the post-login URL?",{"text":71,"@type":63},"Cypress automatically waits using its default timeout, so assertions like cy.location(\"pathname\").should(\"include\",\"/user/profile\") don’t require explicit waiting for navigation to complete.","https://schema.org",{"og:url":31,"og:type":74,"og:title":9,"og:site_name":44,"og:description":11},"article",{"robots":76,"canonical":31},"index,follow",{"doc_id":78,"site_id":7},504856,1791535813,{"code":4,"msg":81,"data":82},"success",[83,87,91,95,100,104,109,113,118,121,125],{"id":21,"doc_module":4,"doc_module_name":24,"category_name":84,"show_sort_weight":85,"slug":86},"Story & Novel",90,"story-novel",{"id":25,"doc_module":4,"doc_module_name":24,"category_name":88,"show_sort_weight":89,"slug":90},"Literature",80,"literature",{"id":32,"doc_module":4,"doc_module_name":24,"category_name":92,"show_sort_weight":93,"slug":94},"Exam",70,"exam",{"id":96,"doc_module":4,"doc_module_name":24,"category_name":97,"show_sort_weight":98,"slug":99},5,"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":24,"category_name":28,"show_sort_weight":102,"slug":103},6,50,"technology",{"id":105,"doc_module":4,"doc_module_name":24,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":54,"doc_module":4,"doc_module_name":24,"category_name":110,"show_sort_weight":111,"slug":112},"Research & Report",30,"research-report",{"id":114,"doc_module":4,"doc_module_name":24,"category_name":115,"show_sort_weight":116,"slug":117},9,"Religion & Spirituality",20,"religion-spirituality",{"id":116,"doc_module":4,"doc_module_name":24,"category_name":119,"show_sort_weight":116,"slug":120},"World Cup","world-cup",{"id":122,"doc_module":4,"doc_module_name":24,"category_name":123,"show_sort_weight":122,"slug":124},10,"Lifestyle","lifestyle",{"id":126,"doc_module":4,"doc_module_name":24,"category_name":127,"show_sort_weight":96,"slug":128},19,"General","general",{"code":4,"msg":81,"data":130},{"doc_id":78,"user_id":131,"nickname":41,"user_avatar":132,"doc_module":4,"category_id":101,"category_name":28,"doc_title":9,"doc_description":11,"doc_content":133,"file_id":134,"file_url":135,"file_type":136,"file_size":137,"view_count":54,"is_deleted":4,"is_public":21,"is_downloadable":21,"audit_status":21,"page_count":32,"language":138,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":139,"faqs":140,"seo_title":141,"seo_description":11,"update_tm":142,"read_time":122,"preview_page_count":32,"preview_urls":143},13056703019404,"https://ap-avatar.wpscdn.com/davatar_29158cc5080c5b710cf443261637dec0","Fast end-to-end testing-Why Cypress is the best way to test  \nWritten by Seth Corker on Benevolent Bytes  \nThank [https://www. drawkit.io/ by @JamesDaly90](https://www. drawkit.io/ by @JamesDaly90) for the slick illustration used as part of this title card  \nHow to start testing web apps with Cypress, a brief tutorial  \nCypress is a JavaScript end-to-end testing framework that allows you to write tests that run in a browser much like Selenium. The key difference is that it is easy to set up, has no dependencies and is a pleasure to write tests with and use. It takes the hassle of setup and replaces it with the joy of getting things done.  \nGetting started with Cypress in minutes  \nI have created a sample web app and I’d like to run some simple tests to see if the login works as expected. The sample application we will look at is written in JavaScript using Preact but Cypress is capable of testing any web app. If you’re interested, take a look at my previous article Save user’s data with a lighter version of React to learn a bit about building an application with Preact.  \nGet Setup Getting started is as easy as npm install cypress--save-dev, you can open the test runner with npx cypress open or by adding it to your project scripts:  \nFigure 1: a snippet of json in package.json scripts,“cypress:open”: “cypress open”  \nLet’s Write a Test When starting cypress for the first time, it creates a full suite of example tests which are really useful to look through and figure out what capabilities Cypress has to offer and how to start using them right away. I recommend taking a brief look to get you started, you can keep the examples around for a while for reference until you get some of your own tests up and running.  \nBelow is the login page which we want to test using Cypress. There are a few things which will make testing easier. You need to be able to find the elements you want to interact with in the DOM, this can be done using query selectors and because this is a very simple example, I’ve added IDs to the elements which need to be interacted with regularly: \\#emailand \\#password.  \nIn /cypress/integration/login.spec.js we can add our tests. This should look familiar to anyone who has used testing frameworks like Jest before. You’ll notice before each test we visit the login page which is locally hosted using a simple server.  \ncontext ( \"Login\" , () => { beforeEach (() => {  \ncy.visit (\"localhost:8080/login\")})  \nit ( \"can find and type in email\" , () => { cy.get( \"\\#email\" )  \n.type(\"[fake@email.com](fake@email.com) \")  \n.should(\"have .value\", \"[fake@email.com](fake@email.com) \")  \nFigure 2: a login screen in a web app  \n})  \nit ( \"can find and type in password\" , () => { cy.get(\"\\#password\")  \n.type(\"fakepassword\")  \n.should ( \"have .value\" , \"fakepassword\")})  \nit ( \"will fail when type invalid user credentials\" , () => { cy.get(\"\\#email\").type(\"[fake@email.com](fake@email.com) \")  \ncy.get(\"\\#password\") .type(\"fakepassword\")  \ncy.get(\"input[type=submit]\") .click ()  \ncy.get(\"\\#login-message\") .should ( \"have .text\" , \"Login failed\")})  \nit ( \"will fail when type invalid password with valid user\" , () => { cy.get(\"\\#email\").type(\"[fake@email.com](fake@email.com) \")  \ncy.get(\"\\#password\") .type( \"abc\" )  \ncy.get(\"input[type=submit]\") .click ()  \ncy.get(\"\\#login-message\") .should ( \"have .text\" , \"Login failed\")})  \nit ( \"will succeed when type valid user credentials\" , () => { cy.get(\"\\#email\").type(\"[a@b.com](a@b.com) \")  \ncy.get(\"\\#password\") .type( \"abc\" )  \ncy.get(\"input[type=submit]\") .click ()  \ncy.get(\"\\#login-message\") .should ( \"not .have .text\" , \"Login failed\")  \ncy.location (\"pathname\") .should ( \"include\" , \"/user/profile\")  \n})  \n})  \nIf it’s not clear what is going on, let’s break down one of the tests.  \nThe intent of the test is to ensure the user can type their email into the input. Firstly we get the element with cy.get(\"\\#email\") then we can type the email address using the .type(\"[fake@email.com](fake@emai","cbCaiva2WtQSGwSf","https://ap.wps.com/l/cbCaiva2WtQSGwSf","pdf",205024,"English","# How to start testing web apps with Cypress\n## Setting up Cypress\n## Writing login tests\n## Understanding Cypress assertions and waiting\n## Running tests interactively","[{\"question\":\"Why choose Cypress for end-to-end testing?\",\"answer\":\"Cypress is designed to be easy to set up, has no dependencies, and is straightforward to write and use, reducing setup hassle while keeping tests readable and maintainable.\"},{\"question\":\"How does the example login test verify email and password input?\",\"answer\":\"The tests locate elements like #email and #password using cy.get, enter values with .type, and confirm expectations with .should checks on the input value.\"},{\"question\":\"How does Cypress handle navigation timing when checking the post-login URL?\",\"answer\":\"Cypress automatically waits using its default timeout, so assertions like cy.location(\\\"pathname\\\").should(\\\"include\\\",\\\"/user/profile\\\") don’t require explicit waiting for navigation to complete.\"}]","why-cypress-is-the-best-way-to-test | PDF",1791076894,[144,148,152,156],{"page_no":21,"url":145,"width":146,"height":147},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/71f78ffa330dfe40ddb9be23e2e76669.webp",983,1390,{"page_no":25,"url":149,"width":150,"height":151},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/213597c27c4b0f14970025d8a9d4d57b.webp",982,1388,{"page_no":29,"url":153,"width":154,"height":155},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/221f8938808e6b748416e6078ee9cf5f.webp",981,1387,{"page_no":32,"url":157,"width":158,"height":159},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/984b076b97b8ec28c7496f0a13c8fe81.webp",980,1385,{"list":161,"token":10},[162,168,174,180,187,194,200,207,214,221],{"doc_id":163,"doc_title":164,"file_type":136,"home_preview_img_url":165,"slug":166,"view_count":96,"category_name":28,"create_tm":167},727286,"Playwright with TypeScript - Module Syllabus","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230028670744/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796179439&Signature=VpcCTRzgHltm4TIn5kYpChIdsRo%3D","playwright-with-typescript-module-syllabus",1795233484,{"doc_id":169,"doc_title":170,"file_type":136,"home_preview_img_url":171,"slug":172,"view_count":105,"category_name":28,"create_tm":173},687118,"App-Based Task Shortcuts for Virtual Assistants","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230001250558/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796179439&Signature=Wwza4zsd3NWaqufhrUUh2OHaAPw%3D","app-based-task-shortcuts-for-virtual-assistants",1794081379,{"doc_id":175,"doc_title":176,"file_type":136,"home_preview_img_url":177,"slug":178,"view_count":29,"category_name":28,"create_tm":179},702986,"CODING PROJECTS IN FLUTTER - A Hands-On, Project-Based Introduction to Mobile App Development","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230012203968/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796179439&Signature=lf1nPmLI0tw4tu4LhXnPLw8PbHs%3D","coding-projects-in-flutter-a-hands-on-project-based-introduction-to-mobile-app-development",1794557141,{"doc_id":181,"doc_title":182,"file_type":136,"home_preview_img_url":183,"slug":184,"view_count":185,"category_name":28,"create_tm":186},138678,"Oracle Policy Modeling User's Guide - Release 10.4 Update 7","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229864154910/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796179439&Signature=fpPY9ctHkRFCNWXthneHs%2B56v78%3D","oracle-policy-modeling-users-guide-release-104-update-7",13,1787486371,{"doc_id":188,"doc_title":189,"file_type":136,"home_preview_img_url":190,"slug":191,"view_count":192,"category_name":28,"create_tm":193},673085,"User Interface API Developer Guide - v68.0 - Version 68.0 last updated Oct 9 2026","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229989981731/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796179439&Signature=RxyVjRiBOkY2cDJwfKn96QswtOc%3D","user-interface-api-developer-guide-v680-version-680-last-updated-oct-9-2026",14,1793619922,{"doc_id":195,"doc_title":196,"file_type":136,"home_preview_img_url":197,"slug":198,"view_count":122,"category_name":28,"create_tm":199},507051,"JFT GURU Partner Program - Partner Program for SSW Training Institutes","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229933946205/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796179439&Signature=kCIFghfZ%2FxhjAGDAxZbR%2FBO4OtQ%3D","jft-guru-partner-program-partner-program-for-ssw-training-institutes",1791172351,{"doc_id":201,"doc_title":202,"file_type":136,"home_preview_img_url":203,"slug":204,"view_count":205,"category_name":28,"create_tm":206},496554,"Automotive Technology: CP - Certificate of Proficiency","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229929882121/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796179439&Signature=89V80mUbxT02NcDhSI2unzuD19c%3D","automotive-technology-cp-certificate-of-proficiency",11,1790934733,{"doc_id":208,"doc_title":209,"file_type":136,"home_preview_img_url":210,"slug":211,"view_count":212,"category_name":28,"create_tm":213},115355,"Claude AI Bible - The Complete Guide to Mastering Claude, Claude Code, Claude Cowork, MCP, AI Agents, Automation & Advanced Prompting","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229831893665/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796179439&Signature=dqd5s%2FqXiSpbnTKtF2wg7trneHE%3D","claude-ai-bible-the-complete-guide-to-mastering-claude-claude-code-claude-cowork-mcp-ai-agents-automation-advanced-prompting",939,1785472614,{"doc_id":215,"doc_title":216,"file_type":136,"home_preview_img_url":217,"slug":218,"view_count":219,"category_name":28,"create_tm":220},185,"XNX Universal Transmitter Installation Manual (Complete Guide) [Honeywell Official]","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229693710157/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796179439&Signature=hEFaHQ3TSMfm0wGlbAamLr9GNl8%3D","xnx-universal-transmitter-installation-manual",861,1776135954,{"doc_id":222,"doc_title":223,"file_type":136,"home_preview_img_url":224,"slug":225,"view_count":226,"category_name":28,"create_tm":227},299143,"THE CANDLESTICK TRADING BIBLE - Trading Guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229905832418/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796179439&Signature=29hI96VJh9R%2Ff1nqxtzclWA4tPo%3D","the-candlestick-trading-bible-trading-guide",812,1789767270]