RSS Amplifier

Cypress Testing Tips & Tricks · Mar 31, 2026

Cypress Tips March 2026

0
Sign in to vote or save

Gleb Bahmutov · Cypress Testing Tips & Tricks

Cypress v16 will disallow using Cypress.env command - because it is a security hole. You can explicitly “expose” public values using the new Cypress.expose command, but for any “env” value you need to call cy.env command to grab its value in the test.

Getting secrets into your tests now is a “normal” async Cypress command that is part of the chain. Non-secret values can be listed inside the “expose” object or passed via “—expose” command-line argument. I wrote several blog posts explaining the new commands and how to transition your test code:

While you are reading these two blog posts, check out my new post on giving more precise type to your string values: String Types For E2E Tests.

You can give your AI code agent access to the Cypress Cloud information by adding Cypress MCP server.

Added Cypress MCP integration to my Cypress Cloud settings

Get your personal access token, configure the agent, point it at https://mcp.cypress.io/mcp with authorization Bearer <token>. You can ask questions like:

Are there are test failures in the last Cypress Cloud run? Give me a summary of each failure.

Is the test “Login XYZ” flaky? Use Cypress Cloud to find out.

It is important to include “Cypress Cloud” in your prompt to make sure your AI agent “selects” the Cypress MCP tool and calls it.

I will experiment with Cypress MCP to see how well it works.

Vitaly Skadorva collected tips on using cypress-axe plugin to test a11y during Cypress E2E tests. Find them here. My personal opinion: a11y testing can be nicely done using wick-a11y plugin - because its reporting is so clear and easy to understand.

Speaking of Sebastian Clavijo Suero - he has a new plugin! wick-dom-observer makes it easy to very those pesky popups, fast loaders that sometimes do not show up at all, etc. Just prepare to watch the DOM using the plugin, do “normal” actions, and the spinner will be validated “out-of-band” with other commands. For example, let’s check a spinner that might be very show-lived, but must appear within 5 seconds of clicking the button:

The command will run for up to 5 seconds, but if the spinner appears early - it will be validated and the command finishes. Here is how to validate the spinner element - without using any Cypress commands, since assertLoadCampaignDataSpinner runs “outside” the normal Cypress chain.

Of course, you can check other DOM elements inside the function.

wick-dom-observer overview
An example of wick-dom-observer failing the test because the spinner was too short-lived.

Happy testing!

No posts

Read the original on cypresstips.substack.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.