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

[UI script] Colorize custom field


#1

Hi

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


#2

Hello,

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!).

Regards,
Tobias


#3

What elements do you refer in the following document then?
http://docs.gurock.com/testrail-custom/uiscripts-introduction#style_sheets


#4

Hello,

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.

Regards,
Tobias


#5

Hi

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

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

Thanks for your help


#6

Hello,

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

http://docs.gurock.com/testrail-custom/uiscripts-introduction#meta_information

Working UI script examples can be found here:

http://docs.gurock.com/testrail-custom/uiscripts-examples#highlight_the_administration_pages

I hope this helps!

Regards,
Tobias


#7

@Gast,
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


#8

Hi

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!
Thanks


#9

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