cypress-store
v1.7.0
Published
Simple data persistence for cypress using Cypress Commands
Downloads
522
Readme
Cypress-store
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-storeAdd 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 !
