Cypress - Plugins


Cypress has multiple plugins to add to its features. There are multiple types of plugins like the authentication, component testing, custom commands, development tools and so on.

Some of the prominent plugins include −

To perform file upload task in Cypress, we have to first install a plugin with the command mentioned below −

npm install –dev cypress-file-upload

Once the installation is done, we have to add the statement import 'cypress-file-upload' in the command.js file, which resides inside the support folder within the Cypress project.

To work with frames, first, we have to install the Cypress plugin for frames with the command given below −

npm install –D cypress-iframe

Then, we have to add the statement import 'cypress-iframe' in the code.

To identify elements with xpath locator, run the following command −

npm install cypress-xpath

Once the installation is done, we have to add the statement require ("cypress-xpath") within the index.js file, which resides inside the support folder within the Cypress project.

Also, we have to use the cy.xpath command to identify elements.

To enable themes, we have to install a plugin with the command mentioned below −

npm install --save-dev cypress-dark

Once the installation is done, we have to add the statement require ("cypress-dark") within the index.js file, which resides inside the support folder within the Cypress project.

Advertisements