Why do testers use plugins to extend Cypress capabilities?
Think about how plugins help customize or add features.
Plugins allow adding new commands and changing Cypress behavior to fit special needs, which default Cypress cannot do alone.
What will be the output in Cypress test runner console after running this plugin code?
module.exports = (on, config) => { on('task', { logMessage(message) { console.log(`Plugin log: ${message}`) return null } }) } // In test file: cy.task('logMessage', 'Hello from plugin')
Look at what the plugin's task does with the message.
The plugin defines a task 'logMessage' that prints the message to the Node console. The test calls this task with 'Hello from plugin', so the console shows that message.
You added a plugin that creates a new Cypress command cy.login(). Which assertion correctly verifies the command works by checking the URL after login?
cy.login('user', 'pass') cy.url().should(____)
Check Cypress assertion syntax for URL substring.
The correct assertion is should('contain', '/dashboard') to check if the URL includes '/dashboard'. 'equal' requires exact match, 'include' is not a valid assertion, 'have' is invalid here.
A plugin task is not running and shows error: TypeError: on is not a function. What is the likely cause?
Check the function signature of the plugin export.
The error means the on parameter is not passed or missing, so calling on() fails. The plugin export must accept on and config parameters.
Which statement best explains how plugins enhance the Cypress testing framework?
Think about what plugins can do beyond browser testing.
Plugins run in the Node.js environment and can integrate Cypress with external tools, databases, or add custom tasks, extending Cypress beyond browser automation.