-
-
Notifications
You must be signed in to change notification settings - Fork 117
Description
Describe the bug
We are observing a difference in behaviour when running BUnit tests from Visual Studio and dotnet test.
This affects calling Change("value") on InputDate and InputNumber.
These work as expected in the Visual Studio Test Explorer. However, no value appears to be set on the <input> element when run via dotnet test. This is not consistent - sometimes the tests pass / fail with no modification in between runs.
dotnet test "Test.csproj" --configuration Release
Example:
Testing this component:
<InputDate Class="form-control" id="delivery-date" @bind-Value="ViewModel.Item.DeliveryDate" />With this test:
var deliveryDateField = component.Find("#delivery-date");
deliveryDateField.Change("2021-09-20");
deliveryDateField.MarkupMatches("<input id=\"delivery-date\" type=\"date\" class=\"form-control\" value=\"2021-09-20\" >");Results in this output:
The following errors were found:
1: The value of the attribute input(0)[class] and actual attribute input(1)[class] are different.
2: The value of the attribute input(0)[value] and actual attribute input(1)[value] are different.
Actual HTML:
<input id="delivery-date" type="date" class="form-control valid" value="" >
Expected HTML:
<input id="delivery-date" type="date" class="form-control modified valid" value="2021-09-20">
Expected behavior:
Expect the value of the <input> element to be consistently set to the value specified when calling Change().
Version info:
- bUnit version: 1.2.49
- .NET Runtime and Blazor version: 6.0 RC1
- OS type and version: Windows 10 - 19042.1165
Additional context:
We are working to identify a minimal reproduction. Any ideas on anything we can try would be appreciated.
Adding Thread.Sleep(1000) between calling Change() and MarkupMatches() appears to reduce (or possibly prevent) failure - is this timing / asynchrony related?