Tips and Tricks FAQ
- Tips and Tricks FAQ
How do I maintain so many failing UI tests?
Just click the "Save Results" button.
In other frameworks, UI tests break often and require a lot of tedious code changes. But IcuBlazor UI tests are interactive & largely decoupled from the UI-under-test. So maintaining a failing test only requires a button click!
How do I test large UI components
Some components are large--sometimes as large as the entire page/viewport. To effectively UI test these components we need to shrink them to a manageable size. There are at least two options:
You can manually "zoom"" the entire test page by pressing Ctrl-Minus/Plus. While you only need to do this once per page, it is a source of inconsistency.
For consistency, you can encode the scale factor by wrapping appropriate areas in a scaled div:
<div style="transform: scale(0.8); transform-origin: 0 0"> ... my tests ... <div/>
On some browsers, these techniques can remove information and introduce scaling artifacts. For many test cases however it will not matter. You can decide on a case by case basis.
How to handle subtle image differences
Captured test images can vary slightly depending on the browser, user, or monitor settings. How can we create reliable tests under such subtleties?
One answer is to crush all diversity! Just ensure your tests always run in the same environment (i.e. on the same browser, user, or monitor settings). This may seem draconian but it is very effective and promotes consistency.
Another solution is to embrace differences. Save test images in different folders for each environment. For example, to handle browser differences you can save images in a "Chrome\" or "Firefox\" folder. Just format
Check().Div()'stestName; e.g. set
How to filter on tagged tests
Running a tagged filter url (e.g.
/MyTests/AllTests?filter=#tag) doesn't work. The '#' char in the url can confuse Blazor. Use the url encoding
filter=%23tag instead. A suite filter like
filter=$mySuite is fine however.
Can I execute tests from the command line
If you have any questions or discover a bug or have a feature request feel free to contact IcuBlazor Support.