summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/tests/UI/e2e/homeControllerSpec.js
diff options
context:
space:
mode:
authorSerena Feng <feng.xiaowei@zte.com.cn>2018-01-18 07:00:33 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-01-18 07:00:33 +0000
commit98fde9b5bd0eaf5bf5acb76dc530925a3cc19881 (patch)
treea0ad3b0ebea119f7732426951a737a80d8c33233 /testapi/opnfv_testapi/tests/UI/e2e/homeControllerSpec.js
parentf82dd79721fec6d4d6e5ac8b7b27cfec689b92ea (diff)
parent86db2b6832d51f8cd4d428bc431aca9daa99c4e0 (diff)
Merge "Design the scenario create method"
Diffstat (limited to 'testapi/opnfv_testapi/tests/UI/e2e/homeControllerSpec.js')
-rw-r--r--testapi/opnfv_testapi/tests/UI/e2e/homeControllerSpec.js56
1 files changed, 56 insertions, 0 deletions
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..57794a6
--- /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", 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"
+ }
+ }
+ }])
+ });
+
+ 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);
+ });
+});