-
Notifications
You must be signed in to change notification settings - Fork 2.3k
waitForAngular not waiting #96
Comments
This looks correct, you shouldn't have to put in a waitForAngular. Not sure what's going on - can you share some more of your code? The template with the buttons and the controller code would be helpful. |
controller: appControllers.controller('UsersCtrl', ['$scope', '$location', '$dialog', 'Restangular', 'errorDialogOptions', function ($scope, $location, $dialog, Restangular, errorDialogOptions) { $scope.searchUsers = function () { template:
ok so visually I see the results on screen during the test, however the test failed with expected 0 to be 1 if set to expect(resultingRows.length).toBe(1); so I am expecting a user to be found. If I expect 0 users the test passes if set to expect(resultingRows.length).toBe(0); |
Your code seems to have a typo ptor.findElement(protractor.By.repeater('users in userList.data').column('{{user.age}}')). // Should be userList.data instead of usersList
then(function(resultingRows) {
expect(resultingRows.length).toBe(0);
}); |
Sorry for the delayed response. I have only just come back into work. I have checked the code and there is no typo in my original test code, it must have been a typo by me when placing the code here. I have run through other tests and they seem to be having the same issue. They are not waiting for angular to resolve before proceeding. I have placed a ptor.sleep() in the test to see if that would help but it doesn't. The tests are very sporadic, some times they pass other times they do not. |
here is actual code from a failing test and the controller, service and html below
controller:
service:
HTML:
hopefully this is something easy to fix |
Ah, looks like this is an instance of #92. That has been fixed in master and the fix should be pushed in 0.10.0 later today. |
I have some tests that fail when filtering by name, address etc..
In my view I display all results using ng-repeat and have some input boxes for filtering the results. My issue is, when the tests run all results are brought back and int one test and this test passes but when filtering the results the filter tests fail. I have tried waitForAngular but this does not work.
My results are brought back using RestAngular and a back end get request. The get request is promise based so I do not understand why I do not get the expect result back.
my test case is
it('should filter results by age: expect result to be 0', function() {
ptor.get('http://localhost:22222/#/users');
ptor.findElement(protractor.By.input('search.age')).sendKeys('29');
ptor.findElement(protractor.By.id('filterBtn')).click();
ptor.findElement(protractor.By.repeater('users in usersList.data').column('{{user.age}}')).then(function(resultingRows) {
expect(resultingRows.length).toBe(0);
});
}, 30000);
Am I doing something wrong here or should I be using webdriver to wait for n time before proceeding.
The text was updated successfully, but these errors were encountered: