Simple data persistence for cypress using Cypress Commands
npm install cypress-store> A simple Cypress plugin for passing data between test scenarios
---
| 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 |
---
``shell`
npm i -D cypress-store
Add to your Cypress commands.js file
`javascript`
import "cypress-store";
---
- To store data :
`javascript`
cy.store(key
| parameter | mandatory | type |
|--|--|--|
| | ✅ | string |value
| | | any |
- To get stored data :
`javascript`
cy.getStored(
//Cypress wraps the retrieved value so you can access it with :
cy.getStored(
// Or :
cy.getStored(
console.log(key);
});key
| parameter | mandatory | type |
|--|--|--|
| | ✅ | string |
- To remove a stored data:
`javascript`
cy.removeStored(key
| parameter | mandatory | type |
|--|--|--|
| | ✅ | string |
- To flush all datas:
`javascript`
cy.flushStored();
- To log all datas:
`javascript``
cy.logStored();
Cheers !