diff options
5 files changed, 73 insertions, 327 deletions
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js index ed5fe9f..1117ef5 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js @@ -63,12 +63,6 @@ describe('testing the Projects Link for anonymous user', function () { expect(cells.get(1).getText()).toContain("testproject"); }); - // it('redirect to project page when user clicks a project',function(){ - // var projectlink = element(by.linkText('testproject')).click(); - // var EC = browser.ExpectedConditions; - // browser.wait(EC.urlContains(baseURL+ '/#/projects/testproject'), 10000); - // }); - it('delete Operation is not visible for anonymous user ', function () { browser.get(baseURL+'#/projects'); var deleteOperation = element(by.css('a[title=Delete]')); @@ -158,10 +152,10 @@ describe('testing the Project Link for user who is not in submitter group', func expect(buttonCreate.isDisplayed()).toBeFalsy(); }); - it('Delete button is not visible for user ', function () { + it('Delete button is not visible for user ', function () { browser.get(baseURL+'#/projects'); - var buttonCreate = element(by.buttonText('Create')); - expect(buttonCreate.isDisplayed()).toBeFalsy(); + var buttonDelete = element(by.buttonText('Delete')); + expect(buttonDelete.isDisplayed()).toBeFalsy(); }); it('delete Operation is not visible for user ', function () { @@ -302,13 +296,13 @@ describe('testing the Project Link for user who is in submitter group', function expect(buttonCreate.isDisplayed()).toBe(true); }); - it('Delete button is not visible for anonymous user ', function () { + it('Delete button is visible for user ', function () { browser.get(baseURL+'#/projects'); - var buttonCreate = element(by.buttonText('Create')); - expect(buttonCreate.isDisplayed()).toBe(true); + var buttonDelete = element(by.buttonText('Delete')); + expect(buttonDelete.isDisplayed()).toBe(true); }); - it('delete Operation is not visible for user ', function () { + it('delete Operation is visible for user ', function () { browser.get(baseURL+'#/projects'); var deleteOperation = element(by.css('a[title=Delete]')); expect(deleteOperation.isDisplayed()).toBe(true); diff --git a/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js index bed80dd..e7c5fb0 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js @@ -32,154 +32,6 @@ describe('testing the scenarios page for anonymous user', function () { { "date": "2016-12-11 01:45", "score": "14/24" - }, - { - "date": "2016-12-15 05:28", - "score": "17/24" - }, - { - "date": "2016-12-17 03:41", - "score": "16/24" - }, - { - "date": "2018-01-22T18:30:00.000Z", - "score": "10/13" - } - ], - "trust_indicators": [ - { - "date": "2016-12-09 11:38", - "status": "silver" - }, - { - "date": "2016-12-25 08:22", - "status": "gold" - }, - { - "date": "2018-01-22T18:30:00.000Z", - "status": "sf" - }, - { - "date": "2018-01-17T18:30:00.000Z", - "status": "df" - } - ] - }, - { - "project": "functest", - "customs": [ - "vping_ssh", - "vping_userdata", - ], - "scores": [ - { - "date": "2016-12-09 11:28", - "score": "6/8" - }, - { - "date": "2016-12-14 15:34", - "score": "8/8" - }, - { - "date": "2016-12-19 13:22", - "score": "8/8" - }, - { - "date": "2016-12-22 18:17", - "score": "8/8" - }, - { - "date": "2016-12-25 08:22", - "score": "8/8" - } - ], - "trust_indicators": [ - { - "date": "2016-12-09 11:38", - "status": "silver" - } - ] - }, - { - "project": "sla", - "customs": [], - "scores": [ - { - "date": "2018-01-16T18:30:00.000Z", - "score": "sdS" - } - ], - "trust_indicators": [] - }, - { - "project": "dvsd", - "customs": [], - "scores": [], - "trust_indicators": [] - } - ] - }, - { - "owner": "dfgvds", - "version": "df", - "projects": [] - } - ] - }, - { - "installer": "fuel2", - "versions": [ - { - "owner": "testUser", - "version": "colorado", - "projects": [ - { - "project": "yardstick", - "customs": [ - "tc002", - "tc005", - "tc010", - "tc011" - ], - "scores": [ - { - "date": "2016-12-11 01:45", - "score": "14/24" - }, - { - "date": "2016-12-15 05:28", - "score": "17/24" - }, - { - "date": "2016-12-17 03:41", - "score": "16/24" - } - ], - "trust_indicators": [ - { - "date": "2016-12-09 11:38", - "status": "silver" - }, - { - "date": "2016-12-25 08:22", - "status": "gold" - } - ] - }, - { - "project": "functest", - "customs": [ - "vping_ssh", - "vping_userdata" - ], - "scores": [ - { - "date": "2016-12-09 11:28", - "score": "6/8" - }, - { - "date": "2016-12-14 15:34", - "score": "8/8" } ], "trust_indicators": [ @@ -197,7 +49,43 @@ describe('testing the scenarios page for anonymous user', function () { "_id": "5a50fcacsdgdsgdasgfvb861c", "name": "test-scenario", "creation_date": "2018-01-06 22:13:24.160407" - } + }, + { + "installers": [ + { + "installer": "fuel", + "versions": [ + { + "owner": "testUser", + "version": "colorado", + "projects": [ + { + "project": "yardstick", + "customs": [ + "dvs" + ], + "scores": [ + { + "date": "2016-12-11 01:45", + "score": "14/24" + } + ], + "trust_indicators": [ + { + "date": "2016-12-09 11:38", + "status": "silver" + } + ] + } + ] + } + ] + } + ], + "_id": "5a50fcacsdgdsgdasgfvb861d", + "name": "z-test-scenario", + "creation_date": "2018-01-06 22:13:24.160407" + } ] } } @@ -229,6 +117,15 @@ describe('testing the scenarios page for anonymous user', function () { expect(cells.get(1).getText()).toContain("test-scenario"); }); + it('Sort scenarios', function () { + browser.get(baseURL+"#/scenarios"); + var sort = element(by.xpath('//*[@id="ng-app"]/body/div/div[4]/div/table/thead/tr/th[2]/a[2]/span')) + sort.click(); + var row = element.all(by.repeater('(index, scenario) in ctrl.data.scenarios')).first(); + var cells = row.all(by.tagName('td')); + expect(cells.get(1).getText()).toContain("z-test-scenario"); + }); + it('create button is not visible for anonymous user ', function () { browser.get(baseURL+'#/scenarios'); var buttonCreate = element(by.buttonText('Create')); @@ -271,154 +168,6 @@ describe('testing the scenarios page for user', function () { { "date": "2016-12-11 01:45", "score": "14/24" - }, - { - "date": "2016-12-15 05:28", - "score": "17/24" - }, - { - "date": "2016-12-17 03:41", - "score": "16/24" - }, - { - "date": "2018-01-22T18:30:00.000Z", - "score": "10/13" - } - ], - "trust_indicators": [ - { - "date": "2016-12-09 11:38", - "status": "silver" - }, - { - "date": "2016-12-25 08:22", - "status": "gold" - }, - { - "date": "2018-01-22T18:30:00.000Z", - "status": "sf" - }, - { - "date": "2018-01-17T18:30:00.000Z", - "status": "df" - } - ] - }, - { - "project": "functest", - "customs": [ - "vping_ssh", - "vping_userdata", - ], - "scores": [ - { - "date": "2016-12-09 11:28", - "score": "6/8" - }, - { - "date": "2016-12-14 15:34", - "score": "8/8" - }, - { - "date": "2016-12-19 13:22", - "score": "8/8" - }, - { - "date": "2016-12-22 18:17", - "score": "8/8" - }, - { - "date": "2016-12-25 08:22", - "score": "8/8" - } - ], - "trust_indicators": [ - { - "date": "2016-12-09 11:38", - "status": "silver" - } - ] - }, - { - "project": "sla", - "customs": [], - "scores": [ - { - "date": "2018-01-16T18:30:00.000Z", - "score": "sdS" - } - ], - "trust_indicators": [] - }, - { - "project": "dvsd", - "customs": [], - "scores": [], - "trust_indicators": [] - } - ] - }, - { - "owner": "dfgvds", - "version": "df", - "projects": [] - } - ] - }, - { - "installer": "fuel2", - "versions": [ - { - "owner": "testUser", - "version": "colorado", - "projects": [ - { - "project": "yardstick", - "customs": [ - "tc002", - "tc005", - "tc010", - "tc011" - ], - "scores": [ - { - "date": "2016-12-11 01:45", - "score": "14/24" - }, - { - "date": "2016-12-15 05:28", - "score": "17/24" - }, - { - "date": "2016-12-17 03:41", - "score": "16/24" - } - ], - "trust_indicators": [ - { - "date": "2016-12-09 11:38", - "status": "silver" - }, - { - "date": "2016-12-25 08:22", - "status": "gold" - } - ] - }, - { - "project": "functest", - "customs": [ - "vping_ssh", - "vping_userdata" - ], - "scores": [ - { - "date": "2016-12-09 11:28", - "score": "6/8" - }, - { - "date": "2016-12-14 15:34", - "score": "8/8" } ], "trust_indicators": [ @@ -514,13 +263,13 @@ describe('testing the scenarios page for user', function () { expect(cells.get(1).getText()).toContain("test-scenario"); }); - it('create button is not visible for user ', function () { + it('create button is visible for user ', function () { browser.get(baseURL+'#/scenarios'); var buttonCreate = element(by.buttonText('Create')); expect(buttonCreate.isDisplayed()).toBe(true); }); - it('delete button is not visible for user ', function () { + it('delete button is visible for user ', function () { browser.get(baseURL+'#/scenarios'); var buttonDelete = element(by.buttonText('Delete')); expect(buttonDelete.isDisplayed()).toBe(true); diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenarios.html b/testapi/opnfv_testapi/ui/components/scenarios/scenarios.html index 9057b0f..bde946c 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenarios.html +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenarios.html @@ -27,7 +27,14 @@ <tr style=" text-align: center;"> <th style="width: 1%;">Bulk Select</th> - <th style="width: 80%;">Name</th> + <th style="width: 80%;">Name + <a class="text-danger" ng-click="ctrl.sortBy()" ng-class="{ 'hidden': ctrl.sortName }" > + <span class="glyphicon glyphicon-sort-by-alphabet pull-right" aria-hidden="true"></span> + </a> + <a class="text-danger" ng-click="ctrl.sortBy()" ng-class="{ 'hidden': !ctrl.sortName}" > + <span class="glyphicon glyphicon-sort-by-alphabet-alt pull-right" aria-hidden="true"></span> + </a> + </th> <th style="width: 19%;" ng-class="{'hidden': !auth.isAuthenticated}">Operations</th> </tr> </thead> diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js index 98e4089..240287c 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js @@ -21,7 +21,7 @@ ScenariosController.$inject = [ '$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl', - 'raiseAlert', 'confirmModal' + 'raiseAlert', 'confirmModal', 'sortService' ]; /** @@ -30,7 +30,7 @@ * through projects declared in TestAPI. */ function ScenariosController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl, - raiseAlert, confirmModal) { + raiseAlert, confirmModal, sortService) { var ctrl = this; ctrl.url = testapiApiUrl + '/scenarios'; @@ -44,8 +44,9 @@ ctrl.deleteScenario = deleteScenario; ctrl.openBatchDeleteModal = openBatchDeleteModal; ctrl.deleteBatchScenario = deleteBatchScenario - + ctrl.sortBy = sortBy ctrl.checkBox = []; + ctrl.sortName = false function openUpdateModal(name){ $uibModal.open({ @@ -68,6 +69,11 @@ confirmModal("Delete", 'scenarios', ctrl.deleteScenario,name); } + function sortBy(){ + ctrl.data.scenarios = sortService.sortFunction(ctrl.data.scenarios, 'name' , ctrl.sortName) + ctrl.sortName=!ctrl.sortName + } + function deleteScenario(name){ var scenarioURL = ctrl.url+"/"+name; ctrl.scenarioRequest = @@ -142,6 +148,7 @@ ctrl.resultsRequest = $http.get(ctrl.url).success(function (data) { ctrl.data = data; + ctrl.sortBy() }).catch(function (data) { ctrl.data = null; ctrl.showError = true; diff --git a/testapi/testapi-client/testapiclient/utils/command.py b/testapi/testapi-client/testapiclient/utils/command.py index 9614acf..b9d1ce8 100644 --- a/testapi/testapi-client/testapiclient/utils/command.py +++ b/testapi/testapi-client/testapiclient/utils/command.py @@ -20,17 +20,6 @@ class CommandMeta(abc.ABCMeta): @six.add_metaclass(CommandMeta) class Command(command.Command): - - def get_parser(self, prog_name): - parser = super(Command, self).get_parser(prog_name) - parser.add_argument('-u', - type=str, - help='Username for authentication') - parser.add_argument('-p', - type=str, - help='Password for authentication') - return parser - def run(self, parsed_args): self.log.debug('run(%s)', parsed_args) return super(Command, self).run(parsed_args) |