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

[UI Script] Hide Version field on Add Test Result dialog


#1

The following UI script hides the Version field on the Add Test Result dialog:

[code]name: Hide Version field
description: Hides the Version field on the Add Test Result dialog
author: Gurock Software
version: 1.0
includes:
excludes:

js:
(document).ready( function() { .subscribe(‘result_dialog.loaded’, ‘uiscript_hide_version’,
function()
{
$(’#addResultVersion’).parent(‘li’).hide();
});
}
);
[/code]

Regards,
Tobias


#2

We finally got a test environment with TR 4.0.2 and it looks like this is broken?


#3

Hello Brian,

Thanks for your posting and your feedback on this. We will make sure to look into this and update the UI script for TestRail 4.0 (which uses a slightly different markup for the Add Test Result dialog).

Regards,
Tobias


Getting my customized "Pass and Move" button to work
#4

Hello Brian,

Here’s the updated script for TestRail 4.0:

[code]name: Hide Version field
description: Hides the Version field on the Add Test Result dialog
author: Gurock Software
version: 1.0
includes:
excludes:

js:
(document).ready( function() { .subscribe(‘result_dialog.loaded’, ‘uiscript_hide_version’,
function()
{
$(’#addResultVersion’).parent(‘div’).hide();
});
}
);[/code]

Regards,
Tobias


#5

Excellent - thanks…!


#6

You are welcome, Brian!


#7

I just tried this on 5.0, and it seems to have broken again…is there an update for it at this point?


#8

Hi Jon,

TestRail 5.0 now has built-in support for hiding/disabling some of the system fields on the Add Test Result dialog and you can customize this under Administration > Customizations. Would this already work for you?

Cheers,
Tobias


#9

We just got to the base 5.0 installed to our production server and the script is running fine for us. Maybe an issue with a 5.x patch?


#10

Hiding it at the system field level worked great…didn’t realize that was now an option! Thanks Tobias!


#11

You are welcome, Jon! Great to hear that this helps :smile:

Cheers,
Tobias


#12

Hi
I`m running the cloud version, and when I try to add any ui script example I get this error message.
What is wrong?
I want to create a UI script that fetch the overall Status (Passed,Retest,Failed) when the user clicks the add result button.
Based on this I want to make a REST call to JIRA to update the worflow status there.

Anyone that can show me how to trigger ex: alert on Add Result?

Thanks alot in advance.
Roy T



#13

Hi Roy,

Thanks for your posting! The UI script for hiding the Version field is no longer required because this is now a built-in feature and can be configured under Administration > Customizations (by editing the Versions field). Regarding the syntax error: the example is missing a empty line before js: (after the header section). This forum unfortunately removes those empty lines.

Regarding the Similar to the version script, you can use the result_dialog.validate event to register for the Add Result click and use this to execute custom code.

I hope this helps!

Cheers,
Tobias


#14

Hi Tobias

Hiding the Versions field was just to test a script, but yes I got it working with the result_dialog.validate ! Thanks alot for helping out. This is great !

Posting my script so other people can see this if they need it.

Best regards
Roy T

name: Hello world
description: Shows a ‘Hello, world!’ message on the dashboard
author: Gurock Software
version: 1.0
includes: ^tests
excludes:

js:
(document).ready( function() { alert('Hello, world!'); .subscribe(‘result_dialog.validate’,‘uiscript’,function(){
alert(‘jada’);
});

}

);


#15

Hello Roy,

You are welcome and great to hear that you got it working!

Cheers,
Tobias