var itemStatus = element(by.model('item.statusId')).getText();
This issue is causing Protractor to raise an error:
Uncaught exception: Error while waiting for Protractor to sync with the page: "Angular could not be found on the window" Process exited with error code 1.
I'm trying to understand why this throws an error, whereas this doesn't:
var itemStatus = element(by.model('item.statusId'))
Could it have something to do with promises? Maybe it can't execute .getText()
until the element is located?
It seems like I need to grasp the fundamentals better.
In the updated version of the code:
var itemStatus = element(by.model('item.statusId'))
// var itemStatus = element(by.model('item.statusId')).getText(); //was throwing with this
And then in the test case below, before commenting out the `.getText()`, I made sure not to run it within expect.
it('Should check item status, verify it is Checked Out.', function(){
expect(itemStatus.getText()).toBe('Checked Out');
//expect(itemStatus).toBe('Checked Out'); //this is how it was during error
});
And the corresponding HTML snippet:
<div class="form-control ng-binding ng-scope ng-isolate-scope ng-valid" ng-model="item.statusId" disabled="disabled">Checked In</div>
Even when all expect statements are commented out, the script would still throw an error when attempting to getText() for var itemStatus.
Apologies for forgetting to include the config:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['transfer_spec.js']
}