From ed112005d1b1fd69e96a902f7f08d9f9ddb143b1 Mon Sep 17 00:00:00 2001 From: thuva4 Date: Wed, 28 Feb 2018 23:38:58 +0530 Subject: Add resource name in scenario page confirm modal Add the name of the insatllers, versions, projects and customs in the delete confirm modal add tests Change-Id: I91e115f484726d98c357de844197189b22f66584 Signed-off-by: thuva4 --- testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js | 2 ++ .../opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js | 2 ++ .../opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js | 13 ++++++++++--- .../opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js | 2 ++ .../opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js | 2 ++ .../ui/components/scenarios/scenario/scenarioController.js | 8 ++++---- .../opnfv_testapi/ui/shared/alerts/confirmModalFactory.js | 13 ++++++++++++- 7 files changed, 34 insertions(+), 8 deletions(-) diff --git a/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js index 0643097..16b219d 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js @@ -258,6 +258,8 @@ describe('testing the Pods page for authorized user', function () { checkBox.click(); var buttonDelete = element(by.buttonText('Delete'));; buttonDelete.click(); + expect(element(by.cssContainingText('label', "You are about to delete following pods : test")) + .isDisplayed()).toBe(true); var buttonOK = element(by.buttonText('Ok')); buttonOK.click(); expect(element(by.cssContainingText(".alert","Delete Success")) diff --git a/testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js index 015dcbb..ed5fe9f 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js @@ -390,6 +390,8 @@ describe('testing the Project Link for user who is in submitter group', function browser.get(baseURL+"#/projects"); var deleteOperation = element(by.css('a[title=Delete]')); deleteOperation.click(); + expect(element(by.cssContainingText('label', "You are about to delete following projects : vsfv")) + .isDisplayed()).toBe(true); var buttonOK = element(by.buttonText('Ok')); buttonOK.click(); expect(element(by.cssContainingText(".alert","Projects is successfully deleted")) diff --git a/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js index 564fbcf..14f3089 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js @@ -716,6 +716,8 @@ describe('testing the scenarios page for user', function () { installersShow.click(); 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')) installerDelete.click() + expect(element(by.cssContainingText('label', "You are about to delete following installers : fuel")) + .isDisplayed()).toBe(true); var buttonOK = element(by.buttonText('Ok')); buttonOK.click(); expect(element(by.cssContainingText(".alert","Installer is successfully deleted.")) @@ -787,6 +789,8 @@ describe('testing the scenarios page for user', function () { versionShow.click() 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')) versionDelete.click() + expect(element(by.cssContainingText('label', "You are about to delete following version : colorado")) + .isDisplayed()).toBe(true); var buttonOK = element(by.buttonText('Ok')); buttonOK.click(); expect(element(by.cssContainingText(".alert","Versions are successfully deleted.")) @@ -870,6 +874,8 @@ describe('testing the scenarios page for user', function () { projectsShow.click(); 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(element(by.cssContainingText('label', "You are about to delete following projects : yardstick")) + .isDisplayed()).toBe(true); var buttonOK = element(by.buttonText('Ok')); buttonOK.click(); expect(element(by.cssContainingText(".alert","Projects are successfully Deleted.")) @@ -1035,7 +1041,6 @@ describe('testing the scenarios page for user', function () { var custom = element(by.model('customModalCtrl.custom')); browser.wait(EC.visibilityOf(custom), 5000); custom.sendKeys('testC'); - // browser.pause(); var buttonAddCustom = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[1]/div/fieldset/div/div/div/table/tfoot/tr/td[2]/input')) buttonAddCustom.click(); custom.sendKeys('testB'); @@ -1066,8 +1071,10 @@ describe('testing the scenarios page for user', function () { 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[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')) - buttonAdd.click() + 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(element(by.cssContainingText('label', "You are about to delete following customs : dvs")) + .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.")) diff --git a/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js index 505b42f..bed80dd 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js @@ -690,6 +690,8 @@ describe('testing the scenarios page for user', function () { browser.get(baseURL+'#/scenarios'); var deleteOperation = element(by.css('a[title=Delete]')); deleteOperation.click(); + expect(element(by.cssContainingText('label', "You are about to delete following scenarios : test-scenario")) + .isDisplayed()).toBe(true); var buttonOK = element(by.buttonText('Ok')); buttonOK.click(); expect(element(by.cssContainingText(".alert","Scenario is successfully deleted.")) diff --git a/testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js index 4f21fd1..53e7bdf 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js @@ -575,6 +575,8 @@ describe('testing the test cases page for user who is in submitter group', funct testCases.click(); var deleteOperation = element(by.css('a[title=Delete]')); deleteOperation.click(); + expect(element(by.cssContainingText('label', "You are about to delete following testcases : testCase")) + .isDisplayed()).toBe(true); var buttonCancel = element(by.buttonText('Cancel')); buttonCancel.click(); expect(buttonCancel.isPresent()).toBe(false); diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js index b76f63c..36e54f5 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js @@ -219,7 +219,7 @@ var data = { "installers": installers } - confirmModal("Delete",ctrl.deleteInstaller,data); + confirmModal("Delete", 'installers', ctrl.deleteInstaller, data); } function addInstaller(installer){ @@ -273,7 +273,7 @@ "version": versions, "installer": installer } - confirmModal("Delete",ctrl.deleteVersion,data); + confirmModal("Delete", "version", ctrl.deleteVersion, data); } function deleteVersion(data){ @@ -359,7 +359,7 @@ "version": version, "installer": installer } - confirmModal("Delete",ctrl.deleteCustom,data); + confirmModal("Delete", 'customs', ctrl.deleteCustom, data); } function deleteCustom(data){ @@ -402,7 +402,7 @@ "version": version, "installer": installer } - confirmModal("Delete",ctrl.deleteProject,data); + confirmModal("Delete", 'projects', ctrl.deleteProject, data); } function deleteProject(data){ diff --git a/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js b/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js index c115a3c..0286341 100644 --- a/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js +++ b/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js @@ -54,7 +54,7 @@ if (typeof ctrl.data.name === 'string') { ctrl.deleteObjects = ctrl.data.name } - else{ + else if (ctrl.data.name instanceof Array){ for(var index in ctrl.data.name){ if(index==0){ ctrl.deleteObjects += ctrl.data.name[index] @@ -65,6 +65,17 @@ } } + else{ + for(var index in ctrl.data.name[ctrl.data.resource]){ + if(index==0){ + ctrl.deleteObjects += ctrl.data.name[ctrl.data.resource][index] + } + else{ + ctrl.deleteObjects += ", "+ ctrl.data.name[ctrl.data.resource][index] + } + + } + } } /** * Initiate confirmation and call the success handler with the -- cgit 1.2.3-korg