Hi I was trying to write a front-end testing using mocha chimp and webdriverio. as I had to work with different id in font end, in every block I had to define them for various purposes. I tried to define the ID outside the describe block then it shows browser is not defined. here is the sample code.
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);
})
} )
can anybody tell me how to define the variable outside the describing block including browser notation, so that I don't need to define them every time in the different describing block.