【发布时间】:2018-02-28 17:21:12
【问题描述】:
您好,我正在尝试使用 mocha chimp 和 webdriverio 编写前端测试。因为我必须在字体末尾使用不同的 id,所以在每个块中我都必须为各种目的定义它们。我试图在描述块之外定义 ID,然后它显示未定义浏览器。这是示例代码。
describe('password validation', function () {
it('password should be empty @watch ', function () {
const passwordInput = browser.element('#passwordInput');
assert.equal(passwordInput.getValue(),"");
});
it("should identify weak password @watch",function () {
const passwordInput = browser.element('#passwordInput');
passwordInput.setValue("helloWordl");
browser.waitForVisible(".has-warning",500);
passwordInput.setValue("helloWordl@3");
})
it("should identify miss matched and matched password @watch",function () {
const confirmpasswordInput = browser.element('#confirmpasswordInput');
confirmpasswordInput.setValue("adofidlf"); //miss matched password given
browser.waitForVisible(".has-error",50); //it should shows the error for worng password
confirmpasswordInput.setValue("helloWordl@3");
browser.waitForVisible(".has-success",50);
})
} )
谁能告诉我如何在描述块之外定义变量,包括浏览器符号,这样我就不需要每次都在不同的描述块中定义它们。
【问题讨论】:
标签: javascript mocha.js webdriver-io chimp.js