Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

[UI script] Colorize custom field



I need some help…I would like to colorize a custom field (add a background color)
We have status for our test cases and one of them needs to be highlighted for a fast identification.

I tried to add the system name in a css in a script but I do not think it is the correct way of doing it.(as it did not work obviously)
If someone could help me out with that, it would be much appreciated.




Thanks for your posting. It’s not really supported to change the color of certain attributes/field values currently. The reason for this is that the test suite and run pages are highly dynamic and it’s difficult to implement this with UI scripts alone (and it would probably break with a future TestRail version). That said, we’ve got the request of highlighting certain values of custom fields before and this is already on our feature request list (I’ve just added another vote, thanks!).



What elements do you refer in the following document then?



Thanks for your reply. The color related customizations mentioned in this article would only apply to static UI/CSS elements in TestRail (e.g. you could change the blue header at the top of the page to green). It wouldn’t be supported currently to use CSS in TestRail to highlight/colorize a specific value of a custom field in the tables. That said, we already had this feature request on our todo list as mentioned and we are happy to look into this again for a future version.




Then if I want the blue header to be updated to a different color, could the following script work?
div.header-menu {

Because it does not with the version v4.0.1.3267
Does the system need to be restarted?

Thanks for your help



You would also need to include the page the UI script should apply to in addition to other meta information. This is explained here:

Working UI script examples can be found here:

I hope this helps!



doesn’t sound like something impossible, though I did not completely understand the requirement — do you need some sort of conditional formatting? Like, highlighting the rows that have high importance status? In that case, it’s doable with UI scripts, although the implementation would be hackish and, as @tgurock said, might break in future TestRail updates. Also it would either require the significant field to be displayed (so that javascript may evaluate whether to highlight the row), or use the REST API to request all cases metadata for the current suite



Each test case has a status (custom test case field) in our master suite.
What I would like to do is highlighting test cases in a specific status.
Any idea on how to do it is more than welcome!


@Gast, there you go:
Made it somewhat universal, so created a separate thread.
Adjust to your requirements (e.g. set only one rule for your custom field)