1.7.0 • Published 2 years ago

cypress-store v1.7.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Cypress-store

cypress version

A simple Cypress plugin for passing data between test scenarios

API

commandaction
cy.storestores data
cy.getStoredgets stored data
cy.removeStoredremoves stored data
cy.flushStoredflushes all stored datas
cy.logStoredlogs 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>);
parametermandatorytype
keystring
valueany
  • 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);
});
parametermandatorytype
keystring
  • To remove a stored data:
cy.removeStored(<key>);
parametermandatorytype
keystring
  • To flush all datas:
cy.flushStored();
  • To log all datas:
cy.logStored();

Cheers !