summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi')
-rw-r--r--testapi/opnfv_testapi/common/check.py24
-rw-r--r--testapi/opnfv_testapi/handlers/sign_handlers.py2
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js233
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/deployResultsControllerSpec.js2
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js36
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js74
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js138
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js45
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js387
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js25
-rw-r--r--testapi/opnfv_testapi/tests/unit/executor.py8
-rw-r--r--testapi/opnfv_testapi/tests/unit/fake_pymongo.py6
-rw-r--r--testapi/opnfv_testapi/tests/unit/handlers/test_base.py4
-rw-r--r--testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py31
-rw-r--r--testapi/opnfv_testapi/ui/Gruntfile.js17
-rw-r--r--testapi/opnfv_testapi/ui/app.js17
-rw-r--r--testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResult.html68
-rw-r--r--testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResultController.js21
-rw-r--r--testapi/opnfv_testapi/ui/components/pods/pod/pod.html30
-rw-r--r--testapi/opnfv_testapi/ui/components/pods/pod/podController.js8
-rw-r--r--testapi/opnfv_testapi/ui/components/pods/pods.html16
-rw-r--r--testapi/opnfv_testapi/ui/components/pods/podsController.js45
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/project/project.html22
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/project/projectController.js6
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html70
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCaseController.js6
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html130
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js68
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/projects.html16
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/projectsController.js66
-rw-r--r--testapi/opnfv_testapi/ui/components/results/result/result.html72
-rw-r--r--testapi/opnfv_testapi/ui/components/results/result/resultController.js22
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html6
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html16
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js93
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenarios.html25
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js83
-rw-r--r--testapi/opnfv_testapi/ui/index.html2
-rw-r--r--testapi/opnfv_testapi/ui/package.json1
39 files changed, 991 insertions, 950 deletions
diff --git a/testapi/opnfv_testapi/common/check.py b/testapi/opnfv_testapi/common/check.py
index 18dc67d..fdc527f 100644
--- a/testapi/opnfv_testapi/common/check.py
+++ b/testapi/opnfv_testapi/common/check.py
@@ -31,16 +31,22 @@ def is_authorized(method):
raises.Unauthorized(message.not_lfid())
if method.__name__ == "_create":
kwargs['creator'] = testapi_id
- if self.table in ['projects']:
+ if self.table in ['projects', 'testcases']:
+ map_name = {
+ 'projects': 'name',
+ 'testcases': 'project_name'
+ }
+ group = "opnfv-gerrit-{}-submitters"
query = kwargs.get('query')
if type(query) is not dict:
query_data = query()
else:
- if self.json_args is None or 'name' not in self.json_args:
+ if (self.json_args is None or
+ map_name[self.table] not in self.json_args):
query_data = query
else:
query_data = self.json_args
- group = "opnfv-gerrit-" + query_data['name'] + "-submitters"
+ group = group.format(query_data[map_name[self.table]])
if group not in user_info['groups']:
raises.Unauthorized(message.no_permission())
ret = yield gen.coroutine(method)(self, *args, **kwargs)
@@ -59,12 +65,14 @@ def is_reource_tied(method):
}
if self.table in tied_maps:
if method.__name__ == '_update':
- if 'name' not in self.json_args:
- ret = yield gen.coroutine(method)(self, *args, **kwargs)
- raise gen.Return(ret)
+ if 'name' in self.json_args:
+ if self.json_args['name'] == kwargs.get('query')['name']:
+ ret = yield gen.coroutine(method)(
+ self, *args, **kwargs)
+ raise gen.Return(ret)
query_data[tied_maps[self.table][1]] = kwargs.get('query')['name']
- data = yield dbapi.db_find_one(tied_maps[self.table][0],
- query_data)
+ data = yield dbapi.db_find_one(
+ tied_maps[self.table][0], query_data)
if data:
raises.Unauthorized(message.tied_with_resource())
ret = yield gen.coroutine(method)(self, *args, **kwargs)
diff --git a/testapi/opnfv_testapi/handlers/sign_handlers.py b/testapi/opnfv_testapi/handlers/sign_handlers.py
index 7540662..2039971 100644
--- a/testapi/opnfv_testapi/handlers/sign_handlers.py
+++ b/testapi/opnfv_testapi/handlers/sign_handlers.py
@@ -46,7 +46,7 @@ class SigninReturnHandler(SignBaseHandler):
dbapi.db_update(self.table, q_user, login_user)
self.clear_cookie(constants.TESTAPI_ID)
- self.set_secure_cookie(constants.TESTAPI_ID, user)
+ self.set_secure_cookie(constants.TESTAPI_ID, user, 1)
self.redirect(url=CONF.ui_url)
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js
index 3212b86..6b9a2bf 100644
--- a/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js
+++ b/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js
@@ -47,7 +47,7 @@ describe('testing the pods page for anonymous user', function () {
});
});
-describe('testing the pods page for anonymous user', function () {
+describe('testing the project page for anonymous user', function () {
beforeEach(function(){
mock([
{
@@ -250,7 +250,7 @@ describe('testing the scenarios page for anonymous user', function () {
browser.get(baseURL+"#/scenarios/test-scenario");
var EC = browser.ExpectedConditions;
browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
- var buttonAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[2]/button'))
+ var buttonAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[2]/button'))
expect(buttonAdd.isDisplayed()).toBe(true);
});
@@ -258,9 +258,9 @@ describe('testing the scenarios page for anonymous user', function () {
browser.get(baseURL+"#/scenarios/test-scenario");
var EC = browser.ExpectedConditions;
browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
- var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p'))
installersShow.click();
- var installerDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[3]/button'))
+ var installerDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[3]/button'))
expect(installerDelete.isDisplayed()).toBe(true);
});
@@ -268,11 +268,11 @@ describe('testing the scenarios page for anonymous user', function () {
browser.get(baseURL+"#/scenarios/test-scenario");
var EC = browser.ExpectedConditions;
browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
- var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p'))
installersShow.click();
- var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
installerShow.click();
- var versionAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[2]/button'))
+ var versionAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[2]/button'))
versionAdd.click()
expect(versionAdd.isDisplayed()).toBe(true);
});
@@ -281,15 +281,15 @@ describe('testing the scenarios page for anonymous user', function () {
browser.get(baseURL+"#/scenarios/test-scenario");
var EC = browser.ExpectedConditions;
browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
- var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p'))
installersShow.click();
- var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
installerShow.click();
- var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
+ var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
versionsShow.click();
- var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
versionShow.click()
- var versionDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody[1]/tr[1]/td[3]/button'))
+ var versionDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody[1]/tr[1]/td[3]/button'))
expect(versionDelete.isDisplayed()).toBe(true);
});
@@ -297,15 +297,15 @@ describe('testing the scenarios page for anonymous user', function () {
browser.get(baseURL+"#/scenarios/test-scenario");
var EC = browser.ExpectedConditions;
browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
- var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p'))
installersShow.click();
- var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
installerShow.click();
- var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
+ var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
versionsShow.click();
- var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
versionShow.click()
- var projectAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[2]/button'))
+ var projectAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[2]/button'))
projectAdd.click()
expect(projectAdd.isDisplayed()).toBe(true);
});
@@ -314,17 +314,17 @@ describe('testing the scenarios page for anonymous user', function () {
browser.get(baseURL+"#/scenarios/test-scenario");
var EC = browser.ExpectedConditions;
browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
- var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p'))
installersShow.click();
- var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
installerShow.click();
- var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
+ var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
versionsShow.click();
- var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
versionShow.click()
- var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a'))
+ var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a'))
projectsShow.click();
- var projectDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[1]/td[3]/button'))
+ var projectDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[1]/td[3]/button'))
projectDelete.click()
expect(projectDelete.isDisplayed()).toBe(true);
});
@@ -333,24 +333,24 @@ describe('testing the scenarios page for anonymous user', function () {
browser.get(baseURL+"#/scenarios/test-scenario");
var EC = browser.ExpectedConditions;
browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
- var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p'))
installersShow.click();
- var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
installerShow.click();
- var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
+ var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
versionsShow.click();
- var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
versionShow.click()
- var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a'))
+ var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a'))
projectsShow.click();
- var projectShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ var projectShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
projectShow.click();
- var customsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/a/p'))
+ var customsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/a/p'))
customsShow.click();
var row = element.all(by.repeater('(indexCU, custom) in project.customs')).first();
var cells = row.all(by.tagName('td'));
expect(cells.get(0).getText()).toContain("dvs");
- var buttonAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/button'))
+ var buttonAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/button'))
buttonAdd.click()
expect(buttonAdd.isDisplayed()).toBe(true);
});
@@ -359,27 +359,182 @@ describe('testing the scenarios page for anonymous user', function () {
browser.get(baseURL+"#/scenarios/test-scenario");
var EC = browser.ExpectedConditions;
browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
- var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[1]/a/p'))
+ var installersShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p'))
installersShow.click();
- var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
installerShow.click();
- var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
+ var versionsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
versionsShow.click();
- var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ var versionShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
versionShow.click()
- var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a'))
+ var projectsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a'))
projectsShow.click();
- var projectShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ var projectShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
projectShow.click();
- var customsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/a/p'))
+ var customsShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/a/p'))
customsShow.click();
var row = element.all(by.repeater('(indexCU, custom) in project.customs')).first();
var cells = row.all(by.tagName('td'));
expect(cells.get(0).getText()).toContain("dvs");
- var buttonDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/table/tbody/tr[1]/td[2]/button'))
+ var buttonDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[4]/td[2]/table/tbody/tr[1]/td[2]/button'))
buttonDelete.click()
expect(buttonDelete.isDisplayed()).toBe(true);
});
});
+describe('testing the testCases page for anonymous user', function () {
+ beforeEach(function(){
+ mock([
+ {
+ request: {
+ path: '/api/v1/projects',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "projects": [
+ {
+ "creator": "thuva4",
+ "_id": "5a0c022f9a07c846d3c2cc94",
+ "creation_date": "2017-11-15 14:30:31.200259",
+ "description": "dsfsd",
+ "name": "testproject"
+ }
+ ]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/projects/testproject',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "creator": "thuva4",
+ "_id": "5a0c022f9a07c846d3c2cc94",
+ "creation_date": "2017-11-15 14:30:31.200259",
+ "description": "dsfsd",
+ "name": "testproject"
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/projects/testproject/cases',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "testcases": [
+ {
+ "project_name": "testproject",
+ "run": null,
+ "description": null,
+ "tags": null,
+ "creation_date": "2017-12-20 18:47:04.025544",
+ "dependencies": null,
+ "tier": null,
+ "trust": null,
+ "blocking": null,
+ "name": "testCase",
+ "ci_loop": null,
+ "url": null,
+ "version": null,
+ "criteria": null,
+ "domains": null,
+ "_id": "5a3a62d09a07c836e06858fb",
+ "catalog_description": null
+ }
+ ]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/projects/testproject/cases/testCase',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "project_name": "testproject",
+ "run": null,
+ "description": null,
+ "tags": null,
+ "creation_date": "2017-12-20 18:47:04.025544",
+ "dependencies": null,
+ "tier": null,
+ "trust": null,
+ "blocking": null,
+ "name": "testCase",
+ "ci_loop": null,
+ "url": null,
+ "version": null,
+ "criteria": null,
+ "domains": null,
+ "_id": "5a3a62d09a07c836e06858fb",
+ "catalog_description": null
+ }
+ }
+ }
+ ]);
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it( 'should show the testCases for anonymous user', function() {
+ browser.get(baseURL+"#/projects/testproject");
+ var testCases = element(by.linkText('Test Cases'));
+ testCases.click();
+ var row = element.all(by.repeater('(index, testcase) in testCasesCtrl.data.testcases')).first();
+ var cells = row.all(by.tagName('td'));
+ expect(cells.get(1).getText()).toContain("testCase");
+ });
+
+ it( 'navigate anonymous user to testCase page', function() {
+ browser.get(baseURL+"#/projects/testproject");
+ var testCases = element(by.linkText('Test Cases'));
+ testCases.click();
+ var testCase = element(by.linkText('testCase'));
+ testCase.click();
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/projects/testproject/testCase'), 10000);
+ });
+
+ it('create button is visible for anonymous user ', function () {
+ browser.get(baseURL+"#/projects/testproject");
+ var testCases = element(by.linkText('Test Cases'));
+ testCases.click();
+ var buttonCreate = element(by.buttonText('Create'));
+ expect(buttonCreate.isDisplayed()).toBe(true);
+ });
+
+ it('Delete button is not visible for anonymous user ', function () {
+ browser.get(baseURL+"#/projects/testproject");
+ var testCases = element(by.linkText('Test Cases'));
+ testCases.click();
+ var buttonDelete = element(by.buttonText('Delete'));
+ expect(buttonDelete.isDisplayed()).toBe(true);
+ });
+
+ it('delete Operation is visible for anonymous user ', function () {
+ browser.get(baseURL+"#/projects/testproject");
+ var testCases = element(by.linkText('Test Cases'));
+ testCases.click();
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ expect(deleteOperation.isDisplayed()).toBe(true);
+ });
+
+ it('Edit Operation is visible for anonymous user ', function () {
+ browser.get(baseURL+"#/projects/testproject");
+ var testCases = element(by.linkText('Test Cases'));
+ testCases.click();
+ var editOperation = element(by.css('a[title=Edit]'));
+ expect(editOperation.isDisplayed()).toBe(true);
+ });
+});
+
+
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/deployResultsControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/deployResultsControllerSpec.js
index e00243b..40f60e4 100644
--- a/testapi/opnfv_testapi/tests/UI/e2e/deployResultsControllerSpec.js
+++ b/testapi/opnfv_testapi/tests/UI/e2e/deployResultsControllerSpec.js
@@ -383,7 +383,7 @@ describe('testing the result page for user', function () {
buttonClear.click();
var row = element.all(by.repeater('(index, result) in ctrl.data.deployresults')).first();
var cells = row.all(by.tagName('td'));
- expect(cells.get(0).getText()).toContain("3c9f8d62");
+ expect(cells.get(0).getText()).toContain("3c9f8d63");
});
it('view the deploy results ', function () {
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js
index 16b219d..ac1f954 100644
--- a/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js
+++ b/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js
@@ -78,7 +78,7 @@ describe('testing the Pods page for anonymous user', function () {
it('Sort the results by mode', function () {
browser.get(baseURL+'#/pods');
- var sortMode = element(by.xpath('//*[@id="ng-app"]/body/div/div[6]/div/table/thead/tr/th[4]/a[2]/span'))
+ var sortMode = element(by.xpath('//*[@id="ng-app"]/body/div/div[5]/div/table/thead/tr/th[4]/a[2]/span'))
sortMode.click();
var row = element.all(by.repeater('(index, pod) in ctrl.data.pods')).first();
var cells = row.all(by.tagName('td'));
@@ -87,7 +87,7 @@ describe('testing the Pods page for anonymous user', function () {
it('Sort the results by role', function () {
browser.get(baseURL+'#/pods');
- var sortRole = element(by.xpath('//*[@id="ng-app"]/body/div/div[6]/div/table/thead/tr/th[3]/a[2]/span'))
+ var sortRole = element(by.xpath('//*[@id="ng-app"]/body/div/div[5]/div/table/thead/tr/th[3]/a[2]/span'))
sortRole.click();
var row = element.all(by.repeater('(index, pod) in ctrl.data.pods')).first();
var cells = row.all(by.tagName('td'));
@@ -262,8 +262,11 @@ describe('testing the Pods page for authorized user', function () {
.isDisplayed()).toBe(true);
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Delete Success"))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Delete Success"))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('Delete the pods ', function () {
@@ -272,8 +275,11 @@ describe('testing the Pods page for authorized user', function () {
deleteOperation.click();
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Delete Success"))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Delete Success"))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('Create the pod', function () {
@@ -286,8 +292,11 @@ describe('testing the Pods page for authorized user', function () {
name.sendKeys('test1');
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Create Success"))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Create Success"))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('Showing error when creating with a empty name ', function () {
@@ -299,8 +308,11 @@ describe('testing the Pods page for authorized user', function () {
browser.wait(EC.visibilityOf(name), 5000);
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click()
- expect(element(by.cssContainingText(".alert","Name is missing."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".error.show","Name is missing."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('cancel the delete confimation modal of the pod ', function () {
@@ -356,8 +368,11 @@ describe('testing the Pods page for authorized user', function () {
deleteOperation.click();
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.css(".alert.alert-danger"))
+ browser.ignoreSynchronization = true;
+ expect(element(by.css(".error.show"))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('view the test case ', function () {
@@ -394,8 +409,13 @@ describe('testing the Pods page for authorized user', function () {
},
]);
browser.get(baseURL+"#/pods");
- expect(element(by.css(".alert.alert-danger"))
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '/#/pods'), 5000);
+ browser.ignoreSynchronization = true;
+ expect(element(by.css(".error.show"))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
}); \ No newline at end of file
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js
index ed5fe9f..da86389 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);
@@ -330,8 +324,12 @@ describe('testing the Project Link for user who is in submitter group', function
name.sendKeys('testproject');
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Project is successfully created."))
+
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Project is successfully created."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('Show error if user doesnt have permission to Create the Project', function () {
@@ -346,7 +344,10 @@ describe('testing the Project Link for user who is in submitter group', function
description.sendKeys('demoDescription');
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.css(".alert.alert-danger")).isDisplayed()).toBe(true);
+ browser.ignoreSynchronization = true;
+ expect(element(by.css(".error")).isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('Showing error when creating with a empty name ', function () {
@@ -358,8 +359,11 @@ describe('testing the Project Link for user who is in submitter group', function
browser.wait(EC.visibilityOf(name), 5000);
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
+ browser.ignoreSynchronization = true;
expect(element(by.cssContainingText(".alert","Name is missing."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('Show error when user click the create button with an already existing name', function () {
@@ -374,7 +378,10 @@ describe('testing the Project Link for user who is in submitter group', function
description.sendKeys('demoDescription');
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.css(".alert.alert-danger")).isDisplayed()).toBe(true);
+ browser.ignoreSynchronization = true;
+ expect(element(by.css(".error")).isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('cancel the delete confimation modal of the project ', function () {
@@ -394,8 +401,11 @@ describe('testing the Project Link for user who is in submitter group', function
.isDisplayed()).toBe(true);
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Projects is successfully deleted"))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Projects is successfully deleted"))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it(' Show error if user doesnt has permission to delete the projects ', function () {
@@ -448,7 +458,10 @@ describe('testing the Project Link for user who is in submitter group', function
deleteOperation.click();
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.css(".alert.alert-danger")).isDisplayed()).toBe(true);
+ browser.ignoreSynchronization = true;
+ expect(element(by.css(".error")).isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('cancel the Edit modal of the Project ', function () {
@@ -474,8 +487,12 @@ describe('testing the Project Link for user who is in submitter group', function
name.sendKeys('test1');
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click()
- expect(element(by.cssContainingText(".alert","Project is successfully updated."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Project is successfully updated."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
+
});
it('Show error if user doesnt has permission to edit the projects ', function () {
@@ -532,7 +549,10 @@ describe('testing the Project Link for user who is in submitter group', function
name.sendKeys('test1');
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click()
- expect(element(by.css(".alert.alert-danger")).isDisplayed()).toBe(true);
+ browser.ignoreSynchronization = true;
+ expect(element(by.css(".error")).isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('Batch Delete the projects ', function () {
@@ -543,8 +563,12 @@ describe('testing the Project Link for user who is in submitter group', function
buttonDelete.click();
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Projects is successfully deleted"))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Projects is successfully deleted"))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
+
});
it('If backend is not responding then show error when user click the create button',function(){
@@ -576,8 +600,10 @@ describe('testing the Project Link for user who is in submitter group', function
name.sendKeys('testproject');
details.sendKeys('demoDescription');
var buttonOK = element(by.buttonText('Ok'));
- buttonOK.click().then(function(){
- expect(element(by.css(".alert.alert-danger")).isDisplayed()).toBe(true);
- });
+ buttonOK.click()
+ browser.ignoreSynchronization = true;
+ expect(element(by.css(".error")).isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
})
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js
index d091a38..48690a1 100644
--- a/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js
+++ b/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js
@@ -44,11 +44,40 @@ describe('testing the result page for anonymous user', function () {
},
{
request: {
+ path: '/api/v1/results/5a45170bbb2092000e2643f4',
+ method: 'GET',
+ },
+ response: {
+ data: {
+ "project_name": "testproject",
+ "description": "Demo results",
+ "stop_date": "2017-12-28 16:08:43",
+ "case_name": "testcase",
+ "build_tag": null,
+ "user": null,
+ "installer": "fuel",
+ "scenario": "test-scenario",
+ "public": "true",
+ "version": "euphrates",
+ "details": {
+ "failures": 0,
+ "errors": 0,
+ "stream": "steam text"
+ },
+ "criteria": "PASS",
+ "_id": "5a45170bbb2092000e2643f4",
+ "start_date": "2017-12-28 14:44:27",
+ "pod_name": "testPod"
+ }
+ }
+ },
+ {
+ request: {
path: '/api/v1/results',
method: 'GET',
queryString: {
page: '1',
- project: 'testproject'
+ installer: 'testinstaller'
}
},
response: {
@@ -65,7 +94,7 @@ describe('testing the result page for anonymous user', function () {
"case_name": "testcase",
"build_tag": null,
"user": null,
- "installer": "fuel",
+ "installer": "testinstaller",
"scenario": "test-scenario",
"trust_indicator": null,
"public": "true",
@@ -86,8 +115,8 @@ describe('testing the result page for anonymous user', function () {
method: 'GET',
queryString: {
page: '1',
- project: 'testproject',
- case: 'testcase'
+ installer: 'testinstaller',
+ version: 'testversion'
}
},
response: {
@@ -104,10 +133,10 @@ describe('testing the result page for anonymous user', function () {
"case_name": "testcase",
"build_tag": null,
"user": null,
- "installer": "fuel",
+ "installer": "testinstaller",
"scenario": "test-scenario",
"public": "true",
- "version": "euphrates",
+ "version": "testversion",
"details": "",
"criteria": "PASS",
"_id": "5a45170bbb2092000e2643f6",
@@ -117,7 +146,25 @@ describe('testing the result page for anonymous user', function () {
]
}
}
- }
+ },
+ {
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ pods: [
+ {role: "community-ci", name: "test2", creator: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7ae5",
+ creation_date: "2017-10-25 11:58:25.926168"},
+ {role: "production-ci", name: "test", creator: "testUser",
+ details: "DemoDetails", mode: "virtual", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}
+ ]
+ }
+ }
+ }
]);
});
@@ -125,7 +172,7 @@ describe('testing the result page for anonymous user', function () {
mock.teardown();
});
- it( 'should show the results page for anonymous user', function() {
+ it( 'should show the results page ', function() {
browser.get(baseURL+"#/results");
expect(element(by.cssContainingText(".ng-binding.ng-scope","Test Results")).isDisplayed()).toBe(true);
});
@@ -137,26 +184,37 @@ describe('testing the result page for anonymous user', function () {
browser.wait(EC.urlContains(baseURL+ '#/results'), 10000);
});
- it('Should show the results in results page for anonymous user ', function () {
+ it('Should show the results in results page', function () {
browser.get(baseURL+"#/results");
var row = element.all(by.repeater('(index, result) in ctrl.data.results')).first();
var cells = row.all(by.tagName('td'));
expect(cells.get(0).getText()).toContain("0e2643f4");
});
- it('Should show the results in results page related to the filters for anonymous user ', function () {
+ it( 'navigate to result page and check details', function() {
+ browser.get(baseURL);
+ var resultLink = element(by.linkText('Results')).click();
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/results'), 10000);
+ var resultLink = element(by.linkText('0e2643f4')).click();
+ browser.wait(EC.urlContains(baseURL+ '#/result/5a45170bbb2092000e2643f4'), 10000);
+ expect(element(by.cssContainingText(".key.col-md-2","failures")).isDisplayed()).toBe(true);
+ expect(element(by.cssContainingText(".leaf-value.col-md-10","0")).isDisplayed()).toBe(true);
+ });
+
+ it('Should show the results in results page related to the filters', function () {
browser.get(baseURL+"#/results");
var filter = element(by.model('ctrl.filter'));
var filterText = element(by.model('ctrl.filterText'));
- filter.sendKeys('project');
- filterText.sendKeys('testproject');
+ filter.sendKeys('installer');
+ filterText.sendKeys('testinstaller');
var buttonFilter = element(by.buttonText('Filter'));
buttonFilter.click();
var row = element.all(by.repeater('(index, result) in ctrl.data.results')).first();
var cells = row.all(by.tagName('td'));
expect(cells.get(0).getText()).toContain("0e2643f5");
- filter.sendKeys('case');
- filterText.sendKeys('testcase')
+ filter.sendKeys('version');
+ filterText.sendKeys('testversion')
buttonFilter.click();
expect(cells.get(0).getText()).toContain("0e2643f6");
});
@@ -164,8 +222,8 @@ describe('testing the result page for anonymous user', function () {
browser.get(baseURL+"#/results");
var filter = element(by.model('ctrl.filter'));
var filterText = element(by.model('ctrl.filterText'));
- filter.sendKeys('project');
- filterText.sendKeys('testproject1');
+ filter.sendKeys('installer');
+ filterText.sendKeys('testisntaller1');
var buttonFilter = element(by.buttonText('Filter'));
buttonFilter.click();
expect(element(by.css('.alert.alert-danger.ng-binding.ng-scope'))
@@ -233,7 +291,7 @@ describe('testing the result page for user', function () {
method: 'GET',
queryString: {
page: '1',
- project: 'testproject'
+ installer: 'testinstaller'
}
},
response: {
@@ -250,7 +308,7 @@ describe('testing the result page for user', function () {
"case_name": "testcase",
"build_tag": null,
"user": null,
- "installer": "fuel",
+ "installer": "testinstaller",
"scenario": "test-scenario",
"public": "true",
"version": "euphrates",
@@ -270,8 +328,8 @@ describe('testing the result page for user', function () {
method: 'GET',
queryString: {
page: '1',
- project: 'testproject',
- case: 'testcase'
+ installer: 'testinstaller',
+ version: 'testversion'
}
},
response: {
@@ -288,11 +346,11 @@ describe('testing the result page for user', function () {
"case_name": "testcase",
"build_tag": null,
"user": null,
- "installer": "fuel",
+ "installer": "testinstaller",
"scenario": "test-scenario",
"trust_indicator": null,
"public": "true",
- "version": "euphrates",
+ "version": "testversion",
"details": "",
"criteria": "PASS",
"_id": "5a45170bbb2092000e2643f6",
@@ -302,7 +360,25 @@ describe('testing the result page for user', function () {
]
}
}
- }
+ },
+ {
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ pods: [
+ {role: "community-ci", name: "test2", creator: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7ae5",
+ creation_date: "2017-10-25 11:58:25.926168"},
+ {role: "production-ci", name: "test", creator: "testUser",
+ details: "DemoDetails", mode: "virtual", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}
+ ]
+ }
+ }
+ }
]);
});
@@ -333,15 +409,15 @@ describe('testing the result page for user', function () {
browser.get(baseURL+"#/results");
var filter = element(by.model('ctrl.filter'));
var filterText = element(by.model('ctrl.filterText'));
- filter.sendKeys('project');
- filterText.sendKeys('testproject');
+ filter.sendKeys('installer');
+ filterText.sendKeys('testinstaller');
var buttonFilter = element(by.buttonText('Filter'));
buttonFilter.click();
var row = element.all(by.repeater('(index, result) in ctrl.data.results')).first();
var cells = row.all(by.tagName('td'));
expect(cells.get(0).getText()).toContain("0e2643f5");
- filter.sendKeys('case');
- filterText.sendKeys('testcase')
+ filter.sendKeys('version');
+ filterText.sendKeys('testversion')
buttonFilter.click();
expect(cells.get(0).getText()).toContain("0e2643f6");
});
@@ -350,8 +426,8 @@ describe('testing the result page for user', function () {
browser.get(baseURL+"#/results");
var filter = element(by.model('ctrl.filter'));
var filterText = element(by.model('ctrl.filterText'));
- filter.sendKeys('project');
- filterText.sendKeys('testproject');
+ filter.sendKeys('installer');
+ filterText.sendKeys('testinstaller');
var buttonFilter = element(by.buttonText('Filter'));
buttonFilter.click();
var row = element.all(by.repeater('(index, result) in ctrl.data.results')).first();
@@ -367,8 +443,8 @@ describe('testing the result page for user', function () {
browser.get(baseURL+"#/results");
var filter = element(by.model('ctrl.filter'));
var filterText = element(by.model('ctrl.filterText'));
- filter.sendKeys('project');
- filterText.sendKeys('testproject1');
+ filter.sendKeys('installer');
+ filterText.sendKeys('testisntaller1');
var buttonFilter = element(by.buttonText('Filter'));
buttonFilter.click();
expect(element(by.css('.alert.alert-danger.ng-binding.ng-scope'))
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js
index 7777721..37b42dc 100644
--- a/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js
+++ b/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js
@@ -682,8 +682,11 @@ describe('testing the scenarios page for user', function () {
name.sendKeys('test');
var buttonOk = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[2]/button[1]'))
buttonOk.click()
- expect(element(by.cssContainingText(".alert","Installers are successfully updated."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Installers are successfully updated."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
@@ -720,8 +723,11 @@ describe('testing the scenarios page for user', function () {
.isDisplayed()).toBe(true);
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Installer is successfully deleted."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Installer is successfully deleted."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it( 'Expand installer by user', function() {
@@ -753,8 +759,11 @@ describe('testing the scenarios page for user', function () {
owner.sendKeys('testOwner');
var buttonOk = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[2]/button[1]'))
buttonOk.click()
- expect(element(by.cssContainingText(".alert","Versions are successfully updated."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Versions are successfully updated."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it( 'Expand versions by user', function() {
@@ -793,8 +802,11 @@ describe('testing the scenarios page for user', function () {
.isDisplayed()).toBe(true);
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Versions are successfully deleted."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Versions are successfully deleted."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it( 'Expand version by user', function() {
@@ -832,8 +844,11 @@ describe('testing the scenarios page for user', function () {
project.sendKeys('testP');
var buttonOk = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[2]/button[1]'))
buttonOk.click()
- expect(element(by.cssContainingText(".alert","Projects are successfully updated."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Projects are successfully updated."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it( 'Expand projects by user', function() {
@@ -878,8 +893,11 @@ describe('testing the scenarios page for user', function () {
.isDisplayed()).toBe(true);
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Projects are successfully Deleted."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Projects are successfully Deleted."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it( 'Expand project by user', function() {
@@ -1011,8 +1029,11 @@ describe('testing the scenarios page for user', function () {
custom.sendKeys('testC');
var buttonOk = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[2]/button[1]'))
buttonOk.click()
- expect(element(by.cssContainingText(".alert","Customs are successfully updated."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Customs are successfully updated."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it( 'Add multiple Customs by user', function() {
@@ -1043,8 +1064,11 @@ describe('testing the scenarios page for user', function () {
custom.sendKeys('testC,testD,');
var buttonOk = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[2]/button[1]'))
buttonOk.click()
- expect(element(by.cssContainingText(".alert","Customs are successfully updated."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Customs are successfully updated."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it( 'Delete Customs by user', function() {
@@ -1074,8 +1098,11 @@ describe('testing the scenarios page for user', function () {
.isDisplayed()).toBe(true);
var buttonOk = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div[3]/button[1]'))
buttonOk.click()
- expect(element(by.cssContainingText(".alert","Customs are successfully deleted."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Customs are successfully deleted."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
}); \ No newline at end of file
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js
index bed80dd..55922ad 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[5]/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);
@@ -535,8 +284,11 @@ describe('testing the scenarios page for user', function () {
name.sendKeys('test');
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Scenario is successfully created."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Scenario is successfully created."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('create scenarrio by user with installers ', function () {
@@ -555,8 +307,11 @@ describe('testing the scenarios page for user', function () {
buttonOK.click();
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Scenario is successfully created."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Scenario is successfully created."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('create scenarrio by user with installers with versions ', function () {
@@ -584,8 +339,11 @@ describe('testing the scenarios page for user', function () {
buttonOK.click();
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Scenario is successfully created."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Scenario is successfully created."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('create scenarrio by user with installers with versions with project', function () {
@@ -620,8 +378,11 @@ describe('testing the scenarios page for user', function () {
buttonOK.click();
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Scenario is successfully created."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Scenario is successfully created."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('create scenarrio by user with installers with versions with project with custom', function () {
@@ -663,8 +424,11 @@ describe('testing the scenarios page for user', function () {
buttonOK.click();
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Scenario is successfully created."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Scenario is successfully created."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('view scenarrio by user ', function () {
@@ -694,8 +458,11 @@ describe('testing the scenarios page for user', function () {
.isDisplayed()).toBe(true);
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Scenario is successfully deleted."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Scenario is successfully deleted."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('Batch Delete the scenarios ', function () {
@@ -706,8 +473,11 @@ describe('testing the scenarios page for user', function () {
buttonDelete.click();
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Scenario is successfully deleted."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Scenario is successfully deleted."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('Edit the scenarios ', function () {
@@ -720,8 +490,11 @@ describe('testing the scenarios page for user', function () {
name.sendKeys('test2');
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click()
- expect(element(by.cssContainingText(".alert","Scenario is successfully Updated."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Scenario is successfully Updated."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
}); \ No newline at end of file
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js
index 53e7bdf..38e0f24 100644
--- a/testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js
+++ b/testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js
@@ -550,8 +550,11 @@ describe('testing the test cases page for user who is in submitter group', funct
name.sendKeys('test');
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Testcase is successfully created."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Testcase is successfully created."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('Showing error when creating with a empty name ', function () {
@@ -565,8 +568,11 @@ describe('testing the test cases page for user who is in submitter group', funct
browser.wait(EC.visibilityOf(name), 5000);
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Name is missing."))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".error.show","Name is missing."))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('cancel the delete confimation modal of the test case ', function () {
@@ -590,8 +596,11 @@ describe('testing the test cases page for user who is in submitter group', funct
deleteOperation.click();
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Test case is successfully deleted"))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Test case is successfully deleted"))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('cancel the Edit modal of the test case ', function () {
@@ -621,8 +630,11 @@ describe('testing the test cases page for user who is in submitter group', funct
name.sendKeys('test1');
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Test case is successfully updated"))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Test case is successfully updated"))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
it('view the test case ', function () {
@@ -646,7 +658,10 @@ describe('testing the test cases page for user who is in submitter group', funct
buttonDelete.click();
var buttonOK = element(by.buttonText('Ok'));
buttonOK.click();
- expect(element(by.cssContainingText(".alert","Test case is successfully deleted"))
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Test case is successfully deleted"))
.isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
});
})
diff --git a/testapi/opnfv_testapi/tests/unit/executor.py b/testapi/opnfv_testapi/tests/unit/executor.py
index d08782c..7c8cb8a 100644
--- a/testapi/opnfv_testapi/tests/unit/executor.py
+++ b/testapi/opnfv_testapi/tests/unit/executor.py
@@ -18,9 +18,9 @@ O_get_secure_cookie = (
def thread_execute(method, *args, **kwargs):
- with ThreadPoolExecutor(max_workers=2) as executor:
- result = executor.submit(method, *args, **kwargs)
- return result
+ with ThreadPoolExecutor(max_workers=2) as executor:
+ result = executor.submit(method, *args, **kwargs)
+ return result
def mock_invalid_lfid():
@@ -91,7 +91,7 @@ def delete(excepted_status, excepted_response):
def wrap(self):
request = delete_request(self)
if isinstance(request, tuple):
- status, body = self.delete(request[0], *(request[1]))
+ status, body = self.delete(*request)
else:
status, body = self.delete(request)
if excepted_status == httplib.OK:
diff --git a/testapi/opnfv_testapi/tests/unit/fake_pymongo.py b/testapi/opnfv_testapi/tests/unit/fake_pymongo.py
index 041e6e8..631e9ac 100644
--- a/testapi/opnfv_testapi/tests/unit/fake_pymongo.py
+++ b/testapi/opnfv_testapi/tests/unit/fake_pymongo.py
@@ -15,9 +15,9 @@ from concurrent.futures import ThreadPoolExecutor
def thread_execute(method, *args, **kwargs):
- with ThreadPoolExecutor(max_workers=2) as executor:
- result = executor.submit(method, *args, **kwargs)
- return result
+ with ThreadPoolExecutor(max_workers=2) as executor:
+ result = executor.submit(method, *args, **kwargs)
+ return result
class MemCursor(object):
diff --git a/testapi/opnfv_testapi/tests/unit/handlers/test_base.py b/testapi/opnfv_testapi/tests/unit/handlers/test_base.py
index 9a7bc5c..1fd3324 100644
--- a/testapi/opnfv_testapi/tests/unit/handlers/test_base.py
+++ b/testapi/opnfv_testapi/tests/unit/handlers/test_base.py
@@ -63,7 +63,8 @@ class TestBase(testing.AsyncHTTPTestCase):
'opnfv-gerrit-functest-submitters',
'opnfv-gerrit-qtip-submitters',
'opnfv-gerrit-qtip-contributors',
- 'opnfv-gerrit-apex-submitters']
+ 'opnfv-gerrit-apex-submitters',
+ 'opnfv-gerrit-noProject-submitters']
})
def tearDown(self):
@@ -158,7 +159,6 @@ class TestBase(testing.AsyncHTTPTestCase):
res = self.fetch(url,
method='DELETE',
headers=self.headers)
-
return res.code, res.body
def delete(self, *args):
diff --git a/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py b/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py
index 97325e2..e0ce381 100644
--- a/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py
+++ b/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py
@@ -32,7 +32,6 @@ class TestCaseBase(base.TestBase):
self.update_res = tcm.Testcase
self.basePath = '/api/v1/projects/%s/cases'
fake_pymongo.projects.insert(self.project_e.format())
- print self.req_d.format()
self.results_d = rm.ResultCreateRequest.from_dict(
self.load_json('test_result'))
@@ -72,8 +71,8 @@ class TestCaseBase(base.TestBase):
return super(TestCaseBase, self).update(new, self.project, case)
@executor.mock_valid_lfid()
- def delete(self, case):
- return super(TestCaseBase, self).delete(self.project, case)
+ def delete(self, case=None, project=None):
+ return super(TestCaseBase, self).delete(project, case)
class TestCaseCreate(TestCaseBase):
@@ -81,6 +80,11 @@ class TestCaseCreate(TestCaseBase):
def test_noBody(self):
return None
+ @executor.create(httplib.FORBIDDEN, message.no_permission())
+ def test_unauthorized(self):
+ self.project = 'newProject'
+ return self.req_d
+
@executor.create(httplib.FORBIDDEN, message.not_found_base)
def test_noProject(self):
self.project = 'noProject'
@@ -154,6 +158,12 @@ class TestCaseUpdate(TestCaseBase):
self.create_e()
return self.update_req, self.req_d.name
+ @executor.update(httplib.FORBIDDEN, message.no_permission())
+ def test_unauthorized(self):
+ update_req_e = tcm.TestcaseUpdateRequest(project_name="newProject",
+ **self.req_e.format())
+ return update_req_e, self.req_d.name
+
@executor.update(httplib.FORBIDDEN, message.no_update())
def test_noUpdate(self):
update = tcm.TestcaseUpdateRequest(project_name=self.project,
@@ -184,19 +194,26 @@ class TestCaseDelete(TestCaseBase):
fake_pymongo.testcases.insert({
'name': self.results_d.case_name,
'project_name': self.results_d.project_name})
+ fake_pymongo.testcases.insert({
+ 'name': 'newCase',
+ 'project_name': 'newProject'})
@executor.delete(httplib.NOT_FOUND, message.not_found_base)
def test_notFound(self):
- return 'notFound'
+ return 'notFound', self.project
+
+ @executor.delete(httplib.FORBIDDEN, message.no_permission())
+ def test_unauthorized(self):
+ return 'newCase', 'newProject'
@executor.delete(httplib.UNAUTHORIZED, message.tied_with_resource())
def test_deleteNotAllowed(self):
- print self.create_help('/api/v1/results', self.results_d)
- return self.results_d.case_name
+ self.create_help('/api/v1/results', self.results_d)
+ return self.results_d.case_name, self.project
@executor.delete(httplib.OK, '_delete_success')
def test_success(self):
- return self.req_d.name
+ return self.req_d.name, self.project
def _delete_success(self, body):
self.assertEqual(body, '')
diff --git a/testapi/opnfv_testapi/ui/Gruntfile.js b/testapi/opnfv_testapi/ui/Gruntfile.js
index 805ad9f..d6a2f47 100644
--- a/testapi/opnfv_testapi/ui/Gruntfile.js
+++ b/testapi/opnfv_testapi/ui/Gruntfile.js
@@ -6,7 +6,22 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-wait');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-connect');
+ grunt.loadNpmTasks('grunt-convert');
grunt.initConfig({
+ convert: {
+ options: {
+ explicitArray: false,
+ },
+ json2xml: {
+ options: {
+ xml: {
+ header: true
+ }
+ },
+ src: ['../tests/UI/coverage/coverage.json'],
+ dest: '../tests/UI/coverage/coverage.xml'
+ }
+ },
connect: {
server: {
options: {
@@ -137,6 +152,7 @@ module.exports = function (grunt) {
makeReport: {
src: '../tests/UI/coverage/*.json',
options: {
+ type: 'cobertura',
print: 'detail'
}
}
@@ -159,6 +175,7 @@ module.exports = function (grunt) {
'wait:default',
'protractor_coverage',
'makeReport',
+ 'convert',
'shell:deleteFiles'
]);
}
diff --git a/testapi/opnfv_testapi/ui/app.js b/testapi/opnfv_testapi/ui/app.js
index ada7577..3fb4bc7 100644
--- a/testapi/opnfv_testapi/ui/app.js
+++ b/testapi/opnfv_testapi/ui/app.js
@@ -19,7 +19,7 @@
angular
.module('testapiApp', [
'ui.router','ui.bootstrap', 'cgBusy',
- 'ngResource', 'angular-confirm'
+ 'ngResource', 'angular-confirm', 'angular-json-tree'
]);
angular
@@ -64,6 +64,21 @@
angular
.module('testapiApp')
+ .service('dataFieldService', function(){
+ this.dataFunction = dataFunction
+ function dataFunction(data, data_field){
+ Object.keys(data).forEach(function (key) {
+ if (typeof data[key] === 'object' && data[key] != null) {
+ return dataFunction(data[key], data_field);
+ }
+ data_field[key] = key.replace(/_/g, " ").trim();
+ });
+ return data_field;
+ }
+ });
+
+ angular
+ .module('testapiApp')
.directive('dynamicModel', ['$compile', '$parse', function ($compile, $parse) {
return {
restrict: 'A',
diff --git a/testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResult.html b/testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResult.html
index 82a0780..c0803ff 100644
--- a/testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResult.html
+++ b/testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResult.html
@@ -3,72 +3,16 @@
<div class="table-responsive">
<table class="table" ng-data="ctrl.data.pods">
<tbody>
- <tr style="padding:9px">
- <td class="podsTableTd">Id&nbsp;:</td>
- <td class="podsTableLeftTd">{{ctrl.data._id}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Installer&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.installer}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Version&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.version}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Scenario&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.scenario}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Pod&nbsp;Name&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.pod_name}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Criteria&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.criteria}}</td>
+ <tr ng-repeat-start="(index, detail) in ctrl.data_field" style="padding:9px">
+ <td class="podsTableTd">{{detail | capitalize}}&nbsp;:</td>
+ <td width="86%" class="podsTableLeftTd">{{ctrl.data[index]}}</td>
</tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Start&nbsp;Date&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.start_date}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Stop&nbsp;Date&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.stop_date}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Job&nbsp;Name&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.job_name}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Build&nbsp;ID&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data['build_id']}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Upstream&nbsp;Job&nbsp;Name&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.upstream_job_name}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Upstream&nbspBuild&nbsp;ID&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.upstream_build_id}}</td>
+ <tr ng-repeat-end=>
</tr>
<tr style="padding:9px">
<td class="podsTableTd">Details&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">
- <a ng-click="ctrl.showDetails()">
- <p ng-if="ctrl.details">Hide</p>
- <p ng-if="!ctrl.details">Show</p>
- </a>
- <table class="table" ng-class="{'hidden' : !ctrl.details}" style="margin:10px">
- <tbody>
- <tr style="padding:9px"></tr>
- <tr ng-repeat-start="(index, detail) in ctrl.data.details" style="padding:9px">
- <td class="podsTableTd">{{index | capitalize}}&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{detail}}</td>
- </tr>
- <tr ng-repeat-end=>
- </tr>
- </tbody>
- </table>
+ <td width="86%" class="podsTableLeftTd">
+ <json-tree object="ctrl.json.object" root-name="object" start-expanded="true"></json-tree>
</td>
</tr>
</tbody>
diff --git a/testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResultController.js b/testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResultController.js
index 40cf1cb..6f9b84c 100644
--- a/testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResultController.js
+++ b/testapi/opnfv_testapi/ui/components/deploy-results/deploy-result/deployResultController.js
@@ -21,7 +21,7 @@
DeployResultController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert',
- 'confirmModal'
+ 'confirmModal', 'dataFieldService'
];
/**
@@ -30,12 +30,16 @@
* through result declared in TestAPI.
*/
function DeployResultController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal) {
+ raiseAlert, confirmModal, dataFieldService) {
var ctrl = this;
ctrl.url = testapiApiUrl + '/deployresults';
ctrl._id = $state.params['_id'];
ctrl.loadDetails = loadDetails
- ctrl.showDetails = showDetails
+ ctrl.data_field = {}
+
+ ctrl.json = {};
+ ctrl.json.string = '{"id": ""}';
+ ctrl.json.object = JSON.parse(ctrl.json.string);
/**
*Contact the testapi and retrevie the result details
@@ -46,6 +50,10 @@
ctrl.podsRequest =
$http.get(resultUrl).success(function (data) {
ctrl.data = data;
+ ctrl.object=JSON.stringify(ctrl.data.details)
+ ctrl.json.object = JSON.parse(ctrl.object)
+ delete ctrl.data.details;
+ ctrl.data_field = dataFieldService.dataFunction(ctrl.data, ctrl.data_field)
}).catch(function (error) {
ctrl.data = null;
ctrl.showError = true;
@@ -53,13 +61,6 @@
});
}
- function showDetails(){
- if(ctrl.details){
- ctrl.details = false
- }else{
- ctrl.details = true
- }
- }
ctrl.loadDetails();
}
})(); \ No newline at end of file
diff --git a/testapi/opnfv_testapi/ui/components/pods/pod/pod.html b/testapi/opnfv_testapi/ui/components/pods/pod/pod.html
index 6aace92..f9ab7c1 100644
--- a/testapi/opnfv_testapi/ui/components/pods/pod/pod.html
+++ b/testapi/opnfv_testapi/ui/components/pods/pod/pod.html
@@ -3,33 +3,11 @@
<div class="table-responsive">
<table class="table" ng-data="ctrl.data.pods">
<tbody>
- <tr style="padding:9px">
- <td class="podsTableTd">Id&nbsp;:</td>
- <td class="podsTableLeftTd">{{ctrl.data._id}}</td>
+ <tr ng-repeat-start="(index, detail) in ctrl.data_field" style="padding:9px">
+ <td class="podsTableTd">{{detail | capitalize}}&nbsp;:</td>
+ <td width="90%" class="podsTableLeftTd">{{ctrl.data[index]}}</td>
</tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Name&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.name}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Creator&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.creator}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Role&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.role}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Mode&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.mode}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Created&nbsp;at&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data['creation_date']}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Details&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.details}}</td>
+ <tr ng-repeat-end=>
</tr>
</tbody>
</table>
diff --git a/testapi/opnfv_testapi/ui/components/pods/pod/podController.js b/testapi/opnfv_testapi/ui/components/pods/pod/podController.js
index a2e18e8..39ba599 100644
--- a/testapi/opnfv_testapi/ui/components/pods/pod/podController.js
+++ b/testapi/opnfv_testapi/ui/components/pods/pod/podController.js
@@ -21,7 +21,7 @@
PodController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert',
- 'confirmModal'
+ 'confirmModal', 'dataFieldService'
];
/**
@@ -30,11 +30,12 @@
* through pod declared in TestAPI.
*/
function PodController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal) {
+ raiseAlert, confirmModal, dataFieldService) {
var ctrl = this;
ctrl.url = testapiApiUrl + '/pods';
ctrl.name = $state.params['name'];
- ctrl.loadDetails = loadDetails
+ ctrl.loadDetails = loadDetails;
+ ctrl.data_field = {};
/**
*Contact the testapi and retrevie the pod details
@@ -45,6 +46,7 @@
ctrl.podsRequest =
$http.get(podUrl).success(function (data) {
ctrl.data = data;
+ ctrl.data_field = dataFieldService.dataFunction(ctrl.data, ctrl.data_field)
}).catch(function (error) {
ctrl.data = null;
ctrl.showError = true;
diff --git a/testapi/opnfv_testapi/ui/components/pods/pods.html b/testapi/opnfv_testapi/ui/components/pods/pods.html
index 8e66a9c..b5dadf5 100644
--- a/testapi/opnfv_testapi/ui/components/pods/pods.html
+++ b/testapi/opnfv_testapi/ui/components/pods/pods.html
@@ -19,22 +19,18 @@
<div class="col-sm-1 pull-right">
<button type="button" class="btn btn-success" ng-click="ctrl.listPods()">
<i class="fa fa-search"></i> Filter</button>
+ <div ng-class="{'show': ctrl.showError}" id="toast" class="error">
+ <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true" ></span>
+ {{ctrl.error}}</div>
+ <div ng-class="{'show': ctrl.showSuccess}" id="toast" class="success">
+ <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
+ {{ctrl.success}}</div>
</div>
<div class="col-sm-3 pull-right">
<span style="margin-top:6px">Search:&nbsp;&nbsp;</span>
<input type="text" class="form-control search" ng-enter="ctrl.listPods()" ng-Model="ctrl.filterText" placeholder="Search String">
</div>
</div>
-<div class="col-md-12">
- <div ng-show="ctrl.showError" class="col-md-12 alert alert-danger" role="alert">
- <span class="pull-right">&nbsp;{{ctrl.error}}</span>
- <span class="glyphicon glyphicon-exclamation-sign pull-right" aria-hidden="true" >Error:</span>
- </div>
- <div ng-show="ctrl.showSuccess" class="col-md-12 alert alert-success" role="alert">
- <span class="pull-right">&nbsp;{{ctrl.success}}</span>
- <span class="glyphicon glyphicon-ok pull-right" aria-hidden="true"></span>
- </div>
-</div>
<div class="col-md-12" style="padding-right:0px">
<div class="table-responsive">
<table class="table table-bordered table-hover" ng-data="ctrl.data.pods">
diff --git a/testapi/opnfv_testapi/ui/components/pods/podsController.js b/testapi/opnfv_testapi/ui/components/pods/podsController.js
index f405ecb..3b6ab97 100644
--- a/testapi/opnfv_testapi/ui/components/pods/podsController.js
+++ b/testapi/opnfv_testapi/ui/components/pods/podsController.js
@@ -21,7 +21,7 @@
PodsController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert',
- 'confirmModal', 'keepState', 'sortService'
+ 'confirmModal', 'keepState', 'sortService', '$timeout'
];
/**
@@ -30,7 +30,7 @@
* through pods declared in TestAPI.
*/
function PodsController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal, keepState, sortService) {
+ raiseAlert, confirmModal, keepState, sortService, $timeout) {
var ctrl = this;
ctrl.url = testapiApiUrl + '/pods';
ctrl.checkBox = []
@@ -48,6 +48,18 @@
ctrl.batchDelete = batchDelete;
ctrl.viewPod = viewPod
ctrl.sortBy = sortBy
+ ctrl.toastError = toastError
+ ctrl.toastSuccess = toastSuccess
+
+ function toastError() {
+ ctrl.showError = true
+ $timeout(function(){ ctrl.showError = false;}, 3000);
+ }
+
+ function toastSuccess() {
+ ctrl.showSuccess = true
+ $timeout(function(){ ctrl.showSuccess = false;}, 3000);
+ }
function sortBy(field){
ctrl.data.pods = sortService.sortFunction(ctrl.data.pods, field , ctrl.sorting[field] )
@@ -82,19 +94,21 @@
role: pod.role,
details: pod.details
};
- ctrl.podsRequest =
- $http.post(pods_url, body).success(function (data) {
- ctrl.showSuccess = true ;
+ ctrl.podsRequest = $http.post(pods_url, body)
+
+ ctrl.podsRequest.success(function (data) {
ctrl.success = "Create Success"
+ ctrl.toastSuccess()
ctrl.listPods();
}).catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError()
});
+ return ctrl.podsRequest
}
else{
- ctrl.showError = true;
ctrl.error = 'Name is missing.'
+ ctrl.toastError()
}
}
@@ -117,13 +131,15 @@
$http.get(reqURL).success(function (data) {
ctrl.data = data;
ctrl.sortBy("name")
- keepState.filter.podFilter = {
- 'name': ctrl.filterText
+ if(ctrl.filterText != undefined){
+ keepState.filter.podFilter = {
+ 'name': ctrl.filterText
+ }
}
}).catch(function (data) {
ctrl.data = null;
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError()
});
}
@@ -137,12 +153,12 @@
function podDelete(podName){
var pods_url = ctrl.url + "/" + podName
$http.delete(pods_url).success(function(){
- ctrl.showSuccess = true ;
ctrl.success = "Delete Success"
+ ctrl.toastSuccess()
ctrl.listPods();
}).catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError()
});
}
@@ -245,9 +261,10 @@
* inputs.
*/
function confirm() {
- $uibModalInstance.close();
if (angular.isDefined(ctrl.data.successHandler)) {
- ctrl.data.successHandler(ctrl.pod);
+ ctrl.data.successHandler(ctrl.pod).success( function(data){
+ $uibModalInstance.close();
+ })
}
}
diff --git a/testapi/opnfv_testapi/ui/components/projects/project/project.html b/testapi/opnfv_testapi/ui/components/projects/project/project.html
index b6a751c..2762fff 100644
--- a/testapi/opnfv_testapi/ui/components/projects/project/project.html
+++ b/testapi/opnfv_testapi/ui/components/projects/project/project.html
@@ -16,25 +16,11 @@
<div class="table-responsive">
<table class="table" ng-data="ctrl.data.pods">
<tbody>
- <tr style="padding:9px">
- <td class="podsTableTd">Id&nbsp;:</td>
- <td class="podsTableLeftTd">{{ctrl.data._id}}</td>
+ <tr ng-repeat-start="(index, detail) in ctrl.data_field" style="padding:9px">
+ <td class="podsTableTd">{{detail | capitalize}}&nbsp;:</td>
+ <td width="85%" class="podsTableLeftTd">{{ctrl.data[index]}}</td>
</tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Name&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.name}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Creator&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.creator}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Created&nbsp;at&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data['creation_date']}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Description&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.description}}</td>
+ <tr ng-repeat-end=>
</tr>
</tbody>
</table>
diff --git a/testapi/opnfv_testapi/ui/components/projects/project/projectController.js b/testapi/opnfv_testapi/ui/components/projects/project/projectController.js
index 78b805d..9dc9e27 100644
--- a/testapi/opnfv_testapi/ui/components/projects/project/projectController.js
+++ b/testapi/opnfv_testapi/ui/components/projects/project/projectController.js
@@ -21,7 +21,7 @@
ProjectController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert',
- 'confirmModal'
+ 'confirmModal', 'dataFieldService'
];
/**
@@ -30,12 +30,13 @@
* through projects declared in TestAPI.
*/
function ProjectController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal) {
+ raiseAlert, confirmModal, dataFieldService) {
var ctrl = this;
ctrl.name = $state.params['name'];
ctrl.url = testapiApiUrl + '/projects/' + ctrl.name;
ctrl.loadDetails = loadDetails;
+ ctrl.data_field = {}
/**
* This will contact the TestAPI to get a listing of declared projects.
@@ -45,6 +46,7 @@
ctrl.projectsRequest =
$http.get(ctrl.url).success(function (data) {
ctrl.data = data;
+ ctrl.data_field = dataFieldService.dataFunction(ctrl.data, ctrl.data_field)
}).catch(function (error) {
ctrl.data = null;
ctrl.showError = true;
diff --git a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html
index f4bae41..509f39a 100644
--- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html
+++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html
@@ -3,73 +3,11 @@
<div class="table-responsive">
<table class="table" ng-data="ctrl.data">
<tbody>
- <tr style="padding:9px">
- <td class="podsTableTd">Id&nbsp;:</td>
- <td class="podsTableLeftTd">{{ctrl.data._id}}</td>
+ <tr ng-repeat-start="(index, detail) in ctrl.data_field" style="padding:9px">
+ <td class="podsTableTd" >{{detail | capitalize}}&nbsp;:</td>
+ <td width="86%" class="podsTableLeftTd">{{ctrl.data[index]}}</td>
</tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Name&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.name}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Project&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.project_name}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Creator&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.creator}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Tier&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.tier}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Blocking&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.blocking}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">CI&nbsp;Loop&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.ci_loop}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Tags&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.tags}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Version&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.version}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Created&nbsp;at&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data['creation_date']}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Dependencies&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.dependencies}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Trust&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.trust}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Criteria&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.criteria}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Catalog&nbsp;Description&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.catalog_description}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">URL&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.url}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Run&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.run}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Description&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.description}}</td>
+ <tr ng-repeat-end=>
</tr>
</tbody>
</table>
diff --git a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCaseController.js b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCaseController.js
index a38b633..6f93fc1 100644
--- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCaseController.js
+++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCaseController.js
@@ -21,7 +21,7 @@
TestCaseController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert',
- 'confirmModal'
+ 'confirmModal', 'dataFieldService'
];
/**
@@ -30,13 +30,14 @@
* through projects declared in TestAPI.
*/
function TestCaseController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal) {
+ raiseAlert, confirmModal, dataFieldService) {
var ctrl = this;
ctrl.name = $state.params['name'];
ctrl.projectName = $state.params['project_name'];
ctrl.url = testapiApiUrl + '/projects/' + ctrl.projectName + "/cases/" + ctrl.name;
ctrl.loadDetails = loadDetails;
+ ctrl.data_field = {}
/**
* This will contact the TestAPI to get a listing of declared projects.
@@ -46,6 +47,7 @@
ctrl.projectsRequest =
$http.get(ctrl.url).success(function (data) {
ctrl.data = data;
+ ctrl.data_field = dataFieldService.dataFunction(ctrl.data, ctrl.data_field)
}).catch(function (error) {
ctrl.data = null;
ctrl.showError = true;
diff --git a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html
index ee87e0a..04baa9c 100644
--- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html
+++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html
@@ -1,68 +1,64 @@
<div ng-controller="TestCasesController as testCasesCtrl" class="col-md-12">
-<div class="row podsTable" style="vertical-align:middle">
- <div class="col-sm-1 pull-right" ng-class="{ 'hidden': ! ((auth.projectNames.length>0) &&
- auth.isAuthenticated) }" >
- <button type="button" class="btn btn-danger" ng-click="testCasesCtrl.openBatchDeleteModal()">
- <i class="fa fa-minus"></i> Delete</button>
- </div>
- <div class="col-sm-1 pull-right" ng-class="{ 'hidden': ! ((auth.projectNames.length>0) &&
- auth.isAuthenticated) }">
- <button type="button" class="btn btn-success" ng-click="testCasesCtrl.openCreateModal()">
- <i class="fa fa-plus"></i> Create</button>
- </div>
-</div>
-<div class='clo-md-12'>
- <div ng-show="testCasesCtrl.showError" class="alert alert-danger" role="alert">
- <span class="pull-right">&nbsp;{{testCasesCtrl.error}}</span>
- <span class="glyphicon glyphicon-exclamation-sign pull-right" aria-hidden="true" >Error:</span>
- </div>
- <div ng-show="testCasesCtrl.showSuccess" class="alert alert-success" role="alert">
- <span class="pull-right">&nbsp;{{testCasesCtrl.successMessage}}</span>
- <span class="glyphicon glyphicon-ok pull-right" aria-hidden="true"></span>
- </div>
-</div>
-<div class='clo-md-12' style="padding-right:0px">
- <div class="table-responsive">
- <table class="table table-bordered table-hover" ng-data="testCasesCtrl.data.testcases">
- <thead>
- <tr style="
- text-align: center;">
- <th style="width: 1%;">Bulk Select</th>
- <th style="width: 19%;">Name</th>
- <th style="width: 20%;">Tier</th>
- <th style="width: 20%;">Blocking</th>
- <th style="width: 20%;">CI&nbsp;Loop</th>
- <th style="width: 20%;" ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated)}">Operations</th>
- </tr>
- </thead>
- <tbody>
- <tr ng-repeat-start="(index, testcase) in testCasesCtrl.data.testcases" style="padding:9px">
- <td>
- <div class="text-center">
- <input type="checkbox" value="{{project.name}}" ng-model="testCasesCtrl.checkBox[index]" >
- </div>
- </td>
- <td>
- <a class="text-info" ng-click="testCasesCtrl.viewTestCase(testcase.name, testcase.project_name)">
- {{testcase.name}}
- </a>
- </td>
- <td>{{testcase.tier}}</td>
- <td>{{testcase.blocking}}</td>
- <td>{{testcase.ci_loop}}</td>
- <td ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated)}">
- <span class="podsTable-col">
- <a class="text-warning" ng-click="testCasesCtrl.openUpdateTestModal(testcase.name)" title="Edit">
- <i class="fa fa-pencil-square-o"></i></a>
- <a class="text-danger" ng-click="testCasesCtrl.openDeleteTestModal(testcase.name)" title="Delete">
- <i class="fa fa-trash-o"></i></a>
- </span>
- </td>
- </tr>
- <tr ng-repeat-end=>
- </tr>
- </tbody>
- </table>
- </div>
-</div>
-</div>
+ <div class="row podsTable" style="vertical-align:middle">
+ <div class="col-sm-1 pull-right" ng-class="{ 'hidden': !((auth.projectNames.length>0) &&
+ auth.isAuthenticated) && authenticate }" >
+ <button type="button" class="btn btn-danger" ng-click="testCasesCtrl.openBatchDeleteModal()">
+ <i class="fa fa-minus"></i> Delete</button>
+ </div>
+ <div class="col-sm-1 pull-right" ng-class="{ 'hidden': ! ((auth.projectNames.length>0) &&
+ auth.isAuthenticated) && authenticate }">
+ <button type="button" class="btn btn-success" ng-click="testCasesCtrl.openCreateModal()">
+ <i class="fa fa-plus"></i> Create</button>
+ </div>
+ </div>
+ <div ng-class="{'show': testCasesCtrl.showError}" id="toast" class="error">
+ <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true" ></span>
+ {{testCasesCtrl.error}}</div>
+ <div ng-class="{'show': testCasesCtrl.showSuccess}" id="toast" class="success">
+ <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
+ {{testCasesCtrl.success}}</div>
+ <div class='clo-md-12' style="padding-right:0px">
+ <div class="table-responsive">
+ <table class="table table-bordered table-hover" ng-data="testCasesCtrl.data.testcases">
+ <thead>
+ <tr style="
+ text-align: center;">
+ <th style="width: 1%;">Bulk Select</th>
+ <th style="width: 19%;">Name</th>
+ <th style="width: 20%;">Tier</th>
+ <th style="width: 20%;">Blocking</th>
+ <th style="width: 20%;">CI&nbsp;Loop</th>
+ <th style="width: 20%;" ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated) && authenticate}">Operations</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat-start="(index, testcase) in testCasesCtrl.data.testcases" style="padding:9px">
+ <td>
+ <div class="text-center">
+ <input type="checkbox" value="{{project.name}}" ng-model="testCasesCtrl.checkBox[index]" >
+ </div>
+ </td>
+ <td>
+ <a class="text-info" ng-click="testCasesCtrl.viewTestCase(testcase.name, testcase.project_name)">
+ {{testcase.name}}
+ </a>
+ </td>
+ <td>{{testcase.tier}}</td>
+ <td>{{testcase.blocking}}</td>
+ <td>{{testcase.ci_loop}}</td>
+ <td ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated) && authenticate}">
+ <span class="podsTable-col">
+ <a class="text-warning" ng-click="testCasesCtrl.openUpdateTestModal(testcase.name)" title="Edit">
+ <i class="fa fa-pencil-square-o"></i></a>
+ <a class="text-danger" ng-click="testCasesCtrl.openDeleteTestModal(testcase.name)" title="Delete">
+ <i class="fa fa-trash-o"></i></a>
+ </span>
+ </td>
+ </tr>
+ <tr ng-repeat-end=>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div> \ No newline at end of file
diff --git a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js
index 9a865d3..ea0498a 100644
--- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js
+++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js
@@ -21,7 +21,7 @@
TestCasesController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert',
- 'confirmModal'
+ 'confirmModal', 'authenticate', '$timeout'
];
/**
@@ -31,7 +31,7 @@
* in them.
*/
function TestCasesController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal) {
+ raiseAlert, confirmModal, authenticate, $timeout) {
var ctrl = this;
ctrl.loadDetails = loadDetails;
ctrl.name = $state.params['name'];
@@ -49,29 +49,40 @@
ctrl.checkBox = [];
ctrl.checkBoxList = [];
+ ctrl.toastError = toastError
+ ctrl.toastSuccess = toastSuccess
+
+ function toastError() {
+ ctrl.showError = true
+ $timeout(function(){ ctrl.showError = false;}, 3000);
+ }
+
+ function toastSuccess() {
+ ctrl.showSuccess = true
+ $timeout(function(){ ctrl.showSuccess = false;}, 3000);
+ }
/**
* This will contact the TestAPI to create a new test case.
*/
function createTestCase(name, testcase) {
- ctrl.showError = false;
- ctrl.showSuccess = false;
if(testcase.name != "" && testcase.name!=null){
var testCase_url = ctrl.requestUrl;
- ctrl.testCasesRequest =
- $http.post(testCase_url, testcase).success(function (data){
- ctrl.showSuccess = true ;
- ctrl.successMessage = "Testcase is successfully created."
+ ctrl.testCasesRequest = $http.post(testCase_url, testcase)
+ ctrl.testCasesRequest.success(function (data){
+ ctrl.success = "Testcase is successfully created."
loadDetails();
+ ctrl.toastSuccess()
})
.catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
+ return ctrl.testCasesRequest;
}
else{
- ctrl.showError = true;
ctrl.error = 'Name is missing.'
+ ctrl.toastError();
}
}
@@ -114,24 +125,23 @@
* This will contact the TestAPI to update an existing test case.
*/
function updateTestCase(name, testCase) {
- ctrl.showError = false;
- ctrl.showSuccess = false;
if(testCase.name != ""){
var testCase_url = ctrl.requestUrl + '/' + name;
- ctrl.testCasesRequest =
- $http.put(testCase_url, testCase).success(function (data){
- ctrl.showSuccess = true ;
- ctrl.successMessage = "Test case is successfully updated"
+ ctrl.testCasesRequest = $http.put(testCase_url, testCase)
+ ctrl.testCasesRequest.success(function (data){
+ ctrl.success = "Test case is successfully updated"
loadDetails();
+ ctrl.toastSuccess();
})
.catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError()
});
+ return ctrl.testCasesRequest;
}
else{
- ctrl.showError = true;
ctrl.error = 'Name is missing.'
+ ctrl.toastError()
}
}
@@ -139,16 +149,14 @@
* This will contact the TestAPI to delete an existing test case.
*/
function deleteTestCase(name) {
- ctrl.showError = false;
- ctrl.showSuccess = false;
ctrl.testCasesRequest =
$http.delete(ctrl.requestUrl+"/"+name).success(function (data) {
loadDetails();
- ctrl.showSuccess = true ;
- ctrl.successMessage = "Test case is successfully deleted"
+ ctrl.success = "Test case is successfully deleted";
+ ctrl.toastSuccess();
}).catch(function (error) {
- ctrl.showError = true;
- ctrl.error = data.statusText;
+ ctrl.error = error.statusText;
+ ctrl.toastError();
});
}
@@ -218,8 +226,8 @@
ctrl.data = data;
}).catch(function (error) {
ctrl.data = null;
- ctrl.showError = true;
ctrl.error = error.statusText;
+ ctrl.toastError()
});
}
ctrl.loadDetails();
@@ -271,9 +279,15 @@
* inputs.
*/
function confirm() {
- $uibModalInstance.close();
if (angular.isDefined(ctrl.data.successHandler)) {
- ctrl.data.successHandler(ctrl.name, ctrl.testcase);
+ if(ctrl.testcase.name){
+ ctrl.data.successHandler(ctrl.name, ctrl.testcase).success( function(){
+ $uibModalInstance.close();
+ })
+ }
+ else{
+ ctrl.data.successHandler(ctrl.name, ctrl.testcase)
+ }
}
}
diff --git a/testapi/opnfv_testapi/ui/components/projects/projects.html b/testapi/opnfv_testapi/ui/components/projects/projects.html
index 5d514d1..3098aa2 100644
--- a/testapi/opnfv_testapi/ui/components/projects/projects.html
+++ b/testapi/opnfv_testapi/ui/components/projects/projects.html
@@ -21,16 +21,12 @@
<input type="text" class="form-control search" ng-enter="ctrl.listProjects()" ng-Model="ctrl.filterText" style="width:80%;" placeholder="Search By Name">
</div>
</div>
-<div class='clo-md-12'>
- <div ng-show="ctrl.showError" class="alert alert-danger" role="alert">
- <span class="pull-right">&nbsp;{{ctrl.error}}</span>
- <span class="glyphicon glyphicon-exclamation-sign pull-right" aria-hidden="true" >Error:</span>
- </div>
- <div ng-show="ctrl.showSuccess" class="alert alert-success" role="alert">
- <span class="pull-right">&nbsp;{{ctrl.success}}</span>
- <span class="glyphicon glyphicon-ok pull-right" aria-hidden="true"></span>
- </div>
-</div>
+<div ng-class="{'show': ctrl.showError}" id="toast" class="error">
+ <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true" ></span>
+ {{ctrl.error}}</div>
+<div ng-class="{'show': ctrl.showSuccess}" id="toast" class="success">
+ <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
+ {{ctrl.success}}</div>
<div class='clo-md-12' style="padding-right:0px">
<div class="table-responsive">
<table class="table table-bordered table-hover" ng-data="ctrl.data.projects">
diff --git a/testapi/opnfv_testapi/ui/components/projects/projectsController.js b/testapi/opnfv_testapi/ui/components/projects/projectsController.js
index 07a58fe..42100bd 100644
--- a/testapi/opnfv_testapi/ui/components/projects/projectsController.js
+++ b/testapi/opnfv_testapi/ui/components/projects/projectsController.js
@@ -21,7 +21,7 @@
ProjectsController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl',
- 'raiseAlert', 'confirmModal', 'authenticate', 'keepState', 'sortService'
+ 'raiseAlert', 'confirmModal', 'authenticate', 'keepState', 'sortService', '$timeout'
];
/**
@@ -30,7 +30,7 @@
* through projects declared in TestAPI.
*/
function ProjectsController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal, authenticate, keepState, sortService) {
+ raiseAlert, confirmModal, authenticate, keepState, sortService, $timeout) {
var ctrl = this;
ctrl.url = testapiApiUrl + '/projects';
@@ -51,27 +51,41 @@
ctrl.name = '';
ctrl.details = '';
ctrl.ascending = false;
+ ctrl.toastError = toastError
+ ctrl.toastSuccess = toastSuccess
+
+ function toastError() {
+ ctrl.showError = true
+ $timeout(function(){ ctrl.showError = false;}, 7000);
+ }
+
+ function toastSuccess() {
+ ctrl.showSuccess = true
+ $timeout(function(){ ctrl.showSuccess = false;}, 7000);
+ }
/**
* This will contact the TestAPI to create a new project.
*/
function create(project) {
- ctrl.showError = false;
- ctrl.showSuccess = false;
var projects_url = ctrl.url;
var body = {
name: project.name,
description: project.description
};
- ctrl.projectsRequest =
- $http.post(projects_url, body).success(function (data){
- ctrl.showSuccess = true ;
- ctrl.success = "Project is successfully created."
+ ctrl.projectsRequest = $http.post(projects_url, body)
+ ctrl.projectsRequest.success(function (data){
+ ctrl.success = "Project is successfully created.";
ctrl.listProjects();
+ ctrl.toastSuccess();
+ ctrl.request = true;
}).catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
+ ctrl.request = false;
});
+
+ return ctrl.projectsRequest
}
function sortByName(){
@@ -135,16 +149,17 @@
ctrl.showError = false;
ctrl.showSuccess = false;
var projectUrl = ctrl.url + '/' + name;
- ctrl.testCasesRequest =
- $http.put(projectUrl, project).success(function (data){
- ctrl.showSuccess = true ;
+ ctrl.projectRequest = $http.put(projectUrl, project)
+ ctrl.projectRequest.success(function (data){
ctrl.success = "Project is successfully updated."
- listProjects();
+ ctrl.listProjects();
+ ctrl.toastSuccess();
})
.catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
+ return ctrl.projectRequest
}
/**
@@ -167,13 +182,15 @@
ctrl.resultsRequest =
$http.get(content_url).success(function (data) {
ctrl.data = data;
- keepState.filter.projectFilter = {
- 'name': ctrl.filterText
+ if(ctrl.filterText != undefined){
+ keepState.filter.projectFilter = {
+ 'name': ctrl.filterText
+ }
}
}).catch(function (data) {
ctrl.data = null;
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
}
@@ -188,13 +205,12 @@
function projectDelete(projectName){
var projectUrl = ctrl.url + "/" + projectName
$http.delete(projectUrl).success(function(){
- ctrl.showSuccess = true ;
ctrl.success = "Projects is successfully deleted"
+ ctrl.toastSuccess();
ctrl.listProjects();
}).catch(function (data) {
- ctrl.showError = true;
- ctrl.showSuccess = false;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
}
@@ -275,11 +291,15 @@
function confirm() {
if (angular.isDefined(ctrl.data.successHandler)) {
if(ctrl.project.name != ""){
- $uibModalInstance.close();
+ var success = false;
if(ctrl.data.project){
- ctrl.data.successHandler(ctrl.projectName, ctrl.project);
+ ctrl.data.successHandler(ctrl.projectName, ctrl.project).success(function (data){
+ $uibModalInstance.close();
+ })
}else{
- ctrl.data.successHandler(ctrl.project);
+ ctrl.data.successHandler(ctrl.project).success(function (data){
+ $uibModalInstance.close();
+ })
}
}else{
ctrl.showCreateError = true;
diff --git a/testapi/opnfv_testapi/ui/components/results/result/result.html b/testapi/opnfv_testapi/ui/components/results/result/result.html
index 52d794e..041f244 100644
--- a/testapi/opnfv_testapi/ui/components/results/result/result.html
+++ b/testapi/opnfv_testapi/ui/components/results/result/result.html
@@ -3,78 +3,16 @@
<div class="table-responsive">
<table class="table" ng-data="ctrl.data.pods">
<tbody>
- <tr style="padding:9px">
- <td class="podsTableTd">Id&nbsp;:</td>
- <td class="podsTableLeftTd">{{ctrl.data._id}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Pod&nbsp;Name:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.pod_name}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Project&nbsp;Name:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.project_name}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Case&nbsp;Name&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.case_name}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Installer&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.installer}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Version&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.version}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Scenario&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.scenario}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Build&nbsp;tag&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data['build_tag']}}</td>
+ <tr ng-repeat-start="(index, detail) in ctrl.data_field" style="padding:9px">
+ <td class="podsTableTd">{{detail | capitalize}}&nbsp;:</td>
+ <td width="90%" class="podsTableLeftTd">{{ctrl.data[index]}}</td>
</tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Criteria&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.criteria}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Start&nbsp;Date:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.start_date}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Stop&nbsp;Date&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.stop_date}}</td>
+ <tr ng-repeat-end=>
</tr>
<tr style="padding:9px">
<td class="podsTableTd">Details&nbsp;:</td>
<td width="90%" class="podsTableLeftTd">
- <a ng-click="ctrl.showDetails()">
- <p ng-if="ctrl.details">Hide</p>
- <p ng-if="!ctrl.details">Show</p>
- </a>
- <table class="table" ng-class="{'hidden' : !ctrl.details}" style="margin:10px">
- <tbody>
- <tr style="padding:9px"></tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Failures&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.details.failures}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Details&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.details.errors}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Stream&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd"><p>{{ctrl.data.details.stream}}</p></td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">TestsRun&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd"><p>{{ctrl.data.details.testsRun}}</p></td>
- </tr>
- </tbody>
- </table>
+ <json-tree object="ctrl.json.object" root-name="object" start-expanded="true"></json-tree>
</td>
</tr>
</tbody>
diff --git a/testapi/opnfv_testapi/ui/components/results/result/resultController.js b/testapi/opnfv_testapi/ui/components/results/result/resultController.js
index cb5dd28..2726704 100644
--- a/testapi/opnfv_testapi/ui/components/results/result/resultController.js
+++ b/testapi/opnfv_testapi/ui/components/results/result/resultController.js
@@ -21,7 +21,7 @@
ResultController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert',
- 'confirmModal'
+ 'confirmModal', 'dataFieldService'
];
/**
@@ -30,13 +30,16 @@
* through result declared in TestAPI.
*/
function ResultController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal) {
+ raiseAlert, confirmModal, dataFieldService) {
var ctrl = this;
ctrl.url = testapiApiUrl + '/results';
ctrl._id = $state.params['_id'];
ctrl.loadDetails = loadDetails
- ctrl.showTrustIndicator = showTrustIndicator
- ctrl.showDetails = showDetails
+ ctrl.data_field = {}
+
+ ctrl.json = {};
+ ctrl.json.string = '{"id": ""}';
+ ctrl.json.object = JSON.parse(ctrl.json.string);
/**
*Contact the testapi and retrevie the result details
@@ -47,6 +50,10 @@
ctrl.podsRequest =
$http.get(resultUrl).success(function (data) {
ctrl.data = data;
+ ctrl.object=JSON.stringify(ctrl.data.details)
+ ctrl.json.object = JSON.parse(ctrl.object)
+ delete ctrl.data.details;
+ ctrl.data_field = dataFieldService.dataFunction(ctrl.data, ctrl.data_field)
}).catch(function (error) {
ctrl.data = null;
ctrl.showError = true;
@@ -54,13 +61,6 @@
});
}
- function showDetails(){
- if(ctrl.details){
- ctrl.details = false
- }else{
- ctrl.details = true
- }
- }
ctrl.loadDetails();
}
})(); \ No newline at end of file
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html b/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html
index 0cd2663..4225749 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html
+++ b/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html
@@ -6,14 +6,16 @@
<legend>{{customModalCtrl.data.text}}</legend>
<div class="row">
<div class="update-project">
- <label for="cpid" class="control-label col-sm-4">Custom: </label>
+ <label for="cpid" class="control-label col-sm-2">Custom: </label>
<table cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<div class="col-sm-12">
<input type="text" class="form-control" ng-model="customModalCtrl.custom"/>
- <p class="help-block"></p>
+ <p class="help-block">
+ Please separate multiple customs with space or comma
+ </p>
</div>
</td>
</tr>
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html
index 4f0a580..d6d4257 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html
+++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html
@@ -225,14 +225,10 @@
</div>
</div>
<div class="row" style="margin-bottom:24px;"></div>
-<div class='clo-md-12'>
- <div ng-show="ctrl.showError" class="alert alert-danger" role="alert">
- <span class="pull-right">&nbsp;{{ctrl.error}}</span>
- <span class="glyphicon glyphicon-exclamation-sign pull-right" aria-hidden="true" >Error:</span>
- </div>
- <div ng-show="ctrl.showSuccess" class="alert alert-success" role="alert">
- <span class="pull-right">&nbsp;{{ctrl.success}}</span>
- <span class="glyphicon glyphicon-ok pull-right" aria-hidden="true"></span>
- </div>
-</div>
+<div ng-class="{'show': ctrl.showError}" id="toast" class="error">
+ <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true" ></span>
+ {{ctrl.error}}</div>
+<div ng-class="{'show': ctrl.showSuccess}" id="toast" class="success">
+ <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
+ {{ctrl.success}}</div>
<div class="row" style="margin-bottom:24px;"></div> \ No newline at end of file
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js
index a0cd5eb..e17718f 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js
+++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js
@@ -21,7 +21,7 @@
ScenarioController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert',
- 'confirmModal', 'authenticate'
+ 'confirmModal', 'authenticate', '$timeout'
];
/**
@@ -30,7 +30,7 @@
* through Scenario declared in TestAPI.
*/
function ScenarioController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal, authenticate) {
+ raiseAlert, confirmModal, authenticate, $timeout) {
var ctrl = this;
ctrl.name = $state.params['name'];
ctrl.url = testapiApiUrl + '/scenarios?name=' + ctrl.name;
@@ -73,7 +73,18 @@
ctrl.buttonInstaller = true
ctrl.buttonVersion = true
ctrl.buttonProject = true
+ ctrl.toastError = toastError
+ ctrl.toastSuccess = toastSuccess
+ function toastError() {
+ ctrl.showError = true
+ $timeout(function(){ ctrl.showError = false;}, 3000);
+ }
+
+ function toastSuccess() {
+ ctrl.showSuccess = true
+ $timeout(function(){ ctrl.showSuccess = false;}, 3000);
+ }
/**
* This will contact the TestAPI to get a listing of declared projects.
*/
@@ -84,8 +95,8 @@
ctrl.data = data;
}).catch(function (error) {
ctrl.data = null;
- ctrl.showError = true;
ctrl.error = error.statusText
+ ctrl.toastError()
});
}
@@ -203,13 +214,13 @@
function deleteInstaller(data){
ctrl.installerReqest = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/installers"
$http.delete(ctrl.installerReqest, {data: data.installers, headers: {'Content-Type': 'application/json'}}).success(function (data){
- ctrl.showSuccess = true ;
ctrl.success = "Installer is successfully deleted."
+ ctrl.toastSuccess();
ctrl.loadDetails();
})
.catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError()
});
}
@@ -225,16 +236,18 @@
function addInstaller(installer){
var installers = []
installers.push(installer)
- ctrl.installerReqest = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/installers"
- $http.post(ctrl.installerReqest, installers).success(function (data){
- ctrl.showSuccess = true ;
+ ctrl.installerRequestUrl = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/installers"
+ ctrl.installerRequest = $http.post(ctrl.installerRequestUrl, installers)
+ ctrl.installerRequest.success(function (data){
ctrl.success = "Installers are successfully updated."
ctrl.loadDetails();
+ ctrl.toastSuccess();
})
.catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
+ return ctrl.installerRequest
}
function openAddInstaller(){
@@ -254,16 +267,18 @@
}
function addVersion(versions, installer){
- ctrl.versionReqest = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/versions?installer="+installer
- $http.post(ctrl.versionReqest, versions).success(function (data){
- ctrl.showSuccess = true ;
+ ctrl.versionRequestUrl = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/versions?installer="+installer
+ ctrl.versionRequest = $http.post(ctrl.versionRequestUrl, versions)
+ ctrl.versionRequest.success(function (data){
ctrl.success = "Versions are successfully updated."
ctrl.loadDetails();
+ ctrl.toastSuccess()
})
.catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError()
});
+ return ctrl.versionRequest;
}
function openDeleteVersionModal(version, installer){
@@ -279,13 +294,13 @@
function deleteVersion(data){
ctrl.versionReqest = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/versions?installer="+data.installer
$http.delete(ctrl.versionReqest, {data: data.version, headers: {'Content-Type': 'application/json'}}).success(function (data){
- ctrl.showSuccess = true ;
ctrl.success = "Versions are successfully deleted."
ctrl.loadDetails();
+ ctrl.toastSuccess();
})
.catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
}
@@ -307,16 +322,18 @@
}
function addProject(project, version, installer){
- ctrl.projectReqest = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/projects?installer="+installer+"&version="+version
- $http.post(ctrl.projectReqest, project).success(function (data){
- ctrl.showSuccess = true ;
+ ctrl.projectRequestUrl = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/projects?installer="+installer+"&version="+version
+ ctrl.projectRequest= $http.post(ctrl.projectRequestUrl, project)
+ ctrl.projectRequest.success(function (data){
ctrl.success = "Projects are successfully updated."
ctrl.loadDetails();
+ ctrl.toastSuccess();
})
.catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
+ return ctrl.projectRequest;
}
function openAddProjectModal(version, installer){
@@ -338,16 +355,18 @@
}
function addCustom(custom,project,version,installer){
- ctrl.customReqest = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/customs?installer="+installer+"&version="+version+"&project="+ project
- $http.post(ctrl.customReqest, custom).success(function (data){
- ctrl.showSuccess = true ;
+ ctrl.customRequestUrl = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/customs?installer="+installer+"&version="+version+"&project="+ project
+ ctrl.customRequest = $http.post(ctrl.customRequestUrl, custom)
+ ctrl.customRequest.success(function (data){
ctrl.success = "Customs are successfully updated."
ctrl.loadDetails();
+ ctrl.toastSuccess();
})
.catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
+ return ctrl.customRequest
}
function openDeleteCustomModal(custom,project,version,installer){
@@ -365,13 +384,13 @@
function deleteCustom(data){
ctrl.customReqest = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/customs?installer="+data.installer+"&version="+data.version+"&project="+ data.project
$http.delete(ctrl.customReqest, {data: data.customs, headers: {'Content-Type': 'application/json'}}).success(function (data){
- ctrl.showSuccess = true ;
ctrl.success = "Customs are successfully deleted."
ctrl.loadDetails();
+ ctrl.toastSuccess();
})
.catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
}
@@ -408,13 +427,13 @@
function deleteProject(data){
ctrl.projectReqest = testapiApiUrl+ "/scenarios/"+ ctrl.name + "/projects?installer="+data.installer+"&version="+data.version
$http.delete(ctrl.projectReqest, {data: data.projects, headers: {'Content-Type': 'application/json'}}).success(function (data){
- ctrl.showSuccess = true ;
- ctrl.success = "Projects are successfully Deleted."
+ ctrl.success = "Projects are successfully Deleted.";
+ ctrl.toastSuccess();
ctrl.loadDetails();
})
.catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
}
@@ -443,8 +462,11 @@
ctrl.customs = custom.split(/[ ,]+/).filter(Boolean);
}
console.log(ctrl.customs)
- ctrl.data.successHandler(ctrl.customs,ctrl.data.project,ctrl.data.version,ctrl.data.installer);
- $uibModalInstance.dismiss('cancel');
+ ctrl.data.successHandler(
+ ctrl.customs, ctrl.data.project,
+ ctrl.data.version,ctrl.data.installer).success(function(){
+ $uibModalInstance.dismiss('cancel');
+ });
}
@@ -486,8 +508,10 @@
*/
function confirm() {
ctrl.projects.push(ctrl.project)
- ctrl.data.successHandler(ctrl.projects, ctrl.data.version, ctrl.data.installer);
- $uibModalInstance.dismiss('cancel');
+ ctrl.data.successHandler(
+ ctrl.projects, ctrl.data.version, ctrl.data.installer).success( function(){
+ $uibModalInstance.dismiss('cancel');
+ });
}
@@ -545,8 +569,9 @@
*/
function confirm() {
ctrl.versions.push(ctrl.version)
- ctrl.data.successHandler(ctrl.versions, ctrl.data.installer);
- $uibModalInstance.dismiss('cancel');
+ ctrl.data.successHandler(ctrl.versions, ctrl.data.installer).success(function(){
+ $uibModalInstance.dismiss('cancel');
+ });
}
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenarios.html b/testapi/opnfv_testapi/ui/components/scenarios/scenarios.html
index 9057b0f..8d23449 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/scenarios.html
+++ b/testapi/opnfv_testapi/ui/components/scenarios/scenarios.html
@@ -10,16 +10,12 @@
<i class="fa fa-plus"></i>Create</button>
</div>
</div>
-<div class='clo-md-12'>
- <div ng-show="ctrl.showError" class="alert alert-danger" role="alert">
- <span class="pull-right">&nbsp;{{ctrl.error}}</span>
- <span class="glyphicon glyphicon-exclamation-sign pull-right" aria-hidden="true" >Error:</span>
- </div>
- <div ng-show="ctrl.showCreateSuccess" class="alert alert-success" role="alert">
- <span class="pull-right">&nbsp;{{ctrl.success}}</span>
- <span class="glyphicon glyphicon-ok pull-right" aria-hidden="true"></span>
- </div>
-</div>
+<div ng-class="{'show': ctrl.showError}" id="toast" class="error">
+ <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true" ></span>
+ {{ctrl.error}}</div>
+<div ng-class="{'show': ctrl.showSuccess}" id="toast" class="success">
+ <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
+ {{ctrl.success}}</div>
<div class='clo-md-12' style="padding-right:0px">
<div class="table-responsive">
<table class="table table-bordered table-hover" ng-data="ctrl.data.scenarios">
@@ -27,7 +23,14 @@
<tr style="
text-align: center;">
<th style="width: 1%;">Bulk&nbsp;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..0aa5bf0 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', '$timeout'
];
/**
@@ -30,7 +30,7 @@
* through projects declared in TestAPI.
*/
function ScenariosController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal) {
+ raiseAlert, confirmModal, sortService, $timeout) {
var ctrl = this;
ctrl.url = testapiApiUrl + '/scenarios';
@@ -44,8 +44,21 @@
ctrl.deleteScenario = deleteScenario;
ctrl.openBatchDeleteModal = openBatchDeleteModal;
ctrl.deleteBatchScenario = deleteBatchScenario
-
+ ctrl.sortBy = sortBy
ctrl.checkBox = [];
+ ctrl.sortName = false
+ ctrl.toastError = toastError
+ ctrl.toastSuccess = toastSuccess
+
+ function toastError() {
+ ctrl.showError = true
+ $timeout(function(){ ctrl.showError = false;}, 3000);
+ }
+
+ function toastSuccess() {
+ ctrl.showSuccess = true
+ $timeout(function(){ ctrl.showSuccess = false;}, 3000);
+ }
function openUpdateModal(name){
$uibModal.open({
@@ -68,16 +81,21 @@
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 =
$http.delete(scenarioURL).success(function (data){
- ctrl.showCreateSuccess = true;
ctrl.success = "Scenario is successfully deleted.";
ctrl.listScenarios();
+ ctrl.toastSuccess();
}).catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError()
});
}
@@ -111,15 +129,21 @@
var body = {
"name": newName
}
- ctrl.scenarioRequest =
- $http.put(scenarioURL, body).success(function (data){
- ctrl.showCreateSuccess = true;
+ if(newName){
+ ctrl.scenarioRequest = $http.put(scenarioURL, body)
+ ctrl.scenarioRequest.success(function (data){
ctrl.success = "Scenario is successfully Updated."
- ctrl.listScenarios()
+ ctrl.listScenarios();
+ ctrl.toastSuccess();
}).catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
+ return ctrl.scenarioRequest
+ }else{
+ ctrl.error = "Name is missing";
+ ctrl.toastError();
+ }
}
function viewScenario(name){
@@ -127,14 +151,17 @@
}
function createScenario(scenario) {
- ctrl.scenarioRequest =
- $http.post(ctrl.url, scenario).success(function (data){
- ctrl.showCreateSuccess = true;
- ctrl.success = "Scenario is successfully created."
+ ctrl.scenarioRequest = $http.post(ctrl.url, scenario)
+
+ ctrl.scenarioRequest.success(function (data){
+ ctrl.success = "Scenario is successfully created.";
+ ctrl.toastSuccess();
}).catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
+
+ return ctrl.scenarioRequest;
}
function listScenarios() {
@@ -142,10 +169,11 @@
ctrl.resultsRequest =
$http.get(ctrl.url).success(function (data) {
ctrl.data = data;
+ ctrl.sortBy()
}).catch(function (data) {
ctrl.data = null;
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
}
@@ -176,8 +204,8 @@
* edit the project's details
*/
angular.module('testapiApp').controller('scenarioModalController', scenarioModalController);
- scenarioModalController.$inject = ['$scope', '$uibModal', '$uibModalInstance', 'data'];
- function scenarioModalController($scope, $uibModal, $uibModalInstance, data) {
+ scenarioModalController.$inject = ['$scope', '$uibModal', '$uibModalInstance', 'data', '$q'];
+ function scenarioModalController($scope, $uibModal, $uibModalInstance, data, $q) {
var ctrl = this;
ctrl.confirm = confirm;
ctrl.cancel = cancel;
@@ -194,8 +222,9 @@
* inputs.
*/
function confirm() {
- ctrl.data.successHandler(ctrl.scenario);
- $uibModalInstance.dismiss('cancel');
+ ctrl.data.successHandler(ctrl.scenario).success(function(){
+ $uibModalInstance.dismiss('cancel');
+ });
}
@@ -208,6 +237,9 @@
function handleModalData(installer){
ctrl.scenario.installers.push(installer)
+ var deferred = $q.defer();
+ deferred.resolve();
+ return deferred.promise;
}
function openInstallerModal(){
@@ -252,8 +284,9 @@
* inputs.
*/
function confirm() {
- ctrl.data.successHandler(ctrl.installer);
- $uibModalInstance.dismiss('cancel');
+ ctrl.data.successHandler(ctrl.installer).success(function(){
+ $uibModalInstance.dismiss('cancel');
+ });
}
@@ -465,9 +498,9 @@
* inputs.
*/
function confirm() {
- ctrl.data.successHandler(ctrl.name,ctrl.data.name);
- $uibModalInstance.dismiss('cancel');
-
+ ctrl.data.successHandler(ctrl.name,ctrl.data.name).success( function() {
+ $uibModalInstance.dismiss('cancel');
+ })
}
/**
diff --git a/testapi/opnfv_testapi/ui/index.html b/testapi/opnfv_testapi/ui/index.html
index 68c6cc5..f345197 100644
--- a/testapi/opnfv_testapi/ui/index.html
+++ b/testapi/opnfv_testapi/ui/index.html
@@ -28,6 +28,7 @@
<link rel="stylesheet" href="testapi-ui/assets/lib/angular-busy/dist/angular-busy.min.css">
<link rel="stylesheet" href="testapi-ui/assets/css/style.css">
<link rel="stylesheet" href="testapi-ui/assets/lib/font-awesome-4.7.0/css/font-awesome.min.css">
+ <link rel="stylesheet" href="testapi-ui/assets/lib/angular-json-tree/angular-json-tree.css" />
<script src="testapi-ui/assets/lib/jquery/jquery-3.2.1.min.js"></script>
<script src="testapi-ui/assets/lib/bootstrap/dist/js/bootstrap.min.js"></script>
@@ -36,6 +37,7 @@
<script src="testapi-ui/assets/lib/angular-resource/angular-resource.min.js"></script>
<script src="testapi-ui/assets/lib/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
<script src="testapi-ui/assets/lib/angular-busy/dist/angular-busy.min.js"></script>
+ <script src="testapi-ui/assets/lib/angular-json-tree/angular-json-tree.min.js"></script>
<script src="testapi-ui/assets/lib/angular-confirm-modal/angular-confirm.js"></script>
<script src="testapi-ui/app.js"></script>
diff --git a/testapi/opnfv_testapi/ui/package.json b/testapi/opnfv_testapi/ui/package.json
index dc99239..2d4eb6e 100644
--- a/testapi/opnfv_testapi/ui/package.json
+++ b/testapi/opnfv_testapi/ui/package.json
@@ -3,6 +3,7 @@
"grunt": "~1.0.1",
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-copy": "^1.0.0",
+ "grunt-convert": "^0.1.12",
"grunt-karma": "~2.0.0",
"grunt-protractor-coverage": "^0.2.18",
"grunt-protractor-runner": "~5.0.0",