chr*_*ton 17 selenium node.js nightwatch.js
我希望在我的nightwatch.js测试中创建可重用的组件.
即.登录Web应用程序,注销Web应用程序
以可重用的方式创建这些步骤的最佳方法/模式是什么?
Cor*_*ter 28
您可以为其创建自定义命令:http://nightwatchjs.org/guide#writing-custom-commands
exports.command = function(username, password) {
this
.waitForElementVisible('#password', 4000)
.setValue('#password', password)
.waitForElementVisible('#username', 1000)
.setValue('#username', username)
.waitForElementVisible('#sign_in', 1000)
.click('#sign_in')
.waitForElementVisible('h1.folder-title', 10000)
return this;
};Run Code Online (Sandbox Code Playgroud)
.login("your_username", "your_password")Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8602 次 |
| 最近记录: |