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

[UI Script] Hide button while in development

I’m working on creating a custom button for running tests in TestRail Cloud. But I don’t want everyone see it until it is finished and tested. Is this possible, i.e. the button and the UI script is visible only for me?

Hi Fabio,
you can easily get the current user id from the context and by this activate or deactive your script - probably just an embracing if.

Check for context here:

Thanks, it works.

But now sometimes the user is returning null and is breaking my script.

To avoid it I put a guard clause like that:

const userId = uiscripts && uiscripts.context && uiscripts.context.user &&;
if (!userId) {

But I really want to know in which situations this context user is returning null

Sorry Fabio, I have no idea.
I expect the context is always filled with th euser info.
Probably the Gurock stuff might help you.

Last idea: Do you wait until the page is completely loaded? E.g. by “$(document).ready”?

Yes, everything is wrapped in “$(document).ready”. I was worried because I did not expected this error and because this everything was broken for everyone. But I added the guard clauses and everything is working. How can I tag the Gurock guys to look this thread?

Hi @shanu.mandot,

can the support probably help?

Let me check if we can provide any additional help here. I will get back to you.