Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #144 #151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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