我有一个要求,我需要将用户电子邮件存储到一个变量中,然后需要使用相同的电子邮件在 cypress 的另一种方法中搜索使用相同电子邮件创建的用户我该怎么做?
下面是我的方法
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)
}
我想在存储在 CreatePrimaryuser 方法中的 searchuser 方法中使用相同的 commontext 值