Cypress Playground - Interactive Testing Lab

Practise the core Cypress commands without installing anything. Type commands in the editor and the playground carries them out step by step on our demo shop, so you can watch every click, form entry and assertion happen. It runs in your browser and understands the Cypress commands listed further down this page, not the full Cypress runner.

Open the Cypress playground

Write & Run
Type cy.* commands and run them straight away, with no Node.js or Cypress install
Live Demo App
A small shop with login, products, cart and checkout, built for practising selectors
Pre-built Examples
Seven ready-made tests, from a valid login to a full checkout, to load and change

Getting Started with Cypress Playground

Step 1: Select a Test Case Template

Click the "Test Cases" dropdown to load pre-built example tests. These templates demonstrate common Cypress patterns like:

  • Login with Valid Credentials and Login Validation Errors
  • Add Item to Cart and Cart Management
  • Sort Products (choosing a value in a select box)
  • Full Checkout Flow, from login to the order confirmation
  • Logout Flow

Step 2: Write or Modify Your Test

Edit the test code in the center editor panel. Use Cypress commands like:

cy.visit('/') // Navigate to page
cy.get('[data-test="selector"]') // Find element
  .type('text') // Enter text
  .click() // Click element
.should('be.visible') // Assert visibility

Tip: Use data-test attributes for reliable element selection

Step 3: Run Your Test

Click the "Run Test" button to execute your code against the demo application. Watch the test results appear on the right panel in real-time.

The results panel shows pass/fail status, execution time, and detailed logs for debugging.

Step 4: Debug and Refine

If your test fails, check the logs for error messages. Common issues:

  • Element not found: compare your selector with the data-test value in the demo shop (right-click the element and choose Inspect)
  • Page not ready: after a click that loads a new page, such as logging in, add cy.wait(1000) before the next command
  • Assertion failed: the log shows the expected and the actual value side by side
  • Not supported: the log names any command this playground cannot run; the list below shows the ones it can

Cypress Commands This Playground Runs

The playground understands this part of the Cypress API. Chain commands on one line, or on the following lines starting with a dot, just as you would in a spec file.

cy.visit('/') Opens the demo shop (the only address available here)
cy.get('[data-test="username"]') Finds an element; the step fails if it is missing
.type('standard_user') Types text into the element found by cy.get()
.click() Clicks the element
.select('price-asc') Picks an option in a select box, such as the sort order
.should('be.visible') Also 'exist', 'not.exist', 'contain', 'have.value' and 'have.text'
.first() Uses the first match when a selector finds several elements
cy.wait(1000) Pauses for the given number of milliseconds

Anything else, such as cy.contains() or .clear(), stops the run with a message naming the command, so a test never shows as passed for steps that did not run.

Popular Cypress Patterns to Practice

Login Testing

Test login forms with valid/invalid credentials, error messages, and session persistence.

Form Validation

Validate required fields, email formats, and error state handling in forms.

Button Interactions

Test button states, click events, loading states, and confirmation dialogs.

Data Verification

Assert table data, list items, text content, and DOM element attributes.

Navigation Testing

Test page navigation, URL changes, and breadcrumb functionality.

Warning: Error Handling

Test error messages, edge cases, and user feedback mechanisms.

Cypress Best Practices

Use data-test attributes

Select elements using data-test attributes instead of class names or IDs which may change

Chain commands for readability

Use command chaining: cy.get().type().click().should() for cleaner, more readable tests

Avoid hard-coded waits

Use .should() assertions instead of cy.wait() for better reliability

Test user behavior

Write tests that simulate what a real user does, rather than what the code does underneath

Keep tests independent

Each test should be able to run independently without depending on other tests

Frequently Asked Questions

Can I use this playground for real automation testing?

No. It is for learning the commands and the shape of a test. Real Cypress runs on Node.js and drives a real browser; for your own projects, install it with npm install cypress --save-dev and run your tests locally or in your CI pipeline.

Why does a step fail right after logging in?

Real Cypress retries each command for up to 4 seconds (its defaultCommandTimeout) until the element appears. This playground runs each command once, so give the page a moment with cy.wait(1000) after a click that loads a new page. In your own Cypress projects, rely on the built-in retry instead of fixed waits.

How do I find the right selectors?

Use the browser DevTools (F12) to inspect elements. Look for unique identifiers like data-test, id, or class attributes. Test your selectors in Cypress directly.

Can I access external APIs in tests?

The playground focuses on UI testing. For API testing, explore Postman or use cy.request() in your local Cypress setup for API interactions.

The Tech World Labs Demo

Cypress Test Editor
Test Results

Run a test to see results