IRenderedComponent<Page> _RenderedPage = context.RenderComponent<Page>(); // initialised early in test
//in assertion phase var markup = _RenderedPage.Markup; //<-------- This markup has exactly what I expect for the Form component. var form = _RenderedPage.FindComponent<Form>(); var formMarkup = form.Markup; // <---------- This markup is different. It has outdated values
It's as though something is internally caching that form and giving me an older state
There is a single RenderTree that is updated when a component renders. But what can happen is that your changes are happening asynchronously... put differently, the blazor renderer that is updating the render tree is updating it in a different thread than the one the test is running in, so the changes might be coming, but might not be there yet. The problem you are seeing might be due to beta-10 though. There was some changes to have the render tree updates would update the markup in the components, and you might be seeing a corner case I believe is fixed now.
@egil Not worried about the API change, easy enough. I mean that after the code changes, many of the tests were now failing.
OK. That surprises me. Are you saying tests that use something like
await cut.Find("button").ClickAsync() now fails with