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

New Button Add Test Run to sidebar-milestones


#1

Hello,

I would like to add the button “Add Test Run” to the sidebar of the milestones.
Has anybody did this already using the UI Scripts ?

Thx in advance!


#2

Hi Aymen,

We wouldn’t normally be able to help much with custom scripts as we don’t really have a professional services team. That said, this request was simple enough I was able to put together the following for you. Keep in mind this doesn’t come with any further support but feel free to tweak it to how you see fit.

name: Add Test Run Button to Milestones
description: appends the "Add Test Run" button to the right-hand side bar on the Milestones page. 
author: Gurock Software
version: 1.0
includes: ^milestones
excludes: 

js:
$(document).ready(
	function() {
		$('.sidebar-inner').prepend('<a class="sidebar-button bottom" href="index.php?/runs/add/2"><span>Add Test Run</span></a>');
	}
);

css:
div.some-class {
}

#3

Hi Vtran ,

thank you very much! I tried the script but I’m getting an error: Field Test Suite is not a valid test suite.
Do you know why?

Thank you in advance!


#4

21-01-_2019_15-58-02


#5

Hi Aymen,

In the script provided by Vu, the URI for adding a test run would require the ID of the test suite the run will be based on:

index.php?/runs/add/2

The ‘2’ in the URI should be changed to reflect the test suite ID used for the new test run. This ID would be unique per project and/or test suite.

Please keep in mind this script is just a basic script to add a single button and would need to be modified to suit your needs.


#6

Hello Jon,

well actually i would like to open the Select Test Suite Dialog in ^milestones/view. I tried to copie the Html Code in the UIScript but it didn’t work.
I have many Test Suites and would like to choose directly under the Milestones which Test Run I’m gonna create without going throw Test Runs & Results.

So this is the HTML Code which I wanna have in the UI Script.

<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
<span class="ui-dialog-title" id="ui-dialog-title-chooseSuiteDialog">Select Test Suite</span>
<a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button"><span class="ui-icon ui-icon-closethick">close</span></a></div>
<div class="dialog ui-dialog-content ui-widget-content" id="chooseSuiteDialog" style="width: auto; display: block; min-height: 0px; height: auto;">
	<div class="dialog-title">Select Test Suite</div>	
	<form id="chooseSuiteForm">
		<div class="dialog-body">
			<div class="form-group bottom">
				<label for="choose_suite_id">Test Suite					<span class="form-required">*</span></label>
				<select class="form-control form-control-full form-select" name="choose_suite_id" id="choose_suite_id">
											<option value="78">Option 1</option>
											<option value="75">Option 2</option>
											<option value="77">Option 3</option>
											
									</select>
				<div class="form-description">Select the test suite for the new test run.</div>
			</div>
		</div>
		<div class="button-group dialog-buttons">
			<button class="button button-left button-positive button-ok dialog-action-default" type="submit">
				OK			</button>
			<a class="button button-left button-negative button-cancel dialog-action-close">
				Cancel			</a>
		</div>
	</form>
</div>

Thank you very much!