I have two input fields, Username and Password and a spinner button. When i click on this spinner button these two input fields get disabled and I am redirected to another page. I am writing an end-to-end testing to check whether these input fields are disabled.
element(by.model('username')).sendKeys('rabi');
element(by.model('password')).sendKeys('rabi');
/* click on spin button */
spinBtn = element(by.className('call-to-action'));
spinBtn.click();
/* check if input is disabled */
var loginInput = element(by.id('login-username'));
expect(loginInput.isEnabled()).toBe(false);
The previous example of
expect(loginInput.getAttribute('disabled')).toEqual('disabled');
Will not work for checking if something is enabled.
You should use
expect(loginInput.isEnabled()).toBe([true|false]);
to accurately verify if something is enabled/disabled.
If that isn't working for you, there's probably something else going on.