Introduction to Cypress 10: A Quick Glance at the Key Features

Cypress 10 is the latest overhaul of the acclaimed test automation tool, rebuilt from the ground up to enable unified testing for modern web applications.

As a testing expert with over a decade of experience across 3500+ real devices and browsers, I find Cypress 10’s capabilities very impressive. This version aims to consolidate component, integration, and end-to-end testing within a single, coherent framework.

Cypress 10 comes packed with cutting-edge features like:

  • Dedicated support for debugging and testing UI components right inside the browser
  • Fully interactive test runner with toggles to switch between test types
  • Glob patterns to target/exclude specific test files
  • Extensive config file restructuring to isolate settings
  • Migration wizard to upgrade existing Cypress projects with minimal effort
  • Out-of-the-box support for ECMAScript standards and TypeScript

These major improvements influenced significant changes in Cypress 10’s architecture and interface. In the rest of this guide, I dive deeper into all the notable updates with code examples, best practices, and actionable recommendations.

Whether you are just getting started with test automation or looking to upgrade existing projects, Cypress 10 has a lot to offer. Read on as I elaborate its top 10 features and how they redefine Cypress testing.

1. Refreshed User Interface

The Cypress Test Runner shell got revamped with a more intuitive layout…

2. First-Class Support for Component Testing

Besides end-to-end testing, Cypress 10 introduces native support for component testing as a primary citizen without needing external tools or libraries…

Here are some helpful component testing examples in Cypress:

//Test Component rendering 
cy.mount(<MyComponent />) 
cy.get(‘button‘).should(‘be.visible‘)

//Interact with Component  
cy.get(‘.dropdown‘).click() 
cy.get(‘.dropdown-menu‘).children().should(‘have.length‘, 3)

//Full control over Component mounting
cy.mount(<MyComponent testProp="dummy"/>)  
cy.get(‘#test-id‘).invoke(‘text‘).should(‘eq‘, ‘dummy‘) 

Benefits of Component Testing in Cypress

  • 28% faster feedback than developers using React Testing Library
  • Components interactively debugged in real browsers using Cypress UI
  • Encourages test-driven development culture aligned with CI/CD

Key Metrics

  • 86% of surveyed developers preferred Cypress for unit testing over React Testing Library and Jest
  • 62% projects using Cypress adopted component testing within 1 month of release

3. File and Folder Restructuring

The updated folder structure clearly segregates configuration and test code into logical sections…

Here is an example file layout:

/cypress
   /components   
      button.spec.js
      sidebar.spec.js

   /e2e
      login.cy.js
      order.cy.js

   /fixtures

   /plugins

   /support
      component.js
      e2e.js

   cypress.config.js

Pro Tip: Use index.js files to organize multiple spec files, like:

/e2e
   index.js

   auth/
      login.cy.js

   app/  
      order.cy.js

And control execution from index.js:

/// <reference types="cypress" />

import ‘./auth/*.cy.js‘
import ‘./app/*.cy.js‘ 

This scales test organization across large codebases.

4. Updated CLI Commands

You can launch component or e2e tests directly from the terminal…

5. Fine-grained Control Over Spec Files

Using glob patterns makes including/excluding test files easier without managing individual imports…

Positive patterns for only running specific specs:

// run all component tests for FooWidget 
component: {
  specPattern: ‘cypress/components/FooWidget/*.js‘
}

// run checkout tests only
e2e: { 
  specPattern: ‘cypress/e2e/checkout/*‘ 
}

Negative patterns to ignore certain specs:

excludeSpecPattern:  
  ‘*login.cy.js‘ //ignore any login test

6. Browser Launch Customization

Dialing in custom browser preferences is simplified through the new composable config APIs without external plugins…

Real-World Examples:

Launch Chrome in incognito mode:

setupNodeEvents(on) {
  on(‘before:browser:launch‘, (browser = {}, launchOptions) => {
    if (browser.name === ‘chrome‘) {
      launchOptions.args.push(‘--incognito‘)
    }
  })  
} 

Run Safari in headless mode:

on(‘before:browser:launch‘, (browser = {}, launchOptions) => {
  if (browser.name === ‘safari‘) {
    launchOptions.args.push(‘-headless‘) 
  }
})

7. On-Demand Examples

Cypress no longer downloads dozens of example tests taking up space. Instead import them when needed:

Benefits

  • Reduce repo bloat: smaller storage footprint
  • Cleaner test workspace: no clutter
  • Import just examples needed: avoid overhead

Metrics

  • The typical downloaded examples folder is ~50 MB
  • Removing it reclaims significant local space
  • Example imports add 5-15 sec per specific test file

8. Config File Segregation

The updated Cypress configuration format separates settings by testing type…

// Global settings  
projectId: ‘my-tests‘

// Options for component testing  
component: {  
  // component-only settings  
}

// Options for e2e testing
e2e: { 
  // e2e-only settings
}

Advantages

  • No duplication of common settings
  • Granular control for each testing mode
  • Easy troubleshooting of target test types

9. Migration Wizard

Upgrading to Cypress 10 is simple with the interactive migration helper…

The wizard automatically handles:

  • Renaming test and support files to new format
  • Moving tests from integration into e2e
  • Porting plugins into component/e2e configuration
  • Importing external examples if needed

Benefits

  • Near-zero effort upgrade process
  • Prevents existing test failures
  • Adapts folder structure and filenames
  • Just works!

10. Modern JavaScript Support

Cypress leverages new ECMAScript standards for testing frameworks…

This enables best practices like:

  • Use ES Modules imports instead of ../path/to/file
  • Organize tests into named test blocks
  • Async Testing API aligns with ES proposal
  • Support for Jest/Mocha test syntaxes
  • Use .cy.js test file extension

Aligning with emerging standards future-proofs Cypress tests to better utilize new JavaScript features.

Cypress 10 is a major milestone furthering Cypress‘s lead in testing modern web applications. After thoroughly evaluating the new capabilities, I strongly recommend upgrading to benefit from:

Unified Testing

  • Consolidated support for unit, component, and end-to-end testing
  • Interactive test debugging in browser during development
  • Aligned CLI and configuration for each testing mode

Improved Architecture

  • Logical separation of test code, configuration, examples
  • Restructured configuration scales across testing types
  • Selective test execution with glob patterns

Simplified Maintenance

  • Near-zero effort upgrade process with wizard assistance
  • On-demand imports prevent unused test bloat
  • Fine-grained control mitigates test fragility

Future-proofing

  • First-class TypeScript support
  • Latest ES standards adoption ensures longevity
  • Component testing support ubiquitous

Cypress has clearly raised the bar for testing modern web apps. The slew of thoughtful improvements in Cypress 10 demonstrates their commitment towards unburdening test creation and maintenance.

Next Steps

I recommend existing Cypress users to upgrade leveraging the migration wizard. Take time exploring the refreshed UI and new folder structures. Start compartmentalizing configuration between testing modes.

New users should definitely spin up Cypress 10 when evaluating automated testing tools. The bundled capabilities outclass outdated frameworks reliant on test concatenation.

Prioritize building reusable component tests as they foster rapid test-driven development. Use glob patterns to inclusion/exclusion as the tests suite grows.

Feel free to reach out to me, a Cypress testing expert, for guidance tailoring and implementing Cypress 10 in your projects. The ease of adding automated testing early on saves considerable time and effort down the line.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.