I have a requirement that i need to store user email into one variable and then need to use same email to search a user created with same email in another method in cypress how can i do that?
below is my method
class UserManager {
CreatePrimaryuser() {
const button = cy.get(':nth-child(2) > a > h3')
button.click()
const button1 = cy.get('.btn-edit-user-view')
button1.click()
const uemail = cy.get('#emailField')
var currentDate = new Date();
var currentTime = currentDate.getTime();
var commentText = 'Automation' + currentTime + '@email.com';
uemail.type(commentText)
}
SearchUser() {
cy.get('#searchUsers').click().type(commentText)
}
i want to use same value of commontext in searchuser method that is stored in CreatePrimaryuser method