![](/img/trans.png)
[英]Cucumber JS not running step but saying its passed then skipping subsequent steps
[英]Cypress Cucumber Step running multiple steps
可以说我有
步骤1
第2步
第三步
是否有可能让 Step4 运行所有 3 个?
更新了我的意思是
我已经写了3个步骤
Given('do step1', function () {})
Given('do step2', function () {})
Given('do step3', function () {})
有没有可能
Given('do step4', function () {
do step1
do step2
do step3
})
如果您将这 3 个步骤编写为单独的函数,您将能够达到与您正在寻找的相同的效果:
login(user, pass){
cy.visit(loginUrl)
cy.get('#username').type(user)
cy.get('#password').type(pass)
return cy.contains('Submit').click()
}
stepTwo(){
... // Other stuff
}
stepThree(){
... // More stuff
}
Given('I log in as {string} with password {string}', function (username, password) {
return login(username, password)
})
Given('some set up step', function () {
login('bill.s.preston@wyldstallyns.com', 'bodacious')
return stepTwo()
})
Given('another set up step', function () {
login('theodore.logan@wyldstallyns.com', 'triumphant')
stepTwo()
return stepThree()
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.