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

Ui scripts: link in a Dialog message


#1

Hi,

I want to show a link in “App.Dialogs.message”.

Is it possible?

Thanks
Giovanni


#2

Hi Giovanni,

Thanks for your posting. App.Dialogs.message expects text so using HTML is not really possible but we are happy to look into this. One option should be to override/set the text yourself after calling App.Dialogs.message and this could look as follows:

App.Dialogs.message('..', 'Title .. ');
$('#messageDialog .dialog-message').html('Your text/HTML ..');

Cheers,
Tobias


#3

It works :slight_smile:

thanks


#4

That’s great to hear, Giovanni :slight_smile:

Cheers,
Tobias


#5

Hi Tobias,

Can you direct me towards some reference or a tutorial where I could do more modifications to the dialog box that pops up after clicking the button? Like instead of App.Dialog.Message, I want to show a list with options in a dialog box where user can select some items and then I can pass/send those via AJAX request (for later processing). An example would be great to have. Thank you in advance.

Pratik


#6

Hi Pratik,

It’s possible to use HTML in the message dialog (via the workaround above) but we would usually advise against heavy customizations via Ajax requests etc. Those complex UI scripts may break with future versions and the more complex UI scripts get the more likely is that they impact TestRail or even break TestRail if your script contains JavaScript errors, for example.

Cheers,
Tobias


#7

Hi Tobias,

Thank you for your response. I will make sure not to make scripts more complex.

Pratik


#8

Thanks, Pratik, sounds good :slight_smile:

Cheers,
Tobias


#9

Hi Tobias, is it possible to use the dialog to gather params (input) to be passed to a jenkins job?


#10

Hi Marcio,

The built-in dialogs are not prepared for this and we would usually recommend triggering automated tests outside of TestRail. This is much more flexible than triggering your tests from TestRail and is the recommended way to trigger tests (e.g. by integrating with your CI or build systems).

Cheers,
Tobias


#11

Tobias,

Is it possible/feasible to gather parameters via a dialog, so we can pass them to the trigger script? I understand that you don’t recommend … TestRail seems to understand the need to trigger execution from TestRail, otherwise you would not have made the UI script customization available.

Thanks,
Márcio


#12

Hello Márcio,

Yes, there are many options to gather additional input via JavaScript. E.g. there are standard JavaScript methods for this such as the “prompt” method, and many other options. We cannot really provide generic JavaScript or programming support as part of the TestRail support, but there are many resources available online on JavaScript programming in general.

I hope this helps!


#13

Hi Dennis,

Usually javascript code comes paired with a css and html portion.
The UI script tutorial provided by TestRail only has sections for javascrip and css definitions. Can you please provide some light how we define the html portion via the UI script?

Thanks,
Márcio


#14

Hello Márcio,

JavaScript would always allow you to add and inject HTML. This is why embedding HTML this way is always the best option. TestRail wouldn’t otherwise know where to inject HTML, so offering other options wouldn’t be as flexible and JavaScript is the best option for this.

Regards,
Dennis


#15

Thanks Dennis. I was able to inject HTML and create a basic form in a modal dialog. At this point we are just playing with UI capabilities. We are more likely to choose a very simple form with a few args to be passed to Jenkins.

Regards,
Márcio


#16

Hi Marcio,

Our team happened to look through these threads with the same purpose of gathering inputs from dialog to be passed to a Jenkins job. If you have any insights or code snippets to share, we’d highly appreciate it.

Thanks!