Skip to content

Commit

Permalink
Fix #144
Browse files Browse the repository at this point in the history
Signed-off-by: Zac Sturgess <[email protected]>
  • Loading branch information
zsturgess committed May 2, 2016
1 parent c099271 commit f9d8a40
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 9 deletions.
9 changes: 9 additions & 0 deletions src/ResultBundle/Tests/E2E/ViewTestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ public function testEditDeleteAndRunInsufficentPermissions()
$this->assertFalse($this->getActionItem(2)->isDisplayed());
$this->assertFalse($this->getActionItem(3)->isDisplayed());
}

public function testEditDeleteAndRunAsAdmin() {
$this->logInAsUser('user-3');
$this->clickThroughToTest(1);

$this->assertTrue($this->getActionItem(1)->isDisplayed());
$this->assertTrue($this->getActionItem(2)->isDisplayed());
$this->assertTrue($this->getActionItem(3)->isDisplayed());
}

private function clickThroughToTest($number)
{
Expand Down
2 changes: 1 addition & 1 deletion src/TestBundle/Tests/E2E/DashboardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function testRunTest()

$this->assertContains(TestFixtures::$tests['test-1']->getName(), $this->getHeaderText());
$this->assertCount(4, $this->webDriver->findElements(
WebDriverBy::cssSelector('.result span')
WebDriverBy::cssSelector('.result')
));
}

Expand Down
2 changes: 1 addition & 1 deletion web/assets/lib/app.min.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion web/assets/lib/src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ overwatchApp.factory('isGranted', [
return userHasRole('ROLE_SUPER_ADMIN');
break;
case 'ADMIN':
return userHasRole('ROLE_ADMIN') && userInGroup(group);
if (typeof group === 'undefined') {
return userHasRole('ROLE_ADMIN');
} else {
return userHasRole('ROLE_ADMIN') && userInGroup(group);
}

break;
case 'USER':
return userInGroup(group);
Expand Down
2 changes: 1 addition & 1 deletion web/assets/styles/app.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions web/partials/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ <h1>Dashboard</h1>
<ul class="tests">
<li data-ng-repeat="test in group.tests">
<div class="test">
<div class="status {{ test.result.status|lowercase }}" title="{{ test.result.status|lowercase|ucfirst }}"></div>
<div class="status {{ test.result.status|lowercase }}" data-ng-attr-title="{{ test.result.status|lowercase|ucfirst }}" title="Not yet run"></div>

<h3>{{ test.name }} (Last Tested <span title="{{ (test.result.createdAt + '000')|date:'medium' }}">{{ test.result.createdAt|timeago }}</span>)</h3>
<h3><a href="#/test/{{ test.id }}" title="View test '{{ test.name }}'">{{ test.name }}</a> (Last Tested <span title="{{ (test.result.createdAt + '000')|date:'medium' }}">{{ test.result.createdAt|timeago }}</span>)</h3>
<p class="test-expect">Expect {{ test.actual }} {{ test.expectation }} {{ test.expected }} </p>

<div class="buttons">
Expand Down
6 changes: 3 additions & 3 deletions web/partials/viewTest.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ <h1>View Test '{{ test.name }}'</h1>
</ul>

<div class="row">
<a class="btn btn-grey" href="#/test/{{ test.id }}/edit" title="Edit test '{{ test.name }}'" data-ng-show="isGranted('ADMIN', group)"><i class="fa fa-pencil-square-o"></i> Edit test</a>
<a class="btn btn-red" data-ng-click="removeTest(test.id)" title="Delete test '{{ test.name }}'" data-ng-show="isGranted('ADMIN', group)"><i class="fa fa-trash-o" aria-hidden="true"></i> Delete</a>
<a class="btn btn-blue" data-ng-click="runTest(test.id)" title="Run test '{{ test.name }}' now" data-ng-show="isGranted('ADMIN', group)"><i class="fa fa-play" aria-hidden="true"></i> Run</a>
<a class="btn btn-grey" href="#/test/{{ test.id }}/edit" title="Edit test '{{ test.name }}'" data-ng-show="isGranted('ADMIN')"><i class="fa fa-pencil-square-o"></i> Edit test</a>
<a class="btn btn-red" data-ng-click="removeTest(test.id)" title="Delete test '{{ test.name }}'" data-ng-show="isGranted('ADMIN')"><i class="fa fa-trash-o" aria-hidden="true"></i> Delete</a>
<a class="btn btn-blue" data-ng-click="runTest(test.id)" title="Run test '{{ test.name }}' now" data-ng-show="isGranted('ADMIN')"><i class="fa fa-play" aria-hidden="true"></i> Run</a>
<a class="btn btn-blue" data-ng-click="loadOlderResults()" title="Show older results" data-ng-show="(test.results.length === lastRequestedResultSize)"><i class="fa fa-eye"></i> Show older results</a>
</div>
</div>
Expand Down

0 comments on commit f9d8a40

Please sign in to comment.