I am using protractor to do E2E testing on an angularjs application. I started with the angular-seed base project which comes with npm set up to run all of your e2e tests with the command npm run protractor, which really just runs "protractor test/protractor-conf.js". I have a test that goes to a page, selects a dropdown menu item, and then verifies that the resulting
it('should render all of the available '+subsystem.subsystem_name+' that can be created', function() {
// first select the appropriate subsystem from the dropdown
element(by.cssContainingText('.subsystem_select option', subsystem.subsystem_name)).click().then(function(){
var create_table = element.all(by.css('table')).get(0);
// filter the General Options and check that the Option Create Table is rendered correctly
browser.executeScript(function(ms_valid_options,subsystem_id) {
return angular.element(document).injector().get("$filter")("filter")(ms_valid_options, {subsystem_id:subsystem_id})
}, MS_VALID_OPTIONS, subsystem.subsystem_id).then(function(filtered_options){
expect( element.all(by.repeater('option in valid_options')).count() ).toEqual(filtered_options.length);
filtered_options.forEach(function(valid_option,i){
var current_row = element.all(by.repeater('option in valid_options')).get(i);
expect( current_row.all(by.css('td')).get(0).getText() ).toEqual(valid_option.option_name+"("+valid_option.default_value+")"); //first table cell has text option_name(default_value)
expect( current_row.all(by.css('td')).get(1).getInnerHtml() ).toEqual('<input type="button" value="Add Option" ng-click="addOption(option)">')//second table cell contains the add option button
expect( current_row.all(by.css('td')).get(2).all(by.css('span')).get(0).getText() ).toEqual('?');//third table cell contains the help questionmark
});
});
});
});
when I run the individual test file all the tests pass as expected, but when I run all of the test files with the npm run protractor command, this test is failing with the error
TypeError: Object [object Object] has no method 'all' and this error is complaining about the line
expect( current_row.all(by.css('td')).get(0).getText() ).toEqual(valid_option.option_name+"("+valid_option.default_value+")");
Any insight into this issue would be appreciated
Thanks
edit just a bit more information, when running the single file(successful case) current_row is an object with these keys on it [ 'locator_', 'parentElementFinder_', 'opt_actionResult_', 'opt_index_', 'click', 'sendKeys', 'getTagName', 'getCssValue', 'getAttribute', 'getText', 'getSize', 'getLocation', 'isEnabled', 'isSelected', 'submit', 'clear', 'isDisplayed', 'getOuterHtml', 'getInnerHtml', 'toWireValue' ]
and when the test is run along with all the other tests(failure case) current_row is an object with these keys on it [ 'then', 'cancel', 'isPending', 'errback', 'driver_', 'id_', 'click', 'sendKeys', 'getTagName', 'getCssValue', 'getAttribute', 'getText', 'getSize', 'getLocation', 'isEnabled', 'isSelected', 'submit', 'clear', 'isDisplayed', 'getOuterHtml', 'getInnerHtml', 'toWireValue', '$', 'findElement', '$$', 'findElements', 'isElementPresent', 'evaluate' ]