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

Operating on fields on suites page


#1

Hello,
recently I’ve been working on some customizations in TestRail projects. However, I have some problems about it.

  1. There is a field ‘Type’ which is default in TestRail. It’s one-select dropdown. I was asked to add a field with multi-select types and remove this only one-select. So I’ve added a new custom field called TestCase Type - multi-select. I haven’t found the way to remove ‘Type’ field from test cases, even for a certain project (not globally) so I’m hiding this field via UI script. The script works fine, however only in pages with ‘cases’ in the URL, where you have a view only for the one single case. It doesn’t work on ‘suites’ page because the content about test cases is loaded through javascript after the whole page was loaded. So I just wanted to know, if there is any way to hide this ‘Type’ field also on ‘suites’ page? In my case it’s always set to other, because I’m not allowing user to set this field. There are some screenshots to explain what I’m talking about:

  1. There is also similar situation with URL type fields. They are always displayed as ‘Link’ and it really doesn’t look well (it doesn’t say anything to user unless he click that). I wish I could set another value for that (depending on the URL). And again, I think I can do that on ‘cases’ page via UI script, but I’m worried about ‘suites’. Maybe there is some javascript hack I could use, that I’m not aware of?

So I need it for
a) entering the ‘suites’ page
b) changing view for another test case while still being on ‘suites’ page

Here is the key code fragment which displays another test case in sutie, but it’s generated after loading the page and I’m not able to access it through UI script. (I guess, as I don’t see this code fragment in view-source:URL page, only in ‘inspect element’ menu in browser)

The UI script I’m currently using:

name: Hide Type field
description: Hides Type field for projects, where multiple type values are enabled
author: Maksymilian Chodacki
version:
includes: ^cases ### adding ^suites here doesn’t solve the problem :slight_smile:
excludes:

js:
$(document).ready(
function() {
projects = [‘Maks - TEST’];
if (projects.indexOf(uiscripts.context.project.name) != -1){
var type_id = document.getElementById(‘type_id’)
if (typeof(type_id) != ‘undefined’ && type_id != null) {
type_id.parentNode.style.display=‘none’;
}
var cell_type_id = document.getElementById(‘cell_type_id’);
if (typeof(cell_type_id) != ‘undefined’ && cell_type_id != null)
{
cell_type_id.style.display=‘none’;
}
}
}
);

Regards,
Maks