如何解决如何在单个文件中使用cypress中的可重用方法不是自定义命令
我有一个下面的可重用方法,它返回该行。
export function viewRuleDetailsFromRulesList(ruleSummary) => {
subject.view({ name: 'SubListInProgramInstance' }).as('currentView');
cy.get('@currentView').field({ name: 'MeasurementRuleConditions' }).find('li span').each(($row) => {
cy.wrap($row).invoke('text').then($rowText => {
if ($rowText == ruleSummary) {
return $row
}
})
})
}
我需要在其他各种验证方法中使用此行。
When('User views the details of the Rule {string}',(ruleSummary) =>{
const elementText= viewRuleDetailsFromRulesList(ruleSummary)//fails
elementText.find('delete').click();
})
我们如何在柏树中实现这一目标?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。