summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js
diff options
context:
space:
mode:
authorthuva4 <tharma.thuva@gmail.com>2018-01-16 00:09:51 +0530
committerthuva4 <tharma.thuva@gmail.com>2018-01-16 09:13:07 +0530
commit86db2b6832d51f8cd4d428bc431aca9daa99c4e0 (patch)
treea834b06487cef796afa67f484005b09a8a81c3bd /testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js
parent62fb9a03e047d70bb15c67d2748ffe377273d0b6 (diff)
Design the scenario create method
design scenario create method in modal way. design scenario page. Add,delete for installers,versions, projects and customs are implemented. tests are added. 1. Pods page 2. project page 3. Scenarios 4. Scenario Change-Id: Ice26af77ec3d5fe874cf5c2062f208072dea289f Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js')
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js390
1 files changed, 280 insertions, 110 deletions
diff --git a/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js
index c3961ab..97e61ad 100644
--- a/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js
+++ b/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js
@@ -17,7 +17,24 @@ describe('testing the Pods page for anonymous user', function () {
creation_date: "2017-10-25 11:58:25.926168"}]
}
}
- }]);
+ },
+ {
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET',
+ queryString: {
+ name: 'test'
+ }
+ },
+ 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(){
@@ -42,81 +59,249 @@ describe('testing the Pods page for anonymous user', function () {
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('Delete button is visible for anonymous user', function () {
+ var buttonDelete = element(by.buttonText('Delete'));
+ expect(buttonDelete.isDisplayed()).toBeFalsy();
});
- it('Show results when click filter button', function () {
+ 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'));
- buttonFilter.click();
- var pod = element(by.css('.show-pod'));
- expect(pod.isPresent()).toBe(true);
+ 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 results when click clear button', function () {
+ it('delete Operation is not visible for user ', 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);
+ var deleteOperation = element(by.css('a[title=Delete]'));
+ expect(deleteOperation.isDisplayed()).toBeFalsy();
});
- 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);
+});
+
+describe('testing the Pods page for authorized 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",
+ "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", owner: "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", owner: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}
+ }
+ }
+ ]);
});
- it('If backend is not responding then show error when click filter button', function () {
- browser.get(baseURL + '/#/pods');
+ 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'));
- buttonFilter.click().then(function(){
- expect(element(by.css('.alert.alert-danger.ng-binding.ng-scope'))
- .isDisplayed()).toBe(true);
- });
+ expect(buttonFilter.isDisplayed()).toBe(true)
});
-});
+ it('Delete button is visible for user', function () {
+ var buttonDelete = element(by.buttonText('Delete'));
+ expect(buttonDelete.isDisplayed()).toBe(true)
+ });
-describe('testing the Pods page for authorized user', function () {
+ 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");
+ });
- beforeEach(function(){
- mock([
- {
+ 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();
+ var buttonOK = element(by.buttonText('Ok'));
+ buttonOK.click();
+ expect(element(by.cssContainingText(".alert","Delete Success"))
+ .isDisplayed()).toBe(true);
+ });
+
+ 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();
+ expect(element(by.cssContainingText(".alert","Delete Success"))
+ .isDisplayed()).toBe(true);
+ });
+
+ 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();
+ expect(element(by.cssContainingText(".alert","Create Success"))
+ .isDisplayed()).toBe(true);
+ });
+
+ 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()
+ expect(element(by.cssContainingText(".alert","Name is missing."))
+ .isDisplayed()).toBe(true);
+ });
+
+ 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: 'POST'
+ path: '/api/v1/pods',
+ method: 'GET'
},
response: {
data: {
- href: baseURL+"/api/v1/pods/test"
+ pods: [{role: "community-ci", name: "test1", owner: "testUser",
+ details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed",
+ creation_date: "2017-10-25 11:58:25.926168"}]
}
- }
- },
- {
- 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'
@@ -127,57 +312,48 @@ describe('testing the Pods page for authorized user', function () {
"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();
+ expect(element(by.css(".alert.alert-danger"))
+ .isDisplayed()).toBe(true);
});
- 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('view the test case ', function () {
+ browser.get(baseURL+"#/pods");
+ var viewOperation = element(by.css('a[class=text-info]'));
+ viewOperation.click();
+ var EC = browser.ExpectedConditions;
+ browser.wait(EC.urlContains('#/pods/test'), 10000);
});
- 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(){
+ it('Show error if server is not responding', function () {
mock.teardown();
- mock([
- {
+ mock([{
+ request: {
+ path: '/api/v1/pods',
+ method: 'GET'
+ },
+ response: {
+ status : 404
+ }
+ },
+ {
request: {
path: '/api/v1/profile',
method: 'GET'
@@ -185,21 +361,15 @@ describe('testing the Pods page for authorized user', function () {
response: {
data: {
"fullname": "Test User", "_id": "79f82eey9a00c84bfhc7aed",
- "user": "testUser", "groups": ["opnfv-testapi-users"],
- "email": "testuser@test.com"
+ "user": "testUser", "groups": ["opnfv-testapi-users",
+ "opnfv-gerrit-functest-submitters"], "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);
- });
+ browser.get(baseURL+"#/pods");
+ expect(element(by.css(".alert.alert-danger"))
+ .isDisplayed()).toBe(true);
});
+
}); \ No newline at end of file