diff options
77 files changed, 1649 insertions, 681 deletions
@@ -25,3 +25,5 @@ nosetests.xml .tox *.retry job_output/ +.vscode +testapi/testapi-client/pip-selfcheck.json diff --git a/ci/mongodb_backup.py b/ci/mongodb_backup.py new file mode 100644 index 0000000..263232a --- /dev/null +++ b/ci/mongodb_backup.py @@ -0,0 +1,82 @@ +############################################################################## +# Copyright (c) 2016 ZTE Corporation +# feng.xiaowei@zte.com.cn +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +import argparse +import os +import subprocess +import urlparse + +import datetime + + +def get_abspath(path): + assert os.path.isdir(path), 'Path %s can\'t be found.' % path + return os.path.abspath(path) + + +def parse_mongodb_url(url): + url = urlparse.urlparse(url) + assert url.scheme == 'mongodb', 'URL must be a MongoDB URL' + return url + + +def url_parse(url): + url = parse_mongodb_url(url) + return url.username, url.password, url.hostname, url.port + + +def execute(cmd, args): + execute_output = subprocess.check_output(cmd) + print(execute_output) + + +def do_backup(args): + db = args.db + out = get_abspath(args.output_dir) + now = datetime.datetime.now() + out = os.path.join(out, '%s__%s' % (db, now.strftime('%Y_%m_%d_%H%M%S'))) + cmd = ['mongodump', '-o', '%s' % out] + if db: + cmd.extend(['--db', '%s' % db]) + + (username, password, hostname, port) = url_parse(args.url) + cmd.extend(['--host', '%s' % hostname, '--port', '%s' % port]) + + if username: + cmd.extend(['-u', '%s' % username]) + if password: + cmd.extend(['-p', '%s' % password]) + print('execute: %s' % cmd) + execute(cmd, args) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description='Backup MongoDBs') + + parser.add_argument('-u', '--url', + type=str, + required=False, + default='mongodb://127.0.0.1:27017/', + help='Mongo DB URL for Backups') + parser.add_argument('-o', '--output_dir', + type=str, + required=False, + default='./', + help='Output directory for the backup.') + + parser.add_argument('-d', '--db', + type=str, + required=False, + default='test_results_collection', + help='database for the backup.') + + args = parser.parse_args() + try: + do_backup(args) + except AssertionError as msg: + print(msg) diff --git a/ci/testapi-backup-mongodb.sh b/ci/testapi-backup-mongodb.sh index e6465ab..9bb5fd9 100644 --- a/ci/testapi-backup-mongodb.sh +++ b/ci/testapi-backup-mongodb.sh @@ -3,7 +3,7 @@ set -e # Run MongoDB backup -python $WORKSPACE/testapi/update/templates/backup_mongodb.py -o $WORKSPACE/ +python $WORKSPACE/ci/mongodb_backup.py -o $WORKSPACE/ # Compressing the dump now=$(date +"%m_%d_%Y_%H_%M_%S") diff --git a/reporting/reporting/qtip/template/index-status-tmpl.html b/reporting/reporting/qtip/template/index-status-tmpl.html index f55f781..9ce82c5 100644 --- a/reporting/reporting/qtip/template/index-status-tmpl.html +++ b/reporting/reporting/qtip/template/index-status-tmpl.html @@ -49,7 +49,7 @@ <li><a href="status-apex.html">Apex</a></li> <!--<li><a href="status-compass.html">Compass</a></li>--> <!--<li><a href="status-daisy.html">Daisy</a></li>--> - <!--<li><a href="status-fuel.html">Fuel</a></li>--> + <li><a href="status-fuel.html">Fuel</a></li> <!--<li><a href="status-joid.html">Joid</a></li>--> </ul> </nav> diff --git a/testapi/.gitignore b/testapi/.gitignore index e34365e..869a07a 100644 --- a/testapi/.gitignore +++ b/testapi/.gitignore @@ -12,4 +12,6 @@ build .ven docs/_build opnfv_testapi/tests/UI/coverage -3rd_party/static/testapi-ui/testapi-ui
\ No newline at end of file +3rd_party/static/testapi-ui/testapi-ui +.stestr/ + diff --git a/testapi/etc/config.ini b/testapi/etc/config.ini index 86cb0ca..5f568a7 100644 --- a/testapi/etc/config.ini +++ b/testapi/etc/config.ini @@ -15,7 +15,7 @@ port = 8000 results_per_page = 20 # With debug_on set to true, error traces will be shown in HTTP responses -debug = True +debug = False token_check = False authenticate = True diff --git a/testapi/opnfv_testapi/common/check.py b/testapi/opnfv_testapi/common/check.py index 9b3ab01..18dc67d 100644 --- a/testapi/opnfv_testapi/common/check.py +++ b/testapi/opnfv_testapi/common/check.py @@ -21,7 +21,8 @@ from opnfv_testapi.db import api as dbapi def is_authorized(method): @functools.wraps(method) def wrapper(self, *args, **kwargs): - if CONF.api_authenticate and self.table in ['pods', 'projects', 'testcases', 'scenarios']: + resources = ['pods', 'projects', 'testcases', 'scenarios'] + if CONF.api_authenticate and self.table in resources: testapi_id = self.get_secure_cookie(constants.TESTAPI_ID) if not testapi_id: raises.Unauthorized(message.not_login()) @@ -29,13 +30,13 @@ def is_authorized(method): if not user_info: raises.Unauthorized(message.not_lfid()) if method.__name__ == "_create": - kwargs['owner'] = testapi_id + kwargs['creator'] = testapi_id if self.table in ['projects']: query = kwargs.get('query') if type(query) is not dict: query_data = query() else: - if self.json_args is None: + if self.json_args is None or 'name' not in self.json_args: query_data = query else: query_data = self.json_args @@ -47,6 +48,30 @@ def is_authorized(method): return wrapper +def is_reource_tied(method): + @functools.wraps(method) + def wrapper(self, *args, **kwargs): + query_data = {} + tied_maps = { + 'projects': ('testcases', 'project_name'), + 'pods': ('results', 'pod_name'), + 'testcases': ('results', 'case_name') + } + if self.table in tied_maps: + if method.__name__ == '_update': + if 'name' not in self.json_args: + ret = yield gen.coroutine(method)(self, *args, **kwargs) + raise gen.Return(ret) + query_data[tied_maps[self.table][1]] = kwargs.get('query')['name'] + data = yield dbapi.db_find_one(tied_maps[self.table][0], + query_data) + if data: + raises.Unauthorized(message.tied_with_resource()) + ret = yield gen.coroutine(method)(self, *args, **kwargs) + raise gen.Return(ret) + return wrapper + + def valid_token(method): @functools.wraps(method) def wrapper(self, *args, **kwargs): @@ -136,8 +161,10 @@ def new_not_exists(xstep): if query: query_data = query() if self.table == 'pods': - if query_data.get('name') is not None: - query_data['name'] = re.compile('\\b' + query_data.get('name') + '\\b', re.IGNORECASE) + if query_data.get('name'): + query_data['name'] = re.compile( + '\\b{}\\b'.format(query_data.get('name')), + re.IGNORECASE) to_data = yield dbapi.db_find_one(self.table, query_data) if to_data: raises.Forbidden(message.exist(self.table, query())) @@ -165,7 +192,9 @@ def query_by_name(xstep): def wrap(self, *args, **kwargs): if 'name' in self.request.query_arguments.keys(): query = kwargs.get('query', {}) - query.update({'name': re.compile(self.get_query_argument('name'), re.IGNORECASE)}) + query.update({ + 'name': re.compile(self.get_query_argument('name'), + re.IGNORECASE)}) kwargs.update({'query': query}) ret = yield gen.coroutine(xstep)(self, *args, **kwargs) diff --git a/testapi/opnfv_testapi/common/constants.py b/testapi/opnfv_testapi/common/constants.py index 70c9223..c7f82d9 100644 --- a/testapi/opnfv_testapi/common/constants.py +++ b/testapi/opnfv_testapi/common/constants.py @@ -1,4 +1,3 @@ TESTAPI_ID = 'testapi_id' CSRF_TOKEN = 'csrf_token' -ROLE = 'role' TESTAPI_USERS = ['opnfv-testapi-users'] diff --git a/testapi/opnfv_testapi/common/message.py b/testapi/opnfv_testapi/common/message.py index b92b7f0..52cc2ad 100644 --- a/testapi/opnfv_testapi/common/message.py +++ b/testapi/opnfv_testapi/common/message.py @@ -10,10 +10,6 @@ not_found_base = 'Could Not Found' exist_base = 'Already Exists' -def key_error(key): - return "KeyError: '{}'".format(key) - - def no_body(): return 'No Body' @@ -64,3 +60,7 @@ def must_int(name): def no_permission(): return 'You do not have permission to perform this action' + + +def tied_with_resource(): + return 'Selected resource is associated with other resources' diff --git a/testapi/opnfv_testapi/handlers/base_handlers.py b/testapi/opnfv_testapi/handlers/base_handlers.py index 537077d..350c38d 100644 --- a/testapi/opnfv_testapi/handlers/base_handlers.py +++ b/testapi/opnfv_testapi/handlers/base_handlers.py @@ -179,6 +179,7 @@ class GenericApiHandler(web.RequestHandler): @gen.coroutine @check.not_exist @check.is_authorized + @check.is_reource_tied def _delete(self, data, query=None): yield dbapi.db_delete(self.table, query) self.finish_request() @@ -189,6 +190,7 @@ class GenericApiHandler(web.RequestHandler): @check.not_exist @check.updated_one_not_exist @check.is_authorized + @check.is_reource_tied def _update(self, data, query=None, **kwargs): data = self.table_cls.from_dict(data) update_req = self._update_requests(data) diff --git a/testapi/opnfv_testapi/handlers/result_handlers.py b/testapi/opnfv_testapi/handlers/result_handlers.py index b0691cd..74acb2e 100644 --- a/testapi/opnfv_testapi/handlers/result_handlers.py +++ b/testapi/opnfv_testapi/handlers/result_handlers.py @@ -8,12 +8,9 @@ ############################################################################## from datetime import datetime from datetime import timedelta -import json -import logging from bson import objectid -from opnfv_testapi.common import constants from opnfv_testapi.common import message from opnfv_testapi.common import raises from opnfv_testapi.common.config import CONF @@ -41,7 +38,6 @@ class GenericResultHandler(base_handlers.GenericApiHandler): query = dict() date_range = dict() - query['public'] = {'$not': {'$eq': 'false'}} for k in self.request.query_arguments.keys(): v = self.get_query_argument(k) if k == 'project' or k == 'pod' or k == 'case': @@ -60,13 +56,6 @@ class GenericResultHandler(base_handlers.GenericApiHandler): date_range.update({'$lt': str(v)}) elif 'build_id' in k: query[k] = self.get_int(k, v) - elif k == 'signed': - username = self.get_secure_cookie(constants.TESTAPI_ID) - role = self.get_secure_cookie(constants.ROLE) - if role: - del query['public'] - if role != "reviewer": - query['user'] = username elif k not in ['last', 'page', 'descend']: query[k] = v if date_range: @@ -121,10 +110,9 @@ class ResultsCLHandler(GenericResultHandler): - criteria : the global criteria status passed or failed - trust_indicator : evaluate the stability of the test case to avoid running systematically long and stable test case - - signed : get logined user result GET /results/project=functest&case=vPing&version=Arno-R1 \ - &pod=pod_name&period=15&signed + &pod=pod_name&period=15 @return 200: all test results consist with query, empty list if no result is found @rtype: L{TestResults} @@ -184,10 +172,6 @@ class ResultsCLHandler(GenericResultHandler): @type trust_indicator: L{float} @in trust_indicator: query @required trust_indicator: False - @param signed: user results or all results - @type signed: L{string} - @in signed: query - @required signed: False @param descend: true, newest2oldest; false, oldest2newest @type descend: L{string} @in descend: query @@ -231,36 +215,8 @@ class ResultsCLHandler(GenericResultHandler): values_check=values_check) -class ResultsUploadHandler(ResultsCLHandler): - @swagger.operation(nickname="uploadTestResult") - def post(self): - """ - @description: upload and create a test result - @param body: result to be created - @type body: L{ResultCreateRequest} - @in body: body - @rtype: L{CreateResponse} - @return 200: result is created. - @raise 404: pod/project/testcase not exist - @raise 400: body/pod_name/project_name/case_name not provided - """ - logging.info('file upload') - fileinfo = self.request.files['file'][0] - is_public = self.get_body_argument('public') - logging.warning('public:%s', is_public) - logging.info('results is :%s', fileinfo['filename']) - logging.info('results is :%s', fileinfo['body']) - self.json_args = json.loads(fileinfo['body']).copy() - self.json_args['public'] = is_public - - openid = self.get_secure_cookie(constants.TESTAPI_ID) - if openid: - self.json_args['user'] = openid - - super(ResultsUploadHandler, self).post() - - class ResultsGURHandler(GenericResultHandler): + @swagger.operation(nickname='getTestResultById') def get(self, result_id): """ diff --git a/testapi/opnfv_testapi/models/pod_models.py b/testapi/opnfv_testapi/models/pod_models.py index 0eddfcc..8af5297 100644 --- a/testapi/opnfv_testapi/models/pod_models.py +++ b/testapi/opnfv_testapi/models/pod_models.py @@ -30,7 +30,7 @@ class Pod(PodCreateRequest): def __init__(self, **kwargs): self._id = kwargs.pop('_id', '') self.creation_date = kwargs.pop('creation_date', '') - self.owner = kwargs.pop('owner', '') + self.creator = kwargs.pop('creator', '') super(Pod, self).__init__(**kwargs) diff --git a/testapi/opnfv_testapi/models/project_models.py b/testapi/opnfv_testapi/models/project_models.py index 5f280f1..5c8c048 100644 --- a/testapi/opnfv_testapi/models/project_models.py +++ b/testapi/opnfv_testapi/models/project_models.py @@ -27,11 +27,16 @@ class ProjectUpdateRequest(base_models.ModelBase): @swagger.model() class Project(base_models.ModelBase): def __init__(self, - name=None, _id=None, description=None, create_date=None): + name=None, + creator='', + _id=None, + description=None, + creation_date=None): + self.creator = creator self._id = _id self.name = name self.description = description - self.creation_date = create_date + self.creation_date = creation_date @swagger.model() diff --git a/testapi/opnfv_testapi/models/result_models.py b/testapi/opnfv_testapi/models/result_models.py index 1dbe729..f8379d8 100644 --- a/testapi/opnfv_testapi/models/result_models.py +++ b/testapi/opnfv_testapi/models/result_models.py @@ -62,8 +62,6 @@ class ResultCreateRequest(base_models.ModelBase): build_tag=None, scenario=None, criteria=None, - user=None, - public="true", trust_indicator=None): self.pod_name = pod_name self.project_name = project_name @@ -76,8 +74,6 @@ class ResultCreateRequest(base_models.ModelBase): self.build_tag = build_tag self.scenario = scenario self.criteria = criteria - self.user = user - self.public = public self.trust_indicator = trust_indicator if trust_indicator else TI(0) def __eq__(self, other): diff --git a/testapi/opnfv_testapi/models/scenario_models.py b/testapi/opnfv_testapi/models/scenario_models.py index 0610c6b..537650e 100644 --- a/testapi/opnfv_testapi/models/scenario_models.py +++ b/testapi/opnfv_testapi/models/scenario_models.py @@ -178,10 +178,16 @@ class Scenario(base_models.ModelBase): @property installers: @ptype installers: C{list} of L{ScenarioInstaller} """ - def __init__(self, name='', create_date='', _id='', installers=None): + def __init__(self, + name='', + creation_date='', + _id='', + creator='', + installers=None): self.name = name + self.creator = creator self._id = _id - self.creation_date = create_date + self.creation_date = creation_date self.installers = list_default(installers) @staticmethod diff --git a/testapi/opnfv_testapi/router/url_mappings.py b/testapi/opnfv_testapi/router/url_mappings.py index b9dd231..8f01a66 100644 --- a/testapi/opnfv_testapi/router/url_mappings.py +++ b/testapi/opnfv_testapi/router/url_mappings.py @@ -49,7 +49,6 @@ mappings = [ # Push results with mandatory request payload parameters # (project, case, and pod) (r"/api/v1/results", result_handlers.ResultsCLHandler), - (r'/api/v1/results/upload', result_handlers.ResultsUploadHandler), (r"/api/v1/results/([^/]+)", result_handlers.ResultsGURHandler), (r"/api/v1/deployresults", deploy_handlers.DeployResultsHandler), (r"/api/v1/deployresults/([^/]+)", deploy_handlers.DeployResultHandler), diff --git a/testapi/opnfv_testapi/tests/UI/e2e/homeControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/homeControllerSpec.js index 57794a6..013527d 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/homeControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/homeControllerSpec.js @@ -20,7 +20,7 @@ describe('testing the home page for user', function () { }, response: { data: { - pods: [{role: "community-ci", name: "test", owner: "testUser", + pods: [{role: "community-ci", name: "test", creator: "testUser", details: "DemoDetails", mode: "metal", _id: "59f02f099a07c84bfc5c7aed", creation_date: "2017-10-25 11:58:25.926168"}] } @@ -53,4 +53,4 @@ describe('testing the home page for user', function () { 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 97e61ad..16b219d 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/podsControllerSpec.js @@ -4,243 +4,269 @@ 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"}] - } - } - }, - { - 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(){ - 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', function () { - var row = element.all(by.repeater('(index, pod) in ctrl.data.pods')).first(); + 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[6]/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[6]/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(); + 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(); - }); + 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: '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"} - } - } - ]); - }); - - 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(); + 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(); + 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('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 () { + 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(); + buttonOK.click(); expect(element(by.cssContainingText(".alert","Delete Success")) .isDisplayed()).toBe(true); - }); + }); - it('Delete the pods ', function () { + it('Delete the pods ', function () { browser.get(baseURL+"#/pods"); var deleteOperation = element(by.css('a[title=Delete]')); deleteOperation.click(); @@ -248,9 +274,9 @@ describe('testing the Pods page for authorized user', function () { buttonOK.click(); expect(element(by.cssContainingText(".alert","Delete Success")) .isDisplayed()).toBe(true); - }); + }); - it('Create the pod', function () { + it('Create the pod', function () { browser.get(baseURL+"#/pods"); var buttonCreate = element(by.buttonText('Create')); buttonCreate.click(); @@ -259,7 +285,7 @@ describe('testing the Pods page for authorized user', function () { browser.wait(EC.visibilityOf(name), 5000); name.sendKeys('test1'); var buttonOK = element(by.buttonText('Ok')); - buttonOK.click(); + buttonOK.click(); expect(element(by.cssContainingText(".alert","Create Success")) .isDisplayed()).toBe(true); }); @@ -271,8 +297,8 @@ describe('testing the Pods page for authorized user', function () { 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() + var buttonOK = element(by.buttonText('Ok')); + buttonOK.click() expect(element(by.cssContainingText(".alert","Name is missing.")) .isDisplayed()).toBe(true); }); @@ -284,92 +310,92 @@ describe('testing the Pods page for authorized user', function () { 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", 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/test1', - method: 'DELETE' - }, - response: { - status : 403, - data : 'pods do not exist' - } - } - ]); + }); + + 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(); + buttonOK.click(); expect(element(by.css(".alert.alert-danger")) .isDisplayed()).toBe(true); - }); + }); - it('view the test case ', function () { - browser.get(baseURL+"#/pods"); - var viewOperation = element(by.css('a[class=text-info]')); + 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" - } - } - }, - ]); + }); + + 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"); expect(element(by.css(".alert.alert-danger")) .isDisplayed()).toBe(true); - }); + }); });
\ 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 8b908c9..ed5fe9f 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); }); @@ -70,10 +70,10 @@ describe('testing the Projects Link for anonymous user', function () { // }); 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(); - }); + browser.get(baseURL+'#/projects'); + var deleteOperation = element(by.css('a[title=Delete]')); + expect(deleteOperation.isDisplayed()).toBeFalsy(); + }); }); @@ -122,7 +122,7 @@ describe('testing the Project Link for user who is not in submitter group', func data: { "projects": [ { - "owner": "thuva4", + "creator": "thuva4", "_id": "5a0c022f9a07c846d3c2cc94", "creation_date": "2017-11-15 14:30:31.200259", "description": "dsfsd", @@ -136,8 +136,8 @@ describe('testing the Project Link for user who is not in submitter group', func }); afterEach(function(){ - mock.teardown(); - }); + mock.teardown(); + }); it( 'should show the Project Link for user', function() { browser.get(baseURL); @@ -280,8 +280,8 @@ describe('testing the Project Link for user who is in submitter group', function }); afterEach(function(){ - mock.teardown(); - }); + mock.teardown(); + }); it( 'should show the Project Link for user', function() { browser.get(baseURL); @@ -363,7 +363,7 @@ describe('testing the Project Link for user who is in submitter group', function }); it('Show error when user click the create button with an already existing name', function () { - browser.get(baseURL+"#/projects"); + browser.get(baseURL+"#/projects"); var buttonCreate = element(by.buttonText('Create')); buttonCreate.click(); var name = element(by.model('ProjectModalCtrl.project.name')); @@ -371,7 +371,7 @@ describe('testing the Project Link for user who is in submitter group', function browser.wait(EC.visibilityOf(name), 5000); var description = element(by.model('ProjectModalCtrl.project.description')); name.sendKeys('testProject3'); - description.sendKeys('demoDescription'); + description.sendKeys('demoDescription'); var buttonOK = element(by.buttonText('Ok')); buttonOK.click(); expect(element(by.css(".alert.alert-danger")).isDisplayed()).toBe(true); @@ -390,6 +390,8 @@ describe('testing the Project Link for user who is in submitter group', function browser.get(baseURL+"#/projects"); var deleteOperation = element(by.css('a[title=Delete]')); deleteOperation.click(); + expect(element(by.cssContainingText('label', "You are about to delete following projects : vsfv")) + .isDisplayed()).toBe(true); var buttonOK = element(by.buttonText('Ok')); buttonOK.click(); expect(element(by.cssContainingText(".alert","Projects is successfully deleted")) @@ -545,9 +547,9 @@ describe('testing the Project Link for user who is in submitter group', function .isDisplayed()).toBe(true); }); - it('If backend is not responding then show error when user click the create button',function(){ - mock.teardown(); - mock([ + it('If backend is not responding then show error when user click the create button',function(){ + mock.teardown(); + mock([ { request: { path: '/api/v1/profile', @@ -563,8 +565,8 @@ describe('testing the Project Link for user who is in submitter group', function } } } - ]); - browser.get(baseURL+"#/projects"); + ]); + browser.get(baseURL+"#/projects"); var buttonCreate = element(by.buttonText('Create')); buttonCreate.click(); var name = element(by.model('ProjectModalCtrl.project.name')); @@ -572,10 +574,10 @@ describe('testing the Project Link for user who is in submitter group', function 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().then(function(){ - expect(element(by.css(".alert.alert-danger")).isDisplayed()).toBe(true); + details.sendKeys('demoDescription'); + var buttonOK = element(by.buttonText('Ok')); + buttonOK.click().then(function(){ + expect(element(by.css(".alert.alert-danger")).isDisplayed()).toBe(true); }); - }); + }); }) diff --git a/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js index d6dfa1c..132f77d 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/resultsControllerSpec.js @@ -143,7 +143,7 @@ describe('testing the result page for anonymous 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 anonymous user ', function () { @@ -156,11 +156,11 @@ describe('testing the result page for anonymous user', function () { 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"); + expect(cells.get(0).getText()).toContain("0e2643f5"); filter.sendKeys('case'); filterText.sendKeys('testcase') 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"); @@ -329,7 +329,7 @@ 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 () { @@ -342,11 +342,11 @@ describe('testing the result page for user', function () { 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"); + expect(cells.get(0).getText()).toContain("0e2643f5"); filter.sendKeys('case'); filterText.sendKeys('testcase') buttonFilter.click(); - expect(cells.get(0).getText()).toContain("5a45170bbb2092000e2643f6"); + expect(cells.get(0).getText()).toContain("0e2643f6"); }); it('Clear the filter', function () { @@ -359,12 +359,12 @@ describe('testing the result page for user', function () { 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"); + 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("5a45170bbb2092000e2643f4"); + 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"); diff --git a/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js index b943ece..7777721 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/scenarioControllerSpec.js @@ -224,7 +224,7 @@ describe('testing the scenarios page 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[4]/td[2]/div[2]/button')) + 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); }); @@ -232,7 +232,7 @@ describe('testing the scenarios page for 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[4]/td[2]/div[1]/a/p')) + 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')); @@ -243,9 +243,9 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[3]/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(installerDelete.isDisplayed()).toBe(false); }); @@ -253,11 +253,11 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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) }); @@ -265,13 +265,13 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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); }); @@ -279,15 +279,15 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + 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); }); @@ -295,17 +295,17 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + 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[4]/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')) + 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) }); @@ -313,30 +313,30 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + 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[4]/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')) + 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[4]/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')) + 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[4]/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')) + 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[4]/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')) + 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 anonymous user', function () { +describe('testing the scenarios page for user', function () { beforeEach(function(){ mock([ { @@ -666,7 +666,7 @@ describe('testing the scenarios page 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[4]/td[2]/div[2]/button')) + 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); }); @@ -674,7 +674,7 @@ describe('testing the scenarios page 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[4]/td[2]/div[2]/button')) + 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; @@ -691,7 +691,7 @@ describe('testing the scenarios page for 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[4]/td[2]/div[1]/a/p')) + 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')); @@ -702,9 +702,9 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[3]/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(installerDelete.isDisplayed()).toBe(true); }); @@ -712,10 +712,12 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[3]/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')) installerDelete.click() + expect(element(by.cssContainingText('label', "You are about to delete following installers : fuel")) + .isDisplayed()).toBe(true); var buttonOK = element(by.buttonText('Ok')); buttonOK.click(); expect(element(by.cssContainingText(".alert","Installer is successfully deleted.")) @@ -726,11 +728,11 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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) }); @@ -738,11 +740,11 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[2]/button')) + 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); @@ -759,16 +761,16 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[2]/button')) - var installerDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[3]/button')) + 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) }); @@ -777,16 +779,18 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody[1]/tr[1]/td[3]/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[1]/tr[1]/td[3]/button')) versionDelete.click() + expect(element(by.cssContainingText('label', "You are about to delete following version : colorado")) + .isDisplayed()).toBe(true); var buttonOK = element(by.buttonText('Ok')); buttonOK.click(); expect(element(by.cssContainingText(".alert","Versions are successfully deleted.")) @@ -797,15 +801,15 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + 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); }); @@ -813,15 +817,15 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[2]/button')) + 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); @@ -836,20 +840,20 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + 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[4]/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')) + 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[4]/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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[3]/button')) + 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) }); @@ -858,18 +862,20 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + 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[4]/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')) + var projectDelete = element(by.xpath('//*[@id="ng-app"]/body/div/div[1]/div/table/tbody/tr[5]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[3]/div/table/tbody[1]/tr[1]/td[3]/button')) projectDelete.click() + expect(element(by.cssContainingText('label', "You are about to delete following projects : yardstick")) + .isDisplayed()).toBe(true); var buttonOK = element(by.buttonText('Ok')); buttonOK.click(); expect(element(by.cssContainingText(".alert","Projects are successfully Deleted.")) @@ -880,23 +886,23 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + 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[4]/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')) + 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[4]/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')) + 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[4]/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')) + 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[4]/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')) + 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) }); @@ -904,19 +910,19 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + 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[4]/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')) + 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[4]/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')) + 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')); @@ -927,19 +933,19 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + 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[4]/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')) + 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[4]/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')) + 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')); @@ -950,29 +956,29 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + 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[4]/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')) + 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[4]/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')) + 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[4]/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[4]/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')) + 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[4]/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[4]/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')) + 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) }); @@ -981,24 +987,24 @@ describe('testing the scenarios page 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + 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[4]/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')) + 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[4]/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')) + 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[4]/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 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); @@ -1009,29 +1015,63 @@ describe('testing the scenarios page for anonymous user', function () { .isDisplayed()).toBe(true); }); - it( 'Delete Customs by user', function() { + 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[4]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[1]/a/p')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[1]/td[2]/a')) + 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[4]/td[2]/div[3]/div/table/tbody/tr[2]/td[2]/div[3]/div/table/tbody/tr[3]/td[2]/div[1]/a')) + 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[4]/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')) + 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[4]/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')) + 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[4]/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')) + 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() + expect(element(by.cssContainingText(".alert","Customs are successfully updated.")) + .isDisplayed()).toBe(true); + }); + + 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() expect(element(by.cssContainingText(".alert","Customs are successfully deleted.")) diff --git a/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js index 505b42f..bed80dd 100644 --- a/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js +++ b/testapi/opnfv_testapi/tests/UI/e2e/scenariosControllerSpec.js @@ -690,6 +690,8 @@ describe('testing the scenarios page for user', function () { browser.get(baseURL+'#/scenarios'); var deleteOperation = element(by.css('a[title=Delete]')); deleteOperation.click(); + expect(element(by.cssContainingText('label', "You are about to delete following scenarios : test-scenario")) + .isDisplayed()).toBe(true); var buttonOK = element(by.buttonText('Ok')); buttonOK.click(); expect(element(by.cssContainingText(".alert","Scenario is successfully deleted.")) diff --git a/testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js b/testapi/opnfv_testapi/tests/UI/e2e/testCasesControllerSpec.js index d509c57..53e7bdf 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", @@ -575,6 +575,8 @@ describe('testing the test cases page for user who is in submitter group', funct testCases.click(); var deleteOperation = element(by.css('a[title=Delete]')); deleteOperation.click(); + expect(element(by.cssContainingText('label', "You are about to delete following testcases : testCase")) + .isDisplayed()).toBe(true); var buttonCancel = element(by.buttonText('Cancel')); buttonCancel.click(); expect(buttonCancel.isPresent()).toBe(false); diff --git a/testapi/opnfv_testapi/tests/unit/common/test_config.py b/testapi/opnfv_testapi/tests/unit/common/test_config.py index 6d160ce..8e4966f 100644 --- a/testapi/opnfv_testapi/tests/unit/common/test_config.py +++ b/testapi/opnfv_testapi/tests/unit/common/test_config.py @@ -11,7 +11,7 @@ def test_config_normal(mocker, config_normal): assert CONF.mongo_url == 'mongodb://127.0.0.1:27017/' assert CONF.mongo_dbname == 'test_results_collection' assert CONF.api_port == 8000 - assert CONF.api_debug is True + assert CONF.api_debug is False assert CONF.api_token_check is False assert CONF.api_authenticate is True assert CONF.ui_url == 'http://localhost:8000' diff --git a/testapi/opnfv_testapi/tests/unit/executor.py b/testapi/opnfv_testapi/tests/unit/executor.py index 743c076..d08782c 100644 --- a/testapi/opnfv_testapi/tests/unit/executor.py +++ b/testapi/opnfv_testapi/tests/unit/executor.py @@ -43,20 +43,6 @@ def mock_valid_lfid(): return _mock_valid_lfid -def upload(excepted_status, excepted_response): - def _upload(create_request): - @functools.wraps(create_request) - def wrap(self): - request = create_request(self) - status, body = self.upload(request) - if excepted_status == httplib.OK: - getattr(self, excepted_response)(body) - else: - self.assertIn(excepted_response, body) - return wrap - return _upload - - def create(excepted_status, excepted_response): def _create(create_request): @functools.wraps(create_request) diff --git a/testapi/opnfv_testapi/tests/unit/handlers/test_base.py b/testapi/opnfv_testapi/tests/unit/handlers/test_base.py index 6436b8b..9a7bc5c 100644 --- a/testapi/opnfv_testapi/tests/unit/handlers/test_base.py +++ b/testapi/opnfv_testapi/tests/unit/handlers/test_base.py @@ -35,20 +35,21 @@ class TestBase(testing.AsyncHTTPTestCase): details='zte pod 1', role='community-ci', _id=str(ObjectId()), - owner='ValidUser', + creator='ValidUser', creation_date=str(datetime.now())) self.pod_e = pod_models.Pod(name='zte-pod2', mode='metal', details='zte pod 2', role='production-ci', _id=str(ObjectId()), - owner='ValidUser', + creator='ValidUser', creation_date=str(datetime.now())) self.project_e = project_models.Project( name='functest', description='functest test', + creator='ValidUser', _id=str(ObjectId()), - create_date=str(datetime.now())) + creation_date=str(datetime.now())) self.req_d = None self.req_e = None diff --git a/testapi/opnfv_testapi/tests/unit/handlers/test_deploy_result.py b/testapi/opnfv_testapi/tests/unit/handlers/test_deploy_result.py index 65e765e..8f2ca76 100644 --- a/testapi/opnfv_testapi/tests/unit/handlers/test_deploy_result.py +++ b/testapi/opnfv_testapi/tests/unit/handlers/test_deploy_result.py @@ -92,6 +92,10 @@ class DeployResultGet(DeployResultBase): self.req_d_id = self._create_d() self.req_10d_later = self._create_changed_date(days=10) + @executor.get(httplib.OK, 'assert_res') + def test_getOne(self): + return self.req_d_id + @executor.query(httplib.OK, '_query_success', 3) def test_queryInstaller(self): return self._set_query('installer') @@ -165,6 +169,19 @@ class DeployResultGet(DeployResultBase): self._create_error_start_date('') return self._set_query(period=5) + @executor.query(httplib.OK, '_query_success', 0) + def test_notFound(self): + return self._set_query('installer', + 'version', + 'job_name', + 'build_id', + 'scenario', + 'upstream_job_name', + 'upstream_build_id', + 'criteria', + pod='notExistPod', + period=1) + def _query_success(self, body, number): self.assertEqual(number, len(body.deployresults)) diff --git a/testapi/opnfv_testapi/tests/unit/handlers/test_pod.py b/testapi/opnfv_testapi/tests/unit/handlers/test_pod.py index 2818513..3a16799 100644 --- a/testapi/opnfv_testapi/tests/unit/handlers/test_pod.py +++ b/testapi/opnfv_testapi/tests/unit/handlers/test_pod.py @@ -10,6 +10,7 @@ import httplib from opnfv_testapi.common import message from opnfv_testapi.models import pod_models as pm +from opnfv_testapi.models import result_models as rm from opnfv_testapi.tests.unit import executor from opnfv_testapi.tests.unit import fake_pymongo from opnfv_testapi.tests.unit.handlers import test_base as base @@ -23,11 +24,13 @@ class TestPodBase(base.TestBase): self.basePath = '/api/v1/pods' self.req_d = pm.PodCreateRequest.from_dict(self.pod_d.format()) self.req_e = pm.PodCreateRequest.from_dict(self.pod_e.format()) + self.results_d = rm.ResultCreateRequest.from_dict( + self.load_json('test_result')) def assert_get_body(self, pod, req=None): if not req: req = self.req_d - self.assertEqual(pod, pm.Pod(owner='ValidUser', **req.format())) + self.assertEqual(pod, pm.Pod(creator='ValidUser', **req.format())) self.assertIsNotNone(pod.creation_date) self.assertIsNotNone(pod._id) @@ -101,3 +104,38 @@ class TestPodGet(TestPodBase): self.assert_get_body(pod) else: self.assert_get_body(pod, self.req_e) + + +class TestPodDelete(TestPodBase): + @executor.mock_valid_lfid() + def setUp(self): + super(TestPodDelete, self).setUp() + fake_pymongo.pods.insert(self.pod_d.format()) + fake_pymongo.projects.insert({'name': self.results_d.project_name}) + fake_pymongo.testcases.insert({ + 'name': self.results_d.case_name, + 'project_name': self.results_d.project_name}) + + @executor.delete(httplib.BAD_REQUEST, message.not_login()) + def test_notlogin(self): + return self.pod_d.name + + @executor.delete(httplib.NOT_FOUND, message.not_found_base) + def test_notFound(self): + return 'notFound' + + @executor.mock_valid_lfid() + @executor.delete(httplib.UNAUTHORIZED, message.tied_with_resource()) + def test_deleteNotAllowed(self): + self.create_help('/api/v1/results', self.results_d) + return self.pod_d.name + + @executor.mock_valid_lfid() + @executor.delete(httplib.OK, '_assert_delete') + def test_success(self): + return self.pod_d.name + + def _assert_delete(self, body): + self.assertEqual(body, '') + code, body = self.get(self.pod_d.name) + self.assertEqual(code, httplib.NOT_FOUND) diff --git a/testapi/opnfv_testapi/tests/unit/handlers/test_project.py b/testapi/opnfv_testapi/tests/unit/handlers/test_project.py index cbd1a4e..5903507 100644 --- a/testapi/opnfv_testapi/tests/unit/handlers/test_project.py +++ b/testapi/opnfv_testapi/tests/unit/handlers/test_project.py @@ -12,6 +12,7 @@ import urllib from opnfv_testapi.common import message from opnfv_testapi.models import project_models +from opnfv_testapi.models import testcase_models as tcm from opnfv_testapi.tests.unit import executor from opnfv_testapi.tests.unit.handlers import test_base as base @@ -23,6 +24,9 @@ class TestProjectBase(base.TestBase): 'qtip-ssh test') self.req_e = project_models.ProjectCreateRequest('functest', 'functest test') + self.testcase_d = tcm.TestcaseCreateRequest.from_dict( + self.load_json('testcase_d')) + self.project = 'qtip' self.get_res = project_models.Project self.list_res = project_models.Projects self.update_res = project_models.Project @@ -150,6 +154,15 @@ class TestProjectUpdate(TestProjectBase): return self.req_d, self.req_d.name @executor.mock_valid_lfid() + @executor.update(httplib.UNAUTHORIZED, message.tied_with_resource()) + def test_updateNotAllowed(self): + self.create_help('/api/v1/projects/%s/cases', + self.testcase_d, + self.req_d.name) + req = project_models.ProjectUpdateRequest('apex', 'apex test') + return req, self.req_d.name + + @executor.mock_valid_lfid() @executor.update(httplib.OK, '_assert_update') def test_success(self): req = project_models.ProjectUpdateRequest('apex', 'apex test') @@ -178,6 +191,14 @@ class TestProjectDelete(TestProjectBase): return 'notFound' @executor.mock_valid_lfid() + @executor.delete(httplib.UNAUTHORIZED, message.tied_with_resource()) + def test_deleteNotAllowed(self): + self.create_help('/api/v1/projects/%s/cases', + self.testcase_d, + self.req_d.name) + return self.req_d.name + + @executor.mock_valid_lfid() @executor.delete(httplib.OK, '_assert_delete') def test_success(self): return self.req_d.name diff --git a/testapi/opnfv_testapi/tests/unit/handlers/test_result.py b/testapi/opnfv_testapi/tests/unit/handlers/test_result.py index f1f055e..892256a 100644 --- a/testapi/opnfv_testapi/tests/unit/handlers/test_result.py +++ b/testapi/opnfv_testapi/tests/unit/handlers/test_result.py @@ -10,7 +10,6 @@ import copy from datetime import datetime from datetime import timedelta import httplib -import json import urllib from opnfv_testapi.common import message @@ -34,8 +33,9 @@ class TestResultBase(base.TestBase): self.basePath = '/api/v1/results' fake_pymongo.pods.insert({'name': self.req_d.pod_name}) fake_pymongo.projects.insert({'name': self.req_d.project_name}) - fake_pymongo.testcases.insert({'name': self.req_d.case_name, - 'project_name': self.req_d.project_name}) + fake_pymongo.testcases.insert({ + 'name': self.req_d.case_name, + 'project_name': self.req_d.project_name}) def assert_res(self, result, req=None): if req is None: @@ -46,22 +46,6 @@ class TestResultBase(base.TestBase): _, res = self.create_d() return res.href.split('/')[-1] - def upload(self, req): - if req and not isinstance(req, str) and hasattr(req, 'format'): - req = req.format() - res = self.fetch(self.basePath + '/upload', - method='POST', - body=json.dumps(req), - headers=self.headers) - - return self._get_return(res, self.create_res) - - -class TestResultUpload(TestResultBase): - @executor.upload(httplib.BAD_REQUEST, message.key_error('file')) - def test_filenotfind(self): - return None - class TestResultCreate(TestResultBase): @executor.create(httplib.BAD_REQUEST, message.no_body()) @@ -197,16 +181,6 @@ class TestResultGet(TestResultBase): def test_queryLast(self): return self._set_query(last=1) - @executor.query(httplib.OK, '_query_success', 4) - def test_queryPublic(self): - self._create_public_data() - return self._set_query() - - @executor.query(httplib.OK, '_query_success', 1) - def test_queryPrivate(self): - self._create_private_data() - return self._set_query(public='false') - @executor.query(httplib.OK, '_query_period_one', 1) def test_combination(self): return self._set_query('pod', @@ -266,18 +240,6 @@ class TestResultGet(TestResultBase): self.create(req) return req - def _create_public_data(self, **kwargs): - req = copy.deepcopy(self.req_d) - req.public = 'true' - self.create(req) - return req - - def _create_private_data(self, **kwargs): - req = copy.deepcopy(self.req_d) - req.public = 'false' - self.create(req) - return req - def _set_query(self, *args, **kwargs): def get_value(arg): if arg in ['pod', 'project', 'case']: diff --git a/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py b/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py index 9a2bf58..97325e2 100644 --- a/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py +++ b/testapi/opnfv_testapi/tests/unit/handlers/test_testcase.py @@ -10,6 +10,7 @@ import httplib from opnfv_testapi.common import message from opnfv_testapi.models import testcase_models as tcm +from opnfv_testapi.models import result_models as rm from opnfv_testapi.tests.unit import executor from opnfv_testapi.tests.unit import fake_pymongo from opnfv_testapi.tests.unit.handlers import test_base as base @@ -32,6 +33,8 @@ class TestCaseBase(base.TestBase): self.basePath = '/api/v1/projects/%s/cases' fake_pymongo.projects.insert(self.project_e.format()) print self.req_d.format() + self.results_d = rm.ResultCreateRequest.from_dict( + self.load_json('test_result')) def assert_body(self, case, req=None): if not req: @@ -176,11 +179,21 @@ class TestCaseDelete(TestCaseBase): def setUp(self): super(TestCaseDelete, self).setUp() self.create_d() + fake_pymongo.pods.insert(self.pod_d.format()) + fake_pymongo.projects.insert({'name': self.results_d.project_name}) + fake_pymongo.testcases.insert({ + 'name': self.results_d.case_name, + 'project_name': self.results_d.project_name}) @executor.delete(httplib.NOT_FOUND, message.not_found_base) def test_notFound(self): return 'notFound' + @executor.delete(httplib.UNAUTHORIZED, message.tied_with_resource()) + def test_deleteNotAllowed(self): + print self.create_help('/api/v1/results', self.results_d) + return self.results_d.case_name + @executor.delete(httplib.OK, '_delete_success') def test_success(self): return self.req_d.name diff --git a/testapi/opnfv_testapi/ui/Gruntfile.js b/testapi/opnfv_testapi/ui/Gruntfile.js index d439764..805ad9f 100644 --- a/testapi/opnfv_testapi/ui/Gruntfile.js +++ b/testapi/opnfv_testapi/ui/Gruntfile.js @@ -130,7 +130,7 @@ module.exports = function (grunt) { }, local: { options: { - configFile: '../tests/UI/protractor-conf.js' + configFile: 'protractor-conf.js' } } }, diff --git a/testapi/opnfv_testapi/ui/app.js b/testapi/opnfv_testapi/ui/app.js index ae50166..ada7577 100644 --- a/testapi/opnfv_testapi/ui/app.js +++ b/testapi/opnfv_testapi/ui/app.js @@ -28,6 +28,42 @@ angular .module('testapiApp') + .service("keepState", function(){ + this.filter = {}; + }); + + angular + .module('testapiApp') + .service('sortService', function(){ + + this.sortFunction = function(data, field, ascending){ + if(ascending){ + data.sort(function(a,b) { + if (a[field].toLowerCase() > b[field].toLowerCase()) { + return -1; + } + if (a[field].toLowerCase() < b[field].toLowerCase()) { + return 1; + } + return 0; + }); + }else{ + data.sort(function(a,b) { + if (a[field].toLowerCase() < b[field].toLowerCase()) { + return -1; + } + if (a[field].toLowerCase() > b[field].toLowerCase()) { + return 1; + } + return 0; + }); + } + return data + } + }); + + angular + .module('testapiApp') .directive('dynamicModel', ['$compile', '$parse', function ($compile, $parse) { return { restrict: 'A', @@ -42,6 +78,21 @@ }; }]); + angular + .module('testapiApp') + .directive('ngEnter', function () { + return function (scope, element, attrs) { + element.bind("keydown keypress", function (event) { + if(event.which === 13) { + scope.$apply(function (){ + scope.$eval(attrs.ngEnter); + }); + event.preventDefault(); + } + }); + }; + }); + configureRoutes.$inject = ['$stateProvider', '$urlRouterProvider']; /** diff --git a/testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html b/testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html index 6fbaaea..380416f 100644 --- a/testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html +++ b/testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html @@ -15,7 +15,7 @@ <div class="col-sm-2 pull-right" ng-class="{'hidden': ctrl.filter=='start_date' || ctrl.filter=='end_date'}"> <span style="margin-top:6px">Search: </span> <input list="filter" name="filter" class="form-control search" style="display:inline;width:105px;padding-left:6px;" - ng-Model="ctrl.filterText" placeholder="Search String"> + ng-enter="ctrl.filterList()" ng-Model="ctrl.filterText" placeholder="Search String"> <datalist id="filter" ng-class="{ 'hidden' : ctrl.filterOption.length<0}"> <option ng-repeat="(index, filterValue) in ctrl.filterOption " value="{{filterValue}}">{{filterValue}}</option> </datalist> @@ -24,6 +24,7 @@ <span style="margin-top:6px">Start Date: </span> <p class="input-group" style="width:48%;display:inline-flex;"> <input type="text" class="form-control" + ng-enter="ctrl.filterList()" uib-datepicker-popup="{{ctrl.format}}" ng-model="ctrl.filterText" is-open="ctrl.startOpen" close-text="Close" /> @@ -38,6 +39,7 @@ <span style="margin-top:6px">End Date: </span> <p class="input-group" style="width:48%;display:inline-flex;"> <input type="text" class="form-control" + ng-enter="ctrl.filterList()" uib-datepicker-popup="{{ctrl.format}}" ng-model="ctrl.filterText" is-open="ctrl.endOpen" close-text="Close" /> diff --git a/testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js b/testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js index 5230a75..1128825 100644 --- a/testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js +++ b/testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js @@ -20,7 +20,8 @@ .controller('DeployResultsController', DeployResultsController); DeployResultsController.$inject = [ - '$scope', '$http', '$filter', '$state', 'testapiApiUrl','raiseAlert' + '$scope', '$http', '$filter', '$state', 'testapiApiUrl','raiseAlert', + 'keepState' ]; /** @@ -29,7 +30,7 @@ * a listing of community uploaded results. */ function DeployResultsController($scope, $http, $filter, $state, testapiApiUrl, - raiseAlert) { + raiseAlert, keepState) { var ctrl = this; ctrl.open = open; @@ -122,6 +123,15 @@ function filterList(){ if(ctrl.filter && ctrl.filterText!="" && ctrl.filterText!=undefined){ ctrl.tagArray[ctrl.filter] = ctrl.filterText; + if(!keepState.filter.deployResultFilter){ + keepState.filter.deployResultFilter = {} + } + keepState.filter.deployResultFilter[ctrl.filter] = ctrl.filterText + } + else if(Object.keys(ctrl.tagArray).length==0){ + if(keepState.filter.deployResultFilter){ + ctrl.tagArray = keepState.filter.deployResultFilter + } } ctrl.showError = false; var content_url = testapiApiUrl + '/deployresults' + diff --git a/testapi/opnfv_testapi/ui/components/pods/pod/pod.html b/testapi/opnfv_testapi/ui/components/pods/pod/pod.html index b78eb2d..6aace92 100644 --- a/testapi/opnfv_testapi/ui/components/pods/pod/pod.html +++ b/testapi/opnfv_testapi/ui/components/pods/pod/pod.html @@ -12,8 +12,8 @@ <td width="90%" class="podsTableLeftTd">{{ctrl.data.name}}</td> </tr> <tr style="padding:9px"> - <td class="podsTableTd">Owner :</td> - <td width="90%" class="podsTableLeftTd">{{ctrl.data.owner}}</td> + <td class="podsTableTd">Creator :</td> + <td width="90%" class="podsTableLeftTd">{{ctrl.data.creator}}</td> </tr> <tr style="padding:9px"> <td class="podsTableTd">Role :</td> diff --git a/testapi/opnfv_testapi/ui/components/pods/pods.html b/testapi/opnfv_testapi/ui/components/pods/pods.html index 4fa8fb1..8e66a9c 100644 --- a/testapi/opnfv_testapi/ui/components/pods/pods.html +++ b/testapi/opnfv_testapi/ui/components/pods/pods.html @@ -22,7 +22,7 @@ </div> <div class="col-sm-3 pull-right"> <span style="margin-top:6px">Search: </span> - <input type="text" class="form-control search" ng-Model="ctrl.filterText" placeholder="Search String"> + <input type="text" class="form-control search" ng-enter="ctrl.listPods()" ng-Model="ctrl.filterText" placeholder="Search String"> </div> </div> <div class="col-md-12"> @@ -42,9 +42,30 @@ <tr style=" text-align: center;"> <th style="width:1%">Bulk Select</th> - <th>Name</th> - <th>Role</th> - <th>Mode</th> + <th>Name + <a class="text-danger" ng-click="ctrl.sortBy('name')" ng-class="{ 'hidden': !ctrl.sorting['name'] }" > + <span class="glyphicon glyphicon-sort-by-alphabet pull-right" aria-hidden="true"></span> + </a> + <a class="text-danger" ng-click="ctrl.sortBy('name')" ng-class="{ 'hidden': ctrl.sorting['name'] }" > + <span class="glyphicon glyphicon-sort-by-alphabet-alt pull-right" aria-hidden="true"></span> + </a> + </th> + <th>Role + <a class="text-danger" ng-click="ctrl.sortBy('role')" ng-class="{ 'hidden': !ctrl.sorting['role']}" > + <span class="glyphicon glyphicon-sort-by-alphabet pull-right" aria-hidden="true"></span> + </a> + <a class="text-danger" ng-click="ctrl.sortBy('role')" ng-class="{ 'hidden': ctrl.sorting['role']}" > + <span class="glyphicon glyphicon-sort-by-alphabet-alt pull-right" aria-hidden="true"></span> + </a> + </th> + <th>Mode + <a class="text-danger" ng-click="ctrl.sortBy('mode')" ng-class="{ 'hidden': !ctrl.sorting['mode'] }" > + <span class="glyphicon glyphicon-sort-by-alphabet pull-right" aria-hidden="true"></span> + </a> + <a class="text-danger" ng-click="ctrl.sortBy('mode')" ng-class="{ 'hidden': ctrl.sorting['mode'] }" > + <span class="glyphicon glyphicon-sort-by-alphabet-alt pull-right" aria-hidden="true"></span> + </a> + </th> <th ng-class="{ 'hidden': !auth.isAuthenticated }">Operation</th> </tr> </thead> diff --git a/testapi/opnfv_testapi/ui/components/pods/podsController.js b/testapi/opnfv_testapi/ui/components/pods/podsController.js index 95e3571..f405ecb 100644 --- a/testapi/opnfv_testapi/ui/components/pods/podsController.js +++ b/testapi/opnfv_testapi/ui/components/pods/podsController.js @@ -21,7 +21,7 @@ PodsController.$inject = [ '$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert', - 'confirmModal' + 'confirmModal', 'keepState', 'sortService' ]; /** @@ -30,11 +30,12 @@ * through pods declared in TestAPI. */ function PodsController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl, - raiseAlert, confirmModal) { + raiseAlert, confirmModal, keepState, sortService) { var ctrl = this; ctrl.url = testapiApiUrl + '/pods'; ctrl.checkBox = [] ctrl.checkBoxList = []; + ctrl.sorting = {}; ctrl.create = create; ctrl.listPods = listPods; @@ -46,7 +47,12 @@ ctrl.podDelete = podDelete ctrl.batchDelete = batchDelete; ctrl.viewPod = viewPod - ctrl.filterText = '' + ctrl.sortBy = sortBy + + function sortBy(field){ + ctrl.data.pods = sortService.sortFunction(ctrl.data.pods, field , ctrl.sorting[field] ) + ctrl.sorting[field]=!ctrl.sorting[field] + } /** * This is called when the date filter calendar is opened. It @@ -68,7 +74,6 @@ function create(pod) { ctrl.showError = false; ctrl.showSuccess = false; - console.log(pod); if(pod.name != ""){ var pods_url = ctrl.url; var body = { @@ -99,12 +104,22 @@ function listPods() { ctrl.showError = false; var reqURL = ctrl.url; - if(ctrl.filterText!=''){ + if(ctrl.filterText!=undefined){ reqURL = ctrl.url + "?name=" + ctrl.filterText } + else if(keepState.filter.podFilter){ + for (var filter in keepState.filter.podFilter){ + reqURL = ctrl.url + '?' + filter + '=' + keepState.filter.podFilter[filter] + ctrl.filterText = keepState.filter.podFilter[filter] + } + } ctrl.podsRequest = $http.get(reqURL).success(function (data) { ctrl.data = data; + ctrl.sortBy("name") + keepState.filter.podFilter = { + 'name': ctrl.filterText + } }).catch(function (data) { ctrl.data = null; ctrl.showError = true; @@ -137,7 +152,6 @@ function batchDelete(){ var index; var checkedBox = []; - console.log(ctrl.checkBox) for(index in ctrl.checkBox){ if(!ctrl.showError){ if(ctrl.checkBox[index]){ @@ -153,7 +167,13 @@ * message */ function openBatchDeleteModal() { - confirmModal("Delete",ctrl.batchDelete); + var deleteObjects = [] + for(var index in ctrl.checkBox){ + if(ctrl.checkBox[index]){ + deleteObjects.push(ctrl.data.pods[index].name) + } + } + confirmModal("Delete", 'pods', ctrl.batchDelete, deleteObjects); } /** @@ -161,8 +181,7 @@ * message */ function openDeleteModal(name) { - console.log(name) - confirmModal("Delete", ctrl.podDelete, name); + confirmModal("Delete", 'pod', ctrl.podDelete, name); } /** diff --git a/testapi/opnfv_testapi/ui/components/projects/project/project.html b/testapi/opnfv_testapi/ui/components/projects/project/project.html index 2921bd9..b6a751c 100644 --- a/testapi/opnfv_testapi/ui/components/projects/project/project.html +++ b/testapi/opnfv_testapi/ui/components/projects/project/project.html @@ -25,8 +25,8 @@ <td width="90%" class="podsTableLeftTd">{{ctrl.data.name}}</td> </tr> <tr style="padding:9px"> - <td class="podsTableTd">Owner :</td> - <td width="90%" class="podsTableLeftTd">{{ctrl.data.owner}}</td> + <td class="podsTableTd">Creator :</td> + <td width="90%" class="podsTableLeftTd">{{ctrl.data.creator}}</td> </tr> <tr style="padding:9px"> <td class="podsTableTd">Created at :</td> diff --git a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html index 70c026a..f4bae41 100644 --- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html +++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html @@ -16,6 +16,10 @@ <td width="90%" class="podsTableLeftTd">{{ctrl.data.project_name}}</td> </tr> <tr style="padding:9px"> + <td class="podsTableTd">Creator :</td> + <td width="90%" class="podsTableLeftTd">{{ctrl.data.creator}}</td> + </tr> + <tr style="padding:9px"> <td class="podsTableTd">Tier :</td> <td width="90%" class="podsTableLeftTd">{{ctrl.data.tier}}</td> </tr> 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 6d3c245..9a865d3 100644 --- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js +++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js @@ -84,7 +84,15 @@ * message */ function openBatchDeleteModal() { - confirmModal("Delete",ctrl.batchDelete); + var deleteObjects = [] + ctrl.checkBox.forEach(function(testcase, index){ + if(!ctrl.showError){ + if(testcase){ + deleteObjects.push(ctrl.data.testcases[index].name) + } + } + }); + confirmModal("Delete", 'testcases', ctrl.batchDelete, deleteObjects); } /** @@ -149,7 +157,7 @@ * message */ function openDeleteTestModal(name) { - confirmModal("Delete", ctrl.deleteTestCase, name); + confirmModal("Delete", 'testcases', ctrl.deleteTestCase, name); } /** diff --git a/testapi/opnfv_testapi/ui/components/projects/projects.html b/testapi/opnfv_testapi/ui/components/projects/projects.html index b6b73d4..5d514d1 100644 --- a/testapi/opnfv_testapi/ui/components/projects/projects.html +++ b/testapi/opnfv_testapi/ui/components/projects/projects.html @@ -18,7 +18,7 @@ </div> <div class="col-sm-3 pull-right"> <span style="margin-top:6px">Search: </span> - <input type="text" class="form-control search" ng-Model="ctrl.filterText" style="width:80%;" placeholder="Search By Name"> + <input type="text" class="form-control search" ng-enter="ctrl.listProjects()" ng-Model="ctrl.filterText" style="width:80%;" placeholder="Search By Name"> </div> </div> <div class='clo-md-12'> @@ -38,7 +38,14 @@ <tr style=" text-align: center;"> <th style="width: 1%;">Bulk Select</th> - <th style="width: 19%;">Name</th> + <th style="width: 19%;">Name + <a class="text-danger" ng-click="ctrl.sortByName()" ng-class="{ 'hidden': !ctrl.sortName }" > + <span class="glyphicon glyphicon-sort-by-alphabet pull-right" aria-hidden="true"></span> + </a> + <a class="text-danger" ng-click="ctrl.sortByName()" ng-class="{ 'hidden': ctrl.sortName }" > + <span class="glyphicon glyphicon-sort-by-alphabet-alt pull-right" aria-hidden="true"></span> + </a> + </th> <th style="width: 70%;">Description</th> <th style="width: 10%;" ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated) && authenticate}">Operations</th> </tr> diff --git a/testapi/opnfv_testapi/ui/components/projects/projectsController.js b/testapi/opnfv_testapi/ui/components/projects/projectsController.js index 940c1e2..07a58fe 100644 --- a/testapi/opnfv_testapi/ui/components/projects/projectsController.js +++ b/testapi/opnfv_testapi/ui/components/projects/projectsController.js @@ -21,7 +21,7 @@ ProjectsController.$inject = [ '$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl', - 'raiseAlert', 'confirmModal', 'authenticate' + 'raiseAlert', 'confirmModal', 'authenticate', 'keepState', 'sortService' ]; /** @@ -30,7 +30,7 @@ * through projects declared in TestAPI. */ function ProjectsController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl, - raiseAlert, confirmModal, authenticate) { + raiseAlert, confirmModal, authenticate, keepState, sortService) { var ctrl = this; ctrl.url = testapiApiUrl + '/projects'; @@ -44,12 +44,13 @@ ctrl.openBatchDeleteModal = openBatchDeleteModal; ctrl.projectDelete = projectDelete; ctrl.batchDelete = batchDelete; + ctrl.sortByName = sortByName ctrl.checkBox = []; ctrl.checkBoxList = []; ctrl.name = ''; ctrl.details = ''; - ctrl.filterText=''; + ctrl.ascending = false; /** * This will contact the TestAPI to create a new project. @@ -73,6 +74,11 @@ }); } + function sortByName(){ + ctrl.data.projects = sortService.sortFunction(ctrl.data.projects, 'name', ctrl.ascending) + ctrl.ascending = !ctrl.ascending + } + /** * This will open the modal that will show the create * project view @@ -148,13 +154,22 @@ ctrl.showError = false; var content_url = ctrl.url + '?'; var filterText = ctrl.filterText; - if(filterText != ''){ + if(filterText != undefined){ content_url = content_url + 'name=' + filterText; } + else if(keepState.filter.projectFilter){ + for (var filter in keepState.filter.projectFilter){ + content_url = content_url + filter + '=' + keepState.filter.projectFilter[filter] + ctrl.filterText = keepState.filter.projectFilter[filter] + } + } ctrl.resultsRequest = $http.get(content_url).success(function (data) { ctrl.data = data; + keepState.filter.projectFilter = { + 'name': ctrl.filterText + } }).catch(function (data) { ctrl.data = null; ctrl.showError = true; @@ -204,7 +219,15 @@ * message */ function openBatchDeleteModal() { - confirmModal("Delete",ctrl.batchDelete); + var deleteObjects = [] + ctrl.checkBox.forEach(function(project, index){ + if(!ctrl.showError){ + if(project){ + deleteObjects.push(ctrl.data.projects[index].name) + } + } + }); + confirmModal("Delete", 'projects', ctrl.batchDelete, deleteObjects); } /** @@ -212,7 +235,7 @@ * message */ function openDeleteModal(name) { - confirmModal("Delete", ctrl.projectDelete, name); + confirmModal("Delete",'projects', ctrl.projectDelete, name); } ctrl.listProjects(); diff --git a/testapi/opnfv_testapi/ui/components/results/results.html b/testapi/opnfv_testapi/ui/components/results/results.html index b0c05ba..e1413d5 100644 --- a/testapi/opnfv_testapi/ui/components/results/results.html +++ b/testapi/opnfv_testapi/ui/components/results/results.html @@ -1,22 +1,5 @@ <h3>{{ctrl.pageHeader}}</h3> <p>{{ctrl.pageParagraph}}</p> -<form class="form-inline" ng-show="ctrl.isUserResults"> -<h4>Upload Results</h4> -<div class="form-group col-m-3"> - <input class="form-contrl btn btn-default" type = "file" file-model = "resultFile"/> -</div> -<div class="checkbox col-m-1"> - <label> - <input type="checkbox" ng-model="ctrl.isPublic">public - </label> -</div> -<div class="form-group col-m-3"> - <button class="btn btn-primary" ng-click = "ctrl.uploadFile()">upload result</button> -</div> -<div> -<lable>{{ctrl.uploadState}}</label> -</div> -</form> <div class="row" style="margin-bottom:24px;"></div> <div class="result-filters" style="border-top: none;"> <div class="row podTable" style="vertical-align:middle"> @@ -31,13 +14,17 @@ </div> <div class="col-sm-2 pull-right" ng-class="{'hidden': ctrl.filter=='start_date' || ctrl.filter=='end_date'}"> <span style="margin-top:6px">Search: </span> - <input type="text" class="form-control search" style="display:inline;width:105px;padding-left:6px;" + <input list="filter" ng-enter="ctrl.filterList()" name="filter" class="form-control search" style="display:inline;width:105px;padding-left:6px;" ng-Model="ctrl.filterText" placeholder="Search String"> + <datalist id="filter" ng-class="{ 'hidden' : ctrl.filterOption.length<0}"> + <option ng-repeat="(index, filterValue) in ctrl.filterOption " value="{{filterValue}}">{{filterValue}}</option> + </datalist> </div> <div class="col-sm-3 pull-right" style="width:20%" ng-class="{'hidden': ctrl.filter!='start_date'}"> <span style="margin-top:6px">Start Date: </span> <p class="input-group" style="width:48%;display:inline-flex;"> <input type="text" class="form-control" + ng-enter="ctrl.filterList()" uib-datepicker-popup="{{ctrl.format}}" ng-model="ctrl.filterText" is-open="ctrl.startOpen" close-text="Close" /> @@ -52,6 +39,7 @@ <span style="margin-top:6px">End Date: </span> <p class="input-group" style="width:48%;display:inline-flex;"> <input type="text" class="form-control" + ng-enter="ctrl.filterList()" uib-datepicker-popup="{{ctrl.format}}" ng-model="ctrl.filterText" is-open="ctrl.endOpen" close-text="Close" /> @@ -64,7 +52,7 @@ </div> <div class="col-md-2 row pull-right" style="width: 20%;"> <span style="margin-top:6px">Filter: </span> - <select ng-model="ctrl.filter" class="form-control" style="display:inline; width:150px;"> + <select ng-model="ctrl.filter" ng-change="ctrl.encodeFilter()" class="form-control" style="display:inline; width:150px;"> <option value="pod" ng-disabled="ctrl.testFilter('pod')" >Pod Name</option> <option value="project" ng-disabled="ctrl.testFilter('project')" >Project Name</option> <option value="case" ng-disabled="ctrl.testFilter('case')">Case Name</option> @@ -79,9 +67,9 @@ </div> <div class='filter-box'> - <div class='filter-tag' ng-repeat="(key, tag) in ctrl.tagArray"> + <div class='filter-tag col-md-1' ng-repeat="(key, tag) in ctrl.tagArray" style="background-color: #f5f5f5;border: 1px solid #e3e3e3;/* border: 1px; */margin-top: 3px;padding: 4px;margin-left: 15px;width: 13%;"> {{key}} : {{tag}} - <div class='delete-tag' ng-click='ctrl.deleteTag(key)'> + <div class='delete-tag btn btn-danger btn-xs' ng-click='ctrl.deleteTag(key)'> × </div> </div> @@ -143,4 +131,4 @@ <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <span class="sr-only">Error:</span> {{ctrl.error}} -</div> +</div>
\ No newline at end of file diff --git a/testapi/opnfv_testapi/ui/components/results/resultsController.js b/testapi/opnfv_testapi/ui/components/results/resultsController.js index 73f3c15..13ead6e 100644 --- a/testapi/opnfv_testapi/ui/components/results/resultsController.js +++ b/testapi/opnfv_testapi/ui/components/results/resultsController.js @@ -38,7 +38,8 @@ }]); ResultsController.$inject = [ - '$scope', '$http', '$filter', '$state', 'testapiApiUrl','raiseAlert' + '$scope', '$http', '$filter', '$state', 'testapiApiUrl', 'raiseAlert', + 'keepState' ]; /** @@ -47,7 +48,7 @@ * a listing of community uploaded results. */ function ResultsController($scope, $http, $filter, $state, testapiApiUrl, - raiseAlert) { + raiseAlert, keepState) { var ctrl = this; ctrl.open = open; @@ -56,8 +57,12 @@ ctrl.filterList= filterList; ctrl.testFilter = testFilter ctrl.viewResult = viewResult; + ctrl.filter = "pod" + ctrl.filterValue = "pod_name" + ctrl.encodeFilter = encodeFilter ctrl.tagArray = {} + ctrl.filterOption=[] /** Mappings of Interop WG components to marketing program names. */ ctrl.targetMappings = { @@ -121,6 +126,75 @@ // ctrl.filterList(); // } + function encodeFilter(){ + ctrl.filterText = '' + ctrl.filterOption=[] + if(ctrl.filter=="pod" || ctrl.filter=="project" || ctrl.filter=="scenario"){ + var reqURL = testapiApiUrl +"/" + ctrl.filter + "s" + ctrl.datasRequest = + $http.get(reqURL).success(function (data) { + ctrl.filterData = data; + for(var index in ctrl.filterData[ctrl.filter + "s"]){ + if( ctrl.filterOption.indexOf(ctrl.filterData[ctrl.filter + "s"][index]["name"]) < 0){ + ctrl.filterOption.push(ctrl.filterData[ctrl.filter + "s"][index]["name"]) + } + } + }).catch(function (data) { + ctrl.data = null; + ctrl.showError = true; + ctrl.error = data.statusText; + }); + + } + else if(ctrl.filter=="case"){ + if("project" in ctrl.tagArray){ + var reqURL = testapiApiUrl +"/projects/"+ctrl.tagArray["project"]+"/cases" + ctrl.dataRequest = + $http.get(reqURL).success(function (data) { + ctrl.filterData = data; + for(var index in ctrl.filterData.testcases){ + if( ctrl.filterOption.indexOf(ctrl.filterData.testcases[index]["name"]) < 0){ + ctrl.filterOption.push(ctrl.filterData.testcases[index]["name"]) + } + } + }).catch(function (data) { + ctrl.data = null; + ctrl.showError = true; + ctrl.error = data.statusText; + }); + + } + else{ + var reqURL = testapiApiUrl +"/projects" + ctrl.dataRequest = + $http.get(reqURL).success(function (data) { + ctrl.projectsData = data; + for(var indexP in ctrl.projectsData.projects){ + reqURL = testapiApiUrl +"/projects/" + ctrl.projectsData.projects[indexP]["name"] +"/cases" + ctrl.datasRequest = + $http.get(reqURL).success(function (data) { + ctrl.filterData = data; + for(var index in ctrl.filterData.testcases){ + if( ctrl.filterOption.indexOf(ctrl.filterData.testcases[index]["name"]) < 0){ + ctrl.filterOption.push(ctrl.filterData.testcases[index]["name"]) + } + } + }).catch(function (data) { + ctrl.data = null; + ctrl.showError = true; + ctrl.error = data.statusText; + }); + } + }).catch(function (data) { + ctrl.data = null; + ctrl.showError = true; + ctrl.error = data.statusText; + }); + } + + } + } + function viewResult(_id){ $state.go('result', {'_id':_id}, {reload: true}); } @@ -144,8 +218,17 @@ * results. */ function filterList(){ - if(ctrl.filter && ctrl.filterText!=""){ + if(ctrl.filter && ctrl.filterText!="" && ctrl.filterText!=undefined){ ctrl.tagArray[ctrl.filter] = ctrl.filterText; + if(!keepState.filter.resultFilter){ + keepState.filter.resultFilter = {} + } + keepState.filter.resultFilter[ctrl.filter] = ctrl.filterText + } + else if(Object.keys(ctrl.tagArray).length==0){ + if(keepState.filter.resultFilter){ + ctrl.tagArray = keepState.filter.resultFilter + } } ctrl.showError = false; var content_url = testapiApiUrl + '/results' + @@ -176,6 +259,7 @@ ctrl.data = data; ctrl.totalItems = ctrl.data.pagination.total_pages * ctrl.itemsPerPage; ctrl.currentPage = ctrl.data.pagination.current_page; + ctrl.encodeFilter(); }).error(function (error) { ctrl.data = null; ctrl.totalItems = 0; @@ -186,8 +270,10 @@ }); ctrl.filterText = '' } + ctrl.filterList(); + /** * This is called when the date filter calendar is opened. It * does some event handling, and sets a scope variable so the UI @@ -208,7 +294,8 @@ function clearFilters() { ctrl.tagArray = {} ctrl.filter = undefined + keepState.filter.resultFilter = {} ctrl.filterList(); } } -})(); +})();
\ No newline at end of file diff --git a/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html b/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html index 987cb1e..0cd2663 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html +++ b/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html @@ -6,11 +6,19 @@ <legend>{{customModalCtrl.data.text}}</legend> <div class="row"> <div class="update-project"> - <label for="cpid" class="control-label col-sm-4">Custom: </label> - <div class="col-sm-6"> - <input type="text" class="form-control" ng-model="customModalCtrl.custom"/> - <p class="help-block"></p> - </div> + <label for="cpid" class="control-label col-sm-4">Custom: </label> + <table cellpadding="0" cellspacing="0"> + <tbody> + <tr> + <td> + <div class="col-sm-12"> + <input type="text" class="form-control" ng-model="customModalCtrl.custom"/> + <p class="help-block"></p> + </div> + </td> + </tr> + </tbody> + </table> </div> </div> </div> diff --git a/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html b/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html index 0a14be9..171cc33 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html +++ b/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html @@ -38,7 +38,7 @@ </tr> </thead> <tbody> - <tr ng-repeat-start="(index, custom) in projectModalCtrl.project.customs" style="padding:9px"> + <tr ng-repeat-start="custom in projectModalCtrl.project.customs" style="padding:9px"> <td>{{custom}}</td> </tr> <tr ng-repeat-end=> diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html index 2a73e9b..4f0a580 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html @@ -12,6 +12,10 @@ <td width="90%" class="podsTableLeftTd">{{ctrl.data.scenarios[0].name}}</td> </tr> <tr style="padding:9px"> + <td class="podsTableTd">Creator :</td> + <td width="90%" class="podsTableLeftTd">{{ctrl.data.scenarios[0].creator}}</td> + </tr> + <tr style="padding:9px"> <td class="podsTableTd">Created at :</td> <td width="90%" class="podsTableLeftTd">{{ctrl.data.scenarios[0].creation_date}}</td> </tr> diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js index 9935649..a0cd5eb 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js @@ -219,7 +219,7 @@ var data = { "installers": installers } - confirmModal("Delete",ctrl.deleteInstaller,data); + confirmModal("Delete", 'installers', ctrl.deleteInstaller, data); } function addInstaller(installer){ @@ -273,7 +273,7 @@ "version": versions, "installer": installer } - confirmModal("Delete",ctrl.deleteVersion,data); + confirmModal("Delete", "version", ctrl.deleteVersion, data); } function deleteVersion(data){ @@ -359,7 +359,7 @@ "version": version, "installer": installer } - confirmModal("Delete",ctrl.deleteCustom,data); + confirmModal("Delete", 'customs', ctrl.deleteCustom, data); } function deleteCustom(data){ @@ -402,7 +402,7 @@ "version": version, "installer": installer } - confirmModal("Delete",ctrl.deleteProject,data); + confirmModal("Delete", 'projects', ctrl.deleteProject, data); } function deleteProject(data){ @@ -434,16 +434,15 @@ ctrl.confirm = confirm; ctrl.cancel = cancel; ctrl.data = angular.copy(data); - ctrl.open = open; + ctrl.customs = []; - /** - * Initiate confirmation and call the success handler with the - * inputs. - */ function confirm() { - ctrl.customs = [] - ctrl.customs.push(ctrl.custom) + var custom = ctrl.custom; + if(custom!="" && custom!=undefined ){ + ctrl.customs = custom.split(/[ ,]+/).filter(Boolean); + } + console.log(ctrl.customs) ctrl.data.successHandler(ctrl.customs,ctrl.data.project,ctrl.data.version,ctrl.data.installer); $uibModalInstance.dismiss('cancel'); diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js index fd137e5..98e4089 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js @@ -65,7 +65,7 @@ } function openDeleteModal(name){ - confirmModal("Delete",ctrl.deleteScenario,name); + confirmModal("Delete", 'scenarios', ctrl.deleteScenario,name); } function deleteScenario(name){ @@ -82,15 +82,23 @@ } function openBatchDeleteModal(){ - confirmModal("Delete",ctrl.deleteBatchScenario); + var deleteObjects = [] + ctrl.checkBox.forEach(function(scenario, index){ + if(!ctrl.showError){ + if(scenario){ + deleteObjects.push(ctrl.data.scenarios[index].name); + } + } + }); + confirmModal("Delete", 'scenarios', ctrl.deleteBatchScenario, deleteObjects); } function deleteBatchScenario(){ var index; var checkedBox = []; - ctrl.checkBox.forEach(function(project, index){ + ctrl.checkBox.forEach(function(scenario, index){ if(!ctrl.showError){ - if(project){ + if(scenario){ deleteScenario(ctrl.data.scenarios[index].name); } } @@ -119,7 +127,6 @@ } function createScenario(scenario) { - console.log(scenario) ctrl.scenarioRequest = $http.post(ctrl.url, scenario).success(function (data){ ctrl.showCreateSuccess = true; @@ -262,7 +269,6 @@ } function openVersionModal(){ - console.log("Hello"); $uibModal.open({ templateUrl: 'testapi-ui/components/scenarios/modals/versionModal.html', controller: 'versionModalCtrl as versionModalCtrl', @@ -375,8 +381,10 @@ $uibModalInstance.dismiss('cancel'); } - function handleModalCustom(custom){ - ctrl.project.customs.push(custom); + function handleModalCustom(customs){ + for (var custom in customs){ + ctrl.project.customs.push(customs[custom]); + } } function openCustomModal(){ @@ -410,6 +418,7 @@ ctrl.cancel = cancel; ctrl.data = angular.copy(data); ctrl.open = open; + ctrl.customs = [] /** @@ -417,7 +426,11 @@ * inputs. */ function confirm() { - ctrl.data.successHandler(ctrl.custom); + var custom = ctrl.custom; + if(custom!="" && custom!=undefined ){ + ctrl.customs = custom.split(/[ ,]+/).filter(Boolean); + } + ctrl.data.successHandler(ctrl.customs); $uibModalInstance.dismiss('cancel'); } diff --git a/testapi/opnfv_testapi/tests/UI/protractor-conf.js b/testapi/opnfv_testapi/ui/protractor-conf.js index affbe5d..affbe5d 100644 --- a/testapi/opnfv_testapi/tests/UI/protractor-conf.js +++ b/testapi/opnfv_testapi/ui/protractor-conf.js diff --git a/testapi/opnfv_testapi/ui/shared/alerts/confirmModal.html b/testapi/opnfv_testapi/ui/shared/alerts/confirmModal.html index e5397e0..417af37 100644 --- a/testapi/opnfv_testapi/ui/shared/alerts/confirmModal.html +++ b/testapi/opnfv_testapi/ui/shared/alerts/confirmModal.html @@ -10,7 +10,7 @@ </div> <div class="Delete" ng-class="{ 'hidden': confirmModal.data.text!='Delete' }"> <div class="form-group"> - <label for="confirmText"> You are about to delete.</label> + <label for="confirmText"> You are about to delete following {{confirmModal.data.resource}} : {{confirmModal.deleteObjects}} </label> <br> Do you want to proceed? </div> diff --git a/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js b/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js index 5e79775..0286341 100644 --- a/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js +++ b/testapi/opnfv_testapi/ui/shared/alerts/confirmModalFactory.js @@ -11,17 +11,19 @@ * Opens confirm modal dialog with input textbox */ function confirmModal($uibModal) { - return function(text, successHandler, name) { + return function(text, resource, successHandler, name) { $uibModal.open({ - templateUrl: '/testapi-ui/shared/alerts/confirmModal.html', + templateUrl: 'testapi-ui/shared/alerts/confirmModal.html', controller: 'CustomConfirmModalController as confirmModal', size: 'md', resolve: { data: function () { return { text: text, + resource: resource, successHandler: successHandler, name: name + }; } } @@ -44,8 +46,37 @@ ctrl.confirm = confirm; ctrl.cancel = cancel; - + ctrl.buildDeleteObjects = buildDeleteObjects; ctrl.data = angular.copy(data); + + function buildDeleteObjects(){ + ctrl.deleteObjects = ''; + if (typeof ctrl.data.name === 'string') { + ctrl.deleteObjects = ctrl.data.name + } + else if (ctrl.data.name instanceof Array){ + for(var index in ctrl.data.name){ + if(index==0){ + ctrl.deleteObjects += ctrl.data.name[index] + } + else{ + ctrl.deleteObjects += ", "+ ctrl.data.name[index] + } + + } + } + else{ + for(var index in ctrl.data.name[ctrl.data.resource]){ + if(index==0){ + ctrl.deleteObjects += ctrl.data.name[ctrl.data.resource][index] + } + else{ + ctrl.deleteObjects += ", "+ ctrl.data.name[ctrl.data.resource][index] + } + + } + } + } /** * Initiate confirmation and call the success handler with the * input text. @@ -63,5 +94,7 @@ function cancel() { $uibModalInstance.dismiss('cancel'); } + + ctrl.buildDeleteObjects(); } })(); diff --git a/testapi/testapi-client/.stestr.conf b/testapi/testapi-client/.stestr.conf new file mode 100644 index 0000000..cdadb67 --- /dev/null +++ b/testapi/testapi-client/.stestr.conf @@ -0,0 +1,2 @@ +[DEFAULT] +test_path=${TEST_PATH:-./testapiclient/tests/unit} diff --git a/testapi/testapi-client/__init__.py b/testapi/testapi-client/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/testapi/testapi-client/__init__.py diff --git a/testapi/testapi-client/etc/client.creds b/testapi/testapi-client/etc/client.creds new file mode 100644 index 0000000..a082047 --- /dev/null +++ b/testapi/testapi-client/etc/client.creds @@ -0,0 +1,3 @@ +export testapi_url=http://localhost:8000/api/v1 +export testapi_cas_signin_return=/auth/signin_return +export testapi_cas_auth_url=https://identity.linuxfoundation.org/user/login?destination=cas/login%3Fservice%3D
\ No newline at end of file diff --git a/testapi/testapi-client/requirements.txt b/testapi/testapi-client/requirements.txt new file mode 100644 index 0000000..0c6ef77 --- /dev/null +++ b/testapi/testapi-client/requirements.txt @@ -0,0 +1,8 @@ +setuptools>=16.0,!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2 # PSF/ZPL + +pbr>=2.0.0,!=2.1.0 # Apache-2.0 +cmd2>=0.6.7 # MIT +PrettyTable<0.8,>=0.7.1 # BSD +pyparsing>=2.1.0 # MIT +six>=1.10.0 # MIT +cliff
\ No newline at end of file diff --git a/testapi/testapi-client/setup.cfg b/testapi/testapi-client/setup.cfg new file mode 100644 index 0000000..72a5a57 --- /dev/null +++ b/testapi/testapi-client/setup.cfg @@ -0,0 +1,32 @@ +[metadata] +name = testapi-client + +[global] +setup-hooks = + pbr.hooks.setup_hook + +[files] +packages = + testapiclient + +[entry_points] +console_scripts = + testapi = testapiclient.main:main + +testapi = + auth = testapiclient.cli.auth:Auth + pod create = testapiclient.cli.pods:PodCreate + pod get = testapiclient.cli.pods:PodGet + pod delete = testapiclient.cli.pods:PodDelete + pod getone = testapiclient.cli.pods:PodGetOne + + project create = testapiclient.cli.projects:ProjectCreate + project get = testapiclient.cli.projects:ProjectGet + project getone = testapiclient.cli.projects:ProjectGetOne + project delete = testapiclient.cli.projects:ProjectDelete + project put = testapiclient.cli.projects:ProjectPut + +[egg_info] +tag_build = +tag_date = 0 +tag_svn_revision = 0 diff --git a/testapi/testapi-client/setup.py b/testapi/testapi-client/setup.py new file mode 100644 index 0000000..96b6dbf --- /dev/null +++ b/testapi/testapi-client/setup.py @@ -0,0 +1,11 @@ + +import setuptools + +try: + import multiprocessing # noqa +except ImportError: + pass + +setuptools.setup( + setup_requires=['pbr>=2.0.0'], + pbr=True) diff --git a/testapi/testapi-client/test-requirements.txt b/testapi/testapi-client/test-requirements.txt new file mode 100644 index 0000000..4c62871 --- /dev/null +++ b/testapi/testapi-client/test-requirements.txt @@ -0,0 +1,2 @@ +stestr>=1.0.0 # Apache-2.0 +testtools>=2.2.0 # MIT
\ No newline at end of file diff --git a/testapi/testapi-client/testapiclient/__init__.py b/testapi/testapi-client/testapiclient/__init__.py new file mode 100644 index 0000000..363bc38 --- /dev/null +++ b/testapi/testapi-client/testapiclient/__init__.py @@ -0,0 +1,8 @@ +############################################################################## +# Copyright (c) 2016 ZTE Corporation +# feng.xiaowei@zte.com.cn +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## diff --git a/testapi/testapi-client/testapiclient/cli/__init__.py b/testapi/testapi-client/testapiclient/cli/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/testapi/testapi-client/testapiclient/cli/__init__.py diff --git a/testapi/testapi-client/testapiclient/cli/auth.py b/testapi/testapi-client/testapiclient/cli/auth.py new file mode 100644 index 0000000..434c55a --- /dev/null +++ b/testapi/testapi-client/testapiclient/cli/auth.py @@ -0,0 +1,14 @@ +from testapiclient.utils import command +from testapiclient.utils import identity + + +class Auth(command.Command): + "Handle Authentication for users" + + def get_parser(self, prog_name): + parser = super(Auth, self).get_parser(prog_name) + return parser + + @identity.authenticate + def take_action(self, parsed_args): + print "Authentication has been successful!" diff --git a/testapi/testapi-client/testapiclient/cli/pods.py b/testapi/testapi-client/testapiclient/cli/pods.py new file mode 100644 index 0000000..cdedc3e --- /dev/null +++ b/testapi/testapi-client/testapiclient/cli/pods.py @@ -0,0 +1,78 @@ +import json + +from testapiclient.utils import command +from testapiclient.utils import http_client as client +from testapiclient.utils import identity +from testapiclient.utils import url_parse + + +def pods_url(): + return url_parse.resource_join('pods') + + +def pod_url(parsed_args): + return url_parse.path_join(pods_url(), parsed_args.name) + + +class PodGet(command.Lister): + "Handle get request for pods" + + def get_parser(self, prog_name): + parser = super(PodGet, self).get_parser(prog_name) + parser.add_argument('-name', + default='', + help='Search pods using name') + return parser + + def take_action(self, parsed_args): + self.show(client.get(self.filter_by_name(pods_url(), parsed_args))) + + +class PodGetOne(command.ShowOne): + "Handle get request for pod by name" + + def get_parser(self, prog_name): + parser = super(PodGetOne, self).get_parser(prog_name) + parser.add_argument('name', + default='', + help='Find pod using name') + return parser + + def take_action(self, parsed_args): + self.show(client.get(pod_url(parsed_args))) + + +class PodCreate(command.Command): + "Handle post request for pods" + + def get_parser(self, prog_name): + parser = super(PodCreate, self).get_parser(prog_name) + parser.add_argument('pod', + type=json.loads, + help='Pod create request format :\n' + '\'{"role": "", "name": "", "details": "", ' + '"mode": ""}\',\n role should be either ' + '"community-ci" or "production-ci", and ' + 'mode should be either "metal" or "virtual.') + return parser + + @identity.authenticate + def take_action(self, parsed_args): + self.show('Create', + client.post(pods_url(), parsed_args.pod)) + + +class PodDelete(command.Command): + "Handle delete request for pods" + + def get_parser(self, prog_name): + parser = super(PodDelete, self).get_parser(prog_name) + parser.add_argument('name', + type=str, + help='Delete pods using name') + return parser + + @identity.authenticate + def take_action(self, parsed_args): + self.show('Delete', + client.delete(pod_url(parsed_args))) diff --git a/testapi/testapi-client/testapiclient/cli/projects.py b/testapi/testapi-client/testapiclient/cli/projects.py new file mode 100644 index 0000000..113b030 --- /dev/null +++ b/testapi/testapi-client/testapiclient/cli/projects.py @@ -0,0 +1,95 @@ +import json + +from testapiclient.utils import command +from testapiclient.utils import http_client as client +from testapiclient.utils import identity +from testapiclient.utils import url_parse + + +def projects_url(): + return url_parse.resource_join('projects') + + +def project_url(parsed_args): + return url_parse.path_join(projects_url(), parsed_args.name) + + +class ProjectGet(command.Lister): + + def get_parser(self, prog_name): + parser = super(ProjectGet, self).get_parser(prog_name) + parser.add_argument('-name', + default='', + help='Search projects by name') + return parser + + def take_action(self, parsed_args): + self.show(client.get(self.filter_name(projects_url(), parsed_args))) + + +class ProjectGetOne(command.ShowOne): + + def get_parser(self, prog_name): + parser = super(ProjectGetOne, self).get_parser(prog_name) + parser.add_argument('-name', + default='', + required=True, + help='Search project by name') + return parser + + def take_action(self, parsed_args): + self.show(client.get(project_url(parsed_args))) + + +class ProjectCreate(command.Command): + + def get_parser(self, prog_name): + parser = super(ProjectCreate, self).get_parser(prog_name) + parser.add_argument('project', + type=json.loads, + help='Project create request format :{' + ' "name": (required)"", ' + '"description": (optional)""}') + return parser + + @identity.authenticate + def take_action(self, parsed_args): + self.show('Create', + client.post(projects_url(), parsed_args.project)) + + +class ProjectDelete(command.Command): + + def get_parser(self, prog_name): + parser = super(ProjectDelete, self).get_parser(prog_name) + parser.add_argument('-name', + type=str, + required=True, + help='Delete project by name') + return parser + + @identity.authenticate + def take_action(self, parsed_args): + self.show('Delete', + client.delete(project_url(parsed_args))) + + +class ProjectPut(command.Command): + + def get_parser(self, prog_name): + parser = super(ProjectPut, self).get_parser(prog_name) + parser.add_argument('-name', + type=str, + required=True, + help='Update project by name') + parser.add_argument('project', + type=json.loads, + help='Project Update request format :{' + '"name": (required)"", ' + '"description": (optional)""}') + return parser + + @identity.authenticate + def take_action(self, parsed_args): + self.show('Update', + client.put(project_url(parsed_args), parsed_args.project)) diff --git a/testapi/testapi-client/testapiclient/main.py b/testapi/testapi-client/testapiclient/main.py new file mode 100644 index 0000000..dfa6284 --- /dev/null +++ b/testapi/testapi-client/testapiclient/main.py @@ -0,0 +1,39 @@ +import sys + +from cliff import app +from cliff import commandmanager +import requests + +from testapiclient.utils import user + + +class TestAPIClient(app.App): + + def __init__(self): + super(TestAPIClient, self).__init__( + description='TestAPI Client', + version='0.1', + command_manager=commandmanager.CommandManager('testapi'), + deferred_help=True, + ) + user.User.session = requests.Session() + + def initialize_app(self, argv): + self.LOG.debug('initialize_app') + + def prepare_to_run_command(self, cmd): + self.LOG.debug('prepare_to_run_command %s', cmd.__class__.__name__) + + def clean_up(self, cmd, result, err): + self.LOG.debug('clean_up %s', cmd.__class__.__name__) + if err: + self.LOG.debug('got an error: %s', err) + + +def main(argv=sys.argv[1:]): + myapp = TestAPIClient() + return myapp.run(argv) + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/testapi/testapi-client/testapiclient/tests/__init__.py b/testapi/testapi-client/testapiclient/tests/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/testapi/testapi-client/testapiclient/tests/__init__.py diff --git a/testapi/testapi-client/testapiclient/tests/unit/__init__.py b/testapi/testapi-client/testapiclient/tests/unit/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/testapi/testapi-client/testapiclient/tests/unit/__init__.py diff --git a/testapi/testapi-client/testapiclient/tests/unit/test_placeholder.py b/testapi/testapi-client/testapiclient/tests/unit/test_placeholder.py new file mode 100644 index 0000000..2b7ad46 --- /dev/null +++ b/testapi/testapi-client/testapiclient/tests/unit/test_placeholder.py @@ -0,0 +1,6 @@ +import testtools + + +class TestPlaceHolder(testtools.TestCase): + def test_placeholder(self): + self.assertEqual(1, 1) diff --git a/testapi/testapi-client/testapiclient/utils/__init__.py b/testapi/testapi-client/testapiclient/utils/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/testapi/testapi-client/testapiclient/utils/__init__.py diff --git a/testapi/testapi-client/testapiclient/utils/command.py b/testapi/testapi-client/testapiclient/utils/command.py new file mode 100644 index 0000000..f9c75a7 --- /dev/null +++ b/testapi/testapi-client/testapiclient/utils/command.py @@ -0,0 +1,41 @@ +from cliff import command + +from testapiclient.utils import url_parse + + +class Command(command.Command): + def get_parser(self, prog_name): + parser = super(Command, self).get_parser(prog_name) + parser.add_argument('-u', + type=str, + help='Username for authentication') + parser.add_argument('-p', + type=str, + help='Password for authentication') + + return parser + + def show(self, request, response): + print ' '.join([request, + 'success' if response.status_code < 300 + else 'failed: {}'.format(response.reason)]) + + +class Lister(command.Command): + + @staticmethod + def filter_by_name(url, parsed_args): + def query_url(): + return url_parse.query_join(url, name=parsed_args.name) + + return query_url() if parsed_args.name else url + + def show(self, response): + print response.json() if response.status_code < 300 \ + else 'Get failed: {}'.format(response.reason) + + +class ShowOne(command.Command): + def show(self, response): + print response.json() if response.status_code < 300 \ + else 'Get failed: {}'.format(response.reason) diff --git a/testapi/testapi-client/testapiclient/utils/http_client.py b/testapi/testapi-client/testapiclient/utils/http_client.py new file mode 100644 index 0000000..6be33ee --- /dev/null +++ b/testapi/testapi-client/testapiclient/utils/http_client.py @@ -0,0 +1,68 @@ +import json + +import requests + +from testapiclient.utils import user + + +class HTTPClient(object): + + __instance = None + headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} + + @staticmethod + def get_Instance(): + """ Static access method. """ + if HTTPClient.__instance is None: + HTTPClient() + return HTTPClient.__instance + + def __init__(self): + """ Virtually private constructor. """ + if HTTPClient.__instance is not None: + raise Exception("This class is a singleton!") + else: + HTTPClient.__instance = self + + def get(self, url): + return requests.get(url) + + def post(self, url, data): + return self._request('post', url, + data=json.dumps(data), + headers=self.headers) + + def put(self, url, data): + return self._request('put', url, + data=json.dumps(data), + headers=self.headers) + + def delete(self, url, *args): + data = json.dumps(args[0]) if len(args) > 0 else None + return self._request('delete', url, + data=data, + headers=self.headers) + + def _request(self, method, *args, **kwargs): + return getattr(user.User.session, method)(*args, **kwargs) + + +def _request(method, *args, **kwargs): + client = HTTPClient.get_Instance() + return getattr(client, method)(*args, **kwargs) + + +def get(url): + return _request('get', url) + + +def post(url, data): + return _request('post', url, data) + + +def put(url, data): + return _request('put', url, data) + + +def delete(url, data=None): + return _request('delete', url, data) diff --git a/testapi/testapi-client/testapiclient/utils/identity.py b/testapi/testapi-client/testapiclient/utils/identity.py new file mode 100644 index 0000000..2aeb87a --- /dev/null +++ b/testapi/testapi-client/testapiclient/utils/identity.py @@ -0,0 +1,38 @@ +import functools +import os +import urllib + +import requests + +from testapiclient.utils import user + + +def _authenticate(username, password): + session = requests.Session() + hostname = '{}{}{}'.format(os.environ.get('testapi_cas_auth_url'), + urllib.quote(os.environ.get('testapi_url')), + os.environ.get('testapi_cas_signin_return')) + data = { + 'name': username, + 'pass': password, + 'form_id': 'user_login' + } + response = session.post(hostname, data) + if "login" not in response.text: + user.User.session = session + return response + + +def authenticate(xstep): + @functools.wraps(xstep) + def wrapper(self, parsed_args): + if(user.User.session is None): + username = parsed_args.u + password = parsed_args.p + if(username and password): + response = _authenticate(username, password) + if "login" in response.text: + print "Authentication has failed." + return + xstep(self, parsed_args) + return wrapper diff --git a/testapi/testapi-client/testapiclient/utils/url_parse.py b/testapi/testapi-client/testapiclient/utils/url_parse.py new file mode 100644 index 0000000..08f7a63 --- /dev/null +++ b/testapi/testapi-client/testapiclient/utils/url_parse.py @@ -0,0 +1,22 @@ +import os + +from six.moves.urllib import parse + + +def path_join(base, *urls): + def _path_join(base, url): + if not base.endswith('/'): + base += '/' + return parse.urljoin(base, url) + + urls = (base,) + urls + return reduce(_path_join, urls) + + +def query_join(base, **queries): + return base + '?' + parse.urlencode(queries) + + +def resource_join(url): + testapi_url = os.environ.get('testapi_url') + return path_join(testapi_url, url) diff --git a/testapi/testapi-client/testapiclient/utils/user.py b/testapi/testapi-client/testapiclient/utils/user.py new file mode 100644 index 0000000..7e72163 --- /dev/null +++ b/testapi/testapi-client/testapiclient/utils/user.py @@ -0,0 +1,2 @@ +class User(): + session = None diff --git a/testapi/testapi-client/tox.ini b/testapi/testapi-client/tox.ini new file mode 100644 index 0000000..51c3d57 --- /dev/null +++ b/testapi/testapi-client/tox.ini @@ -0,0 +1,34 @@ +# Tox (http://tox.testrun.org/) is a tool for running tests +# in multiple virtualenvs. This configuration file will run the +# test suite on all supported python versions. To use it, "pip install tox" +# and then run "tox" from this directory. + +[tox] +envlist = pep8,py27 +skipsdist = True +sitepackages = True + +[testenv] +usedevelop = True +install_command = pip install -U {opts} {packages} +deps = + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +setenv= + HOME = {envtmpdir} + PYTHONPATH = {toxinidir} +commands = stestr run {posargs} +whitelist_externals = stestr + +[testenv:pep8] +deps = flake8 +commands = flake8 {toxinidir} + +[flake8] +# H803 skipped on purpose per list discussion. +# E123, E125 skipped as they are invalid PEP-8. + +show-source = True +ignore = E123,E125,H803 +builtins = _ +exclude = bin, build, dist, lib, local, .git, .eggs, .tox, .venv, venv, testapi_client.egg-info
\ No newline at end of file diff --git a/testapi/tox.ini b/testapi/tox.ini index 13b197c..e15deea 100644 --- a/testapi/tox.ini +++ b/testapi/tox.ini @@ -38,7 +38,7 @@ commands = flake8 {toxinidir} # E123, E125 skipped as they are invalid PEP-8. show-source = True -ignore = E123,E125,H803,E501 +ignore = E123,E125,H803 builtins = _ exclude = build,dist,doc,legacy,.eggs,.git,.tox,.venv,testapi_venv,venv |