Skip to content Skip to sidebar Skip to footer

Cypressio Returning String Value From Cy.task() Using Cy.wrap() Gives Error "cy Is Not Defined"

In cypress /plugins/index.js I have code to query oracleDB module.exports = (on, config) => { on('task', { 'registration': async (email) => { const oracledb = r

Solution 1:

My working solution:

/plugins/index.js extended from above code:

var extractedUrlText = JSON.stringify((await result).rows).extract('/VerifiedRegistrationFormView','\"');
    console.log('Extracted NODE URL: \r\n' + extractedUrlText);

  return extractedUrlText
}

In spec file:

let extractedUrl;

        cy.task('registration', emailAddress).then(value => {
            extractedUrl = value;
            cy.log('Extracted CY URL: ' + extractedUrl)
        })

Result: enter image description here

Post a Comment for "Cypressio Returning String Value From Cy.task() Using Cy.wrap() Gives Error "cy Is Not Defined""