From 7ee79fc3a89698479b442460099d2fadc3143380 Mon Sep 17 00:00:00 2001 From: thuva4 Date: Thu, 15 Mar 2018 19:51:43 +0530 Subject: fix the authentication=false in testcases page fix the authentication error in testcases page when authenticate=false + tests JIRA: RELENG-340 Change-Id: Ic2ad2a9676de46e9e6b8209750a5728eea9fa9ab Signed-off-by: thuva4 --- .../tests/UI/e2e/authenticateFalseSpec.js | 157 ++++++++++++++++++++- .../projects/project/testCases/testCases.html | 134 +++++++++--------- .../project/testCases/testCasesController.js | 4 +- 3 files changed, 225 insertions(+), 70 deletions(-) (limited to 'testapi/opnfv_testapi') diff --git a/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js index 3212b86..e287f29 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/authenticateFalseSpec.js @@ -47,7 +47,7 @@ describe('testing the pods page for anonymous user', function () { }); }); -describe('testing the pods page for anonymous user', function () { +describe('testing the project page for anonymous user', function () { beforeEach(function(){ mock([ { @@ -383,3 +383,158 @@ describe('testing the scenarios page for anonymous user', function () { }); +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/ui/components/projects/project/testCases/testCases.html b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html index ee87e0a..395db03 100644 --- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html +++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html @@ -1,68 +1,68 @@
-
-
- -
-
- -
-
-
- - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - -
Bulk SelectNameTierBlockingCI LoopOperations
-
- -
-
- - {{testcase.name}} - - {{testcase.tier}}{{testcase.blocking}}{{testcase.ci_loop}} - - - - - - -
-
-
-
+
+
+ +
+
+ +
+
+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
Bulk SelectNameTierBlockingCI LoopOperations
+
+ +
+
+ + {{testcase.name}} + + {{testcase.tier}}{{testcase.blocking}}{{testcase.ci_loop}} + + + + + + +
+
+
+ \ No newline at end of file diff --git a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js index 9a865d3..4d6153e 100644 --- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js +++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js @@ -21,7 +21,7 @@ TestCasesController.$inject = [ '$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert', - 'confirmModal' + 'confirmModal', 'authenticate' ]; /** @@ -31,7 +31,7 @@ * in them. */ function TestCasesController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl, - raiseAlert, confirmModal) { + raiseAlert, confirmModal, authenticate) { var ctrl = this; ctrl.loadDetails = loadDetails; ctrl.name = $state.params['name']; -- cgit 1.2.3-korg