Socket
Socket
Sign inDemoInstall

cypress-plugin-steps

Package Overview
Dependencies
551
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cypress-plugin-steps

Add steps to your tests


Version published
Weekly downloads
44K
decreased by-20.95%
Maintainers
1
Install size
8.14 kB
Created
Weekly downloads
 

Changelog

Source

1.1.1 (2023-03-17)

Bug Fixes

  • cy.step and cy.section in before and beforeEach hooks (74c0bdc)

Readme

Source

Cypress Steps plugin

A small Cypress helper that adds your test steps to the timeline and error logs.

Table of contents

Installation

Install this package:

npm i cypress-plugin-steps
# or
yarn add cypress-plugin-steps

Import the plugin into your cypress/support/e2e.js file:

import 'cypress-plugin-steps'
// or
require('cypress-plugin-steps')

TypeScript support

In most cases, types work just by installing plugin, but you can add the types to your tsconfig.json

{
  "types": ["cypress-plugin-steps"]
}

This will add types for cy.step() and cy.section() command.

Usage

This will add two new commands to your Cypress library: cy.step() and cy.section() See the details below

cy.step()

This works similarly to cy.log() command, but in addition, will add numbering to your tests:

it('numbers test steps', () => {

  cy.step('open a page')
  cy.visit('cypress/index.html')

  cy.step('find all primary colors')
  cy.get('.primary')

  cy.step('select blue')
  cy.get('.blue')

});

screenshot.png

Error messages

If your test fails, your scenario will be added to the error message. This way your scenario will be visible right on the error screenshot that Cypress does automatically:

error scenario

You can also see the scenario in terminal: error in terminal

cy.section()

Works similarly to cy.step() but will be more prominent in Cypress runner (adding '---' to the log message) and will reset counter. This way you can divide your test into multiple secions.

sections

TIP: rename all your cy.log() to cy.step() commands

You can find and replace all your cy.log() commands by matching the word log with following regex:

(?:cy\s*)?log\s*

...powered by coffee and love ❤️ Filip Hric

FAQs

Last updated on 17 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc