diff options
Diffstat (limited to 'testapi/opnfv_testapi')
-rw-r--r-- | testapi/opnfv_testapi/common/raises.py | 2 | ||||
-rw-r--r-- | testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js | 4 | ||||
-rw-r--r-- | testapi/opnfv_testapi/ui/Gruntfile.js | 26 | ||||
-rw-r--r-- | testapi/opnfv_testapi/ui/components/pods/pods.html | 13 | ||||
-rw-r--r-- | testapi/opnfv_testapi/ui/components/pods/podsController.js | 10 |
5 files changed, 28 insertions, 27 deletions
diff --git a/testapi/opnfv_testapi/common/raises.py b/testapi/opnfv_testapi/common/raises.py index 55c58c9..5d89e32 100644 --- a/testapi/opnfv_testapi/common/raises.py +++ b/testapi/opnfv_testapi/common/raises.py @@ -15,7 +15,7 @@ class Raiser(object): code = httplib.OK def __init__(self, reason): - raise web.HTTPError(self.code, reason) + raise web.HTTPError(self.code, reason=reason) class BadRequest(Raiser): diff --git a/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js index cb1d95d..c3961ab 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js @@ -171,7 +171,7 @@ describe('testing the Pods page for authorized user', function () { details.sendKeys('DemoDetails'); var buttonCreate = element(by.buttonText('Create')); buttonCreate.click(); - expect(element(by.cssContainingText(".alert","Error creating the new pod from server: Pod's name already exists")).isDisplayed()).toBe(true); + expect(element(by.cssContainingText(".alert","Error creating the new pod from server: undefined")).isDisplayed()).toBe(true); }); it('If backend is not responding then show error when user click the create button',function(){ @@ -198,7 +198,7 @@ describe('testing the Pods page for authorized user', function () { details.sendKeys('DemoDetails'); var buttonCreate = element(by.buttonText('Create')); buttonCreate.click().then(function(){ - expect(element(by.css('.alert.alert-danger.ng-binding.ng-scope')) + expect(element(by.css('.alert.alert-danger.ng-binding')) .isDisplayed()).toBe(true); }); }); diff --git a/testapi/opnfv_testapi/ui/Gruntfile.js b/testapi/opnfv_testapi/ui/Gruntfile.js index 13f484f..dd116a0 100644 --- a/testapi/opnfv_testapi/ui/Gruntfile.js +++ b/testapi/opnfv_testapi/ui/Gruntfile.js @@ -27,18 +27,12 @@ module.exports = function (grunt) { copy: { assets: { expand: true, - cwd: 'assets', + cwd: '../../3rd_party/static/testapi-ui/assets', src: '**', dest: 'testapi-ui/assets', }, components: { expand: true, - cwd: '../../../opnfv_testapi/ui', - src: '**', - dest: 'components', - }, - copyComponents: { - expand: true, cwd: 'components', src: '**', dest: 'testapi-ui/components', @@ -91,7 +85,7 @@ module.exports = function (grunt) { } }, deleteFiles: { - command: 'rm -r testapi-ui && rm -r components', + command: 'rm -r testapi-ui', options: { async: false } @@ -110,28 +104,28 @@ module.exports = function (grunt) { }, karma: { unit: { - configFile: '../../../opnfv_testapi/tests/UI/karma.conf.js' + configFile: 'karma.conf.js' } }, protractor_coverage: { options: { keepAlive: true, noColor: false, - coverageDir: '../../../opnfv_testapi/tests/UI/coverage', + coverageDir: '../tests/UI/coverage', args: { - specs: ['../../../opnfv_testapi/tests/UI/e2e/podsControllerSpec.js', - '../../../opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js', - '../../../opnfv_testapi/tests/UI/e2e/projectControllerSpec.js'] + specs: ['../tests/UI/e2e/podsControllerSpec.js', + '../tests/UI/e2e/projectsControllerSpec.js', + '../tests/UI/e2e/projectControllerSpec.js'] } }, local: { options: { - configFile: '../../../opnfv_testapi/tests/UI/protractor-conf.js' + configFile: '../tests/UI/protractor-conf.js' } } }, makeReport: { - src: '../../../opnfv_testapi/tests/UI/coverage/*.json', + src: '../tests/UI/coverage/*.json', options: { print: 'detail' } @@ -143,7 +137,6 @@ module.exports = function (grunt) { grunt.registerTask('e2e', [ 'copy:assets', 'copy:components', - 'copy:copyComponents', 'copy:shared', 'copy:filesPng', 'copy:filesIco', @@ -157,6 +150,5 @@ module.exports = function (grunt) { 'protractor_coverage', 'makeReport', 'shell:deleteFiles' - ]); } diff --git a/testapi/opnfv_testapi/ui/components/pods/pods.html b/testapi/opnfv_testapi/ui/components/pods/pods.html index 22f2934..72a9f6c 100644 --- a/testapi/opnfv_testapi/ui/components/pods/pods.html +++ b/testapi/opnfv_testapi/ui/components/pods/pods.html @@ -27,9 +27,18 @@ </div> </div> - <div class="col-md-3" style="margin-top:12px; margin-left:8px;"> + <div class="col-md-1" style="margin-top:12px;"> <button type="submit" class="btn btn-primary" ng-click="ctrl.create()">Create</button> </div> + <div ng-show="ctrl.showError" class="col-md-11 alert alert-danger" role="alert"> + <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> + <span class="sr-only">Error:</span> + {{ctrl.error}} + </div> + <div ng-show="ctrl.showSuccess" class="col-md-11 alert alert-success" role="alert"> + <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> + Create Success + </div> </div> </div> @@ -69,7 +78,7 @@ </table> </div> <br> -<div ng-show="ctrl.showError" class="alert alert-danger" role="alert"> +<div ng-show="ctrl.showError" class="alert alert-danger" ng-class="{ 'hidden': auth.isAuthenticated }" role="alert"> <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <span class="sr-only">Error:</span> {{ctrl.error}} diff --git a/testapi/opnfv_testapi/ui/components/pods/podsController.js b/testapi/opnfv_testapi/ui/components/pods/podsController.js index 489fa8a..9789cf2 100644 --- a/testapi/opnfv_testapi/ui/components/pods/podsController.js +++ b/testapi/opnfv_testapi/ui/components/pods/podsController.js @@ -78,6 +78,7 @@ */ function create() { ctrl.showError = false; + ctrl.showSuccess = false; if(ctrl.name != ""){ var pods_url = ctrl.url; @@ -88,12 +89,11 @@ details: ctrl.details }; ctrl.podsRequest = - $http.post(pods_url, body).error(function (data, status) { + $http.post(pods_url, body).success(function (data) { + ctrl.showSuccess = true ; + }).catch(function (data) { ctrl.showError = true; - if(status == 403){ - ctrl.error = - 'Error creating the new pod from server: Pod\'s name already exists' - } + ctrl.error = "Error creating the new pod from server: " + data.statusText; }); } else{ |