如何等待Bunit测试中存在元素?
假设我有下面的测试。 是否有一种方法可以在渲染组件的标记中等待一个元素?
[Fact]
public void Component_DoesSomething()
{
// Arrange
var ctx = new TestContext();
var unitUnderTest = ctx.RenderComponent<SomeComponent>();
var selector = "tbody";
// Act
var tableBody = unitUnderTest.Find(selector);
// Assert
Assert.Contains(tableBody.InnerHtml, "someStuff");
}
我已经回顾了下面的文档,但是我看不到任何指示如何等待元素的内容。
Let's say I have a test like the one below. Is there a way to wait for an element to be present in the markup of a rendered component?
[Fact]
public void Component_DoesSomething()
{
// Arrange
var ctx = new TestContext();
var unitUnderTest = ctx.RenderComponent<SomeComponent>();
var selector = "tbody";
// Act
var tableBody = unitUnderTest.Find(selector);
// Assert
Assert.Contains(tableBody.InnerHtml, "someStuff");
}
I've reviewed the docs below, but I don't see anything indicating how to wait for an element.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
RIRENDEREDCOMPONENT.WAITFORELEMENT()
方法。请参阅下面的代码:另请参阅:
WaitForelements()
You can use
IRenderedComponent.WaitForElement()
method. See the code below:See also:
WaitForElements()