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

UI Script: Multiple functions in a single script


#1

Is there a way to do multiple functions inside of a single UI script? My use case would be a situation where I am removing the Test Run button and renaming all of the places where Test Runs are referenced to our internal nomenclature. right now I have a whole bunch of individual scripts, but I would like to bundle all of these similar things into one script for ease of maintenance.


#2

Hi Jon!

You can simply put them into a single UI script and then include all relevant pages in the includes option. It’s important to note that the UI script should be fast, otherwise this would negatively affect the TestRail experience and this is especially important on complex pages such as the suite/case repository and run pages with potentially very large tables/lists of cases/tests.

Cheers,
Tobias


#3

Do you have an example of this that you could share? I have tried a multitude of different ways, and none of them seem to work.


#4

Hi Jon!

I don’t have a concrete example but you can simply put your code into a single $(document).ready() block. You could either leave the includes option empty (would target all pages then) or include multiple pages as follows:

includes: ^(runs/view)|(runs/overview)|(tests/view) ..

Would this work for you?

Cheers,
Tobias