【发布时间】:2022-03-03 23:00:46
【问题描述】:
我想做的是在 nightwatch.js 中的另一个自定义命令中调用一个自定义命令(目的是使测试不那么脆弱)。
例如,在我的第一个自定义命令 (message1.js) 中,我可以有以下代码;
exports.command = function(browser) {
this
browser
console.log('display this first')
return this;
随后在我的第二个自定义命令 (message2.js) 中,我想先调用 message1.js 命令,然后执行其余代码。
例如;
exports.command = function(browser) {
this
browser
//call the message1.js command
console.log('display the second message')
return this;
我试过用方法调用它;
exports.command = function(browser) {
this
browser
.message1();
console.log('display the second message')
return this;
但这不起作用。
所以我的问题是;
是否可以在另一个自定义命令中调用一个自定义命令 如果没有,还有其他方法吗?
【问题讨论】:
标签: command nightwatch.js