Socket
Socket
Sign inDemoInstall

cypress-localstorage-commands

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cypress-localstorage-commands

Extends Cypress' cy commands with localStorage methods. Allows preserving localStorage between tests


Version published
Weekly downloads
319K
increased by4.51%
Maintainers
1
Weekly downloads
 
Created

What is cypress-localstorage-commands?

The cypress-localstorage-commands package provides custom commands for Cypress to interact with the browser's localStorage. It allows you to set, get, and clear localStorage items, which can be useful for testing purposes.

What are cypress-localstorage-commands's main functionalities?

Set LocalStorage Item

This command sets a localStorage item with the specified key and value. It is useful for pre-populating localStorage with data before running tests.

cy.setLocalStorage('key', 'value');

Get LocalStorage Item

This command retrieves the value of a localStorage item by its key. It can be used to verify that the correct data is stored in localStorage during tests.

cy.getLocalStorage('key').then(value => { console.log(value); });

Clear LocalStorage

This command clears all items from localStorage. It is useful for ensuring a clean state before running tests.

cy.clearLocalStorage();

Remove LocalStorage Item

This command removes a specific item from localStorage by its key. It can be used to test the behavior of your application when certain localStorage items are missing.

cy.removeLocalStorage('key');

Other packages similar to cypress-localstorage-commands

Keywords

FAQs

Package last updated on 17 May 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc