Skip to content

sylvain-viole/cypress-store

Repository files navigation

Cypress-store

cypress version

A simple Cypress plugin for passing data between test scenarios


API

command action
cy.store stores data
cy.getStored gets stored data
cy.removeStored removes stored data
cy.flushStored flushes all stored datas
cy.logStored logs all stored datas

Install

npm i -D cypress-store

Add to your Cypress commands.js file

import "cypress-store";

Usage

  • To store data :
cy.store(<key>, <value>);
parameter mandatory type
key string
value any
  • To get stored data :
cy.getStored(<key>);
//Cypress wraps the retrieved value so you can access it with :
cy.getStored(<key>).should("eql", <value>);
// Or :
cy.getStored(<key>).then((key) => {
  console.log(key);
});
parameter mandatory type
key string
  • To remove a stored data:
cy.removeStored(<key>);
parameter mandatory type
key string
  • To flush all datas:
cy.flushStored();
  • To log all datas:
cy.logStored();

Cheers !

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published