summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/tests/UI/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi/tests/UI/e2e')
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js540
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/deployResultsControllerSpec.js397
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/homeControllerSpec.js56
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js602
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/projectControllerSpec.js354
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js482
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js169
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js1108
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js500
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js39
10 files changed, 3578 insertions, 669 deletions
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js
new file mode 100644
index 0000000..6b9a2bf
--- /dev/null
+++ b/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js
@@ -0,0 +1,540 @@
+
+var mock = require('protractor-http-mock');
+var baseURL = "http://localhost:8000/";
+
+
+describe('testing the pods page for anonymous user', function () {
+ beforeEach(function(){
+ mock([{
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ pods: [{role: "community-ci", name: "test", owner: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}]
+ }
+ }
+ }
+ ]);
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it('Delete button is visible for anonymous user', function () {
+ var fs = require('fs')
+ var m = JSON.parse(fs.readFileSync('testapi-ui/config.json').toString());
+ m.authenticate = false;
+ fs.writeFile('testapi-ui/config.json', JSON.stringify(m, null, 2))
+ browser.restart();
+ browser.get(baseURL+'#/pods');
+ var buttonDelete = element(by.buttonText('Delete'));
+ expect(buttonDelete.isDisplayed()).toBe(true)
+ });
+
+ it('Delete button is visible for anonymous user', function () {
+ var buttonDelete = element(by.buttonText('Delete'));
+ expect(buttonDelete.isDisplayed()).toBe(true)
+ });
+
+ it('delete Operation is visible for user ', function () {
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ expect(deleteOperation.isDisplayed()).toBe(true);
+ });
+});
+
+describe('testing the project page for anonymous user', function () {
+ beforeEach(function(){
+ mock([
+ {
+ request: {
+ path: '/api/v1/projects',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "projects": [
+ {
+ "owner": "thuva4",
+ "_id": "5a0c022f9a07c846d3c2cc94",
+ "creation_date": "2017-11-15 14:30:31.200259",
+ "description": "dsfsd",
+ "name": "testproject"
+ }
+ ]
+ }
+ }
+ }
+ ]);
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it('create button is visible for user', function () {
+ browser.get(baseURL+'#/projects');
+ var buttonCreate = element(by.buttonText('Create'));
+ expect(buttonCreate.isDisplayed()).toBe(true);
+ });
+
+ 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);
+ });
+
+ it('Edit Operation is visible for user ', function () {
+ browser.get(baseURL+'#/projects');
+ var editOperation = element(by.css('a[title=Edit]'));
+ expect(editOperation.isDisplayed()).toBe(true);
+ });
+});
+
+
+describe('testing the scenarios page for anonymous user', function () {
+ beforeEach(function(){
+ mock([
+ {
+ request: {
+ path: '/api/v1/scenarios',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "scenarios": [
+ {
+ "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"
+ }
+ ]
+ },
+ {
+ "project": "functest",
+ "customs": [
+ "vping_ssh",
+ "vping_userdata",
+ ],
+ "scores": [
+ {
+ "date": "2016-12-09 11:28",
+ "score": "6/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"
+ }
+ ],
+ "trust_indicators": [
+ {
+ "date": "2016-12-09 11:38",
+ "status": "silver"
+ }
+ ]
+ },
+ {
+ "project": "functest",
+ "customs": [
+ "vping_ssh",
+ "vping_userdata"
+ ],
+ "scores": [
+ {
+ "date": "2016-12-09 11:28",
+ "score": "6/8"
+ }
+ ],
+ "trust_indicators": [
+ {
+ "date": "2016-12-09 11:38",
+ "status": "silver"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "_id": "5a50fcacsdgdsgdasgfvb861c",
+ "name": "test-scenario",
+ "creation_date": "2018-01-06 22:13:24.160407"
+ }
+ ]
+ }
+ }
+ }
+ ])
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it( 'should show the add installer option 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[5]/td[2]/div[2]/button'))
+ expect(buttonAdd.isDisplayed()).toBe(true);
+ });
+
+ it( 'should show the delete installer option for 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[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[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[3]/button'))
+ expect(installerDelete.isDisplayed()).toBe(true);
+ });
+
+ it( 'should show the add version option for 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[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[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[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[2]/button'))
+ versionAdd.click()
+ expect(versionAdd.isDisplayed()).toBe(true);
+ });
+
+ it( 'should show the delete version option for 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[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[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[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[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[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);
+ });
+
+ it( 'should show the add project option for 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[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[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[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[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[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);
+ });
+
+ it( 'should show the delete project option for 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[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[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[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[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[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[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);
+ });
+
+ it( 'should show the add customs option for 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[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[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[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[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[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[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[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[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);
+ });
+
+ it( 'should show the delete customs option for 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[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[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[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[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[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[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[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[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
new file mode 100644
index 0000000..40f60e4
--- /dev/null
+++ b/testapi/opnfv_testapi/tests/UI/e2e/deployResultsControllerSpec.js
@@ -0,0 +1,397 @@
+'use strict';
+
+var mock = require('protractor-http-mock');
+var baseURL = "http://localhost:8000/"
+
+describe('testing the result page for anonymous user', function () {
+ beforeEach(function(){
+ mock([
+ {
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ pods: [{role: "community-ci", name: "test", owner: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/deployresults',
+ method: 'GET',
+ queryString: {
+ page: '1'
+ }
+ },
+ response: {
+ data: {
+ "pagination": {
+ "current_page": 1,
+ "total_pages": 1
+ },
+ "deployresults": [
+ {
+ "build_id": 411,
+ "upstream_build_id": 184,
+ "scenario": "os-nosdn-nofeature-ha",
+ "stop_date": "2018-01-2723:21:31.3N",
+ "start_date": "2018-01-2723:21:28.3N",
+ "upstream_job_name": "daisy-os-nosdn-nofeature-ha-baremetal-daily-master",
+ "version": "master",
+ "pod_name": "zte-pod",
+ "criteria": "PASS",
+ "installer": "daisy",
+ "_id": "5a6dc1089a07c80f3c9f8d62",
+ "job_name": "daisy-deploy-baremetal-daily-master",
+ "details": null
+ }
+ ]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/deployresults',
+ method: 'GET',
+ queryString: {
+ page: '1',
+ installer: 'daisy'
+ }
+ },
+ response: {
+ data: {
+ "pagination": {
+ "current_page": 1,
+ "total_pages": 1
+ },
+ "deployresults": [
+ {
+ "build_id": 411,
+ "upstream_build_id": 184,
+ "scenario": "os-nosdn-nofeature-ha",
+ "stop_date": "2018-01-2723:21:31.3N",
+ "start_date": "2018-01-2723:21:28.3N",
+ "upstream_job_name": "daisy-os-nosdn-nofeature-ha-baremetal-daily-master",
+ "version": "master",
+ "pod_name": "zte-pod",
+ "criteria": "PASS",
+ "installer": "daisy",
+ "_id": "5a6dc1089a07c80f3c9f8d63",
+ "job_name": "daisy-deploy-baremetal-daily-master",
+ "details": null
+ }
+ ]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/deployresults',
+ method: 'GET',
+ queryString: {
+ page: '1',
+ installer: 'daisy',
+ job_name: 'daisy-deploy-baremetal-daily-master'
+ }
+ },
+ response: {
+ data: {
+ "pagination": {
+ "current_page": 1,
+ "total_pages": 1
+ },
+ "deployresults": [
+ {
+ "build_id": 411,
+ "upstream_build_id": 184,
+ "scenario": "os-nosdn-nofeature-ha",
+ "stop_date": "2018-01-2723:21:31.3N",
+ "start_date": "2018-01-2723:21:28.3N",
+ "upstream_job_name": "daisy-os-nosdn-nofeature-ha-baremetal-daily-master",
+ "version": "master",
+ "pod_name": "zte-pod",
+ "criteria": "PASS",
+ "installer": "daisy",
+ "_id": "5a6dc1089a07c80f3c9f8d64",
+ "job_name": "daisy-deploy-baremetal-daily-master",
+ "details": null
+ }
+ ]
+ }
+ }
+ }
+ ]);
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it( 'should show the deploy results page for anonymous user', function() {
+ browser.get(baseURL+"#/deployresults");
+ expect(element(by.cssContainingText(".ng-binding.ng-scope","Deploy Results")).isDisplayed()).toBe(true);
+ });
+
+ it( 'navigate anonymous user to results page', function() {
+ browser.get(baseURL);
+ var resultLink = element(by.linkText('Deploy Results')).click();
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/deployresults'), 10000);
+ });
+
+ it('Should show the results in results page for anonymous user ', function () {
+ browser.get(baseURL+"#/deployresults");
+ 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");
+ });
+
+ it('Should show the results in results page related to the filters for anonymous user ', function () {
+ browser.get(baseURL+"#/deployresults");
+ var filter = element(by.model('ctrl.filter'));
+ var filterText = element(by.model('ctrl.filterText'));
+ filter.sendKeys('installer');
+ filterText.sendKeys('daisy');
+ var buttonFilter = element(by.buttonText('Filter'));
+ buttonFilter.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("3c9f8d63");
+ filter.sendKeys('job_name');
+ filterText.sendKeys('daisy-deploy-baremetal-daily-master')
+ buttonFilter.click();
+ expect(cells.get(0).getText()).toContain("3c9f8d64");
+ });
+ it('Should not show the results in results page related to the filters for anonymous user ', function () {
+ browser.get(baseURL+"#/deployresults");
+ var filter = element(by.model('ctrl.filter'));
+ var filterText = element(by.model('ctrl.filterText'));
+ filter.sendKeys('installer');
+ filterText.sendKeys('daisyl');
+ var buttonFilter = element(by.buttonText('Filter'));
+ buttonFilter.click();
+ expect(element(by.css('.alert.alert-danger.ng-binding.ng-scope'))
+ .isDisplayed()).toBe(true);
+ });
+
+});
+
+describe('testing the result page for user', function () {
+ beforeEach(function(){
+ mock([
+ {
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ pods: [{role: "community-ci", name: "test", owner: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/profile',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
+ "user": "testUser", "groups": ["opnfv-testapi-users"],
+ "email": "testuser@test.com"
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/deployresults',
+ method: 'GET',
+ queryString: {
+ page: '1'
+ }
+ },
+ response: {
+ data: {
+ "pagination": {
+ "current_page": 1,
+ "total_pages": 1
+ },
+ "deployresults": [
+ {
+ "build_id": 411,
+ "upstream_build_id": 184,
+ "scenario": "os-nosdn-nofeature-ha",
+ "stop_date": "2018-01-2723:21:31.3N",
+ "start_date": "2018-01-2723:21:28.3N",
+ "upstream_job_name": "daisy-os-nosdn-nofeature-ha-baremetal-daily-master",
+ "version": "master",
+ "pod_name": "zte-pod",
+ "criteria": "PASS",
+ "installer": "daisy",
+ "_id": "5a6dc1089a07c80f3c9f8d62",
+ "job_name": "daisy-deploy-baremetal-daily-master",
+ "details": null
+ }
+ ]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/deployresults',
+ method: 'GET',
+ queryString: {
+ page: '1',
+ installer: 'daisy'
+ }
+ },
+ response: {
+ data: {
+ "pagination": {
+ "current_page": 1,
+ "total_pages": 1
+ },
+ "deployresults": [
+ {
+ "build_id": 411,
+ "upstream_build_id": 184,
+ "scenario": "os-nosdn-nofeature-ha",
+ "stop_date": "2018-01-2723:21:31.3N",
+ "start_date": "2018-01-2723:21:28.3N",
+ "upstream_job_name": "daisy-os-nosdn-nofeature-ha-baremetal-daily-master",
+ "version": "master",
+ "pod_name": "zte-pod",
+ "criteria": "PASS",
+ "installer": "daisy",
+ "_id": "5a6dc1089a07c80f3c9f8d63",
+ "job_name": "daisy-deploy-baremetal-daily-master",
+ "details": null
+ }
+ ]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/deployresults',
+ method: 'GET',
+ queryString: {
+ page: '1',
+ installer: 'daisy',
+ job_name : 'daisy-deploy-baremetal-daily-master'
+ }
+ },
+ response: {
+ data: {
+ "pagination": {
+ "current_page": 1,
+ "total_pages": 1
+ },
+ "deployresults": [
+ {
+ "build_id": 411,
+ "upstream_build_id": 184,
+ "scenario": "os-nosdn-nofeature-ha",
+ "stop_date": "2018-01-2723:21:31.3N",
+ "start_date": "2018-01-2723:21:28.3N",
+ "upstream_job_name": "daisy-os-nosdn-nofeature-ha-baremetal-daily-master",
+ "version": "master",
+ "pod_name": "zte-pod",
+ "criteria": "PASS",
+ "installer": "daisy",
+ "_id": "5a6dc1089a07c80f3c9f8d64",
+ "job_name": "daisy-deploy-baremetal-daily-master",
+ "details": null
+ }
+ ]
+ }
+ }
+ }
+ ]);
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it( 'should show the deploy results page for user', function() {
+ browser.get(baseURL+"#/deployresults");
+ expect(element(by.cssContainingText(".ng-binding.ng-scope","Deploy Results")).isDisplayed()).toBe(true);
+ });
+
+ it( 'navigate user to results page', function() {
+ browser.get(baseURL);
+ var resultLink = element(by.linkText('Deploy Results')).click();
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/deployresults'), 10000);
+ });
+
+ it('Should show the results in results page for user ', function () {
+ browser.get(baseURL+"#/deployresults");
+ 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");
+ });
+
+ it('Should show the results in results page related to the filters for user ', function () {
+ browser.get(baseURL+"#/deployresults");
+ var filter = element(by.model('ctrl.filter'));
+ var filterText = element(by.model('ctrl.filterText'));
+ filter.sendKeys('installer');
+ filterText.sendKeys('daisy');
+ var buttonFilter = element(by.buttonText('Filter'));
+ buttonFilter.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("3c9f8d63");
+ filter.sendKeys('job_name');
+ filterText.sendKeys('daisy-deploy-baremetal-daily-master')
+ buttonFilter.click();
+ expect(cells.get(0).getText()).toContain("3c9f8d64");
+ });
+ it('Should not show the results in results page related to the filters for user ', function () {
+ browser.get(baseURL+"#/deployresults");
+ var filter = element(by.model('ctrl.filter'));
+ var filterText = element(by.model('ctrl.filterText'));
+ filter.sendKeys('installer');
+ filterText.sendKeys('daisy1');
+ var buttonFilter = element(by.buttonText('Filter'));
+ buttonFilter.click();
+ expect(element(by.css('.alert.alert-danger.ng-binding.ng-scope'))
+ .isDisplayed()).toBe(true);
+ });
+
+ it('Clear the filter', function () {
+ browser.get(baseURL+"#/deployresults");
+ var filter = element(by.model('ctrl.filter'));
+ var filterText = element(by.model('ctrl.filterText'));
+ filter.sendKeys('installer');
+ filterText.sendKeys('daisy');
+ var buttonFilter = element(by.buttonText('Filter'));
+ buttonFilter.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("3c9f8d63");
+ var buttonClear = element(by.buttonText('Clear'));
+ 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("3c9f8d63");
+ });
+
+ it('view the deploy results ', function () {
+ browser.get(baseURL+"#/deployresults");
+ var viewOperation = element(by.linkText('3c9f8d62'))
+ viewOperation.click();
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains('#/deployresults/5a6dc1089a07c80f3c9f8d62'), 10000);
+ });
+
+}); \ No newline at end of file
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/homeControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/homeControllerSpec.js
new file mode 100644
index 0000000..013527d
--- /dev/null
+++ b/testapi/opnfv_testapi/tests/UI/e2e/homeControllerSpec.js
@@ -0,0 +1,56 @@
+'use strict';
+
+var mock = require('protractor-http-mock');
+var baseURL = "http://localhost:8000"
+describe('testing the home page for anonymous user', function () {
+
+ it( 'should navigate to pods link ', function() {
+ browser.get(baseURL);
+ var signOut = element(by.linkText('Sign In / Sign Up'))
+ expect(signOut.isDisplayed()).toBe(true);
+ });
+});
+
+describe('testing the home page for user', function () {
+ beforeEach(function(){
+ mock([{
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ pods: [{role: "community-ci", name: "test", creator: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/profile',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
+ "user": "testUser", "groups": ["opnfv-testapi-users",
+ "opnfv-gerrit-functest-submitters"], "email": "testuser@test.com"
+ }
+ }
+ }])
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it( 'should show the profile page', function() {
+ browser.get(baseURL);
+ var profile = element(by.linkText('Profile'))
+ expect(profile.isDisplayed()).toBe(true);
+ profile.click()
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '/#/profile'), 10000);
+ });
+}); \ No newline at end of file
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js
index c3961ab..ac1f954 100644
--- a/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js
+++ b/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js
@@ -4,202 +4,418 @@ var mock = require('protractor-http-mock');
var baseURL = "http://localhost:8000"
describe('testing the Pods page for anonymous user', function () {
- beforeEach(function(){
- mock([{
- request: {
- path: '/api/v1/pods',
- method: 'GET'
- },
- response: {
- data: {
- pods: [{role: "community-ci", name: "test", owner: "testUser",
- details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed",
- creation_date: "2017-10-25 11:58:25.926168"}]
- }
- }
- }]);
- });
-
- afterEach(function(){
- mock.teardown();
- });
-
- it( 'should navigate to pods link ', function() {
- browser.get(baseURL);
- var podslink = element(by.linkText('Pods')).click();
- var EC = browser.ExpectedConditions;
- browser.wait(EC.urlContains(baseURL+ '/#/pods'), 10000);
- });
-
- it('create button is not visible for anonymous user', function () {
- browser.get(baseURL+'#/pods');
- var buttonCreate = element(by.buttonText('Create'));
- expect(buttonCreate.isDisplayed()).toBeFalsy();
- });
-
- it('filter button is visible for anonymous user', function () {
- var buttonFilter = element(by.buttonText('Filter'));
- expect(buttonFilter.isDisplayed()).toBe(true)
- });
-
- it('clear button is visible for anonymous user', function () {
- var buttonClear = element(by.buttonText('Clear'));
- expect(buttonClear.isDisplayed()).toBe(true)
- });
-
- it('Show results when click filter button', function () {
- var buttonFilter = element(by.buttonText('Filter'));
- buttonFilter.click();
- var pod = element(by.css('.show-pod'));
- expect(pod.isPresent()).toBe(true);
- });
-
- it('Show results when click clear button', function () {
- browser.get(baseURL+'#/pods');
- var buttonClear = element(by.buttonText('Clear'));
- buttonClear.click();
- var pod = element(by.css('.show-pod'));
- expect(pod.isPresent()).toBe(true);
- });
-
- it('If details is not shown then show details when click the link',function() {
- expect(element(by.css('.show-pod.hidden')).isPresent()).toBe(true);
- var podslink = element(by.linkText('test')).click();
- expect(element(by.css('.show-pod.hidden')).isPresent()).toBe(false);
- });
-
- it('If details is shown then hide details when click the link',function() {
- expect(element(by.css('.show-pod.hidden')).isPresent()).toBe(false);
- var podslink = element(by.linkText('test')).click();
- expect(element(by.css('.show-pod.hidden')).isPresent()).toBe(true);
- });
-
- it('If backend is not responding then show error when click filter button', function () {
- browser.get(baseURL + '/#/pods');
- mock.teardown();
- var buttonFilter = element(by.buttonText('Filter'));
- buttonFilter.click().then(function(){
- expect(element(by.css('.alert.alert-danger.ng-binding.ng-scope'))
- .isDisplayed()).toBe(true);
- });
- });
+ beforeEach(function(){
+ mock([
+ {
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET',
+ queryString: {
+ name: 'test'
+ }
+ },
+ response: {
+ data: {
+ pods: [{role: "community-ci", name: "test", creator: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}]
+ }
+ }
+ },
+ {
+ 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"}
+ ]
+ }
+ }
+ }
+ ]);
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it( 'should navigate to pods link ', function() {
+ browser.get(baseURL);
+ var podslink = element(by.linkText('Pods')).click();
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '/#/pods'), 10000);
+ });
+
+ it('create button is not visible for anonymous user', function () {
+ browser.get(baseURL+'#/pods');
+ var buttonCreate = element(by.buttonText('Create'));
+ expect(buttonCreate.isDisplayed()).toBeFalsy();
+ });
+
+ it('filter button is visible for anonymous user', function () {
+ var buttonFilter = element(by.buttonText('Filter'));
+ expect(buttonFilter.isDisplayed()).toBe(true)
+ });
+
+ it('Delete button is visible for anonymous user', function () {
+ var buttonDelete = element(by.buttonText('Delete'));
+ expect(buttonDelete.isDisplayed()).toBeFalsy();
+ });
+
+ it('Show results in a sorted order', function () {
+ var row = element.all(by.repeater('(index, pod) in ctrl.data.pods')).first();
+ var cells = row.all(by.tagName('td'));
+ expect(cells.get(1).getText()).toContain("test");
+ });
+
+ it('Sort the results by mode', function () {
+ browser.get(baseURL+'#/pods');
+ 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'));
+ expect(cells.get(1).getText()).toContain("test2");
+ });
+
+ it('Sort the results by role', function () {
+ browser.get(baseURL+'#/pods');
+ 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'));
+ expect(cells.get(1).getText()).toContain("test2");
+ });
+
+ it('Show relevant results to the filter', function () {
+ var filter = element(by.model('ctrl.filterText'));
+ filter.sendKeys('test');
+ var buttonFilter = element(by.buttonText('Filter'));
+ var row = element.all(by.repeater('(index, pod) in ctrl.data.pods')).first();
+ var cells = row.all(by.tagName('td'));
+ expect(cells.get(1).getText()).toContain("test");
+ });
+
+ it('delete Operation is not visible for user ', function () {
+ browser.get(baseURL+'#/pods');
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ expect(deleteOperation.isDisplayed()).toBeFalsy();
+ });
+
});
describe('testing the Pods page for authorized user', function () {
- beforeEach(function(){
- mock([
- {
- request: {
- path: '/api/v1/pods',
- method: 'POST'
- },
- response: {
- data: {
- href: baseURL+"/api/v1/pods/test"
- }
- }
- },
- {
- request: {
- path: '/api/v1/pods',
- method: 'POST',
- data: {
- name: 'test1',
- details : 'DemoDetails',
- role : 'community-ci',
- mode : 'metal'
- }
- },
- response: {
- status : 403
- }
- },
- {
- request: {
- path: '/api/v1/profile',
- method: 'GET'
- },
- response: {
- data: {
- "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
- "user": "testUser", "groups": ["opnfv-testapi-users",
- "opnfv-gerrit-functest-submitters"], "email": "testuser@test.com"
- }
- }
- }
- ]);
- });
-
- afterEach(function(){
- mock.teardown();
- });
-
- it('create button is visible for authorized user', function () {
- browser.get(baseURL + '/#/pods');
- var buttonCreate = element(by.buttonText('Create'));
- expect(buttonCreate.isDisplayed()).toBe(true);
- });
-
- it('Do not show error if input is acceptable', function () {
- var name = element(by.model('ctrl.name'));
- var details = element(by.model('ctrl.details'));
- name.sendKeys('test');
- details.sendKeys('DemoDetails');
- var buttonCreate = element(by.buttonText('Create'));
- buttonCreate.click().then(function(){
- expect(element(by.css('.alert.alert-danger.ng-binding.ng-scope'))
- .isDisplayed()).toBe(false);
- });
- });
-
- it('Show error when user click the create button with a empty name', function () {
- browser.get(baseURL+ '/#/pods');
- var details = element(by.model('ctrl.details'));
- details.sendKeys('DemoDetails');
- var buttonCreate = element(by.buttonText('Create'));
- buttonCreate.click();
- expect(element(by.cssContainingText(".alert","Name is missing.")).isDisplayed()).toBe(true);
- });
-
- it('Show error when user click the create button with an already existing name', function () {
- browser.get(baseURL+ '/#/pods');
- var name = element(by.model('ctrl.name'));
- var details = element(by.model('ctrl.details'));
- name.sendKeys('test1');
- details.sendKeys('DemoDetails');
- var buttonCreate = element(by.buttonText('Create'));
- buttonCreate.click();
- expect(element(by.cssContainingText(".alert","Error creating the new pod from server: undefined")).isDisplayed()).toBe(true);
- });
-
- it('If backend is not responding then show error when user click the create button',function(){
- mock.teardown();
- mock([
- {
- request: {
- path: '/api/v1/profile',
- method: 'GET'
- },
- response: {
- data: {
- "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
- "user": "testUser", "groups": ["opnfv-testapi-users"],
- "email": "testuser@test.com"
- }
- }
- }
- ]);
- browser.get(baseURL+ '/#/pods');
- var name = element(by.model('ctrl.name'));
- var details = element(by.model('ctrl.details'));
- name.sendKeys('test');
- details.sendKeys('DemoDetails');
- var buttonCreate = element(by.buttonText('Create'));
- buttonCreate.click().then(function(){
- expect(element(by.css('.alert.alert-danger.ng-binding'))
- .isDisplayed()).toBe(true);
- });
- });
+ beforeEach(function(){
+ mock([{
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ pods: [{role: "community-ci", name: "test", creator: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/profile',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
+ "user": "testUser", "groups": ["opnfv-testapi-users",
+ "opnfv-gerrit-functest-submitters"], "email": "testuser@test.com"
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET',
+ queryString: {
+ name: 'test'
+ }
+ },
+ response: {
+ data: {
+ pods: [{role: "community-ci", name: "test", creator: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/pods/test',
+ method: 'DELETE'
+ },
+ response: {
+ data: {
+ href: baseURL+"/api/v1/pods/test"
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/pods/test1',
+ method: 'DELETE'
+ },
+ response: {
+ data: {
+ href: baseURL+"/api/v1/pods/test1"
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/pods',
+ method: 'POST'
+ },
+ response: {
+ data: {
+ href: baseURL+"/api/v1/pods/test1"
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/pods/test',
+ method: 'GET'
+ },
+ response: {
+ data: {role: "community-ci", name: "test", creator: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}
+ }
+ }
+ ]);
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it( 'should navigate to pods link ', function() {
+ browser.get(baseURL);
+ var podslink = element(by.linkText('Pods')).click();
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '/#/pods'), 10000);
+ });
+
+ it('create button is not visible for user', function () {
+ browser.get(baseURL+'#/pods');
+ var buttonCreate = element(by.buttonText('Create'));
+ expect(buttonCreate.isDisplayed()).toBe(true);
+ });
+
+ it('filter button is visible for user', function () {
+ var buttonFilter = element(by.buttonText('Filter'));
+ expect(buttonFilter.isDisplayed()).toBe(true)
+ });
+
+ it('Delete button is visible for user', function () {
+ var buttonDelete = element(by.buttonText('Delete'));
+ expect(buttonDelete.isDisplayed()).toBe(true)
+ });
+
+ it('Show results', function () {
+ var row = element.all(by.repeater('(index, pod) in ctrl.data.pods')).first();
+ var cells = row.all(by.tagName('td'));
+ expect(cells.get(1).getText()).toContain("test");
+ });
+
+ it('Show relevant results to the filter', function () {
+ var filter = element(by.model('ctrl.filterText'));
+ filter.sendKeys('test');
+ var buttonFilter = element(by.buttonText('Filter'));
+ var row = element.all(by.repeater('(index, pod) in ctrl.data.pods')).first();
+ var cells = row.all(by.tagName('td'));
+ expect(cells.get(1).getText()).toContain("test");
+ });
+
+ it('delete Operation is visible for user ', function () {
+ browser.get(baseURL+'#/pods');
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ expect(deleteOperation.isDisplayed()).toBe(true);
+ });
+
+ it('Batch Delete the pods ', function () {
+ browser.get(baseURL+"#/pods");
+ var checkBox = element(by.model('ctrl.checkBox[index]'));
+ 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();
+ 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 () {
+ browser.get(baseURL+"#/pods");
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ deleteOperation.click();
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ 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 () {
+ browser.get(baseURL+"#/pods");
+ var buttonCreate = element(by.buttonText('Create'));
+ buttonCreate.click();
+ var name = element(by.model('PodModalCtrl.pod.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ name.sendKeys('test1');
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ 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 () {
+ browser.get(baseURL+"#/pods");
+ var buttonCreate = element(by.buttonText('Create'));
+ buttonCreate.click();
+ var name = element(by.model('PodModalCtrl.pod.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click()
+ 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 () {
+ browser.get(baseURL+"#/pods");
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ deleteOperation.click();
+ var buttonCancel = element(by.buttonText('Cancel'));
+ buttonCancel.click();
+ expect(buttonCancel.isPresent()).toBe(false);
+ });
+
+ it('Delete the pods which do not exist ', function () {
+ mock.teardown();
+ mock([{
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ pods: [{role: "community-ci", name: "test1", creator: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/profile',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
+ "user": "testUser", "groups": ["opnfv-testapi-users",
+ "opnfv-gerrit-functest-submitters"], "email": "testuser@test.com"
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/pods/test1',
+ method: 'DELETE'
+ },
+ response: {
+ status : 403,
+ data : 'pods do not exist'
+ }
+ }
+ ]);
+ browser.get(baseURL+"#/pods");
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ deleteOperation.click();
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ browser.ignoreSynchronization = true;
+ expect(element(by.css(".error.show"))
+ .isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
+ });
+
+ it('view the test case ', function () {
+ browser.get(baseURL+"#/pods");
+ var viewOperation = element(by.linkText('test'));
+ viewOperation.click();
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains('#/pods/test'), 10000);
+ });
+
+ it('Show error if server is not responding', function () {
+ mock.teardown();
+ mock([{
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET'
+ },
+ response: {
+ status : 404
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/profile',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
+ "user": "testUser", "groups": ["opnfv-testapi-users",
+ "opnfv-gerrit-functest-submitters"], "email": "testuser@test.com"
+ }
+ }
+ },
+ ]);
+ browser.get(baseURL+"#/pods");
+ 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/projectControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/projectControllerSpec.js
deleted file mode 100644
index 475e037..0000000
--- a/testapi/opnfv_testapi/tests/UI/e2e/projectControllerSpec.js
+++ /dev/null
@@ -1,354 +0,0 @@
-'use strict';
-
-var mock = require('protractor-http-mock');
-var baseURL = "http://localhost:8000/#/"
-
-describe('testing the Project Link for anonymous user', function () {
- beforeEach(function(){
- mock([
- {
- request: {
- path: '/api/v1/projects/testproject',
- method: 'GET'
- },
- response: {
- data: {
- "owner": "thuva4",
- "_id": "5a0c022f9a07c846d3c2cc94",
- "creation_date": "2017-11-15 14:30:31.200259",
- "description": "dsfsd",
- "name": "testproject"
- }
- }
- }
- ]);
- });
-
- afterEach(function(){
- mock.teardown();
- });
-
- it( 'navigate to the project page', function() {
- browser.get(baseURL+"projects/testproject");
- var EC = browser.ExpectedConditions;
- browser.wait(EC.urlContains(baseURL+ 'projects/testproject'), 10000);
- });
-
- it('show the project details for anonymous user ', function(){
- var table = $$('.projects-table.ng-scope tr');
- var projectDetailsLable = ['Name','Description','Creation date']
- var projectDetails = ['testproject', 'dsfsd','2017-11-15 14:30:31.200259']
- table.each(function(row,index) {
- var rowElems = row.$$('td');
- expect(rowElems.count()).toBe(2);
- expect(rowElems.get(0).getText()).toMatch(projectDetailsLable[index]);
- expect(rowElems.get(1).getText()).toMatch(projectDetails[index]);
- });
- });
-
- it('should not show the update & delete button', function(){
- var buttonUpdate = element(by.buttonText('Update Project'));
- var buttonDelete = element(by.buttonText('Delete Project'));
- expect(buttonUpdate.isDisplayed()).toBeFalsy();
- expect(buttonDelete.isDisplayed()).toBeFalsy();
- });
-
-});
-
-
-describe('testing the Project Link for authorized user(not a submitter)', function () {
- beforeEach(function(){
- mock([
- {
- request: {
- path: '/api/v1/projects/testproject',
- method: 'GET'
- },
- response: {
- data: {
- "owner": "thuva4",
- "_id": "5a0c022f9a07c846d3c2cc94",
- "creation_date": "2017-11-15 14:30:31.200259",
- "description": "dsfsd",
- "name": "testproject"
- }
- }
- },
- {
- request: {
- path: '/api/v1/profile',
- method: 'GET'
- },
- response: {
- data: {
- "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
- "user": "testUser", "groups": ["opnfv-testapi-users"],
- "email": "testuser@test.com"
- }
- }
- }
- ]);
- });
-
- afterEach(function(){
- mock.teardown();
- });
-
- it( 'navigate to the project page', function() {
- browser.get(baseURL+"projects/testproject");
- var EC = browser.ExpectedConditions;
- browser.wait(EC.urlContains(baseURL+ 'projects/testproject'), 10000);
- });
-
- it('show the project details for user ', function(){
- var table = $$('.projects-table.ng-scope tr');
- var projectDetailsLable = ['Name','Description','Creation date']
- var projectDetails = ['testproject', 'dsfsd','2017-11-15 14:30:31.200259']
- table.each(function(row,index) {
- var rowElems = row.$$('td');
- expect(rowElems.count()).toBe(2);
- expect(rowElems.get(0).getText()).toMatch(projectDetailsLable[index]);
- expect(rowElems.get(1).getText()).toMatch(projectDetails[index]);
- });
- });
-
- it('should not show the update & delete button', function(){
- var buttonUpdate = element(by.buttonText('Update Project'));
- var buttonDelete = element(by.buttonText('Delete Project'));
- expect(buttonUpdate.isDisplayed()).toBeFalsy();
- expect(buttonDelete.isDisplayed()).toBeFalsy();
- });
-
-});
-
-describe('testing the Project Link for authorized user(a submitter)', function () {
- beforeEach(function(){
- mock([
- {
- request: {
- path: '/api/v1/projects/testproject',
- method: 'GET'
- },
- response: {
- data: {
- "owner": "thuva4",
- "_id": "5a0c022f9a07c846d3c2cc94",
- "creation_date": "2017-11-15 14:30:31.200259",
- "description": "dsfsd",
- "name": "testproject"
- }
- }
- },
- {
- request: {
- path: '/api/v1/projects/testproject1',
- method: 'GET'
- },
- response: {
- data: {
- "owner": "thuva4",
- "_id": "5a0c022f9a07c846d3c2cc94",
- "creation_date": "2017-11-15 14:30:31.200259",
- "description": "dsfsd",
- "name": "testproject1"
- }
- }
- },
- {
- request: {
- path: '/api/v1/projects',
- method: 'GET'
- },
- response: {
- data: {
- "projects": [
- {
- "owner": "thuva4",
- "_id": "5a0c022f9a07c846d3c2cc94",
- "creation_date": "2017-11-15 14:30:31.200259",
- "description": "dsfsd",
- "name": "testproject"
- }
- ]
- }
- }
- },
- {
- request: {
- path: '/api/v1/projects/testproject',
- method: 'DELETE'
- },
- response: {
- status : 200
- }
- },
- {
- request: {
- path: '/api/v1/projects/testproject1',
- method: 'DELETE'
- },
- response: {
- status : 403
- }
- },
- {
- request: {
- path: '/api/v1/projects/testproject',
- method: 'PUT',
- data: {
- name: 'testProject2',
- description : 'demoDescription',
- }
- },
- response: {
- status : 200,
- data : {
- "owner": "thuva4",
- "_id": "5a0c022f9a07c846d3c2cc94",
- "creation_date": "2017-11-15 14:30:31.200259",
- "description": "dsfsd",
- "name": "testproject2"
- }
- }
- },
- {
- request: {
- path: '/api/v1/projects/testproject',
- method: 'PUT',
- data: {
- name: 'testProject1',
- description : 'demoDescription',
- }
- },
- response: {
- status : 403
- }
- },
- {
- request: {
- path: '/api/v1/profile',
- method: 'GET'
- },
- response: {
- data: {
- "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
- "user": "testUser", "groups": ["opnfv-testapi-users",
- "opnfv-gerrit-testProject-submitters",
- "opnfv-gerrit-testProject2-submitters" ],
- "email": "testuser@test.com"
- }
- }
- },
- ]);
- });
-
- afterEach(function(){
- mock.teardown();
- });
-
- it( 'navigate to the project page', function() {
- browser.get(baseURL+"projects/testproject");
- var EC = browser.ExpectedConditions;
- browser.wait(EC.urlContains(baseURL+ 'projects/testproject'), 10000);
- });
-
- it('show the project details for user ', function(){
- var table = $$('.projects-table.ng-scope tr');
- var projectDetailsLable = ['Name','Description','Creation date']
- var projectDetails = ['testproject', 'dsfsd','2017-11-15 14:30:31.200259']
- table.each(function(row,index) {
- var rowElems = row.$$('td');
- expect(rowElems.count()).toBe(2);
- expect(rowElems.get(0).getText()).toMatch(projectDetailsLable[index]);
- expect(rowElems.get(1).getText()).toMatch(projectDetails[index]);
- });
- });
-
- it('should show the update & delete button', function(){
- var buttonUpdate = element(by.buttonText('Update Project'));
- var buttonDelete = element(by.buttonText('Delete Project'));
- expect(buttonUpdate.isDisplayed()).toBe(true);
- expect(buttonDelete.isDisplayed()).toBe(true);
- });
-
- it('show the update modal when user clicks the update button', function(){
- browser.get(baseURL+"projects/testproject");
- var buttonDelete = element(by.buttonText('Update Project')).click();
- var EC = protractor.ExpectedConditions;
- var elm = element(by.css(".modal-body"));
- browser.wait(EC.textToBePresentInElement(elm, "Update"), 5000);
- expect(elm.isDisplayed()).toBe(true);
- var buttonCancel = element(by.buttonText('Cancel')).click();
- expect(elm.isPresent()).toEqual(false);
- });
-
- it('send a update request to server and show success when we click ok', function(){
- browser.get(baseURL+"projects/testproject");
- var buttonUpdate = element(by.buttonText('Update Project')).click();
- var EC = protractor.ExpectedConditions;
- var elm = element(by.css(".modal-body"));
- browser.wait(EC.textToBePresentInElement(elm, "Update"), 5000);
- expect(elm.isDisplayed()).toBe(true);
- var name = element(by.model('updateModal.name'));
- var description = element(by.model('updateModal.description'));
- name.click().clear().sendKeys('testProject2');
- description.click().clear().sendKeys('demoDescription');
- var buttonOk = element(by.buttonText('Ok')).click();
- expect(element(by.cssContainingText(".alert.alert-success",
- "Update Success"))
- .isDisplayed()).toBe(true);
- });
-
- it('show error when server send a error response when we click ok', function(){
- browser.get(baseURL+"projects/testproject");
- var buttonUpdate = element(by.buttonText('Update Project')).click();
- var EC = protractor.ExpectedConditions;
- var elm = element(by.css(".modal-body"));
- browser.wait(EC.textToBePresentInElement(elm, "Update"), 5000);
- expect(elm.isDisplayed()).toBe(true);
- var name = element(by.model('updateModal.name'));
- var description = element(by.model('updateModal.description'));
- name.click().clear().sendKeys('testProject1');
- description.click().clear().sendKeys('demoDescription');
- var buttonOk = element(by.buttonText('Ok')).click();
- expect(element(by.cssContainingText(".alert",
- "Error updating the existing Project from server: undefined"))
- .isDisplayed()).toBe(true);
- });
-
- it('show the confirm modal when user clicks the delete button', function(){
- var buttonDelete = element(by.buttonText('Delete Project')).click();
- var EC = protractor.ExpectedConditions;
- var elm = element(by.css(".modal-body"));
- browser.wait(EC.textToBePresentInElement(elm, "You are about to delete."), 5000);
- expect(elm.isDisplayed()).toBe(true);
- var buttonCancel = element(by.buttonText('Cancel')).click();
- expect(elm.isPresent()).toEqual(false);
- });
-
- it('send a delete request to server when we click ok', function(){
- var buttonDelete = element(by.buttonText('Delete Project')).click();
- var EC = protractor.ExpectedConditions;
- var elm = element(by.css(".modal-body"));
- browser.wait(EC.textToBePresentInElement(elm, "You are about to delete."), 5000);
- expect(elm.isDisplayed()).toBe(true);
- var buttonCancel = element(by.buttonText('Ok')).click();
- browser.wait(EC.urlContains(baseURL+ 'projects'), 10000);
- });
-
- it('show the error message when we click ok', function(){
- browser.get(baseURL+"projects/testproject1");
- var buttonDelete = element(by.buttonText('Delete Project')).click();
- var EC = protractor.ExpectedConditions;
- var elm = element(by.css(".modal-body"));
- browser.wait(EC.textToBePresentInElement(elm, "You are about to delete."), 5000);
- expect(elm.isDisplayed()).toBe(true);
- var buttonCancel = element(by.buttonText('Ok')).click();
- // browser.wait(EC.urlContains(baseURL+ 'projects'), 10000);
- expect(element(by.cssContainingText(".alert",
- "Error deleting project from server: undefined"))
- .isDisplayed()).toBe(true);
- // browser.pause();
- });
-
-}); \ 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 64a5aeb..da86389 100644
--- a/testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js
+++ b/testapi/opnfv_testapi/tests/UI/e2e/projectsControllerSpec.js
@@ -15,7 +15,7 @@ describe('testing the Projects Link for anonymous user', function () {
data: {
"projects": [
{
- "owner": "thuva4",
+ "creator": "thuva4",
"_id": "5a0c022f9a07c846d3c2cc94",
"creation_date": "2017-11-15 14:30:31.200259",
"description": "dsfsd",
@@ -28,13 +28,13 @@ describe('testing the Projects Link for anonymous user', function () {
]);
});
- afterEach(function(){
- mock.teardown();
- });
+ afterEach(function(){
+ mock.teardown();
+ });
- it( 'should show the Projects Link for anonymous user', function() {
+ it( 'should show the Projects Link for anonymous user', function() {
mock.teardown();
- browser.get(baseURL);
+ browser.get(baseURL);
var projectslink = element(by.linkText('Projects'));
expect(projectslink.isPresent()).toBe(true);
});
@@ -51,16 +51,22 @@ describe('testing the Projects Link for anonymous user', function () {
expect(buttonCreate.isDisplayed()).toBeFalsy();
});
- it('Show projects list when user comes to the projects page', function () {
- var firstBookName = element(by.repeater('(index, project) in ctrl.data.projects').
- row(0).column('{{project.name}}'));
- expect(firstBookName).toBeDefined();
+ it('Delete button is not visible for anonymous user ', function () {
+ browser.get(baseURL+'#/projects');
+ var buttonCreate = element(by.buttonText('Create'));
+ expect(buttonCreate.isDisplayed()).toBeFalsy();
});
- 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('Show projects list when anonymous user comes to the projects page', function () {
+ var row = element.all(by.repeater('(index, project) in ctrl.data.projects')).first();
+ var cells = row.all(by.tagName('td'));
+ expect(cells.get(1).getText()).toContain("testproject");
+ });
+
+ it('delete Operation is not visible for anonymous user ', function () {
+ browser.get(baseURL+'#/projects');
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ expect(deleteOperation.isDisplayed()).toBeFalsy();
});
});
@@ -70,6 +76,26 @@ describe('testing the Project Link for user who is not in submitter group', func
mock([
{
request: {
+ path: '/api/v1/projects',
+ method: 'GET',
+ queryString: {
+ name: 'test'
+ }
+ },
+ response: {
+ data: {
+ "projects": [
+ {
+ "_id": "5a0c1c9a9a07c846d3a7247b",
+ "creation_date": "2017-11-15 16:23:14.217093",
+ "description": "sdgfd",
+ "name": "test"
+ }]
+ }
+ }
+ },
+ {
+ request: {
path: '/api/v1/profile',
method: 'GET'
},
@@ -80,13 +106,32 @@ describe('testing the Project Link for user who is not in submitter group', func
"email": "testuser@test.com"
}
}
+ },
+ {
+ 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"
+ }
+ ]
+ }
+ }
}
]);
});
afterEach(function(){
- mock.teardown();
- });
+ mock.teardown();
+ });
it( 'should show the Project Link for user', function() {
browser.get(baseURL);
@@ -106,6 +151,28 @@ describe('testing the Project Link for user who is not in submitter group', func
var buttonCreate = element(by.buttonText('Create'));
expect(buttonCreate.isDisplayed()).toBeFalsy();
});
+
+ it('Delete button is not visible for user ', function () {
+ browser.get(baseURL+'#/projects');
+ var buttonDelete = element(by.buttonText('Delete'));
+ expect(buttonDelete.isDisplayed()).toBeFalsy();
+ });
+
+ it('delete Operation is not visible for user ', function () {
+ browser.get(baseURL+'#/projects');
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ expect(deleteOperation.isDisplayed()).toBeFalsy();
+ });
+
+ it('Show relevant results to the filter', function () {
+ var filter = element(by.model('ctrl.filterText'));
+ filter.sendKeys('test');
+ var buttonFilter = element(by.buttonText('Filter'));
+ buttonFilter.click()
+ var row = element.all(by.repeater('(index, project) in ctrl.data.projects')).first();
+ var cells = row.all(by.tagName('td'));
+ expect(cells.get(1).getText()).toContain("test");
+ });
})
describe('testing the Project Link for user who is in submitter group', function () {
@@ -139,6 +206,28 @@ describe('testing the Project Link for user who is in submitter group', function
},
{
request: {
+ path: '/api/v1/projects/vsfv',
+ method: 'DELETE'
+ },
+ response: {
+ data: {
+ href: baseURL+"/api/v1/projects/testProject1"
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/projects/vsfv',
+ method: 'PUT'
+ },
+ response: {
+ data: {
+ href: baseURL+"/api/v1/projects/testProject1"
+ }
+ }
+ },
+ {
+ request: {
path: '/api/v1/projects',
method: 'POST',
data: {
@@ -163,13 +252,30 @@ describe('testing the Project Link for user who is in submitter group', function
status : 403,
data : 'You do not have permission to perform this action'
}
+ },
+ {
+ request: {
+ path: '/api/v1/projects',
+ method: 'GET'
+ },
+ response: {
+ data : {
+ "projects": [
+ {
+ "_id": "5a0c1c9a9a07c846d3a7247b",
+ "creation_date": "2017-11-15 16:23:14.217093",
+ "description": "sdgfd",
+ "name": "vsfv"
+ }]
+ }
+ }
}
]);
});
afterEach(function(){
- mock.teardown();
- });
+ mock.teardown();
+ });
it( 'should show the Project Link for user', function() {
browser.get(baseURL);
@@ -190,58 +296,121 @@ describe('testing the Project Link for user who is in submitter group', function
expect(buttonCreate.isDisplayed()).toBe(true);
});
- it('Show error when user click the create button with a empty name', function () {
- browser.get(baseURL+ '/#/projects');
- var description = element(by.model('ctrl.description'));
- description.sendKeys('DemoDescription');
- var buttonCreate = element(by.buttonText('Create'));
- buttonCreate.click();
- expect(element(by.cssContainingText(".alert","Name is missing."))
+ it('Delete button is visible for user ', function () {
+ browser.get(baseURL+'#/projects');
+ var buttonDelete = element(by.buttonText('Delete'));
+ expect(buttonDelete.isDisplayed()).toBe(true);
+ });
+
+ 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);
+ });
+
+ it('Edit Operation is visible for user ', function () {
+ browser.get(baseURL+'#/projects');
+ var editOperation = element(by.css('a[title=Edit]'));
+ expect(editOperation.isDisplayed()).toBe(true);
+ });
+
+ it('Create the Project', function () {
+ browser.get(baseURL+"#/projects");
+ var buttonCreate = element(by.buttonText('Create'));
+ buttonCreate.click();
+ var name = element(by.model('ProjectModalCtrl.project.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ name.sendKeys('testproject');
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Project is successfully created."))
.isDisplayed()).toBe(true);
- });
-
- it('Show error when user click the create button with an already existing name', function () {
- browser.get(baseURL+ '/#/projects');
- var name = element(by.model('ctrl.name'));
- var details = element(by.model('ctrl.description'));
- name.sendKeys('testProject2');
- details.sendKeys('demoDescription');
- var buttonCreate = element(by.buttonText('Create'));
- buttonCreate.click();
- expect(element(by.cssContainingText(".alert",
- "Error creating the new Project from server:undefined"))
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
+ });
+
+ it('Show error if user doesnt have permission to Create the Project', function () {
+ browser.get(baseURL+"#/projects");
+ var buttonCreate = element(by.buttonText('Create'));
+ buttonCreate.click();
+ var name = element(by.model('ProjectModalCtrl.project.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ var description = element(by.model('ProjectModalCtrl.project.description'));
+ name.sendKeys('testProject2');
+ description.sendKeys('demoDescription');
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ 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 () {
+ browser.get(baseURL+"#/projects");
+ var buttonCreate = element(by.buttonText('Create'));
+ buttonCreate.click();
+ var name = element(by.model('ProjectModalCtrl.project.name'));
+ var EC = browser.ExpectedConditions;
+ 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 try to create a project which he is not belonged to ', function () {
- browser.get(baseURL+ '/#/projects');
- var name = element(by.model('ctrl.name'));
- var details = element(by.model('ctrl.description'));
- name.sendKeys('testProject3');
- details.sendKeys('demoDescription');
- var buttonCreate = element(by.buttonText('Create'));
+ it('Show error when user click the create button with an already existing name', function () {
+ browser.get(baseURL+"#/projects");
+ var buttonCreate = element(by.buttonText('Create'));
buttonCreate.click();
- expect(element(by.cssContainingText(".alert",
- 'Error creating the new Project from server:"You do not have permission to perform this action"')).isDisplayed())
- .toBe(true);
+ var name = element(by.model('ProjectModalCtrl.project.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ var description = element(by.model('ProjectModalCtrl.project.description'));
+ name.sendKeys('testProject3');
+ description.sendKeys('demoDescription');
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ 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 () {
+ browser.get(baseURL+"#/projects");
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ deleteOperation.click();
+ var buttonCancel = element(by.buttonText('Cancel'));
+ buttonCancel.click();
+ expect(buttonCancel.isPresent()).toBe(false);
});
- it('Do not show error if input is acceptable', function () {
- var name = element(by.model('ctrl.name'));
- var details = element(by.model('ctrl.description'));
- name.sendKeys('testProject1');
- details.sendKeys('demoDescription');
- var buttonCreate = element(by.buttonText('Create'));
- buttonCreate.click().then(function(){
- expect(element(by.cssContainingText(".alert",
- "Create Success"))
- .isDisplayed()).toBe(true);
- });
+ it('Delete the projects ', 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();
+ 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(){
- mock.teardown();
- mock([
+ it(' Show error if user doesnt has permission to delete the projects ', function () {
+ mock.teardown();
+ mock([
{
request: {
path: '/api/v1/profile',
@@ -256,16 +425,185 @@ describe('testing the Project Link for user who is in submitter group', function
"email": "testuser@test.com"
}
}
+ },
+ {
+ request: {
+ path: '/api/v1/projects/testproject3',
+ method: 'DELETE'
+ },
+ response: {
+ status: 403
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/projects',
+ method: 'GET'
+ },
+ response: {
+ data : {
+ "projects": [
+ {
+ "_id": "5a0c1c9a9a07c846d3a7247b",
+ "creation_date": "2017-11-15 16:23:14.217093",
+ "description": "sdgfd",
+ "name": "testproject3"
+ }]
+ }
+ }
}
- ]);
- browser.get(baseURL+ '/#/projects');
- var name = element(by.model('ctrl.name'));
- var details = element(by.model('ctrl.description'));
- name.sendKeys('testProject1');
- details.sendKeys('demoDescription');
- var buttonCreate = element(by.buttonText('Create'));
- buttonCreate.click().then(function(){
- expect(element(by.css(".alert.alert-danger")).isDisplayed()).toBe(true);
- });
- });
+ ]);
+ browser.get(baseURL+"#/projects");
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ deleteOperation.click();
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ 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 () {
+ browser.get(baseURL+"#/projects");
+ var editOperation = element(by.css('a[title=Edit]'));
+ editOperation.click();
+ var name = element(by.model('ProjectModalCtrl.project.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ name.sendKeys('test1');
+ var buttonCancel = element(by.buttonText('Cancel'));
+ buttonCancel.click();
+ expect(name.isPresent()).toBe(false);
+ });
+
+ it('Edit the Project ', function () {
+ browser.get(baseURL+"#/projects");
+ var editOperation = element(by.css('a[title=Edit]'));
+ editOperation.click();
+ var name = element(by.model('ProjectModalCtrl.project.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ name.sendKeys('test1');
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click()
+ 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 () {
+ mock.teardown();
+ mock([
+ {
+ request: {
+ path: '/api/v1/profile',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
+ "user": "testUser", "groups": ["opnfv-testapi-users",
+ "opnfv-gerrit-testProject1-submitters",
+ "opnfv-gerrit-testProject2-submitters" ],
+ "email": "testuser@test.com"
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/projects/testproject3',
+ method: 'PUT'
+ },
+ response: {
+ status: 403
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/projects',
+ method: 'GET'
+ },
+ response: {
+ data : {
+ "projects": [
+ {
+ "_id": "5a0c1c9a9a07c846d3a7247b",
+ "creation_date": "2017-11-15 16:23:14.217093",
+ "description": "sdgfd",
+ "name": "testproject3"
+ }]
+ }
+ }
+ }
+ ]);
+ browser.get(baseURL+"#/projects");
+ var editOperation = element(by.css('a[title=Edit]'));
+ editOperation.click();
+ var name = element(by.model('ProjectModalCtrl.project.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ name.sendKeys('test1');
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click()
+ browser.ignoreSynchronization = true;
+ expect(element(by.css(".error")).isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
+ });
+
+ it('Batch Delete the projects ', function () {
+ browser.get(baseURL+"#/projects");
+ var checkBox = element(by.model('ctrl.checkBox[index]'));
+ checkBox.click();
+ var buttonDelete = element(by.buttonText('Delete'));;
+ buttonDelete.click();
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ 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(){
+ mock.teardown();
+ mock([
+ {
+ request: {
+ path: '/api/v1/profile',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
+ "user": "testUser", "groups": ["opnfv-testapi-users",
+ "opnfv-gerrit-testProject1-submitters",
+ "opnfv-gerrit-testProject2-submitters" ],
+ "email": "testuser@test.com"
+ }
+ }
+ }
+ ]);
+ browser.get(baseURL+"#/projects");
+ var buttonCreate = element(by.buttonText('Create'));
+ buttonCreate.click();
+ var name = element(by.model('ProjectModalCtrl.project.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ var details = element(by.model('ProjectModalCtrl.project.description'));
+ name.sendKeys('testproject');
+ details.sendKeys('demoDescription');
+ var buttonOK = element(by.buttonText('Ok'));
+ 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 a14f8ea..48690a1 100644
--- a/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js
+++ b/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js
@@ -30,7 +30,6 @@ describe('testing the result page for anonymous user', function () {
"user": null,
"installer": "fuel",
"scenario": "test-scenario",
- "trust_indicator": null,
"public": "true",
"version": "euphrates",
"details": "",
@@ -45,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: {
@@ -66,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",
@@ -87,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: {
@@ -105,11 +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",
- "trust_indicator": null,
"public": "true",
- "version": "euphrates",
+ "version": "testversion",
"details": "",
"criteria": "PASS",
"_id": "5a45170bbb2092000e2643f6",
@@ -119,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"}
+ ]
+ }
+ }
+ }
]);
});
@@ -127,47 +172,58 @@ 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);
});
- it( 'navigate anonymous user to testCase page', function() {
+ it( 'navigate anonymous user to results page', function() {
browser.get(baseURL);
var resultLink = element(by.linkText('Results')).click();
var EC = browser.ExpectedConditions;
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("5a45170bbb2092000e2643f4");
+ expect(cells.get(0).getText()).toContain("0e2643f4");
+ });
+
+ 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 for anonymous user ', function () {
+ 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("5a45170bbb2092000e2643f5");
- filter.sendKeys('case');
- filterText.sendKeys('testcase')
+ expect(cells.get(0).getText()).toContain("0e2643f5");
+ filter.sendKeys('version');
+ filterText.sendKeys('testversion')
buttonFilter.click();
- expect(cells.get(0).getText()).toContain("5a45170bbb2092000e2643f6");
+ expect(cells.get(0).getText()).toContain("0e2643f6");
});
it('Should not show the results in results page related to the filters 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'))
@@ -235,7 +291,7 @@ describe('testing the result page for user', function () {
method: 'GET',
queryString: {
page: '1',
- project: 'testproject'
+ installer: 'testinstaller'
}
},
response: {
@@ -252,9 +308,8 @@ 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",
"details": "",
@@ -273,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: {
@@ -291,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",
@@ -305,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"}
+ ]
+ }
+ }
+ }
]);
});
@@ -329,31 +402,49 @@ describe('testing the result page for user', 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("5a45170bbb2092000e2643f4");
+ expect(cells.get(0).getText()).toContain("0e2643f4");
});
it('Should show the results in results page related to the filters 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("5a45170bbb2092000e2643f5");
- filter.sendKeys('case');
- filterText.sendKeys('testcase')
+ expect(cells.get(0).getText()).toContain("0e2643f5");
+ filter.sendKeys('version');
+ filterText.sendKeys('testversion')
buttonFilter.click();
- expect(cells.get(0).getText()).toContain("5a45170bbb2092000e2643f6");
+ expect(cells.get(0).getText()).toContain("0e2643f6");
+ });
+
+ it('Clear the filter', function () {
+ browser.get(baseURL+"#/results");
+ var filter = element(by.model('ctrl.filter'));
+ var filterText = element(by.model('ctrl.filterText'));
+ 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");
+ var buttonClear = element(by.buttonText('Clear'));
+ buttonClear.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("0e2643f4");
});
it('Should not show the results in results page related to the filters 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
new file mode 100644
index 0000000..37b42dc
--- /dev/null
+++ b/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js
@@ -0,0 +1,1108 @@
+'use strict';
+
+var mock = require('protractor-http-mock');
+var baseURL = "http://localhost:8000/"
+
+describe('testing the scenarios page for anonymous user', function () {
+ beforeEach(function(){
+ mock([
+ {
+ request: {
+ path: '/api/v1/scenarios',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "scenarios": [
+ {
+ "installers": [
+ {
+ "installer": "fuel",
+ "versions": [
+ {
+ "owner": "testUser",
+ "version": "colorado",
+ "projects": [
+ {
+ "project": "yardstick",
+ "customs": [
+ "dvs"
+ ],
+ "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"
+ },
+ {
+ "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": [
+ {
+ "date": "2016-12-09 11:38",
+ "status": "silver"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "_id": "5a50fcacsdgdsgdasgfvb861c",
+ "name": "test-scenario",
+ "creation_date": "2018-01-06 22:13:24.160407"
+ }
+ ]
+ }
+ }
+ }
+ ]);
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it( 'should show the scenarios page for anonymous user', function() {
+ browser.get(baseURL+"#/scenarios");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios'), 10000);
+ 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("test-scenario");
+ var scenarioLink = element(by.linkText('test-scenario')).click();
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
+ });
+
+ it( 'should not show the add installer option 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[5]/td[2]/div[2]/button'))
+ expect(buttonAdd.isDisplayed()).toBe(false);
+ });
+
+ it( 'Expand installers by anonymous user', function() {
+ browser.get(baseURL+"#/scenarios/test-scenario");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a'))
+ installerShow.click();
+ var row = element.all(by.repeater('(indexI, installer) in ctrl.data.scenarios[0].installers')).first();
+ var cells = row.all(by.tagName('td'));
+ expect(cells.get(1).getText()).toContain("fuel");
+ });
+
+ it( 'should not show the delete installer option 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[5]/td[2]/div[1]/a'))
+ 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'))
+ expect(installerDelete.isDisplayed()).toBe(false);
+ });
+
+ it( 'Expand installer by 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[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[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[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
+ expect(versionsShow.isDisplayed()).toBe(true)
+ });
+
+ it( 'Expand versions by 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[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[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[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[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ expect(versionShow.isDisplayed()).toBe(true);
+ });
+
+ it( 'Expand version by 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[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[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[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[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[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a'))
+ expect(projectsShow.isDisplayed()).toBe(true);
+ });
+
+ it( 'Expand projects by 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[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[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[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[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[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[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'))
+ expect(projectShow.isDisplayed()).toBe(true)
+ });
+
+ it( 'Expand project by 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[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[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[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[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[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[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[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[4]/td[2]/a/p'))
+ expect(customsShow.isDisplayed()).toBe(true)
+ var trustIndicatorsShow = 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[2]/td[2]/a/p'))
+ expect(trustIndicatorsShow.isDisplayed()).toBe(true)
+ var scoresShow = 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[3]/td[2]/a/p'))
+ expect(scoresShow.isDisplayed()).toBe(true)
+ });
+
+});
+
+
+describe('testing the scenarios page for user', function () {
+ beforeEach(function(){
+ mock([
+ {
+ request: {
+ path: '/api/v1/scenarios',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "scenarios": [
+ {
+ "installers": [
+ {
+ "installer": "fuel",
+ "versions": [
+ {
+ "owner": "testUser",
+ "version": "colorado",
+ "projects": [
+ {
+ "project": "yardstick",
+ "customs": [
+ "dvs"
+ ],
+ "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"
+ },
+ {
+ "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": [
+ {
+ "date": "2016-12-09 11:38",
+ "status": "silver"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "_id": "5a50fcacsdgdsgdasgfvb861c",
+ "name": "test-scenario",
+ "creation_date": "2018-01-06 22:13:24.160407"
+ }
+ ]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/profile',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
+ "user": "testUser", "groups": ["opnfv-testapi-users"],
+ "email": "testuser@test.com"
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/scenarios/test-scenario/installers',
+ method: 'POST'
+ },
+ response: {
+ status : 200
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/scenarios/test-scenario/installers',
+ method: 'DELETE'
+ },
+ response: {
+ status : 200
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/scenarios/test-scenario/versions',
+ method: 'POST',
+ queryString: {
+ installer: 'fuel'
+ }
+ },
+ response: {
+ status : 200
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/scenarios/test-scenario/versions',
+ method: 'DELETE',
+ queryString: {
+ installer: 'fuel'
+ }
+ },
+ response: {
+ status : 200
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/scenarios/test-scenario/projects',
+ method: 'POST',
+ queryString: {
+ installer: 'fuel',
+ version: 'colorado'
+ }
+ },
+ response: {
+ status : 200
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/scenarios/test-scenario/projects',
+ method: 'DELETE',
+ queryString: {
+ installer: 'fuel',
+ version: 'colorado'
+ }
+ },
+ response: {
+ status : 200
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/scenarios/test-scenario/customs',
+ method: 'POST',
+ queryString: {
+ installer: 'fuel',
+ version: 'colorado',
+ project: 'yardstick'
+ }
+ },
+ response: {
+ status : 200
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/scenarios/test-scenario/customs',
+ method: 'DELETE',
+ queryString: {
+ installer: 'fuel',
+ version: 'colorado',
+ project: 'yardstick'
+ }
+ },
+ response: {
+ status : 200
+ }
+ }
+ ]);
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it( 'should show the scenarios page for user', function() {
+ browser.get(baseURL+"#/scenarios");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios'), 10000);
+ 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("test-scenario");
+ var scenarioLink = element(by.linkText('test-scenario')).click();
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
+ });
+
+ it( 'should show the add installer option for 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[5]/td[2]/div[2]/button'))
+ expect(buttonAdd.isDisplayed()).toBe(true);
+ });
+
+ it('add installer', 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[5]/td[2]/div[2]/button'))
+ buttonAdd.click();
+ var name = element(by.model('installerModalCtrl.installer.installer'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ name.sendKeys('test');
+ var buttonOk = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[2]/button[1]'))
+ buttonOk.click()
+ browser.ignoreSynchronization = true;
+ expect(element(by.cssContainingText(".success.show","Installers are successfully updated."))
+ .isDisplayed()).toBe(true);
+ browser.sleep(500);
+ browser.ignoreSynchronization = false;
+
+ });
+
+ it( 'Expand installers by user', function() {
+ browser.get(baseURL+"#/scenarios/test-scenario");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
+ var installerShow = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[1]/a/p'))
+ installerShow.click();
+ var row = element.all(by.repeater('(indexI, installer) in ctrl.data.scenarios[0].installers')).first();
+ var cells = row.all(by.tagName('td'));
+ expect(cells.get(1).getText()).toContain("fuel");
+ });
+
+ it( 'should show the delete installer option for 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[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[5]/td[2]/div[3]/div/table/tbody/tr[1]/td[3]/button'))
+ expect(installerDelete.isDisplayed()).toBe(true);
+ });
+
+ it( 'delete installer', 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[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[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();
+ 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() {
+ 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[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[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[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p'))
+ expect(versionsShow.isDisplayed()).toBe(true)
+ });
+
+ it( 'add version for an installer', 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[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[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[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[2]/button'))
+ versionAdd.click()
+ var version = element(by.model('versionModalCtrl.version.version'));
+ browser.wait(EC.visibilityOf(version), 5000);
+ version.sendKeys('testV');
+ var owner = element(by.model('versionModalCtrl.version.owner'));
+ owner.sendKeys('testOwner');
+ var buttonOk = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[2]/button[1]'))
+ buttonOk.click()
+ 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() {
+ 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[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[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[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[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a'))
+ expect(versionShow.isDisplayed()).toBe(true);
+ var installerAdd = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[2]/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(installerAdd.isDisplayed()).toBe(false);
+ expect(installerDelete.isDisplayed()).toBe(false)
+ });
+
+ it( 'delete version', 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[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[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[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[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[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();
+ 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() {
+ 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[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[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[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[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[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a'))
+ expect(projectsShow.isDisplayed()).toBe(true);
+ });
+
+ it( 'add project', 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[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[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[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[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[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()
+ var project = element(by.model('projectModalCtrl.project.project'));
+ browser.wait(EC.visibilityOf(project), 5000);
+ project.sendKeys('testP');
+ var buttonOk = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[2]/button[1]'))
+ buttonOk.click()
+ 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() {
+ 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[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[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[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[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[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[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'))
+ expect(projectShow.isDisplayed()).toBe(true)
+ 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'))
+ 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/tr[1]/td[3]/button'))
+ expect(versionAdd.isDisplayed()).toBe(false)
+ expect(versionDelete.isDisplayed()).toBe(false)
+ });
+
+ it( 'delete project', 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[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[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[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[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[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[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();
+ 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() {
+ 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[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[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[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[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[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[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[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[4]/td[2]/a/p'))
+ expect(customsShow.isDisplayed()).toBe(true)
+ var trustIndicatorsShow = 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[2]/td[2]/a/p'))
+ expect(trustIndicatorsShow.isDisplayed()).toBe(true)
+ var scoresShow = 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[3]/td[2]/a/p'))
+ expect(scoresShow.isDisplayed()).toBe(true)
+ });
+
+ it( 'Expand trust indicator by 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[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[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[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[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[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[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 trustIndicatorsShow = 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[2]/td[2]/a/p'))
+ trustIndicatorsShow.click();
+ var row = element.all(by.repeater('(indexTI, trust_indicator) in project.trust_indicators')).first();
+ var cells = row.all(by.tagName('td'));
+ expect(cells.get(1).getText()).toContain("silver");
+ });
+
+ it( 'Expand score by 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[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[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[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[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[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[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 scoresShow = 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[3]/td[2]/a/p'))
+ scoresShow.click();
+ var row = element.all(by.repeater('(indexSC, score) in project.scores')).first();
+ var cells = row.all(by.tagName('td'));
+ expect(cells.get(1).getText()).toContain("14/24");
+ });
+
+ it( 'Expand Customs by 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[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[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[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[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[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[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[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 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'))
+ 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'))
+ expect(projectDelete.isDisplayed()).toBe(false)
+ expect(projectAdd.isDisplayed()).toBe(false)
+ 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'))
+ 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'))
+ expect(buttonAdd.isDisplayed()).toBe(true)
+ expect(buttonDelete.isDisplayed()).toBe(true)
+ });
+
+ it( 'Add Customs by 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[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[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[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[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[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[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[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[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()
+ var custom = element(by.model('customModalCtrl.custom'));
+ browser.wait(EC.visibilityOf(custom), 5000);
+ custom.sendKeys('testC');
+ var buttonOk = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[2]/button[1]'))
+ buttonOk.click()
+ 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() {
+ 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[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[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[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[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[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[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[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[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()
+ var custom = element(by.model('customModalCtrl.custom'));
+ browser.wait(EC.visibilityOf(custom), 5000);
+ custom.sendKeys('testC,testD,');
+ var buttonOk = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[2]/button[1]'))
+ buttonOk.click()
+ 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() {
+ 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[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[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[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[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[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[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[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[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()
+ 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
new file mode 100644
index 0000000..55922ad
--- /dev/null
+++ b/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js
@@ -0,0 +1,500 @@
+'use strict';
+
+var mock = require('protractor-http-mock');
+var baseURL = "http://localhost:8000/"
+
+describe('testing the scenarios page for anonymous user', function () {
+ beforeEach(function(){
+ mock([
+ {
+ request: {
+ path: '/api/v1/scenarios',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "scenarios": [
+ {
+ "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": "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"
+ }
+ ]
+ }
+ }
+ }
+ ]);
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it( 'should show the scenarios page for anonymous user', function() {
+ browser.get(baseURL+"#/scenarios");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios'), 10000);
+ });
+
+ it( 'navigate anonymous user to scenarios page', function() {
+ browser.get(baseURL);
+ var resultLink = element(by.linkText('Scenarios')).click();
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios'), 10000);
+ });
+
+ it('Should show the scenarios in scenarios page for anonymous user ', function () {
+ browser.get(baseURL+"#/scenarios");
+ 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("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'));
+ expect(buttonCreate.isDisplayed()).toBeFalsy();
+ });
+ it('delete button is not visible for anonymous user ', function () {
+ browser.get(baseURL+'#/scenarios');
+ var buttonCreate = element(by.buttonText('Delete'));
+ expect(buttonCreate.isDisplayed()).toBeFalsy();
+ });
+
+});
+
+describe('testing the scenarios page for user', function () {
+ beforeEach(function(){
+ mock([
+ {
+ request: {
+ path: '/api/v1/scenarios',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "scenarios": [
+ {
+ "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": "5a50fcacsdgdsgdasgfvb861c",
+ "name": "test-scenario",
+ "creation_date": "2018-01-06 22:13:24.160407"
+ }
+ ]
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/profile',
+ method: 'GET'
+ },
+ response: {
+ data: {
+ "fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
+ "user": "testUser", "groups": ["opnfv-testapi-users"],
+ "email": "testuser@test.com"
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/scenarios',
+ method: 'POST'
+ },
+ response: {
+ data: {
+ href: baseURL+"/api/v1/scenarios/testScenario"
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/scenarios/test-scenario',
+ method: 'DELETE'
+ },
+ response: {
+ data: {
+ href: baseURL+"/api/v1/scenarios/testScenario"
+ }
+ }
+ },
+ {
+ request: {
+ path: '/api/v1/scenarios/test-scenario',
+ method: 'PUT'
+ },
+ response: {
+ data: {
+ href: baseURL+"/api/v1/scenarios/testScenario"
+ }
+ }
+ }
+ ]);
+ });
+
+ afterEach(function(){
+ mock.teardown();
+ });
+
+ it( 'should show the scenarios page for user', function() {
+ browser.get(baseURL+"#/scenarios");
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios'), 10000);
+ });
+
+ it( 'navigate user to scenarios page', function() {
+ browser.get(baseURL);
+ var resultLink = element(by.linkText('Scenarios')).click();
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios'), 10000);
+ });
+
+ it('Should show the scenarios in scenarios page for user ', function () {
+ browser.get(baseURL+"#/scenarios");
+ 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("test-scenario");
+ });
+
+ 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 visible for user ', function () {
+ browser.get(baseURL+'#/scenarios');
+ var buttonDelete = element(by.buttonText('Delete'));
+ expect(buttonDelete.isDisplayed()).toBe(true);
+ });
+
+ it('craete scenarrio by user without installers ', function () {
+ browser.get(baseURL+'#/scenarios');
+ var buttonCreate = element(by.buttonText('Create')).click();
+ var name = element(by.model('scenarioModalController.scenario.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ name.sendKeys('test');
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ 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 () {
+ browser.get(baseURL+'#/scenarios');
+ var buttonCreate = element(by.buttonText('Create')).click();
+ var name = element(by.model('scenarioModalController.scenario.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ name.sendKeys('test');
+ var buttonInstaller = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[1]/div[1]/fieldset/div/div/div[2]/div[2]/button'))
+ buttonInstaller.click();
+ var installer = element(by.model('installerModalCtrl.installer.installer'));
+ browser.wait(EC.visibilityOf(installer), 5000);
+ installer.sendKeys('testI');
+ var buttonOK = element(by.xpath('//*[@id="ng-app"]/body/div[4]/div/div/div/div[2]/button[1]'));
+ buttonOK.click();
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ 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 () {
+ browser.get(baseURL+'#/scenarios');
+ var buttonCreate = element(by.buttonText('Create')).click();
+ var name = element(by.model('scenarioModalController.scenario.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ name.sendKeys('test');
+ var buttonInstaller = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[1]/div[1]/fieldset/div/div/div[2]/div[2]/button'))
+ buttonInstaller.click();
+ var installer = element(by.model('installerModalCtrl.installer.installer'));
+ browser.wait(EC.visibilityOf(installer), 5000);
+ installer.sendKeys('testI');
+ var buttonVersion = element(by.xpath('//*[@id="ng-app"]/body/div[4]/div/div/div/div[1]/div[1]/fieldset/div/div/div[2]/div[2]/button'))
+ buttonVersion.click();
+ var version = element(by.model('versionModalCtrl.version.version'));
+ browser.wait(EC.visibilityOf(version), 5000);
+ version.sendKeys('testV');
+ var owner = element(by.model('versionModalCtrl.version.owner'));
+ owner.sendKeys('testOwner');
+ var buttonOK = element(by.xpath('//*[@id="ng-app"]/body/div[5]/div/div/div/div[2]/button[1]'));
+ buttonOK.click();
+ var buttonOK = element(by.xpath('//*[@id="ng-app"]/body/div[4]/div/div/div/div[2]/button[1]'));
+ buttonOK.click();
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ 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 () {
+ browser.get(baseURL+'#/scenarios');
+ var buttonCreate = element(by.buttonText('Create')).click();
+ var name = element(by.model('scenarioModalController.scenario.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ name.sendKeys('test');
+ var buttonInstaller = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[1]/div[1]/fieldset/div/div/div[2]/div[2]/button'))
+ buttonInstaller.click();
+ var installer = element(by.model('installerModalCtrl.installer.installer'));
+ browser.wait(EC.visibilityOf(installer), 5000);
+ installer.sendKeys('testI');
+ var buttonVersion = element(by.xpath('//*[@id="ng-app"]/body/div[4]/div/div/div/div[1]/div[1]/fieldset/div/div/div[2]/div[2]/button'))
+ buttonVersion.click();
+ var version = element(by.model('versionModalCtrl.version.version'));
+ browser.wait(EC.visibilityOf(version), 5000);
+ version.sendKeys('testV');
+ var owner = element(by.model('versionModalCtrl.version.owner'));
+ owner.sendKeys('testOwner');
+ var buttonProject = element(by.xpath('//*[@id="ng-app"]/body/div[5]/div/div/div/div[1]/div[1]/fieldset/div/div/div[3]/div[2]/button'))
+ buttonProject.click();
+ var project = element(by.model('projectModalCtrl.project.project'));
+ browser.wait(EC.visibilityOf(project), 5000);
+ project.sendKeys('testP');
+ var buttonOK = element(by.xpath('//*[@id="ng-app"]/body/div[6]/div/div/div/div[2]/button[1]'));
+ buttonOK.click();
+ var buttonOK = element(by.xpath('//*[@id="ng-app"]/body/div[5]/div/div/div/div[2]/button[1]'));
+ buttonOK.click();
+ var buttonOK = element(by.xpath('//*[@id="ng-app"]/body/div[4]/div/div/div/div[2]/button[1]'));
+ buttonOK.click();
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ 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 () {
+ browser.get(baseURL+'#/scenarios');
+ var buttonCreate = element(by.buttonText('Create')).click();
+ var name = element(by.model('scenarioModalController.scenario.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ name.sendKeys('test');
+ var buttonInstaller = element(by.xpath('//*[@id="ng-app"]/body/div[3]/div/div/div/div[1]/div[1]/fieldset/div/div/div[2]/div[2]/button'))
+ buttonInstaller.click();
+ var installer = element(by.model('installerModalCtrl.installer.installer'));
+ browser.wait(EC.visibilityOf(installer), 5000);
+ installer.sendKeys('testI');
+ var buttonVersion = element(by.xpath('//*[@id="ng-app"]/body/div[4]/div/div/div/div[1]/div[1]/fieldset/div/div/div[2]/div[2]/button'))
+ buttonVersion.click();
+ var version = element(by.model('versionModalCtrl.version.version'));
+ browser.wait(EC.visibilityOf(version), 5000);
+ version.sendKeys('testV');
+ var owner = element(by.model('versionModalCtrl.version.owner'));
+ owner.sendKeys('testOwner');
+ var buttonProject = element(by.xpath('//*[@id="ng-app"]/body/div[5]/div/div/div/div[1]/div[1]/fieldset/div/div/div[3]/div[2]/button'))
+ buttonProject.click();
+ var project = element(by.model('projectModalCtrl.project.project'));
+ browser.wait(EC.visibilityOf(project), 5000);
+ project.sendKeys('testP');
+ var buttonCustom = element(by.xpath('//*[@id="ng-app"]/body/div[6]/div/div/div/div[1]/div[1]/fieldset/div/div/div[2]/div[2]/button'))
+ buttonCustom.click();
+ var custom = element(by.model('customModalCtrl.custom'));
+ browser.wait(EC.visibilityOf(custom), 5000);
+ custom.sendKeys('testC');
+ var buttonOK = element(by.xpath('//*[@id="ng-app"]/body/div[7]/div/div/div/div[2]/button[1]'));
+ buttonOK.click();
+ var buttonOK = element(by.xpath('//*[@id="ng-app"]/body/div[6]/div/div/div/div[2]/button[1]'));
+ buttonOK.click();
+ var buttonOK = element(by.xpath('//*[@id="ng-app"]/body/div[5]/div/div/div/div[2]/button[1]'));
+ buttonOK.click();
+ var buttonOK = element(by.xpath('//*[@id="ng-app"]/body/div[4]/div/div/div/div[2]/button[1]'));
+ buttonOK.click();
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ 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 () {
+ browser.get(baseURL+'#/scenarios');
+ var scenarioLink = element(by.linkText('test-scenario')).click();
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains(baseURL+ '#/scenarios/test-scenario'), 10000);
+ });
+
+ it('delete Operation is visible for user ', function () {
+ browser.get(baseURL+'#/scenarios');
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ expect(deleteOperation.isDisplayed()).toBe(true);
+ });
+
+ it('edit Operation is visible for user ', function () {
+ browser.get(baseURL+'#/scenarios');
+ var deleteOperation = element(by.css('a[title=Edit]'));
+ expect(deleteOperation.isDisplayed()).toBe(true);
+ });
+
+ it('Delete the Scenario ', 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();
+ 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 () {
+ browser.get(baseURL+'#/scenarios');
+ var checkBox = element(by.model('ctrl.checkBox[index]'));
+ checkBox.click();
+ var buttonDelete = element(by.buttonText('Delete'));;
+ buttonDelete.click();
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ 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 () {
+ browser.get(baseURL+'#/scenarios');
+ var editOperation = element(by.css('a[title=Edit]'));
+ editOperation.click();
+ var name = element(by.model('ScenarioNameUpdateCtrl.name'));
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.visibilityOf(name), 5000);
+ name.sendKeys('test2');
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click()
+ 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 d509c57..38e0f24 100644
--- a/testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js
+++ b/testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js
@@ -15,7 +15,7 @@ describe('testing the testCases page for anonymous user', function () {
data: {
"projects": [
{
- "owner": "thuva4",
+ "creator": "thuva4",
"_id": "5a0c022f9a07c846d3c2cc94",
"creation_date": "2017-11-15 14:30:31.200259",
"description": "dsfsd",
@@ -32,7 +32,7 @@ describe('testing the testCases page for anonymous user', function () {
},
response: {
data: {
- "owner": "thuva4",
+ "creator": "thuva4",
"_id": "5a0c022f9a07c846d3c2cc94",
"creation_date": "2017-11-15 14:30:31.200259",
"description": "dsfsd",
@@ -182,7 +182,7 @@ describe('testing the testcaese page for user who is not in submitter group', fu
data: {
"projects": [
{
- "owner": "thuva4",
+ "creator": "thuva4",
"_id": "5a0c022f9a07c846d3c2cc94",
"creation_date": "2017-11-15 14:30:31.200259",
"description": "dsfsd",
@@ -199,7 +199,7 @@ describe('testing the testcaese page for user who is not in submitter group', fu
},
response: {
data: {
- "owner": "thuva4",
+ "creator": "thuva4",
"_id": "5a0c022f9a07c846d3c2cc94",
"creation_date": "2017-11-15 14:30:31.200259",
"description": "dsfsd",
@@ -397,7 +397,7 @@ describe('testing the test cases page for user who is in submitter group', funct
data: {
"projects": [
{
- "owner": "thuva4",
+ "creator": "thuva4",
"_id": "5a0c022f9a07c846d3c2cc94",
"creation_date": "2017-11-15 14:30:31.200259",
"description": "dsfsd",
@@ -414,7 +414,7 @@ describe('testing the test cases page for user who is in submitter group', funct
},
response: {
data: {
- "owner": "thuva4",
+ "creator": "thuva4",
"_id": "5a0c022f9a07c846d3c2cc94",
"creation_date": "2017-11-15 14:30:31.200259",
"description": "dsfsd",
@@ -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 () {
@@ -575,6 +581,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);
@@ -588,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 () {
@@ -619,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 () {
@@ -644,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;
});
})