jorjj
jorjj

Reputation: 1619

Blazor: Start with the client instead of index.html

I am trying to test my Blazor app using selenium with Nunit. But the problem is I cannot run my use cases because of the starting page is index.html. Tests don't wait for redirecting and they always fail for this reason. Is there any way to eliminate the index.html and run my tests.

Upvotes: 1

Views: 1139

Answers (2)

Flores
Flores

Reputation: 8942

No, there must be a starting page which holds the first <app></app> tag.

But your should be able to test with selenium, because the Blazor team does this also. See https://github.com/aspnet/Blazor/tree/master/test

and post a new question on the problems you encounter with Selenium.

Btw: I'm using testcafe for my Blazor app which I find way better then Selenium.

Upvotes: 2

Rob Bos
Rob Bos

Reputation: 1481

With Selenium you can wait for a specific element to be present, so just wait for the app tag to be visible?

See here and here for examples.

They boil down to:

WebDriverWait wait = new WebDriverWait(webDriver, 10); //seconds wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("foo)));

Or see the Selenium documentation about it: https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp

Upvotes: 1

Related Questions