Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#817 nicer selection layout so folks can click on the tests they want…
… to run; run it multiple times with a single button click or type a filter to select a sub-set of the tests to run
  • Loading branch information
jstrachan committed Dec 6, 2013
1 parent 48c5b54 commit 97e83ba
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 25 deletions.
56 changes: 38 additions & 18 deletions hawtio-web/src/main/webapp/app/junit/html/tests.html
@@ -1,24 +1,44 @@
<h1>Tests</h1>
<style>
.testGrid {
height: 300px;
}
</style>
<div ng-controller="JUnit.TreeController">
<div class="row-fluid">
<div class="span8">
<input class="search-query span12" type="text" ng-model="gridOptions.filterOptions.filterText"
placeholder="Filter tests">
</div>
<div class="span4">
<div class="pull-right">
<form class="form-inline">
<button class="btn pull-right" ng-click="runTests()" ng-disabled="!gridOptions.selectedItems.length">Run
Tests
</button>
</form>
</div>
</div>
</div>

<a class="btn" ng-click="runSelectedTests()">Run Selected Tests</a>
<a class="btn" ng-click="runAllTests()">Run All Tests</a>
<div class="row-fluid">
<div class="testGrid" ng-grid="gridOptions"></div>
</div>

<ul>
<li ng-repeat="test in selectedTests">
{{test}} <a class="btn" ng-click="runTest(test)">Run</a>
</li>
</ul>
<div class="row-fluid">
<div ng-show="running">
Running!
</div>
</div>

<div ng-show="running">
Running!
</div>

<div ng-show="testResults" class="alert alert-{{alertClass}}">
<button type="button" class="close" ng-click="clearResults()">&times;</button>
<div class="row-fluid">
<div ng-show="testResults" class="alert alert-{{alertClass}}">
<button type="button" class="close" ng-click="clearResults()">&times;</button>

Run count <strong>{{testResults.runCount}}</strong>
Failure count <strong>{{testResults.failureCount}}</strong>
Ignore count <strong>{{testResults.ignoreCount}}</strong>
Time: <strong>{{testResults.runTime}} ms</strong>
Run count <strong>{{testResults.runCount}}</strong>
Failure count <strong>{{testResults.failureCount}}</strong>
Ignore count <strong>{{testResults.ignoreCount}}</strong>
Time: <strong>{{testResults.runTime}} ms</strong>
</div>
</div>
</div>

39 changes: 32 additions & 7 deletions hawtio-web/src/main/webapp/app/junit/js/tree.ts
Expand Up @@ -7,6 +7,25 @@ module JUnit {
$scope.testClasses = [];
$scope.testClassMap = {};

$scope.gridOptions = {
selectedItems: [],
data: 'selectedTests',
displayFooter: false,
showFilter: false,
filterOptions: {
filterText: ''
},
//selectWithCheckboxOnly: true,
showSelectionCheckbox: true,
columnDefs: [
{
field: 'id',
displayName: 'Test Class'
//cellTemplate: '<div class="ngCellText"><a ng-click="openMessageDialog(row)">{{row.entity.JMSMessageID}}</a></div>',
}
]
};

$scope.$on("$routeChangeSuccess", function (event, current, previous) {
// lets do this asynchronously to avoid Error: $digest already in progress
setTimeout(updateSelectionFromURL, 50);
Expand All @@ -20,12 +39,9 @@ module JUnit {
runTests($scope.testClasses);
};

$scope.runSelectedTests = () => {
runTests($scope.selectedTests);
};

$scope.clearResults = () => {
$scope.testResults = null;
$scope.runTests = () => {
var tests = ($scope.gridOptions.selectedItems || []).map(o => o.id);
runTests(tests);
};

$scope.runTest = (className) => {
Expand All @@ -34,6 +50,13 @@ module JUnit {
}
};


$scope.clearResults = () => {
$scope.testResults = null;
};



function updateSelectionFromURL() {
Jmx.updateTreeSelectionFromURL($location, $("#junittree"), true);
}
Expand All @@ -48,7 +71,9 @@ module JUnit {
if (selectionKey) {
selectedTests = $scope.testClassMap[selectionKey] || [selectionKey];
}
$scope.selectedTests = selectedTests;
$scope.selectedTests = selectedTests.map(t => {
return {id: t};
});
Core.$apply($scope);
}

Expand Down

0 comments on commit 97e83ba

Please sign in to comment.