I wrote a test case by using Karma/Jasmine for ag-grid in angular. In my test case just checking the ag-grid headers and getting error like "fixture.nativeElement.query is not a function" but i am not confident enough whether this is a right approach or not which i have written. If any one having idea please help me.
This is my test case
it('to test the column headers',()=>{
fixture.nativeElement.query(By.css(".ag-fresh"))
.map(function (header){
return header.getText()
}).then(function(headers){
expect(headers).toEqual(['color','qty','price']);
});
});
You should be using query()
on fixture.debugElement
. And also I don't think you need to map
the result here.
fixture.debugElement.query(By.css(".ag-fresh")).nativeElement
should do it for you.