This is second part of: Expect: does not get the actual value
I was able to reproduce it a little bit better, so what I have:
expect((rfpPage.buttons.sendRequest).getAttribute('disabled')).toBe('true');
(rfpPage.inputs.firstName).sendKeys('Name');
(rfpPage.inputs.lastName).sendKeys('Surname');
(rfpPage.inputs.email).sendKeys('name@email.com');
(rfpPage.inputs.phone).sendKeys('1234312');
(rfpPage.inputs.company).sendKeys('Company');
(rfpPage.inputs.address).sendKeys('Leningrad Motorway');
(rfpPage.inputs.city).sendKeys('Moscow');
(rfpPage.inputs.postalCode).sendKeys('125171');
(rfpPage.inputs.eventName).sendKeys('Test Meeting');
expect((rfpPage.buttons.sendRequest).getAttribute('disabled')).toBe(null);
HTML: When form is not filled in:
<button type="submit" class="btn btn-lg btn-warning pull-right ng-binding" ng-disabled="!rfpForm.$valid || isWaitForRfp" disabled="disabled">Send Request
</button>
When the form is filled in:
<button type="submit" class="btn btn-lg btn-warning pull-right ng-binding" ng-disabled="!rfpForm.$valid || isWaitForRfp"> Send Request
</button>
What should happen:
- All required fields are getting populated.
- Send Request button becomes enabled (disabled attribute getting removed from DOM)
2nd expect fails saying expect true to be null.
This test worked JUST fine locally on 3-4 machines, on browserstack on multiple browsers, on saucelabs for several months.
*NOW: it started failing when it is getting executed via Jenkins on BrowserStack. If I run this test locally on remote desktop machine(from where Jenkins executes tests) it is still runs just ok. Locally on several machines it still runs ok. Locally on BrowserStack it runs ok. *
I have protractor 2.2.0 here and Jasmine 2.3.4
In my opinion something goes wrong with control flow, but really it is very strange stuff and I do want to explicitly wait for this attribute to be removed, because it will help, but looks like it is not proper solution.
2nd sample:
expect(contactInfoPage.selectors.contactInfoSection.companyName.isDisplayed()).toBe(false);
contactInfoPage.selectors.contactInfoSection.isCorporate.click();
expect(contactInfoPage.selectors.contactInfoSection.companyName.isDisplayed()).toBe(true);
DOM before click:
<input tabindex="11" type="text" ng-model="contactInfo.companyName" id="companyName" ng-required="isCorporateEvent" class="ng-valid-maxlength ng-touched ng-valid ng-valid-required" maxlength="80">
DOM after click:
<input tabindex="11" type="text" ng-model="contactInfo.companyName" id="companyName" ng-required="isCorporateEvent" class="ng-valid-maxlength ng-touched required ng-invalid ng-invalid-required" maxlength="80" required="required">
Error: expect true to be false