Why is the Bunit TestContext not rendering Telerik Grid rows in while testing a blazor components

38 views Asked by At

I have a Telerik grid inside my CUT (component under test), a blazor component. The rendering happens to everything except the grid rows. I always get the row with the .k-grid-norecords class inside the grid body. but not the actual rows with the data. The data gets stored in the list bound with the Grid but doesn't get rendered. What could be the problem?

NB: The table rows render on browser. This only happens while testing.

Here's my test code.

 // Arrange
 int dtosToGenerateCount = 5;

 var faker = new Faker<Dto>()
   .RuleFor(u => u.Id, f => f.IndexGlobal)
   .RuleFor(u => u.Code, f => f.Random.Number(250, 100000).ToString())
   .RuleFor(u => u.Oms, f => string.Join("", f.Random.Chars(count: 11)))
   .RuleFor(u => u.Ind, f => f.Random.Bool());

 var DtosList = faker.Generate(dtosToGenerateCount);

 var endpoint = $"/dto";
 Services.AddMockHttpClient(endpoint, DtosList);

 //Act
 var cut = RenderComponent<Buurt>();
 var tableDataRows = cut.FindAll("table tbody tr");

 //Asssert
 //assert code goes here

I am using .NET 7 Bunit 1.25.3 Telerik 5.0.1

I was expecting the rows to be rendered in the telerik grid. I tried to change the IJSruntime to strict and add some setups, but that made the whole grid to be not rendered.

0

There are 0 answers