From 71891b3040605103397ffa7fb349215eced3a2c3 Mon Sep 17 00:00:00 2001 From: Edan Binshtok Date: Sun, 19 Nov 2017 11:50:50 +0200 Subject: Pep8 another fixes Add more fixes to pep8 Issue-ID: VVP-25 Change-Id: Icc3bd3977ced2b537c858a9801e04a6bf6d1db05 Signed-off-by: Edan Binshtok --- tests/__init__.py | 4 +- tests/apiTests/__init__.py | 4 +- tests/apiTests/test_api_base.py | 29 ++- tests/apiTests/test_negative_requests.py | 151 ++++++++----- tests/signalTests/__init__.py | 4 +- tests/signalTests/test_checklist_signal.py | 10 +- tests/signalTests/test_git_signal.py | 198 +++++++++++------ tests/signalTests/test_signal_base.py | 29 ++- tests/uiTests/__init__.py | 4 +- tests/uiTests/test_admin_dropdown.py | 34 +-- tests/uiTests/test_admin_section.py | 26 ++- tests/uiTests/test_bucket_e2e.py | 10 +- tests/uiTests/test_bucket_url.py | 4 +- tests/uiTests/test_checklist_validations.py | 61 ++++-- .../uiTests/test_cms_news_and_announcementsion.py | 78 ++++--- tests/uiTests/test_dashboard_feature.py | 6 +- tests/uiTests/test_detailed_view.py | 222 +++++++++++-------- tests/uiTests/test_edit_checklist_template.py | 15 +- tests/uiTests/test_export_excel.py | 53 ++--- tests/uiTests/test_feedback_modal.py | 15 +- .../uiTests/test_invitations_and_throttle_logic.py | 140 ++++++------ tests/uiTests/test_left_nav_panel.py | 64 ++++-- tests/uiTests/test_login_with_new_user.py | 238 +++++++++++++++------ tests/uiTests/test_next_step.py | 57 +++-- tests/uiTests/test_notification_for_new_user.py | 95 ++++---- tests/uiTests/test_overview.py | 3 +- tests/uiTests/test_portal_homepage.py | 9 +- tests/uiTests/test_progress_bar.py | 3 +- tests/uiTests/test_rados_perms.py | 37 ++-- tests/uiTests/test_remove_user_from_eng.py | 116 ++++++---- tests/uiTests/test_reset_password.py | 28 ++- tests/uiTests/test_rgwa_credentials.py | 4 +- tests/uiTests/test_sanity.py | 48 +++-- tests/uiTests/test_set_stage.py | 117 ++++++---- tests/uiTests/test_ssh_key.py | 13 +- tests/uiTests/test_ui_base.py | 119 ++++++----- tests/uiTests/test_user_profile_settings.py | 17 +- tests/uiTests/test_validate_signup.py | 115 +++++----- 38 files changed, 1378 insertions(+), 802 deletions(-) (limited to 'tests') diff --git a/tests/__init__.py b/tests/__init__.py index 30d7152..32b601a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. diff --git a/tests/apiTests/__init__.py b/tests/apiTests/__init__.py index 30d7152..32b601a 100644 --- a/tests/apiTests/__init__.py +++ b/tests/apiTests/__init__.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. diff --git a/tests/apiTests/test_api_base.py b/tests/apiTests/test_api_base.py index 55269e3..5fad138 100644 --- a/tests/apiTests/test_api_base.py +++ b/tests/apiTests/test_api_base.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -88,14 +88,27 @@ class TestApiBase(TestCase, Helper): @logFuncEntry def results(self): - params = {"testType": "E2E Test", "testFeature": self.className, - "testResult": "PASS", "testName": self.funcName, "duration": self.testDuration} + params = { + "testType": "E2E Test", + "testFeature": self.className, + "testResult": "PASS", + "testName": self.funcName, + "duration": self.testDuration} if (session.errorCounter == 0): - DBGeneral.insert_results(params["testType"], params["testFeature"], params[ - "testResult"], params["testName"], params['duration']) + DBGeneral.insert_results( + params["testType"], + params["testFeature"], + params["testResult"], + params["testName"], + params['duration']) else: params["testResult"] = "FAIL" # Mark test as fail. # Add the errors to notes column in table. params["notes"] = session.errorList - DBGeneral.insert_results(params["testType"], params["testFeature"], params[ - "testResult"], params["testName"], params['duration'], params["notes"]) + DBGeneral.insert_results( + params["testType"], + params["testFeature"], + params["testResult"], + params["testName"], + params['duration'], + params["notes"]) diff --git a/tests/apiTests/test_negative_requests.py b/tests/apiTests/test_negative_requests.py index d6f16cd..9efb69e 100644 --- a/tests/apiTests/test_negative_requests.py +++ b/tests/apiTests/test_negative_requests.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -54,41 +54,49 @@ class TestNegativeRequests(TestApiBase, Helper): @exception() def test_negative_invite_member(self): logger.debug( - "This negative test will try to invite team member to an engagement using other auth token.") + "This negative test will try to invite team " + + "member to an engagement using other auth token.") user_a = API.VirtualFunction.create_engagement() user_b = API.VirtualFunction.create_engagement() user_a['session_token'] = user_b['session_token'] try: logger.debug( - "About to invite team member to the engagement of user " + user_a['full_name']) + "About to invite team member to the engagement of user " + + user_a['full_name']) API.VirtualFunction.invite_team_member(user_a) raise Exception( - user_a['full_name'] + " has invited user using other auth token.") - except: + user_a['full_name'] + + " has invited user using other auth token.") + except BaseException: logger.debug( "Success! Test failed to invite user using other auth token.") @exception() def test_negative_add_contact(self): logger.debug( - "This negative test will try to add contact to an engagement using other auth token.") + "This negative test will try to add contact to " + + "an engagement using other auth token.") user_a = API.VirtualFunction.create_engagement() user_b = API.VirtualFunction.create_engagement() user_a['session_token'] = user_b['session_token'] try: logger.debug( - "About to invite contact to the engagement of user " + user_a['full_name']) + "About to invite contact to the engagement of user " + + user_a['full_name']) API.VirtualFunction.add_contact(user_a) raise Exception( - user_a['full_name'] + " has invited contact user using other auth token.") - except: + user_a['full_name'] + + " has invited contact user using other auth token.") + except BaseException: logger.debug( - "Success! Test failed to invite contact user using other auth token.") + "Success! Test failed to invite contact " + + "user using other auth token.") @exception() def test_negative_add_next_step(self): logger.debug( - "This negative test will try to add a next step to engagement using PR / standard user / admin_ro auth token.") + "This negative test will try to add a next step to engagement " + + "using PR / standard user / admin_ro auth token.") user_content = API.VirtualFunction.create_engagement() users = [user_content['email'], user_content[ 'pr_email'], Constants.Users.AdminRO.EMAIL] @@ -96,19 +104,29 @@ class TestNegativeRequests(TestApiBase, Helper): token = "token " + API.User.login_user(user) user_content['session_token'] = token try: - logger.debug("About to add a next step to VF " + - user_content['vfName'] + " using " + user + " token.") + logger.debug( + "About to add a next step to VF " + + user_content['vfName'] + + " using " + + user + + " token.") API.VirtualFunction.add_next_step(user_content) raise Exception( - "Next step was added to VF " + user_content['vfName'] + " using " + user + " token.") - except: + "Next step was added to VF " + + user_content['vfName'] + + " using " + + user + + " token.") + except BaseException: logger.debug( - "Success! Test failed to add a new next step to the engagement using other auth token.") + "Success! Test failed to add a new next step to the " + + "engagement using other auth token.") @exception() def test_negative_edit_next_step(self): logger.debug( - "This negative test will try to edit a next step using PR / standard user / admin_ro auth token.") + "This negative test will try to edit a next step using PR / " + + "standard user / admin_ro auth token.") user_content = API.VirtualFunction.create_engagement() token = "token " + API.User.login_user(user_content['el_email']) user_content['session_token'] = token @@ -120,19 +138,25 @@ class TestNegativeRequests(TestApiBase, Helper): user_content['session_token'] = token try: logger.debug( - "About to edit a next step (ns uuid: " + ns_uuid + ") using " + user + " token.") + "About to edit a next step (ns uuid: " + + ns_uuid + + ") using " + + user + + " token.") API.VirtualFunction.edit_next_step(user_content, ns_uuid) raise Exception( "Next step was edited using " + user + " token.") - except: + except BaseException: logger.debug( - "Success! Test failed to edit a next step using other auth token.") + "Success! Test failed to edit a next step using " + + "other auth token.") @exception() def test_negative_create_checklist(self): user_content = API.VirtualFunction.create_engagement() logger.debug( - "This negative test will try to create a checklist using PR / standard user / admin_ro auth token.") + "This negative test will try to create a checklist " + + "using PR / standard user / admin_ro auth token.") users = [user_content['email'], user_content[ 'pr_email'], Constants.Users.AdminRO.EMAIL] for user in users: @@ -140,25 +164,29 @@ class TestNegativeRequests(TestApiBase, Helper): user_content['session_token'] = token try: logger.debug( - "About to create checklist for VF " + user_content['vfName']) + "About to create checklist for VF " + + user_content['vfName']) API.Checklist.create_checklist(user_content) raise Exception( "Checklist was created using " + user + " token.") - except: + except BaseException: logger.debug( - "Success! Test failed to create checklist using other auth token.") + "Success! Test failed to create checklist using other " + + "auth token.") @exception() def test_negative_update_checklist(self): user_content = API.VirtualFunction.create_engagement() API.GitLab.git_clone_push(user_content) logger.debug( - "Create checklist with engagement lead (next: try to edit checklist with PR and standard user)") + "Create checklist with engagement lead (next: try to edit " + + "checklist with PR and standard user)") token = "token " + API.User.login_user(user_content['el_email']) user_content['session_token'] = token cl_content = API.Checklist.create_checklist(user_content) logger.debug( - "This negative test will try to create a checklist using PR / standard user / admin_ro auth token.") + "This negative test will try to create a checklist using PR / " + + "standard user / admin_ro auth token.") users = [user_content['email'], user_content[ 'pr_email'], Constants.Users.AdminRO.EMAIL] for user in users: @@ -166,75 +194,89 @@ class TestNegativeRequests(TestApiBase, Helper): user_content['session_token'] = token try: logger.debug( - "About to update checklist for VF " + user_content['vfName']) + "About to update checklist for VF " + + user_content['vfName']) API.Checklist.update_checklist( user_content, cl_content['uuid']) raise Exception( "Checklist was created using " + user + " token.") - except: + except BaseException: logger.debug( - "Success! Test failed to create checklist using other auth token.") + "Success! Test failed to create checklist using other " + + "auth token.") @exception() def test_negative_set_checklist_state(self): user_content = API.VirtualFunction.create_engagement() API.GitLab.git_clone_push(user_content) logger.debug( - "Create checklist with engagement lead (next: try to change checklist state with PR, standard user and admin_ro)") + "Create checklist with engagement lead (next: try to change " + + "checklist state with PR, standard user and admin_ro)") token = "token " + API.User.login_user(user_content['el_email']) user_content['session_token'] = token cl_content = API.Checklist.create_checklist(user_content) logger.debug( - "This negative test will try to change checklist state using PR / standard user / admin_ro auth token.") + "This negative test will try to change checklist state using " + + "PR / standard user / admin_ro auth token.") users = [user_content['email'], user_content[ 'pr_email'], Constants.Users.AdminRO.EMAIL] for user in users: try: logger.debug( - "About to change checklist state for VF " + user_content['vfName']) + "About to change checklist state for VF " + + user_content['vfName']) API.Checklist.jump_state(cl_content['uuid'], user) raise Exception( "Checklist state was changed using " + user + " token.") - except: + except BaseException: logger.debug( - "Success! Test failed to change checklist state using other auth token.") + "Success! Test failed to change checklist state using " + + "other auth token.") @exception() def test_add_checklist_audit_log(self): user_content = API.VirtualFunction.create_engagement() logger.debug( - "Create checklist with engagement lead (next: try to add audit log to checklist with standard user and admin_ro)") + "Create checklist with engagement lead (next: try to add audit " + + "log to checklist with standard user and admin_ro)") token = "token " + API.User.login_user(user_content['el_email']) user_content['session_token'] = token cl_content = API.Checklist.create_checklist(user_content, files=[]) logger.debug( - "This negative test will try to add audit log to checklist using standard user / admin_ro auth token.") + "This negative test will try to add audit log to checklist " + + "using standard user / admin_ro auth token.") users = [user_content['email'], Constants.Users.AdminRO.EMAIL] for user in users: token = "token " + API.User.login_user(user) user_content['session_token'] = token try: logger.debug( - "About to add audit log to checklist uuid " + cl_content['uuid']) + "About to add audit log to checklist uuid " + + cl_content['uuid']) API.Checklist.add_checklist_audit_log( user_content, cl_content['uuid']) raise Exception( - "Audit log was added to checklist using " + user + " token.") - except: + "Audit log was added to checklist using " + + user + + " token.") + except BaseException: logger.debug( - "Success! Test failed to add audit log to checklist using other auth token.") + "Success! Test failed to add audit log to checklist " + + "using other auth token.") @exception() def test_add_checklist_next_step(self): user_content = API.VirtualFunction.create_engagement() API.GitLab.git_clone_push(user_content) logger.debug( - "Create checklist with engagement lead (next: try to add checklist next step with PR, standard user and admin_ro)") + "Create checklist with engagement lead (next: try to add " + + "checklist next step with PR, standard user and admin_ro)") token = "token " + API.User.login_user(user_content['el_email']) user_content['session_token'] = token cl_content = API.Checklist.create_checklist(user_content) logger.debug( - "This negative test will try to add checklist next step using PR / standard user / admin_ro auth token.") + "This negative test will try to add checklist next step using " + + "PR / standard user / admin_ro auth token.") users = [user_content['email'], user_content[ 'pr_email'], Constants.Users.AdminRO.EMAIL] for user in users: @@ -242,14 +284,18 @@ class TestNegativeRequests(TestApiBase, Helper): user_content['session_token'] = token try: logger.debug( - "About to add next step to checklist uuid " + cl_content['uuid']) + "About to add next step to checklist uuid " + + cl_content['uuid']) API.Checklist.add_checklist_next_step( user_content, cl_content['uuid']) raise Exception( - "Next step was added to checklist using " + user + " token.") - except: + "Next step was added to checklist using " + + user + + " token.") + except BaseException: logger.debug( - "Success! Test failed to add next steps to checklist using other auth token.") + "Success! Test failed to add next steps to checklist " + + "using other auth token.") @exception() def test_negative_checklist_files(self): @@ -259,13 +305,16 @@ class TestNegativeRequests(TestApiBase, Helper): else: # Test starts here # user_content = API.VirtualFunction.create_engagement() logger.debug( - "Trying to create checklist with associated files when git repo is empty") + "Trying to create checklist with associated files when " + + "git repo is empty") token = "token " + API.User.login_user(user_content['el_email']) user_content['session_token'] = token try: API.Checklist.create_checklist(user_content) raise Exception( - "Checklist was created with associated files while git repo is empty.") - except: + "Checklist was created with associated files while " + + "git repo is empty.") + except BaseException: logger.debug( - "Success! Test failed to create checklist with associated files while git repo is empty.") + "Success! Test failed to create checklist with " + + "associated files while git repo is empty.") diff --git a/tests/signalTests/__init__.py b/tests/signalTests/__init__.py index 30d7152..32b601a 100644 --- a/tests/signalTests/__init__.py +++ b/tests/signalTests/__init__.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. diff --git a/tests/signalTests/test_checklist_signal.py b/tests/signalTests/test_checklist_signal.py index 7d3cd1c..0e84140 100644 --- a/tests/signalTests/test_checklist_signal.py +++ b/tests/signalTests/test_checklist_signal.py @@ -1,4 +1,3 @@ - # ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== @@ -36,9 +35,8 @@ # ============LICENSE_END============================================ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. -''' -Created on 16 Nov 2016 -''' + + from django.conf import settings from iceci.decorator.exception_decor import exception @@ -65,4 +63,6 @@ class TestChecklistSignal(TestSignalBase): cl_content = API.Checklist.create_checklist(user_content) API.GitLab.git_push_commit(user_content) DB.Checklist.state_changed( - "uuid", cl_content['uuid'], Constants.ChecklistStates.Archive.TEXT) + "uuid", + cl_content['uuid'], + Constants.ChecklistStates.Archive.TEXT) diff --git a/tests/signalTests/test_git_signal.py b/tests/signalTests/test_git_signal.py index 63290d2..ada7db2 100644 --- a/tests/signalTests/test_git_signal.py +++ b/tests/signalTests/test_git_signal.py @@ -47,7 +47,6 @@ from services.constants import Constants, ServiceProvider from services.logging_service import LoggingServiceFactory from services.types import API from tests.signalTests.test_signal_base import TestSignalBase -from services.helper import Helper logger = LoggingServiceFactory.get_logger() @@ -65,7 +64,8 @@ class TestGitSignal(TestSignalBase): path_with_namespace = user_content[ 'engagement_manual_id'] + "%2F" + user_content['vfName'] API.GitLab.get_git_project(path_with_namespace) - if not API.GitLab.validate_git_project_members(path_with_namespace, user_content['el_email']): + if not API.GitLab.validate_git_project_members( + path_with_namespace, user_content['el_email']): logger.error("Couldn't find user in GitLab response.") raise logger.debug( @@ -76,7 +76,7 @@ class TestGitSignal(TestSignalBase): API.Jenkins.get_jenkins_job(job_name) except Exception as e: logger.error( - "_-_-_-_-_- Unexpected error in test_create_eng: " + str(e)) + "_-_-_-_- Unexpected error in test_create_eng: " + str(e)) raise Exception("Job wasnt created on APIJenkins." + str(e)) @exception() @@ -91,10 +91,14 @@ class TestGitSignal(TestSignalBase): git_user_pub_key = API.GitLab.get_git_user_ssh_key(git_user['id']) if sshKey != git_user_pub_key: logger.error( - "The SSH Key received does not equal to the one provided! The key from GitLab:\n" + git_user_pub_key) + "The SSH Key received does not " + + "equal to the one provided! The key from GitLab:\n" + + git_user_pub_key) raise logger.debug( - "SSH Key for user " + user_content['full_name'] + " added to GitLab.") + "SSH Key for user " + + user_content['full_name'] + + " added to GitLab.") @exception() def test_set_ssh(self): @@ -108,10 +112,14 @@ class TestGitSignal(TestSignalBase): git_user_pub_key = API.GitLab.get_git_user_ssh_key(git_user['id']) if sshKey != git_user_pub_key: logger.error( - "The SSH Key received does not equal to the one provided! The key from GitLab:\n" + git_user_pub_key) + "The SSH Key received does not equal" + + " to the one provided! The key from GitLab:\n" + + git_user_pub_key) raise logger.debug( - "SSH Key for user " + user_content['full_name'] + " added to GitLab.") + "SSH Key for user " + + user_content['full_name'] + + " added to GitLab.") @exception() def test_invite_member(self): @@ -119,8 +127,9 @@ class TestGitSignal(TestSignalBase): logger.debug("Local environment, skipping test...") else: user_content = API.VirtualFunction.create_engagement() - invited_email, invite_token, invite_url = API.VirtualFunction.invite_team_member( - user_content) + invited_email, invite_token,\ + invite_url = API.VirtualFunction.invite_team_member( + user_content) second_user = API.User.signup_invited_user( user_content[ 'vendor'], invited_email, invite_token, invite_url, @@ -129,14 +138,19 @@ class TestGitSignal(TestSignalBase): user_content, Constants.EngagementStages.ACTIVE) path_with_namespace = user_content[ 'engagement_manual_id'] + "%2F" + user_content['vfName'] - if not API.GitLab.validate_git_project_members(path_with_namespace, user_content['email']): + if not API.GitLab.validate_git_project_members( + path_with_namespace, user_content['email']): raise Exception( - "Couldn't find the inviter user (%s) in GitLab." % user_content['email']) - if not API.GitLab.validate_git_project_members(path_with_namespace, second_user['email']): + "Couldn't find the inviter user (%s) in GitLab." % + user_content['email']) + if not API.GitLab.validate_git_project_members( + path_with_namespace, second_user['email']): raise Exception( - "Couldn't find the inviter user (%s) in GitLab." % second_user['email']) + "Couldn't find the inviter user (%s) in GitLab." % + second_user['email']) logger.debug( - "Inviter and invited users were created successfully on GitLab!") + "Inviter and invited users " + + "were created successfully on GitLab!") @exception() def test_add_contact(self): @@ -149,20 +163,33 @@ class TestGitSignal(TestSignalBase): path_with_namespace = user_content[ 'engagement_manual_id'] + "%2F" + user_content['vfName'] API.GitLab.get_git_project(path_with_namespace) - if not API.GitLab.validate_git_project_members(path_with_namespace, user_content['email']): + if not API.GitLab.validate_git_project_members( + path_with_namespace, user_content['email']): raise Exception( - "Couldn't find the inviter user (%s) in GitLab." % user_content['email']) - second_user_email, invite_token, invite_url = API.VirtualFunction.add_contact( - user_content) - second_user = API.User.signup_invited_user(ServiceProvider.MainServiceProvider, second_user_email, invite_token, invite_url, - user_content, "true", True) - if API.GitLab.validate_git_project_members(path_with_namespace, second_user_email): + "Couldn't find the inviter user (%s) in GitLab." % + user_content['email']) + second_user_email, invite_token, \ + invite_url = API.VirtualFunction.add_contact( + user_content) + second_user = API.User.signup_invited_user( + ServiceProvider.MainServiceProvider, + second_user_email, + invite_token, + invite_url, + user_content, + "true", + True) + if API.GitLab.validate_git_project_members( + path_with_namespace, second_user_email): logger.debug( - "Invited contact user " + second_user['full_name'] + " found in GitLab.") + "Invited contact user " + + second_user['full_name'] + + " found in GitLab.") else: raise Exception("Couldn't find the invited user in GitLab.") logger.debug( - "Inviter and invited users were created successfully on GitLab!") + "Inviter and invited users were " + + "created successfully on GitLab!") @exception() def test_join_of_staff_users_to_new_gitlab_repo(self): @@ -173,10 +200,13 @@ class TestGitSignal(TestSignalBase): path_with_namespace = user_content[ 'engagement_manual_id'] + "%2F" + user_content['vfName'] eng_team_users_emails = [ - user_content['el_email'], user_content['pr_email'], Constants.Users.Admin.EMAIL] + user_content['el_email'], + user_content['pr_email'], + Constants.Users.Admin.EMAIL] API.GitLab.are_all_list_users_registered_as_project_members( eng_team_users_emails, path_with_namespace) - logger.debug("Staff users were added successfully to GitLab repo!") + logger.debug("Staff users were added " + + "successfully to GitLab repo!") @exception() def test_join_of_stn_users_to_new_rep_after_active(self): @@ -188,27 +218,41 @@ class TestGitSignal(TestSignalBase): 'engagement_manual_id'] + "%2F" + user_content['vfName'] # invite 2 new users in order to join standard users in the eng # team - invited_email_address, invite_token, invite_url = API.VirtualFunction.invite_team_member( + invited_email_address, invite_token, \ + invite_url = API.VirtualFunction.invite_team_member( + user_content) + invited_email_address = API.User.signup_invited_user( + user_content['vendor'], + invited_email_address, + invite_token, + invite_url, user_content) - invited_email_address = API.User.signup_invited_user(user_content['vendor'], invited_email_address, - invite_token, invite_url, user_content) - second_invited_email, second_invite_token, second_invite_url = API.VirtualFunction.invite_team_member( + second_invited_email, second_invite_token, \ + second_invite_url = API.VirtualFunction.invite_team_member( + user_content) + second_invited_email = API.User.signup_invited_user( + user_content['vendor'], + second_invited_email, + second_invite_token, + second_invite_url, user_content) - second_invited_email = API.User.signup_invited_user(user_content['vendor'], second_invited_email, - second_invite_token, second_invite_url, user_content) API.VirtualFunction.set_eng_stage( user_content, Constants.EngagementStages.ACTIVE) - eng_team_users_emails = [invited_email_address['email'], second_invited_email['email'], - user_content['email'], user_content[ - 'el_email'], user_content['pr_email'], - Constants.Users.Admin.EMAIL] + eng_team_users_emails = [ + invited_email_address['email'], + second_invited_email['email'], + user_content['email'], + user_content['el_email'], + user_content['pr_email'], + Constants.Users.Admin.EMAIL] API.GitLab.are_all_list_users_registered_as_project_members( eng_team_users_emails, path_with_namespace) logger.debug( - "Staff, Inviter and invited users were added successfully to GitLab repo!") + "Staff, Inviter and invited users were " + + "added successfully to GitLab repo!") @exception() def test_rem_users_from_repo_after_active_and_validated(self): @@ -218,15 +262,24 @@ class TestGitSignal(TestSignalBase): user_content = API.VirtualFunction.create_engagement() # invite 2 new users in order to join standard users in the eng # team - invited_email_address, invite_token, invite_url = API.VirtualFunction.invite_team_member( - user_content) + invited_email_address, invite_token, invite_url\ + = API.VirtualFunction.invite_team_member(user_content) invited_email_address = API.User.signup_invited_user( - user_content['vendor'], invited_email_address, invite_token, invite_url, user_content) - - second_invited_email, second_invite_token, second_invite_url = API.VirtualFunction.invite_team_member( + user_content['vendor'], + invited_email_address, + invite_token, + invite_url, user_content) + + second_invited_email, second_invite_token, \ + second_invite_url = API.VirtualFunction.invite_team_member( + user_content) second_invited_email = API.User.signup_invited_user( - user_content['vendor'], second_invited_email, second_invite_token, second_invite_url, user_content) + user_content['vendor'], + second_invited_email, + second_invite_token, + second_invite_url, + user_content) # change eng stage in order to include all standard users in the # eng git lab repo @@ -240,20 +293,29 @@ class TestGitSignal(TestSignalBase): # check that all standard users, staff users and admin are in the # git lab repo API.GitLab.get_git_project(path_with_namespace) - eng_team_users_emails = [user_content['el_email'], - user_content['pr_email'], Constants.Users.Admin.EMAIL] + eng_team_users_emails = [ + user_content['el_email'], + user_content['pr_email'], + Constants.Users.Admin.EMAIL] should_not_be_in_repo_users_list = [ invited_email_address['email'], user_content['email']] for email in eng_team_users_emails: - if not API.GitLab.validate_git_project_members(path_with_namespace, email): + if not API.GitLab.validate_git_project_members( + path_with_namespace, email): if email not in should_not_be_in_repo_users_list: raise Exception( - "Couldn't find the invited users: " + email + " in GitLab.") + "Couldn't find the invited users: " + email + + " in GitLab.") logger.debug( - "Invited user: " + email + " and" + second_invited_email['full_name'] + " found in GitLab.") + "Invited user: " + + email + + " and" + + second_invited_email['full_name'] + + " found in GitLab.") logger.debug( - "Inviter and invited users were created successfully on GitLab!") + "Inviter and invited users were created " + + "successfully on GitLab!") @exception() def test_rem_users_from_repo_after_completed(self): @@ -263,15 +325,22 @@ class TestGitSignal(TestSignalBase): user_content = API.VirtualFunction.create_engagement() # invite 2 new users in order to join standard users in the eng # team - invited_email, invite_token, invite_url = API.VirtualFunction.invite_team_member( - user_content) + invited_email, invite_token, \ + invite_url = API.VirtualFunction.invite_team_member( + user_content) invited_email = API.User.signup_invited_user( - user_content['vendor'], invited_email, invite_token, invite_url, user_content) + user_content['vendor'], invited_email, invite_token, + invite_url, user_content) - second_invited_email, second_invite_token, second_invite_url = API.VirtualFunction.invite_team_member( - user_content) + second_invited_email, second_invite_token, \ + second_invite_url = API.VirtualFunction.invite_team_member( + user_content) second_invited_email = API.User.signup_invited_user( - user_content['vendor'], second_invited_email, second_invite_token, second_invite_url, user_content) + user_content['vendor'], + second_invited_email, + second_invite_token, + second_invite_url, + user_content) # change eng stage in order to include all standard users in the # eng git lab repo @@ -287,17 +356,26 @@ class TestGitSignal(TestSignalBase): # check that all standard users, staff users and admin are in the # git lab repo API.GitLab.get_git_project(path_with_namespace) - eng_team_users_emails = [user_content['el_email'], - user_content['pr_email'], Constants.Users.Admin.EMAIL] + eng_team_users_emails = [ + user_content['el_email'], + user_content['pr_email'], + Constants.Users.Admin.EMAIL] should_not_be_in_repo_users_list = [ invited_email['email'], user_content['email']] for email in eng_team_users_emails: - if not API.GitLab.validate_git_project_members(path_with_namespace, email): + if not API.GitLab.validate_git_project_members( + path_with_namespace, email): if email not in should_not_be_in_repo_users_list: raise Exception( - "Couldn't find the user: " + email + " in GitLab.") + "Couldn't find the user: " + + email + " in GitLab.") logger.debug( - "Invited user: " + email + " and" + second_invited_email['full_name'] + " found in GitLab.") + "Invited user: " + + email + + " and" + + second_invited_email['full_name'] + + " found in GitLab.") logger.debug( - "Inviter and invited users were created successfully on GitLab!") + "Inviter and invited users were created " + + "successfully on GitLab!") diff --git a/tests/signalTests/test_signal_base.py b/tests/signalTests/test_signal_base.py index 6caade4..841a855 100644 --- a/tests/signalTests/test_signal_base.py +++ b/tests/signalTests/test_signal_base.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -90,14 +90,27 @@ class TestSignalBase(unittest.TestCase, Helper): @logFuncEntry def results(self): - params = {"testType": "E2E Test", "testFeature": self.className, - "testResult": "PASS", "testName": self.funcName, "duration": self.testDuration} + params = { + "testType": "E2E Test", + "testFeature": self.className, + "testResult": "PASS", + "testName": self.funcName, + "duration": self.testDuration} if (session.errorCounter == 0): - DBGeneral.insert_results(params["testType"], params["testFeature"], params[ - "testResult"], params["testName"], params['duration']) + DBGeneral.insert_results( + params["testType"], + params["testFeature"], + params["testResult"], + params["testName"], + params['duration']) else: params["testResult"] = "FAIL" # Mark test as fail. # Add the errors to notes column in table. params["notes"] = session.errorList - DBGeneral.insert_results(params["testType"], params["testFeature"], params[ - "testResult"], params["testName"], params['duration'], params["notes"]) + DBGeneral.insert_results( + params["testType"], + params["testFeature"], + params["testResult"], + params["testName"], + params['duration'], + params["notes"]) diff --git a/tests/uiTests/__init__.py b/tests/uiTests/__init__.py index 30d7152..32b601a 100644 --- a/tests/uiTests/__init__.py +++ b/tests/uiTests/__init__.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. diff --git a/tests/uiTests/test_admin_dropdown.py b/tests/uiTests/test_admin_dropdown.py index 25621f4..8b838d6 100644 --- a/tests/uiTests/test_admin_dropdown.py +++ b/tests/uiTests/test_admin_dropdown.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -41,7 +40,6 @@ from django.conf import settings from iceci.decorator.exception_decor import exception from services.constants import Constants from services.logging_service import LoggingServiceFactory -from services.session import session from services.types import API, DB, Frontend from tests.uiTests.test_ui_base import TestUiBase @@ -70,9 +68,11 @@ class TestAdminDropdown(TestUiBase): # the engagement we are able to archive the engagement) path_with_namespace = user_content[ 'engagement_manual_id'] + "%2F" + user_content['vfName'] - if not API.GitLab.validate_git_project_members(path_with_namespace, user_content['email']): + if not API.GitLab.validate_git_project_members( + path_with_namespace, user_content['email']): raise Exception( - "Couldn't find the engagement lead user (%s) in GitLab." % user_content['email']) + "Couldn't find the engagement lead user (%s) in GitLab." % + user_content['email']) Frontend.Dashboard.statuses_search_vf( user_content['engagement_manual_id'], user_content['vfName']) Frontend.Overview.click_on_archeive_engagement_from_dropdown() @@ -103,7 +103,8 @@ class TestAdminDropdown(TestUiBase): other_user = DB.User.select_el_not_in_engagement( self.user_content['el_name'], self.user_content['pr_name']) Frontend.Dashboard.statuses_search_vf( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Frontend.Overview.click_on_change_peer_reviewer_from_dropdown() Frontend.Overview.change_engagement_lead_modal( other_user, is_reviewer=False) @@ -115,7 +116,8 @@ class TestAdminDropdown(TestUiBase): Frontend.User.login( Constants.Users.Admin.EMAIL, Constants.Default.Password.TEXT) Frontend.Dashboard.statuses_search_vf( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Frontend.Overview.click_on_update_status_from_dropdown() Frontend.Overview.fill_update_status_form_admin_dropdown() @@ -124,7 +126,8 @@ class TestAdminDropdown(TestUiBase): Frontend.User.login( self.user_content['el_email'], Constants.Default.Password.TEXT) Frontend.Dashboard.statuses_search_vf( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Frontend.Overview.click_on_update_status_from_dropdown() Frontend.Overview.fill_update_status_form_admin_dropdown() @@ -148,7 +151,8 @@ class TestAdminDropdown(TestUiBase): self.user_content['el_name'], self.user_content['pr_name']) other_el_email = DB.User.get_email_by_full_name(other_el) Frontend.Dashboard.statuses_search_vf( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) engName = self.user_content[ 'engagement_manual_id'] + ": " + self.user_content['vfName'] vf_left_nav_id = "clickable-" + engName @@ -157,8 +161,10 @@ class TestAdminDropdown(TestUiBase): Frontend.General.re_open(Constants.Default.LoginURL.TEXT) Frontend.Overview.invite_and_reopen_link( self.user_content, other_el_email) - Frontend.User.login(other_el_email, Constants.Default.Password.TEXT, - Constants.Dashboard.Default.DASHBOARD_ID) + Frontend.User.login( + other_el_email, + Constants.Default.Password.TEXT, + Constants.Dashboard.Default.DASHBOARD_ID) Frontend.Overview.click_on_update_status_from_dropdown() Frontend.Overview.fill_update_status_form_admin_dropdown() finally: @@ -174,9 +180,11 @@ class TestAdminDropdown(TestUiBase): user_content, Constants.EngagementStages.ACTIVE) path_with_namespace = user_content[ 'engagement_manual_id'] + "%2F" + user_content['vfName'] - if not API.GitLab.validate_git_project_members(path_with_namespace, user_content['email']): + if not API.GitLab.validate_git_project_members( + path_with_namespace, user_content['email']): raise Exception( - "Couldn't find the inviter user (%s) in GitLab." % user_content['email']) + "Couldn't find the inviter user (%s) in GitLab." % + user_content['email']) if settings.DATABASE_TYPE != 'local': git_user = API.GitLab.get_git_user(user_content['email']) git_user_id = str(git_user['id']) diff --git a/tests/uiTests/test_admin_section.py b/tests/uiTests/test_admin_section.py index 8ec9b44..f1339a1 100644 --- a/tests/uiTests/test_admin_section.py +++ b/tests/uiTests/test_admin_section.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -54,20 +53,29 @@ class TestAdminSection(TestUiBase): def setUpClass(cls): super(TestAdminSection, cls).setUpClass() - cls.user_content = API.VirtualFunction.create_engagement(wait_for_gitlab=False) + cls.user_content = API.VirtualFunction.create_engagement( + wait_for_gitlab=False) @exception() def test_admin_page(self): - Frontend.User.login(Constants.Users.Admin.EMAIL, Constants.Default.Password.TEXT) + Frontend.User.login( + Constants.Users.Admin.EMAIL, + Constants.Default.Password.TEXT) Frontend.User.go_to_account() Frontend.User.go_to_admin() - + @exception() def test_negative_admin_page(self): - users_email_list = [self.user_content['email'], self.user_content['pr_email'], self.user_content['el_email'], - Constants.Users.AdminRO.EMAIL] + users_email_list = [ + self.user_content['email'], + self.user_content['pr_email'], + self.user_content['el_email'], + Constants.Users.AdminRO.EMAIL] for user_email in users_email_list: Frontend.User.relogin(user_email, Constants.Default.Password.TEXT) Frontend.User.click_on_avatar() - session.run_negative(lambda: Frontend.User.click_on_admin(), "Negative test failed at" - " click_on_admin with user %s" % user_email) + session.run_negative( + lambda: Frontend.User.click_on_admin(), + "Negative test failed at" + " click_on_admin with user %s" % + user_email) diff --git a/tests/uiTests/test_bucket_e2e.py b/tests/uiTests/test_bucket_e2e.py index 73e18ca..246ba8d 100644 --- a/tests/uiTests/test_bucket_e2e.py +++ b/tests/uiTests/test_bucket_e2e.py @@ -1,4 +1,3 @@ - # ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== @@ -43,6 +42,7 @@ from wheel.signatures import assertTrue from iceci.decorator.exception_decor import exception from services.constants import Constants from services.database.db_user import DBUser +from services.frontend.base_actions.wait import Wait from services.helper import Helper from services.logging_service import LoggingServiceFactory from services.types import API @@ -62,16 +62,17 @@ class TestBucketE2E(TestUiBase): user_content, Constants.EngagementStages.ACTIVE) bucket_id = user_content[ 'engagement_manual_id'] + "_" + user_content['vfName'].lower() + Wait.bucket_to_create(bucket_id) bucket = API.Rados.get_bucket(bucket_id) assertTrue(API.Rados.is_bucket_ready(bucket_id)) assertTrue(bucket != "None") assertTrue(API.Rados.users_of_bucket_ready_after_created( - bucket_id, user_content['full_name'])) + bucket_id, user_content['uuid'])) # validate users added to bucket grants = API.Rados.get_bucket_grants(bucket_id) count = 0 for g in grants: - if g.id == user_content['full_name']: + if g.id == user_content['uuid']: count = +1 assertTrue(count > 0) @@ -86,6 +87,7 @@ class TestBucketE2E(TestUiBase): fileName = Helper.rand_string("randomString") bucket_id = user_content[ 'engagement_manual_id'] + "_" + user_content['vfName'].lower() + Wait.bucket_to_create(bucket_id) bucket = API.Rados.get_bucket(bucket_id) assertTrue(API.Rados.is_bucket_ready(bucket_id)) key = bucket.new_key(fileName + '.dat') @@ -134,7 +136,7 @@ class TestBucketE2E(TestUiBase): secret = CryptographyText.decrypt(secret_key) bucket_for_specific_user = API.Rados.get_bucketfor_specific_user( bucket_id, access_key, secret) - assertTrue(bucket_for_specific_user != None) + assertTrue(bucket_for_specific_user is not None) # create upload file with user str_content = Helper.rand_string( "randomString") + Helper.rand_string("randomNumber") diff --git a/tests/uiTests/test_bucket_url.py b/tests/uiTests/test_bucket_url.py index 05f857f..632b113 100644 --- a/tests/uiTests/test_bucket_url.py +++ b/tests/uiTests/test_bucket_url.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. diff --git a/tests/uiTests/test_checklist_validations.py b/tests/uiTests/test_checklist_validations.py index 07d303c..bac465d 100644 --- a/tests/uiTests/test_checklist_validations.py +++ b/tests/uiTests/test_checklist_validations.py @@ -1,4 +1,3 @@ - # ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== @@ -36,14 +35,9 @@ # ============LICENSE_END============================================ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. -from asyncio.tasks import sleep -import time - from wheel.signatures import assertTrue from iceci.decorator.exception_decor import exception -from services.api.api_bridge import APIBridge -from services.api.api_gitlab import APIGitLab from services.constants import Constants from services.frontend.base_actions.get import Get from services.helper import Helper @@ -69,7 +63,8 @@ class TestChecklistValidations(TestUiBase): def setUpClass(cls): super(TestChecklistValidations, cls).setUpClass() - cls.user_content_api = API.User.create_new_user_content_login_with_api() + cls.user_content_api = \ + API.User.create_new_user_content_login_with_api() cls.user_content = API.VirtualFunction.create_engagement() @exception() @@ -89,7 +84,9 @@ class TestChecklistValidations(TestUiBase): Frontend.Overview.click_on_vf(self.user_content) Frontend.Overview.complete_defaults_nextsteps(engagement_id) Frontend.User.relogin( - engLeadEmail, Constants.Default.Password.TEXT, engagement_manual_id) + engLeadEmail, + Constants.Default.Password.TEXT, + engagement_manual_id) Frontend.Overview.click_on_vf(self.user_content) actualVfName = Get.by_id(actualVfNameid) checklistName = Frontend.Checklist.create_checklist( @@ -110,7 +107,9 @@ class TestChecklistValidations(TestUiBase): DB.Checklist.update_decisions(checklistUuid, checklistName) Frontend.User.relogin( - engLeadEmail, Constants.Default.Password.TEXT, engagement_manual_id) + engLeadEmail, + Constants.Default.Password.TEXT, + engagement_manual_id) Frontend.Checklist.click_on_checklist(user_content, checklistName) Frontend.Checklist.validate_reject_is_enabled() Frontend.Checklist.review_state_actions_and_validations( @@ -159,7 +158,9 @@ class TestChecklistValidations(TestUiBase): "uuid", checklistUuid, Constants.ChecklistStates.Review.TEXT) DB.Checklist.update_decisions(checklistUuid, checklistName) Frontend.User.relogin( - engLeadEmail, Constants.Default.Password.TEXT, engagement_manual_id) + engLeadEmail, + Constants.Default.Password.TEXT, + engagement_manual_id) Frontend.Checklist.click_on_checklist(user_content, checklistName) Frontend.Checklist.validate_reject_is_enabled() Frontend.Checklist.review_state_actions_and_validations( @@ -193,7 +194,9 @@ class TestChecklistValidations(TestUiBase): DB.Checklist.update_decisions(checklistUuid, checklistName) Frontend.User.relogin( - engLeadEmail, Constants.Default.Password.TEXT, engagement_manual_id) + engLeadEmail, + Constants.Default.Password.TEXT, + engagement_manual_id) Frontend.Checklist.click_on_checklist(user_content, checklistName) Frontend.Checklist.validate_reject_is_enabled() @@ -202,7 +205,11 @@ class TestChecklistValidations(TestUiBase): DB.Checklist.update_checklist_to_review_state(newFileNames[0]) Frontend.General.refresh() Frontend.Checklist.add_nsteps( - checklistUuid, actualVfNameid, myVfName, checklistName, newFileNames) + checklistUuid, + actualVfNameid, + myVfName, + checklistName, + newFileNames) @exception() def test_multi_el(self): @@ -220,7 +227,10 @@ class TestChecklistValidations(TestUiBase): self.user_content_api['el_email'], Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(self.user_content_api) Frontend.Checklist.validate_multi_eng( - self.user_content_api, checklist_content, newEL_content, actualVfNameid) + self.user_content_api, + checklist_content, + newEL_content, + actualVfNameid) @exception() def test_create_checklist_without_files(self): @@ -243,15 +253,18 @@ class TestChecklistValidations(TestUiBase): self.user_content_api, cl_content['name'], recent_checklist_uuid) Frontend.Checklist.reject("Reject checklist on review state.") DB.Checklist.state_changed( - "uuid", recent_checklist_uuid, Constants.ChecklistStates.Archive.TEXT) + "uuid", recent_checklist_uuid, + Constants.ChecklistStates.Archive.TEXT) @exception() def test_clone_decision_auditlogs(self): cl_content = API.Checklist.create_checklist(self.user_content_api) DB.Checklist.state_changed( "name", cl_content['name'], Constants.ChecklistStates.Review.TEXT) - Frontend.User.login(self.user_content_api['el_email'], Constants.Default.Password.TEXT, - self.user_content_api['engagement_manual_id']) + Frontend.User.login( + self.user_content_api['el_email'], + Constants.Default.Password.TEXT, + self.user_content_api['engagement_manual_id']) recent_checklist_uuid = DB.Checklist.get_recent_checklist_uuid( cl_content['name'])[0] Frontend.Checklist.click_on_checklist( @@ -260,7 +273,9 @@ class TestChecklistValidations(TestUiBase): Frontend.Checklist.reject( 'Reject checklist as part of test_clone_decision_auditlogs test') DB.Checklist.state_changed( - "uuid", recent_checklist_uuid, Constants.ChecklistStates.Archive.TEXT) + "uuid", + recent_checklist_uuid, + Constants.ChecklistStates.Archive.TEXT) recent_checklist_uuid = DB.Checklist.get_recent_checklist_uuid( cl_content['name'])[0] Frontend.Checklist.click_on_checklist( @@ -273,8 +288,10 @@ class TestChecklistValidations(TestUiBase): self.user_content_api) DB.Checklist.state_changed( "name", cl_content['name'], Constants.ChecklistStates.Review.TEXT) - Frontend.User.login(self.user_content_api['el_email'], Constants.Default.Password.TEXT, - self.user_content_api['engagement_manual_id']) + Frontend.User.login( + self.user_content_api['el_email'], + Constants.Default.Password.TEXT, + self.user_content_api['engagement_manual_id']) Frontend.Checklist.click_on_checklist( self.user_content_api, cl_content['name'], cl_content['uuid']) Frontend.Checklist.get_jenkins_log() @@ -285,8 +302,10 @@ class TestChecklistValidations(TestUiBase): self.user_content_api) DB.Checklist.state_changed( "name", cl_content['name'], Constants.ChecklistStates.Review.TEXT) - Frontend.User.login(self.user_content_api['el_email'], Constants.Default.Password.TEXT, - self.user_content_api['engagement_manual_id']) + Frontend.User.login( + self.user_content_api['el_email'], + Constants.Default.Password.TEXT, + self.user_content_api['engagement_manual_id']) cl_content['uuid'] = DB.Checklist.get_recent_checklist_uuid( cl_content['name'])[0] Frontend.Checklist.click_on_checklist( diff --git a/tests/uiTests/test_cms_news_and_announcementsion.py b/tests/uiTests/test_cms_news_and_announcementsion.py index b639338..ad918d8 100644 --- a/tests/uiTests/test_cms_news_and_announcementsion.py +++ b/tests/uiTests/test_cms_news_and_announcementsion.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -40,11 +39,9 @@ from wheel.signatures import assertTrue from iceci.decorator.exception_decor import exception from services.constants import Constants -from services.frontend.base_actions.click import Click from services.logging_service import LoggingServiceFactory -from services.session import session -from services.types import * from tests.uiTests.test_ui_base import TestUiBase +from services.types import API, Frontend, DB logger = LoggingServiceFactory.get_logger() @@ -55,12 +52,15 @@ class TestCMSNewsAndAnnoucements(TestUiBase): def setUpClass(cls): super(TestCMSNewsAndAnnoucements, cls).setUpClass() - cls.user_content = API.VirtualFunction.create_engagement(wait_for_gitlab=False) - logger.debug("user_conntent = "+str(cls.user_content)) + cls.user_content = API.VirtualFunction.create_engagement( + wait_for_gitlab=False) + logger.debug("user_conntent = " + str(cls.user_content)) def setUp(self): super(TestCMSNewsAndAnnoucements, self).setUp() - Frontend.User.login(self.user_content['email'], Constants.Default.Password.TEXT) + Frontend.User.login( + self.user_content['email'], + Constants.Default.Password.TEXT) @exception() def test_announcements(self): @@ -70,19 +70,25 @@ class TestCMSNewsAndAnnoucements(TestUiBase): @exception() def test_insert_post_Announcement(self): title, description = DB.Cms.create_announcement() - Frontend.General.refresh() + Frontend.User.logout() + Frontend.User.login( + self.user_content['email'], Constants.Default.Password.TEXT) Frontend.Cms.validae_announcement(title, description) @exception() def test_insert_post_News(self): title, description = DB.Cms.create_news() - Frontend.General.refresh() + Frontend.User.logout() + Frontend.User.login( + self.user_content['email'], Constants.Default.Password.TEXT) Frontend.Cms.validate_news(title, description) @exception() def test_insert_post_FAQ(self): title, description = DB.Cms.create_faq() - Frontend.General.refresh() + Frontend.User.logout() + Frontend.User.login( + self.user_content['email'], Constants.Default.Password.TEXT) Frontend.Cms.validate_FAQ(description) @exception() @@ -94,11 +100,18 @@ class TestCMSNewsAndAnnoucements(TestUiBase): def test_search_documentation_title(self): title, description = DB.Cms.create_page() logger.debug("About to login with EL and add VFC") - users = [self.user_content['el_email'], self.user_content['pr_email'], Constants.Users.AdminRO.EMAIL, - Constants.Users.Admin.EMAIL, self.user_content['email']] + users = [ + self.user_content['el_email'], + self.user_content['pr_email'], + Constants.Users.AdminRO.EMAIL, + Constants.Users.Admin.EMAIL, + self.user_content['email']] for user in users: logger.debug("Login with user " + user) - Frontend.User.relogin(user, Constants.Default.Password.TEXT, "documentation") + Frontend.User.relogin( + user, + Constants.Default.Password.TEXT, + "documentation") Frontend.Cms.search_documentation_title(title, self.user_content) @exception() @@ -112,8 +125,11 @@ class TestCMSNewsAndAnnoucements(TestUiBase): @exception() def test_validate_expired_post_Announcement(self): title, description = DB.Cms.create_announcement() - Frontend.General.refresh() - Frontend.Cms.validate_expired_post_Announcement(title, description) + Frontend.User.logout() + Frontend.User.login( + self.user_content['email'], Constants.Default.Password.TEXT) + Frontend.Cms.validate_expired_post_Announcement( + self.user_content['email'], title, description) ''' Announcement toast should stay was published if the user closes the message @@ -121,18 +137,27 @@ class TestCMSNewsAndAnnoucements(TestUiBase): @exception() def test_Announcement_validate_toast(self): title, description = DB.Cms.create_announcement() - Frontend.User.relogin(self.user_content['email'], Constants.Default.Password.TEXT, Constants.Toast.CMS_ID) - Frontend.Cms.announcement_validate_toast(title, description, self.user_content) + Frontend.User.relogin( + self.user_content['email'], + Constants.Default.Password.TEXT, + Constants.Toast.CMS_ID) + Frontend.Cms.announcement_validate_toast( + title, description, self.user_content) ''' - Announcement toast is shown for users even after the entry has disappeared from the widget on the Dashboard + Announcement toast is shown for users even after the entry has disappeared + from the widget on the Dashboard ''' @exception() def test_validate_5_last_Announcement_displayed(self): listOfTitleAnDescriptions = DB.Cms.create_announcements(6) - Frontend.User.relogin(self.user_content['email'], Constants.Default.Password.TEXT) - last_title = listOfTitleAnDescriptions[len(listOfTitleAnDescriptions) - 1][0] - Frontend.Cms.validate_5_last_announcement_displayed(listOfTitleAnDescriptions, self.user_content, last_title) + Frontend.User.relogin( + self.user_content['email'], + Constants.Default.Password.TEXT) + last_title = listOfTitleAnDescriptions[len( + listOfTitleAnDescriptions) - 1][0] + Frontend.Cms.validate_5_last_announcement_displayed( + listOfTitleAnDescriptions, self.user_content, last_title) @exception() def test_insert_grandchild_page(self): @@ -140,5 +165,10 @@ class TestCMSNewsAndAnnoucements(TestUiBase): parent_id = DB.Cms.get_last_inserted_page_id() child_title, child_description = DB.Cms.create_page(parent_id) child_id = DB.Cms.get_last_inserted_page_id() - grand_child_title, grand_child_description = DB.Cms.create_page(child_id) - Frontend.Cms.validate_grandchild_page(parent_title, child_title, grand_child_title, grand_child_description) + grand_child_title, grand_child_description = DB.Cms.create_page( + child_id) + Frontend.Cms.validate_grandchild_page( + parent_title, + child_title, + grand_child_title, + grand_child_description) diff --git a/tests/uiTests/test_dashboard_feature.py b/tests/uiTests/test_dashboard_feature.py index 2303eb8..b1fc570 100644 --- a/tests/uiTests/test_dashboard_feature.py +++ b/tests/uiTests/test_dashboard_feature.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -73,7 +72,8 @@ class TestDashboardFeature(TestUiBase): @exception() def test_validate_filtering_by_stage_validated(self): - query = "UPDATE ice_engagement SET engagement_stage='Validated' WHERE engagement_manual_id ='" + \ + query = "UPDATE ice_engagement SET engagement_stage='Validated'" \ + " WHERE engagement_manual_id ='" + \ str(self.user_content['engagement_manual_id']) + "';" DB.General.update_by_query(query) Frontend.User.login( diff --git a/tests/uiTests/test_detailed_view.py b/tests/uiTests/test_detailed_view.py index cc95d7c..e9870b8 100644 --- a/tests/uiTests/test_detailed_view.py +++ b/tests/uiTests/test_detailed_view.py @@ -1,52 +1,51 @@ - -# ============LICENSE_START========================================== -# org.onap.vvp/test-engine -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the “License”); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -import uuid - -from iceci.decorator.exception_decor import exception -from services.constants import Constants -from services.helper import Helper -from services.logging_service import LoggingServiceFactory -from services.session import session -from services.types import API, DB, Frontend -from tests.uiTests.test_ui_base import TestUiBase - - +# ============LICENSE_START========================================== +# org.onap.vvp/test-engine +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the “License”); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +import uuid + +from iceci.decorator.exception_decor import exception +from services.constants import Constants +from services.helper import Helper +from services.logging_service import LoggingServiceFactory +from services.session import session +from services.types import API, DB, Frontend +from tests.uiTests.test_ui_base import TestUiBase + + logger = LoggingServiceFactory.get_logger() @@ -54,11 +53,13 @@ class TestDetailedView(TestUiBase): ''' Name: test_detailed_view Steps: - Create new User via SignUp request-->Login with This One--> build "activationUrl"--> + Create new User via SignUp request-->Login with This One--> + build "activationUrl"--> Validation of successful activate--> - close Wizard --> Logout-->login-->Open Wizard--> fill all fields in all Tab's(4)--> + close Wizard --> Logout-->login-->Open Wizard--> fill all fields + in all Tab's(4)--> build inviteURL from email--> reopen browser with inviteURL--> - Validate fields filled's in SignUp form + Validate fields filled's in SignUp form ''' user_content = None @@ -73,8 +74,9 @@ class TestDetailedView(TestUiBase): def test_detailed_view(self): Frontend.User.login( self.user_content['el_email'], Constants.Default.Password.TEXT) - Frontend.DetailedView.search_vf_and_go_to_detailed_view(self.user_content['engagement_manual_id'], - self.user_content['vfName']) + Frontend.DetailedView.search_vf_and_go_to_detailed_view( + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Frontend.DetailedView.validate_all_titles_on_dv_form() logger.debug("Add Deployment Target") Frontend.DetailedView.add_deployment_target(self.user_content) @@ -87,7 +89,8 @@ class TestDetailedView(TestUiBase): Frontend.User.login( self.user_content['email'], Constants.Default.Password.TEXT) Frontend.DetailedView.search_vf_and_go_to_detailed_view( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Frontend.DetailedView.update_aic_version() Frontend.DetailedView.validate_aic_version() @@ -96,12 +99,14 @@ class TestDetailedView(TestUiBase): Frontend.User.login( self.user_content['email'], Constants.Default.Password.TEXT) Frontend.DetailedView.search_vf_and_go_to_detailed_view( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) newVFVersionName = Frontend.DetailedView.update_vf_version() Frontend.DetailedView.validate_vf_version(newVFVersionName) ''' - Add new ECOMP release to DB, go to detailed view and change ECOMP release and AIC version. + Add new ECOMP release to DB, go to detailed view and change + ECOMP release and AIC version. Verify changes are saved and presented in UI. ''' @exception() @@ -113,7 +118,8 @@ class TestDetailedView(TestUiBase): Frontend.User.login( self.user_content['email'], Constants.Default.Password.TEXT) Frontend.DetailedView.search_vf_and_go_to_detailed_view( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Frontend.DetailedView.update_ecomp_release(EcompName) Frontend.DetailedView.validate_ecomp_version() finally: @@ -143,7 +149,8 @@ class TestDetailedView(TestUiBase): Frontend.User.login(Constants.Users.Admin.EMAIL, Constants.Default.Password.TEXT) Frontend.DetailedView.search_vf_and_go_to_detailed_view( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) date = Frontend.DetailedView.update_target_lab_entry() Frontend.DetailedView.validate_target_lab_entry(date) @@ -152,7 +159,8 @@ class TestDetailedView(TestUiBase): Frontend.User.login( self.user_content['email'], Constants.Default.Password.TEXT) Frontend.DetailedView.search_vf_and_go_to_detailed_view( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) date = Frontend.DetailedView.update_target_lab_entry() Frontend.DetailedView.validate_target_lab_entry(date) @@ -164,11 +172,15 @@ class TestDetailedView(TestUiBase): new_aic_version = DB.VirtualFunction.insert_aic_version() Frontend.User.login( self.user_content['el_email'], Constants.Default.Password.TEXT) - Frontend.DetailedView.search_vf_and_go_to_detailed_view(self.user_content['engagement_manual_id'], - self.user_content['vfName']) + Frontend.DetailedView.search_vf_and_go_to_detailed_view( + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Frontend.DetailedView.click_on_update_aic_version() - Helper.internal_assert(Frontend.General.get_meta_order_of_element( - Constants.Dashboard.DetailedView.AIC.Dropdown.UniversalVersion.ID % new_aic_version['version']), 0) + Helper.internal_assert( + Frontend.General. + get_meta_order_of_element(Constants.Dashboard.DetailedView.AIC. + Dropdown.UniversalVersion.ID % + new_aic_version['version']), 0) finally: if new_aic_version: DB.VirtualFunction.delete_aic_version(new_aic_version['uuid']) @@ -186,10 +198,14 @@ class TestDetailedView(TestUiBase): Frontend.User.login( self.user_content['el_email'], Constants.Default.Password.TEXT) Frontend.DetailedView.search_vf_and_go_to_detailed_view( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Frontend.DetailedView.click_on_update_ecomp_release() - Helper.internal_assert(Frontend.General.get_meta_order_of_element( - Constants.Dashboard.DetailedView.ECOMP.Dropdown.UniversalRelease.ID % new_ecomp_release['name']), 0) + Helper.internal_assert( + Frontend.General.get_meta_order_of_element( + Constants.Dashboard.DetailedView.ECOMP.Dropdown. + UniversalRelease.ID % + new_ecomp_release['name']), 0) finally: if new_ecomp_release: DB.VirtualFunction.delete_ecomp_release( @@ -204,10 +220,14 @@ class TestDetailedView(TestUiBase): Frontend.User.login( self.user_content['el_email'], Constants.Default.Password.TEXT) Frontend.DetailedView.search_vf_and_go_to_detailed_view( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Frontend.DetailedView.click_on_update_aic_version() - session.run_negative(lambda: Frontend.General.get_meta_order_of_element( - Constants.Dashboard.DetailedView.AIC.Dropdown.UniversalVersion.ID % new_aic_version['version']), + session.run_negative( + lambda: Frontend.General.get_meta_order_of_element( + Constants.Dashboard.DetailedView.AIC.Dropdown. + UniversalVersion.ID % + new_aic_version['version']), "New AIC version was found in dropdown.") finally: if new_aic_version: @@ -218,16 +238,25 @@ class TestDetailedView(TestUiBase): new_ecomp_release = None try: new_ecomp_release = { - "uuid": uuid.uuid4(), "name": Helper.rand_string(), "ui_visibility": "FALSE"} + "uuid": uuid.uuid4(), + "name": Helper.rand_string(), + "ui_visibility": "FALSE"} DB.VirtualFunction.insert_ecomp_release( - new_ecomp_release['uuid'], new_ecomp_release['name'], new_ecomp_release['ui_visibility']) + new_ecomp_release['uuid'], + new_ecomp_release['name'], + new_ecomp_release['ui_visibility']) Frontend.User.login( self.user_content['el_email'], Constants.Default.Password.TEXT) Frontend.DetailedView.search_vf_and_go_to_detailed_view( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Frontend.DetailedView.click_on_update_ecomp_release() - session.run_negative(lambda: Frontend.General.get_meta_order_of_element( - Constants.Dashboard.DetailedView.ECOMP.Dropdown.UniversalRelease.ID % new_ecomp_release['name']), "New ECOMP release was found in dropdown.") + session.run_negative( + lambda: Frontend.General.get_meta_order_of_element( + Constants.Dashboard.DetailedView.ECOMP.Dropdown. + UniversalRelease.ID % + new_ecomp_release['name']), + "New ECOMP release was found in dropdown.") finally: if new_ecomp_release: DB.VirtualFunction.delete_ecomp_release( @@ -243,11 +272,14 @@ class TestDetailedView(TestUiBase): self.user_content['session_token'] = "token " + \ API.User.login_user(self.user_content['el_email']) API.VirtualFunction.update_aic_version( - self.user_content['engagement_uuid'], new_aic_version['uuid'], self.user_content['session_token']) + self.user_content['engagement_uuid'], + new_aic_version['uuid'], + self.user_content['session_token']) Frontend.User.login( self.user_content['el_email'], Constants.Default.Password.TEXT) Frontend.DetailedView.search_vf_and_go_to_detailed_view( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Frontend.DetailedView.compare_aic_selected_version( new_aic_version['version']) Frontend.DetailedView.click_on_update_aic_version() @@ -256,7 +288,9 @@ class TestDetailedView(TestUiBase): finally: if old_aic_version_uuid: API.VirtualFunction.update_aic_version( - self.user_content['engagement_uuid'], old_aic_version_uuid, self.user_content['session_token']) + self.user_content['engagement_uuid'], + old_aic_version_uuid, + self.user_content['session_token']) if new_aic_version: DB.VirtualFunction.delete_aic_version( new_aic_version['uuid']) @@ -265,28 +299,40 @@ class TestDetailedView(TestUiBase): def test_retire_selected_ecomp_release(self): old_ecomp_release_uuid = new_ecomp_release = None try: - old_ecomp_release_uuid = DB.VirtualFunction.select_ecomp_release_uuid( - self.user_content['ecomp_release']) - new_ecomp_release = {"uuid": str( - uuid.uuid4()), "name": Helper.rand_string(), "ui_visibility": "FALSE"} + old_ecomp_release_uuid = \ + DB.VirtualFunction.select_ecomp_release_uuid( + self.user_content['ecomp_release']) + new_ecomp_release = { + "uuid": str( + uuid.uuid4()), + "name": Helper.rand_string(), + "ui_visibility": "FALSE"} DB.VirtualFunction.insert_ecomp_release( - new_ecomp_release['uuid'], new_ecomp_release['name'], new_ecomp_release['ui_visibility']) + new_ecomp_release['uuid'], + new_ecomp_release['name'], + new_ecomp_release['ui_visibility']) self.user_content['session_token'] = "token " + \ API.User.login_user(self.user_content['el_email']) API.VirtualFunction.update_ecomp_release( - self.user_content['engagement_uuid'], new_ecomp_release['uuid'], self.user_content['session_token']) + self.user_content['engagement_uuid'], + new_ecomp_release['uuid'], + self.user_content['session_token']) Frontend.User.login( self.user_content['el_email'], Constants.Default.Password.TEXT) Frontend.DetailedView.search_vf_and_go_to_detailed_view( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Frontend.DetailedView.compare_selected_ecomp_release( new_ecomp_release['name']) Frontend.DetailedView.click_on_update_ecomp_release() - Frontend.DetailedView.validate_deprecated_ecomp_release_in_dropdown( - new_ecomp_release['name']) + Frontend.DetailedView.\ + validate_deprecated_ecomp_release_in_dropdown( + new_ecomp_release['name']) finally: if self.user_content and old_ecomp_release_uuid: API.VirtualFunction.update_ecomp_release( - self.user_content['engagement_uuid'], old_ecomp_release_uuid, self.user_content['session_token']) + self.user_content['engagement_uuid'], + old_ecomp_release_uuid, + self.user_content['session_token']) DB.VirtualFunction.delete_ecomp_release( new_ecomp_release['uuid'], new_ecomp_release['name']) diff --git a/tests/uiTests/test_edit_checklist_template.py b/tests/uiTests/test_edit_checklist_template.py index 62130e3..6b636a8 100644 --- a/tests/uiTests/test_edit_checklist_template.py +++ b/tests/uiTests/test_edit_checklist_template.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -55,7 +54,7 @@ class TestChecklistTemplate(TestUiBase): DB.Checklist.create_editing_cl_template_if_not_exist() @exception() - def test_save_checklist_tamplate_without_changes(self): + def test_save_checklist_template_without_changes(self): Frontend.ChecklistTemplate.basic_admin_navigation() Frontend.ChecklistTemplate.click_on_template_name_on_navigation( Constants.Dashboard.LeftPanel.EditChecklistTemplate.HEAT, @@ -63,7 +62,7 @@ class TestChecklistTemplate(TestUiBase): Frontend.ChecklistTemplate.save_with_no_changes() @exception() - def test_discard_checklist_tamplate_with_changes(self): + def test_discard_checklist_template_with_changes(self): Frontend.ChecklistTemplate.basic_admin_navigation() Frontend.ChecklistTemplate.click_on_template_name_on_navigation( Constants.Dashboard.LeftPanel.EditChecklistTemplate.HEAT, @@ -71,7 +70,7 @@ class TestChecklistTemplate(TestUiBase): Frontend.ChecklistTemplate.discard_checklist_after_modification() @exception() - def test_save_checklist_tamplate_after_edit_section_name(self): + def test_save_checklist_template_after_edit_section_name(self): Frontend.ChecklistTemplate.basic_admin_navigation() Frontend.ChecklistTemplate.click_on_template_name_on_navigation( Constants.Dashboard.LeftPanel.EditChecklistTemplate.HEAT, @@ -79,7 +78,7 @@ class TestChecklistTemplate(TestUiBase): Frontend.ChecklistTemplate.edit_template_and_save() @exception() - def test_save_checklist_tamplate_after_lineitem_delete(self): + def test_save_checklist_template_after_lineitem_delete(self): Frontend.ChecklistTemplate.basic_admin_navigation() Frontend.ChecklistTemplate.click_on_template_name_on_navigation( Constants.Dashboard.LeftPanel.EditChecklistTemplate.HEAT, @@ -87,7 +86,7 @@ class TestChecklistTemplate(TestUiBase): Frontend.ChecklistTemplate.del_lineitem_and_save() @exception() - def test_save_checklist_tamplate_after_lineitem_added(self): + def test_save_checklist_template_after_lineitem_added(self): Frontend.ChecklistTemplate.basic_admin_navigation() Frontend.ChecklistTemplate.click_on_template_name_on_navigation( Constants.Dashboard.LeftPanel.EditChecklistTemplate.HEAT, @@ -103,7 +102,7 @@ class TestChecklistTemplate(TestUiBase): Frontend.ChecklistTemplate.add_lineitem_and_check_db() @exception() - def test_save_checklist_tamplate_after_edit_lineitem(self): + def test_save_checklist_template_after_edit_lineitem(self): Frontend.ChecklistTemplate.basic_admin_navigation() Frontend.ChecklistTemplate.click_on_template_name_on_navigation( Constants.Dashboard.LeftPanel.EditChecklistTemplate.HEAT, diff --git a/tests/uiTests/test_export_excel.py b/tests/uiTests/test_export_excel.py index faad489..d63ce45 100644 --- a/tests/uiTests/test_export_excel.py +++ b/tests/uiTests/test_export_excel.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -45,26 +44,30 @@ from services.types import API, Frontend from tests.uiTests.test_ui_base import TestUiBase -logger = LoggingServiceFactory.get_logger() - - -class TestFeatureExportToExcel(TestUiBase): - user_content = None - - @classmethod - def setUpClass(cls): - super(TestFeatureExportToExcel, cls).setUpClass() - - cls.user_content = API.VirtualFunction.create_engagement(wait_for_gitlab=False) - - @exception() - def test_validate_export_to_csv(self): - Frontend.User.login(self.user_content['email'], Constants.Default.Password.TEXT) - Frontend.User.click_on_export_excel(self.user_content) - try: - token = "token " + API.Bridge.login_user(self.user_content['email']) - content = API.VirtualFunction.get_export_dasboard_excel(token) - if not content: - raise Exception("content is empty.") - except TimeoutException: - logger.error("TimeoutException Not Appear") +logger = LoggingServiceFactory.get_logger() + + +class TestFeatureExportToExcel(TestUiBase): + user_content = None + + @classmethod + def setUpClass(cls): + super(TestFeatureExportToExcel, cls).setUpClass() + + cls.user_content = API.VirtualFunction.create_engagement( + wait_for_gitlab=False) + + @exception() + def test_validate_export_to_csv(self): + Frontend.User.login( + self.user_content['email'], + Constants.Default.Password.TEXT) + Frontend.User.click_on_export_excel(self.user_content) + try: + token = "token " + \ + API.Bridge.login_user(self.user_content['email']) + content = API.VirtualFunction.get_export_dasboard_excel(token) + if not content: + raise Exception("content is empty.") + except TimeoutException: + logger.error("TimeoutException Not Appear") diff --git a/tests/uiTests/test_feedback_modal.py b/tests/uiTests/test_feedback_modal.py index d47ed2f..521f196 100644 --- a/tests/uiTests/test_feedback_modal.py +++ b/tests/uiTests/test_feedback_modal.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -53,14 +52,16 @@ class TestFeedbackModal(TestUiBase): def setUpClass(cls): super(TestFeedbackModal, cls).setUpClass() - cls.user_content = API.VirtualFunction.create_engagement(wait_for_gitlab=False) + cls.user_content = API.VirtualFunction.create_engagement( + wait_for_gitlab=False) - @exception() def test_add_feedback(self): - Frontend.User.login(self.user_content['email'], Constants.Default.Password.TEXT) + Frontend.User.login( + self.user_content['email'], + Constants.Default.Password.TEXT) Frontend.User.click_on_avatar() Frontend.User.click_on_feedback() description = Frontend.User.add_feedback() - Frontend.User.validate_feedback(description, self.user_content['email']) - + Frontend.User.validate_feedback( + description, self.user_content['email']) diff --git a/tests/uiTests/test_invitations_and_throttle_logic.py b/tests/uiTests/test_invitations_and_throttle_logic.py index f5742fc..2e44ffc 100644 --- a/tests/uiTests/test_invitations_and_throttle_logic.py +++ b/tests/uiTests/test_invitations_and_throttle_logic.py @@ -1,53 +1,52 @@ - -# ============LICENSE_START========================================== -# org.onap.vvp/test-engine -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the “License”); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -from iceci.decorator.exception_decor import exception -from services.constants import Constants -from services.frontend.base_actions.click import Click -from services.frontend.base_actions.enter import Enter -from services.frontend.base_actions.get import Get -from services.frontend.base_actions.wait import Wait -from services.helper import Helper -from services.logging_service import LoggingServiceFactory -from services.types import API, DB, Frontend -from tests.uiTests.test_ui_base import TestUiBase - - +# ============LICENSE_START========================================== +# org.onap.vvp/test-engine +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the “License”); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +from iceci.decorator.exception_decor import exception +from services.constants import Constants +from services.frontend.base_actions.click import Click +from services.frontend.base_actions.enter import Enter +from services.frontend.base_actions.get import Get +from services.frontend.base_actions.wait import Wait +from services.helper import Helper +from services.logging_service import LoggingServiceFactory +from services.types import API, DB, Frontend +from tests.uiTests.test_ui_base import TestUiBase + + logger = LoggingServiceFactory.get_logger() @@ -71,14 +70,25 @@ class TestInvitationsLogic(TestUiBase): Click.id(vf_left_nav_id) Frontend.Wizard.invite_team_members_modal(user_content[1]['email']) enguuid = DB.General.select_where( - "uuid", "ice_engagement", "engagement_manual_id", user_content[0]['engagement_manual_id'], 1) + "uuid", + "ice_engagement", + "engagement_manual_id", + user_content[0]['engagement_manual_id'], + 1) invitation_token = DB.User.select_invitation_token( - "invitation_token", "ice_invitation", "engagement_uuid", enguuid, user_content[1]['email'], 1) + "invitation_token", + "ice_invitation", + "engagement_uuid", + enguuid, + user_content[1]['email'], + 1) inviterURL = Constants.Default.InviteURL.Login.TEXT + invitation_token Frontend.General.re_open(inviterURL) title_id = "title-id-" + engName Frontend.User.login( - user_content[1]['email'], Constants.Default.Password.TEXT, title_id) + user_content[1]['email'], + Constants.Default.Password.TEXT, + title_id) vf_left_nav_id = "clickable-" + engName Click.id(vf_left_nav_id) actualVfName = Get.by_id(vf_left_nav_id) @@ -93,18 +103,22 @@ class TestInvitationsLogic(TestUiBase): Click.id(vf_left_nav_id) Click.id(Constants.Dashboard.Overview.TeamMember.ID) Wait.text_by_css(Constants.Dashboard.Wizard.Title.CSS, - Constants.Dashboard.Wizard.InviteTeamMembers.Title.TEXT) + Constants.Dashboard.Wizard.InviteTeamMembers. + Title.TEXT) Enter.text_by_name("email", user_content[1]['email']) - Wait.text_by_css(Constants.SubmitButton.CSS, - Constants.Dashboard.Wizard.InviteTeamMembers.Button.TEXT) + Wait.text_by_css( + Constants.SubmitButton.CSS, + Constants.Dashboard.Wizard.InviteTeamMembers.Button.TEXT) Click.css(Constants.SubmitButton.CSS) Wait.id(Constants.Toast.ID) Helper.internal_assert( Get.by_id(Constants.Toast.ID), "Invite couldn't be created") ''' - If there are 5 invitations for a specific email in the last 24 hours for a particular standard user - and/or email do not send an email. Note: ELs and admins do not have a limit for how many invitations + If there are 5 invitations for a specific email in the last 24 + hours for a particular standard user + and/or email do not send an email. Note: ELs and admins do not + have a limit for how many invitations they can get per 24 hours. ''' @exception() @@ -126,8 +140,8 @@ class TestInvitationsLogic(TestUiBase): Frontend.Invite.invite_and_validate_limit(user_content, vf_left_nav_id) ''' - If there are more than 25 invitations for an invited_by_user_uuid - corresponding to an normal standard users and read only admins, + If there are more than 25 invitations for an invited_by_user_uuid + corresponding to an normal standard users and read only admins, do not send the invite. ''' @exception() @@ -155,7 +169,8 @@ class TestInvitationsLogic(TestUiBase): Click.id( Constants.Dashboard.Overview.TeamMember.ID, wait_for_page=True) Wait.text_by_css(Constants.Dashboard.Wizard.Title.CSS, - Constants.Dashboard.Wizard.InviteTeamMembers.Title.TEXT) + Constants.Dashboard.Wizard.InviteTeamMembers. + Title.TEXT) Frontend.Invite.invite_x_users_from_tm( list_of_invite_emails, countofUser2, countOfem2, 9) countOfem3 = 2 @@ -163,7 +178,8 @@ class TestInvitationsLogic(TestUiBase): Click.id( Constants.Dashboard.Overview.TeamMember.ID, wait_for_page=True) Wait.text_by_css(Constants.Dashboard.Wizard.Title.CSS, - Constants.Dashboard.Wizard.InviteTeamMembers.Title.TEXT) + Constants.Dashboard.Wizard.InviteTeamMembers. + Title.TEXT) Frontend.Invite.invite_x_users_from_tm( list_of_invite_emails, countofUser3, countOfem3, 5) Wait.text_by_id(Constants.Toast.ID, diff --git a/tests/uiTests/test_left_nav_panel.py b/tests/uiTests/test_left_nav_panel.py index 236097d..d90d3bb 100644 --- a/tests/uiTests/test_left_nav_panel.py +++ b/tests/uiTests/test_left_nav_panel.py @@ -1,4 +1,3 @@ - # ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== @@ -63,7 +62,8 @@ class TestLeftNavPanel(TestUiBase): cls.user_content = API.VirtualFunction.create_engagement( wait_for_gitlab=False) cls.eng_title = "%s: %s" % ( - cls.user_content['engagement_manual_id'], cls.user_content['vfName']) + cls.user_content['engagement_manual_id'], + cls.user_content['vfName']) cls.left_panel_eng_id = "clickable-%s" % (cls.eng_title) def setUp(self): @@ -78,7 +78,11 @@ class TestLeftNavPanel(TestUiBase): Click.id(self.left_panel_eng_id) Wait.id("title-id-" + self.eng_title) Helper.internal_assert( - self.user_content['engagement_manual_id'] + ":", Get.by_id("title-id-" + self.eng_title)) + self.user_content['engagement_manual_id'] + + ":", + Get.by_id( + "title-id-" + + self.eng_title)) Click.id(Constants.Dashboard.Overview.Star.ID, wait_for_page=True) Wait.id("title-id-" + self.eng_title) Click.id(Constants.Dashboard.Overview.Star.ID, wait_for_page=True) @@ -86,11 +90,15 @@ class TestLeftNavPanel(TestUiBase): Helper.internal_assert( self.eng_title, Get.by_id(self.left_panel_eng_id)) Enter.text_by_xpath( - "//input[@type='text']", self.user_content['engagement_manual_id'], wait_for_page=True) + "//input[@type='text']", + self.user_content['engagement_manual_id'], + wait_for_page=True) Wait.text_by_css( - Constants.Dashboard.LeftPanel.SearchBox.Results.CSS, self.eng_title) + Constants.Dashboard.LeftPanel.SearchBox.Results.CSS, + self.eng_title) Click.css( - Constants.Dashboard.LeftPanel.SearchBox.Results.CSS, wait_for_page=True) + Constants.Dashboard.LeftPanel.SearchBox.Results.CSS, + wait_for_page=True) @exception() def test_search_bar(self): @@ -99,25 +107,28 @@ class TestLeftNavPanel(TestUiBase): 'engagement_manual_id'] + ": " + self.user_content['vfName'] try: Enter.text_by_id( - Constants.Dashboard.LeftPanel.SearchBox.ID, self.user_content['vfName']) + Constants.Dashboard.LeftPanel.SearchBox.ID, + self.user_content['vfName']) Wait.css(Constants.Dashboard.LeftPanel.SearchBox.Results.CSS) Click.css(Constants.Dashboard.LeftPanel.SearchBox.Results.CSS) Wait.text_by_id( Constants.Dashboard.Overview.Title.ID, vfFullName) - except: + except BaseException: errorMsg = "Failed to search by VF name." raise Exception(errorMsg) try: - Enter.text_by_id(Constants.Dashboard.LeftPanel.SearchBox.ID, self.user_content[ - 'engagement_manual_id']) - Enter.text_by_id(Constants.Dashboard.LeftPanel.SearchBox.ID, self.user_content[ - 'engagement_manual_id']) + Enter.text_by_id( + Constants.Dashboard.LeftPanel.SearchBox.ID, + self.user_content['engagement_manual_id']) + Enter.text_by_id( + Constants.Dashboard.LeftPanel.SearchBox.ID, + self.user_content['engagement_manual_id']) Wait.css(Constants.Dashboard.LeftPanel.SearchBox.Results.CSS) Click.css(Constants.Dashboard.LeftPanel.SearchBox.Results.CSS) Wait.text_by_id( Constants.Dashboard.Overview.Title.ID, vfFullName) - except: + except BaseException: errorMsg = "Failed to search by Engagement Manual ID." raise Exception(errorMsg) Frontend.Overview.click_on_vf(self.user_content) @@ -130,13 +141,17 @@ class TestLeftNavPanel(TestUiBase): extRefID = Helper.rand_string("randomNumber") Enter.text_by_name("name", vfcName) Enter.text_by_name("extRefID", extRefID, wait_for_page=True) - Select(session.ice_driver.find_element_by_id(Constants.Dashboard.DetailedView.VFC.Choose_Company.ID)).select_by_visible_text( - self.user_content['vendor']) + Select(session.ice_driver.find_element_by_id( + Constants.Dashboard.DetailedView.VFC.Choose_Company.ID)).\ + select_by_visible_text(self.user_content['vendor']) Click.id( - Constants.Dashboard.DetailedView.VFC.Save_button.ID, wait_for_page=True) + Constants.Dashboard.DetailedView.VFC.Save_button.ID, + wait_for_page=True) try: Enter.text_by_id( - Constants.Dashboard.LeftPanel.SearchBox.ID, vfcName, wait_for_page=True) + Constants.Dashboard.LeftPanel.SearchBox.ID, + vfcName, + wait_for_page=True) Click.id( "search-" + self.user_content['vfName'], wait_for_page=True) Wait.id("clickable-" + vfFullName, wait_for_page=True) @@ -150,7 +165,7 @@ class TestLeftNavPanel(TestUiBase): myVfName = self.user_content[ 'engagement_manual_id'] + ": " + self.user_content['vfName'] actualVfNameid = "clickable-" + myVfName - actualVfName = Get.by_id(actualVfNameid, True) + actualVfName = Get.by_id(actualVfNameid) Helper.internal_assert(myVfName, actualVfName) Click.id(actualVfNameid) uuid = DB.General.select_where_email( @@ -175,9 +190,10 @@ class TestLeftNavPanel(TestUiBase): Wait.text_by_id(self.left_panel_eng_id, self.eng_title) DB.VirtualFunction.remove_engagement_from_recent( self.user_content['vf_uuid']) - Frontend.General.refresh() + Frontend.General.refresh() Frontend.Dashboard.statuses_search_vf( - self.user_content['engagement_manual_id'], self.user_content['vfName']) + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Wait.text_by_id(self.left_panel_eng_id, self.eng_title) @exception() @@ -187,7 +203,9 @@ class TestLeftNavPanel(TestUiBase): Frontend.User.relogin( user_content['email'], Constants.Default.Password.TEXT) Frontend.Dashboard.search_in_left_searchbox_by_param( - user_content['engagement_manual_id'], user_content['vfName'], user_content['email']) + user_content['engagement_manual_id'], + user_content['vfName'], + user_content['email']) @exception() def test_search_by_username(self): @@ -196,4 +214,6 @@ class TestLeftNavPanel(TestUiBase): Frontend.User.relogin( user_content['email'], Constants.Default.Password.TEXT) Frontend.Dashboard.search_in_left_searchbox_by_param( - user_content['engagement_manual_id'], user_content['vfName'], user_content['full_name']) + user_content['engagement_manual_id'], + user_content['vfName'], + user_content['full_name']) diff --git a/tests/uiTests/test_login_with_new_user.py b/tests/uiTests/test_login_with_new_user.py index d7d1bda..4cb0578 100644 --- a/tests/uiTests/test_login_with_new_user.py +++ b/tests/uiTests/test_login_with_new_user.py @@ -58,7 +58,8 @@ class TestLoginPageWithNewUser(TestUiBase): ''' Create new user login. ''' user_content = API.User.create_new_user() Frontend.User.login( - user_content['email'], Constants.Default.Password.TEXT, Constants.Toast.ID) + user_content['email'], Constants.Default.Password.TEXT, + Constants.Toast.ID) logger.debug("Resend Activation Email Page Opened ") Wait.text_by_id( Constants.Toast.ID, Constants.ActivateAccount.Toast.TEXT) @@ -68,7 +69,8 @@ class TestLoginPageWithNewUser(TestUiBase): ''' Negative: Type wrong password in login page. ''' user_content = API.User.create_new_user(activate=True) Frontend.User.login( - user_content['email'], Helper.rand_string("randomString"), Constants.Toast.ID) + user_content['email'], Helper.rand_string("randomString"), + Constants.Toast.ID) Wait.text_by_id(Constants.Toast.ID, Constants.Login.Toast.TEXT) logger.debug( "Message Error(APIUser or Password does not match) Displayed") @@ -78,7 +80,8 @@ class TestLoginPageWithNewUser(TestUiBase): ''' Negative: Type wrong password in login page. ''' user_content = API.User.create_new_user(activate=True) Frontend.User.login( - user_content['email'] + "s", Constants.Default.Password.TEXT, Constants.Toast.ID) + user_content['email'] + "s", Constants.Default.Password.TEXT, + Constants.Toast.ID) Wait.text_by_id(Constants.Toast.ID, Constants.Login.Toast.TEXT) logger.debug( "Message Error(APIUser or Password does not match) Displayed") @@ -92,11 +95,15 @@ class TestLoginPageWithNewUser(TestUiBase): Enter.text_by_name(Constants.Login.Password.NAME, "1") Enter.text_by_name(Constants.Login.Password.NAME, "") Wait.text_by_css( - Constants.Login.Password.Error.CSS, Constants.Login.Password.Error.TEXT) + Constants.Login.Password.Error.CSS, + Constants.Login.Password.Error.TEXT) @exception() def test_login_page_dont_have_accaunt_button(self): - ''' Go to login page, click_on on "Don't have an account", verify user is redirected to signup page. ''' + ''' + Go to login page, click_on on "Don't have an account", + verify user is redirected to signup page. + ''' Click.id(Constants.Login.DontHaveAccount.ID) Wait.text_by_css( Constants.Signup.Title.CSS, Constants.Signup.Title.TEXT) @@ -112,7 +119,8 @@ class TestLoginPageWithNewUser(TestUiBase): ''' Create user and activate by log-in. ''' user_content = API.User.create_new_user() Frontend.User.login( - user_content['email'], Constants.Default.Password.TEXT, Constants.Toast.ID) + user_content['email'], Constants.Default.Password.TEXT, + Constants.Toast.ID) ''' Resend Activation Email Page Opened ''' Wait.text_by_id( Constants.Toast.ID, Constants.ActivateAccount.Toast.TEXT) @@ -125,7 +133,10 @@ class TestLoginPageWithNewUser(TestUiBase): @exception() def test_invite_existing_user(self): - ''' Create user and VF, login, invite existing user, login with second user and verify user has joined to engagement ''' + ''' + Create user and VF, login, invite existing user, + login with second user and verify user has joined to engagement + ''' user_content = API.VirtualFunction.create_engagement( wait_for_gitlab=False) second_user_content = API.VirtualFunction.create_engagement( @@ -140,15 +151,26 @@ class TestLoginPageWithNewUser(TestUiBase): Click.id(actualVfNameid, wait_for_page=True) Wait.id(Constants.Dashboard.Overview.TeamMember.ID) Frontend.Wizard.invite_team_members_modal(second_user_content['email']) - enguuid = DB.General.select_where("uuid", "ice_engagement", "engagement_manual_id", user_content[ - 'engagement_manual_id'], 1) # Fetch one is_service_provider_contact user ID. - invitation_token = DB.User.select_invitation_token("invitation_token", "ice_invitation", "engagement_uuid", - enguuid, second_user_content['email'], 1) + enguuid = DB.General.select_where( + "uuid", + "ice_engagement", + "engagement_manual_id", + user_content['engagement_manual_id'], + 1) # Fetch one is_service_provider_contact user ID. + invitation_token = DB.User.select_invitation_token( + "invitation_token", + "ice_invitation", + "engagement_uuid", + enguuid, + second_user_content['email'], + 1) inviterURL = Constants.Default.InviteURL.Login.TEXT + invitation_token Frontend.General.re_open(inviterURL) actualVfNameid = "clickable-" + vfFullName Frontend.User.login( - second_user_content['email'], Constants.Default.Password.TEXT, actualVfNameid) + second_user_content['email'], + Constants.Default.Password.TEXT, + actualVfNameid) Wait.modal_to_dissappear() Frontend.Overview.click_on_vf(user_content) Wait.text_by_id(Constants.Dashboard.Overview.Title.ID, vfFullName) @@ -158,9 +180,11 @@ class TestLoginPageWithNewUser(TestUiBase): ''' TC Name: test_invite_new_user_aservice_provider_internal Steps: - Create new NOT-MainServiceProvider APIUser via SignUp request-->Login with This One--> build "activationUrl"--> + Create new NOT-MainServiceProvider APIUser via SignUp request--> + Login with This One--> build "activationUrl"--> Validation of successful activate--> - close Wizard --> Logout from Dashboard -->login-->Open Wizard--> fill all fields in all Tab's(4)--> + close Wizard --> Logout from Dashboard -->login-->Open Wizard--> + fill all fields in all Tab's(4)--> validate second Tab is a "add_service_provider_internal"--> build inviteURL from email--> reopen browser with inviteURL--> Validate Login Form opened --> @@ -172,7 +196,7 @@ class TestLoginPageWithNewUser(TestUiBase): activationUrl = DB.User.get_activation_url(user_content['email']) Frontend.General.re_open(activationUrl) Frontend.User.login( - user_content['email'], Constants.Default.Password.TEXT) # new + user_content['email'], Constants.Default.Password.TEXT) Wait.text_by_id( Constants.Toast.ID, Constants.Dashboard.ActivateMsg.Success.TEXT) Click.id(Constants.Dashboard.Wizard.CloseButton.ID) @@ -181,34 +205,46 @@ class TestLoginPageWithNewUser(TestUiBase): Frontend.User.login( user_content['email'], Constants.Default.Password.TEXT) Wait.text_by_css( - Constants.Dashboard.LeftPanel.Title.CSS, Constants.Dashboard.LeftPanel.Title.TEXT) + Constants.Dashboard.LeftPanel.Title.CSS, + Constants.Dashboard.LeftPanel.Title.TEXT) Wait.id(Constants.Dashboard.Statuses.Title.ID) Click.id(Constants.Dashboard.LeftPanel.AddEngagement.ID) # Wizard vfName = Frontend.Wizard.add_vf() - service_provider_internal = Frontend.Wizard.add_service_provider_internal() + service_provider_internal = \ + Frontend.Wizard.add_service_provider_internal() inviteEmail = Helper.rand_invite_email() Frontend.Wizard.invite_team_members(inviteEmail) Frontend.Wizard.add_ssh_key() enguuid = DB.General.select_where("uuid", "ice_vf", "name", vfName, 1) - invitation_token = DB.User.select_invitation_token("invitation_token", "ice_invitation", "engagement_uuid", - enguuid, inviteEmail, 1) + invitation_token = DB.User.select_invitation_token( + "invitation_token", "ice_invitation", "engagement_uuid", + enguuid, inviteEmail, 1) inviterURL = Constants.Default.InviteURL.Signup.TEXT + \ invitation_token + "&email=" + inviteEmail Frontend.General.re_open(inviterURL) actualInvitedEmail = Get.value_by_name(Constants.Signup.Email.NAME) Helper.internal_assert(inviteEmail, actualInvitedEmail) - signUpURLforContact = DB.User.get_contact_signup_url(invitation_token, uuid, service_provider_internal["email"], - service_provider_internal["full_name"], service_provider_internal["phone"], service_provider_internal["company"]) + signUpURLforContact = DB.User.get_contact_signup_url( + invitation_token, + uuid, + service_provider_internal["email"], + service_provider_internal["full_name"], + service_provider_internal["phone"], + service_provider_internal["company"]) Frontend.General.re_open(signUpURLforContact) actualInvitedEmail = Get.value_by_name(Constants.Signup.Email.NAME) Helper.internal_assert( service_provider_internal["email"], actualInvitedEmail) Helper.internal_assert( - "+" + service_provider_internal["phone"], Get.value_by_name(Constants.Signup.Phone.NAME)) + "+" + service_provider_internal["phone"], + Get.value_by_name( + Constants.Signup.Phone.NAME)) Helper.internal_assert( - service_provider_internal["full_name"], Get.value_by_name(Constants.Signup.FullName.NAME)) + service_provider_internal["full_name"], + Get.value_by_name( + Constants.Signup.FullName.NAME)) signupCompany = Get.value_by_name(Constants.Signup.Company.NAME, True) Helper.internal_assert( service_provider_internal["company"], signupCompany) @@ -216,7 +252,8 @@ class TestLoginPageWithNewUser(TestUiBase): @exception() def test_create_2_new_users(self): ''' - Login and activate new user, than reopen browser and loging with new other user - + Login and activate new user, + than reopen browser and loging with new other user - check wizard appears for both Frontend.User. ''' # First APIUser @@ -239,7 +276,7 @@ class TestLoginPageWithNewUser(TestUiBase): logger.debug(activationUrl2) Frontend.General.re_open_not_clean_cache(activationUrl2) Frontend.User.login( - user_content['email'], Constants.Default.Password.TEXT) # new + user_content['email'], Constants.Default.Password.TEXT) Wait.text_by_id( Constants.Toast.ID, Constants.Dashboard.ActivateMsg.Success.TEXT) Click.id(Constants.Dashboard.Wizard.CloseButton.ID) @@ -263,7 +300,8 @@ class TestLoginPageWithNewUser(TestUiBase): ''' TC Name: test_add_vendor_contact Steps: - Invite vendor contact and activate the invited user. Validate the invited user has the right VF. + Invite vendor contact and activate the invited user. + Validate the invited user has the right VF. ''' user_content = API.User.create_new_user() # Fetch one user ID. @@ -281,7 +319,8 @@ class TestLoginPageWithNewUser(TestUiBase): Frontend.User.login( user_content['email'], Constants.Default.Password.TEXT) Wait.text_by_css( - Constants.Dashboard.LeftPanel.Title.CSS, Constants.Dashboard.LeftPanel.Title.TEXT) + Constants.Dashboard.LeftPanel.Title.CSS, + Constants.Dashboard.LeftPanel.Title.TEXT) Wait.id(Constants.Dashboard.Statuses.Title.ID) logger.debug("click_on on + Dashboard") Click.id(Constants.Dashboard.LeftPanel.AddEngagement.ID) @@ -297,33 +336,56 @@ class TestLoginPageWithNewUser(TestUiBase): engLeadEmail = DB.User.select_el_email(vfName) engagement_manual_id = DB.General.select_where( "engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) - invitation_token = DB.User.select_invitation_token("invitation_token", "ice_invitation", "engagement_uuid", - engagement_id, vendor_contact["email"], 1) - signUpURLforContact = DB.User.get_contact_signup_url(invitation_token, uuid, vendor_contact["email"], - vendor_contact["full_name"], vendor_contact["phone"], vendor_contact["company"]) + invitation_token = DB.User.select_invitation_token( + "invitation_token", + "ice_invitation", + "engagement_uuid", + engagement_id, + vendor_contact["email"], + 1) + signUpURLforContact = DB.User.get_contact_signup_url( + invitation_token, + uuid, + vendor_contact["email"], + vendor_contact["full_name"], + vendor_contact["phone"], + vendor_contact["company"]) Frontend.General.re_open(signUpURLforContact) actualInvitedEmail = Get.value_by_name(Constants.Signup.Email.NAME) Helper.internal_assert(vendor_contact["email"], actualInvitedEmail) Helper.internal_assert( - "+" + vendor_contact["phone"], Get.value_by_name(Constants.Signup.Phone.NAME)) + "+" + vendor_contact["phone"], + Get.value_by_name( + Constants.Signup.Phone.NAME)) Helper.internal_assert( - vendor_contact["full_name"], Get.value_by_name(Constants.Signup.FullName.NAME)) + vendor_contact["full_name"], + Get.value_by_name( + Constants.Signup.FullName.NAME)) Helper.internal_assert( - vendor_contact["company"], Get.value_by_name(Constants.Signup.Company.NAME)) + vendor_contact["company"], + Get.value_by_name( + Constants.Signup.Company.NAME)) # SignUp for VendorContact user_content['engagement_uuid'] = engagement_id user_content['engagement_manual_id'] = engagement_manual_id user_content['vfName'] = vfName user_content['el_email'] = engLeadEmail - API.User.signup_invited_user(vendor_contact["company"], vendor_contact["email"], invitation_token, - signUpURLforContact, user_content, True) + API.User.signup_invited_user( + vendor_contact["company"], + vendor_contact["email"], + invitation_token, + signUpURLforContact, + user_content, + True) activationUrl2 = DB.User.get_activation_url(vendor_contact["email"]) # Activate for VendorContact myVfName = engagement_manual_id + ": " + vfName actualVfNameid = "clickable-" + myVfName Frontend.General.re_open(activationUrl2) Frontend.User.login( - vendor_contact["email"], Constants.Default.Password.TEXT, actualVfNameid) + vendor_contact["email"], + Constants.Default.Password.TEXT, + actualVfNameid) # Validate opened right VF for VendorContact actualVfName = Get.by_id(actualVfNameid) Helper.internal_assert(myVfName, actualVfName) @@ -333,7 +395,8 @@ class TestLoginPageWithNewUser(TestUiBase): ''' TC Name: test_add_service_provider_internal Steps: - Invite is_service_provider_contact Sponsor and activate the invited user. Validate sponsor has the right VF. + Invite is_service_provider_contact Sponsor and + activate the invited user. Validate sponsor has the right VF. ''' user_content = API.User.create_new_user(company="Amdocs") uuid = DB.General.select_where_email( @@ -350,35 +413,51 @@ class TestLoginPageWithNewUser(TestUiBase): Frontend.User.login( user_content['email'], Constants.Default.Password.TEXT) Wait.text_by_css( - Constants.Dashboard.LeftPanel.Title.CSS, Constants.Dashboard.LeftPanel.Title.TEXT) + Constants.Dashboard.LeftPanel.Title.CSS, + Constants.Dashboard.LeftPanel.Title.TEXT) Wait.id(Constants.Dashboard.Statuses.Title.ID) logger.debug("click_on on + Dashboard") Click.id(Constants.Dashboard.LeftPanel.AddEngagement.ID) # Wizard vfName = Frontend.Wizard.add_vf() - service_provider_internal = Frontend.Wizard.add_service_provider_internal() + service_provider_internal = \ + Frontend.Wizard.add_service_provider_internal() inviteEmail = "automationqatt" + \ Helper.rand_string("randomString") + "@gmail.com" Frontend.Wizard.invite_team_members(inviteEmail) Frontend.Wizard.add_ssh_key() enguuid = DB.General.select_where("uuid", "ice_vf", "name", vfName, 1) - invitation_token = DB.User.select_invitation_token("invitation_token", "ice_invitation", "engagement_uuid", - enguuid, inviteEmail, 1) + invitation_token = DB.User.select_invitation_token( + "invitation_token", "ice_invitation", "engagement_uuid", + enguuid, inviteEmail, 1) inviterURL = Constants.Default.InviteURL.Signup.TEXT + \ invitation_token + "&email=" + inviteEmail Frontend.General.re_open(inviterURL) actualInvitedEmail = Get.value_by_name("email") Helper.internal_assert(inviteEmail, actualInvitedEmail) - signUpURLforContact = DB.User.get_contact_signup_url(invitation_token, uuid, service_provider_internal["email"], - service_provider_internal["full_name"], service_provider_internal["phone"], service_provider_internal["company"]) + signUpURLforContact = DB.User.get_contact_signup_url( + invitation_token, + uuid, + service_provider_internal["email"], + service_provider_internal["full_name"], + service_provider_internal["phone"], + service_provider_internal["company"]) Frontend.General.re_open(signUpURLforContact) actualInvitedEmail = Get.value_by_name(Constants.Signup.Email.NAME) Helper.internal_assert( - str("+" + service_provider_internal["phone"]), Get.value_by_name(Constants.Signup.Phone.NAME)) + str( + "+" + + service_provider_internal["phone"]), + Get.value_by_name( + Constants.Signup.Phone.NAME)) Helper.internal_assert( - service_provider_internal["full_name"], Get.value_by_name(Constants.Signup.FullName.NAME)) + service_provider_internal["full_name"], + Get.value_by_name( + Constants.Signup.FullName.NAME)) Helper.internal_assert( - service_provider_internal["company"], Get.value_by_name(Constants.Signup.Company.NAME)) + service_provider_internal["company"], + Get.value_by_name( + Constants.Signup.Company.NAME)) # Fetch one is_service_provider_contact user ID. engagement_id = DB.General.select_where( "engagement_id", "ice_vf", "name", vfName, 1) @@ -386,23 +465,30 @@ class TestLoginPageWithNewUser(TestUiBase): engagement_manual_id = DB.General.select_where( "engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) - invitation_token = DB.User.select_invitation_token("invitation_token", "ice_invitation", "engagement_uuid", - engagement_id, service_provider_internal["email"], 1) + invitation_token = DB.User.select_invitation_token( + "invitation_token", + "ice_invitation", + "engagement_uuid", + engagement_id, + service_provider_internal["email"], + 1) engLeadEmail = DB.User.select_el_email(vfName) user_content['engagement_uuid'] = engagement_id user_content['engagement_manual_id'] = engagement_manual_id user_content['vfName'] = vfName user_content['el_email'] = engLeadEmail - API.User.signup_invited_user(service_provider_internal["company"], service_provider_internal["email"], invitation_token, - signUpURLforContact, user_content, True) + API.User.signup_invited_user( + service_provider_internal["company"], + service_provider_internal["email"], + invitation_token, + signUpURLforContact, + user_content, + True) activationUrl2 = DB.User.get_activation_url( service_provider_internal["email"]) # Activate for VendorContact - - - engagement_manual_id = DB.General.select_where( "engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) # Validate opened right VF for VendorContact @@ -410,13 +496,17 @@ class TestLoginPageWithNewUser(TestUiBase): actualVfNameid = "clickable-" + myVfName Frontend.General.re_open(activationUrl2) Frontend.User.login( - service_provider_internal["email"], Constants.Default.Password.TEXT, actualVfNameid) + service_provider_internal["email"], + Constants.Default.Password.TEXT, + actualVfNameid) actualVfName = Get.by_id(actualVfNameid, wait_for_page=True) Helper.internal_assert(myVfName, actualVfName) @exception() def test_Validate_SSHkeyNS(self): - ''' Insert a valid ssh key in wizard, validate "add ssh key" next step marked as completed. ''' + ''' Insert a valid ssh key in wizard, validate "add ssh key" + next step marked as completed. + ''' user_content = API.User.create_new_user() activationUrl = DB.User.get_activation_url(user_content['email']) Frontend.General.re_open(activationUrl) @@ -430,7 +520,8 @@ class TestLoginPageWithNewUser(TestUiBase): Frontend.User.login( user_content['email'], Constants.Default.Password.TEXT) Wait.text_by_css( - Constants.Dashboard.LeftPanel.Title.CSS, Constants.Dashboard.LeftPanel.Title.TEXT) + Constants.Dashboard.LeftPanel.Title.CSS, + Constants.Dashboard.LeftPanel.Title.TEXT) logger.debug("click_on on + Dashboard") Click.id(Constants.Dashboard.LeftPanel.AddEngagement.ID) # Wizard @@ -482,8 +573,8 @@ class TestLoginPageWithNewUser(TestUiBase): Helper.internal_assert(user_content['full_name'], actualFullName) Click.id(Constants.Dashboard.Statuses.ID) Frontend.Overview.click_on_vf(user_content) - Helper.internal_assert( - "Current Status", Get.by_css(Constants.Dashboard.Overview.Status.Header.ID)) + Helper.internal_assert("Current Status", Get.by_css( + Constants.Dashboard.Overview.Status.Header.ID)) Wait.text_by_id(Constants.Dashboard.Overview.Status.Description.ID, "No status update has been provided yet.") Click.id(Constants.Dashboard.Avatar.ID) @@ -495,17 +586,22 @@ class TestLoginPageWithNewUser(TestUiBase): Helper.internal_assert( "Add Status", Get.by_css("h3.modal-title.ng-binding")) Helper.internal_assert( - "Use the form below to add the current status of the engagement.", Get.by_css("span.ng-binding")) + "Use the form below to add the current status of the engagement.", + Get.by_css("span.ng-binding")) Click.css("textarea[name=\"description\"]") Enter.text_by_css( - "textarea[name=\"description\"]", "Add new Status", wait_for_page=True) - Helper.internal_assert( - "Add status", Get.by_id(Constants.Dashboard.DetailedView.VFC.Save_button.ID)) + "textarea[name=\"description\"]", + "Add new Status", + wait_for_page=True) + Helper.internal_assert("Add status", Get.by_id( + Constants.Dashboard.DetailedView.VFC.Save_button.ID)) Click.id( - Constants.Dashboard.DetailedView.VFC.Save_button.ID, wait_for_page=True) + Constants.Dashboard.DetailedView.VFC.Save_button.ID, + wait_for_page=True) Helper.assertTrue("Last updated" in Get.by_id("status-update-details")) Wait.text_by_id( - Constants.Dashboard.Overview.Status.Description.ID, "Add new Status") + Constants.Dashboard.Overview.Status.Description.ID, + "Add new Status") Wait.css(Constants.Dashboard.Overview.Status.Edit.CSS) Wait.modal_to_dissappear() Click.css(Constants.Dashboard.Overview.Status.Edit.CSS) @@ -516,15 +612,17 @@ class TestLoginPageWithNewUser(TestUiBase): Click.id(Constants.Dashboard.DetailedView.VFC.Save_button.ID) Wait.modal_to_dissappear() Wait.text_by_id( - Constants.Dashboard.Overview.Status.Description.ID, "Update Status") + Constants.Dashboard.Overview.Status.Description.ID, + "Update Status") Frontend.User.logout() Frontend.User.relogin( - user_content['email'], Constants.Default.Password.TEXT) # new + user_content['email'], Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(user_content) - Helper.internal_assert( - "Current Status", Get.by_css(Constants.Dashboard.Overview.Status.Header.ID)) + Helper.internal_assert("Current Status", Get.by_css( + Constants.Dashboard.Overview.Status.Header.ID)) Wait.text_by_id( - Constants.Dashboard.Overview.Status.Description.ID, "Update Status") + Constants.Dashboard.Overview.Status.Description.ID, + "Update Status") @exception() def test_XSS_script(self): diff --git a/tests/uiTests/test_next_step.py b/tests/uiTests/test_next_step.py index cf1e00c..5c281f8 100644 --- a/tests/uiTests/test_next_step.py +++ b/tests/uiTests/test_next_step.py @@ -85,8 +85,10 @@ class TestNextStep(TestUiBase): def test_complete_next_steps(self): user_content = API.VirtualFunction.create_engagement( wait_for_gitlab=False) - steps_uuids = DB.VirtualFunction.return_expected_steps(user_content['engagement_uuid'], - Constants.EngagementStages.INTAKE, user_content['email']) + steps_uuids = DB.VirtualFunction.return_expected_steps( + user_content['engagement_uuid'], + Constants.EngagementStages.INTAKE, + user_content['email']) Frontend.User.login( user_content['email'], Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(user_content) @@ -102,18 +104,22 @@ class TestNextStep(TestUiBase): user_content['session_token'] = "token " + \ API.User.login_user(user_content['el_email']) - # Create a checklist in order for the files to be viewed in the Overview. when + # Create a checklist in order for the + # files to be viewed in the Overview. when # we want to filter next steps by files in the Overview - EM shows us # files that relate to the VF's CLs) API.Checklist.create_checklist(user_content) next_step_uuid = API.VirtualFunction.add_next_step( - user_content, [Constants.Dashboard.Overview.NextSteps.FilterByFileDropDown.FILE0_LINK_TEXT]) + user_content, [ + Constants.Dashboard.Overview.NextSteps. + FilterByFileDropDown.FILE0_LINK_TEXT]) Frontend.User.login( user_content['el_email'], Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(user_content) Frontend.Overview.next_steps_filter_by_files() - Helper.internal_assert(Frontend.Overview.get_next_step_description(0), - DB.VirtualFunction.select_next_step_description(next_step_uuid)) + Helper.internal_assert( + Frontend.Overview.get_next_step_description(0), + DB.VirtualFunction.select_next_step_description(next_step_uuid)) @exception() def test_filter_next_steps_by_associated_files_via_pr(self): @@ -123,13 +129,16 @@ class TestNextStep(TestUiBase): API.User.login_user(user_content['el_email']) API.Checklist.create_checklist(user_content) next_step_uuid = API.VirtualFunction.add_next_step( - user_content, [Constants.Dashboard.Overview.NextSteps.FilterByFileDropDown.FILE0_LINK_TEXT]) + user_content, [ + Constants.Dashboard.Overview.NextSteps. + FilterByFileDropDown.FILE0_LINK_TEXT]) Frontend.User.login( user_content['pr_email'], Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(user_content) Frontend.Overview.next_steps_filter_by_files() - Helper.internal_assert(Frontend.Overview.get_next_step_description(0), - DB.VirtualFunction.select_next_step_description(next_step_uuid)) + Helper.internal_assert( + Frontend.Overview.get_next_step_description(0), + DB.VirtualFunction.select_next_step_description(next_step_uuid)) @exception() def test_delete_next_step(self): @@ -138,8 +147,8 @@ class TestNextStep(TestUiBase): Frontend.User.login( user_content['el_email'], Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(user_content) - steps_uuids = DB.VirtualFunction.select_next_steps_uuids_by_stage(user_content['engagement_uuid'], - Constants.EngagementStages.INTAKE) + steps_uuids = DB.VirtualFunction.select_next_steps_uuids_by_stage( + user_content['engagement_uuid'], Constants.EngagementStages.INTAKE) for idx, step_uuid in enumerate(steps_uuids): Frontend.Overview.delete_next_step(step_uuid) logger.debug("Next step deleted! (%s of %s)" % @@ -152,8 +161,8 @@ class TestNextStep(TestUiBase): Frontend.User.login( user_content['pr_email'], Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(user_content) - steps_uuids = DB.VirtualFunction.select_next_steps_uuids_by_stage(user_content['engagement_uuid'], - Constants.EngagementStages.INTAKE) + steps_uuids = DB.VirtualFunction.select_next_steps_uuids_by_stage( + user_content['engagement_uuid'], Constants.EngagementStages.INTAKE) for idx, step_uuid in enumerate(steps_uuids): Frontend.Overview.delete_next_step(step_uuid) logger.debug("Next step deleted! (%s of %s)" % @@ -165,14 +174,17 @@ class TestNextStep(TestUiBase): wait_for_gitlab=False) user_content['session_token'] = "token " + \ API.User.login_user(user_content['email']) - steps_uuids = DB.VirtualFunction.return_expected_steps(user_content['engagement_uuid'], - Constants.EngagementStages.INTAKE, user_content['email']) + steps_uuids = DB.VirtualFunction.return_expected_steps( + user_content['engagement_uuid'], + Constants.EngagementStages.INTAKE, + user_content['email']) Frontend.User.login( user_content['email'], Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(user_content) Click.id(Constants.Dashboard.Overview.NextSteps.StateDropDown.ID) Click.link_text( - Constants.Dashboard.Overview.NextSteps.StateDropDown.COMPLETED_LINK_TEXT) + Constants.Dashboard.Overview.NextSteps. + StateDropDown.COMPLETED_LINK_TEXT) Click.id(Constants.Dashboard.Overview.NextSteps.StateDropDown.ID, wait_for_page=True) Frontend.Overview.validate_next_steps_order(steps_uuids) @@ -183,7 +195,9 @@ class TestNextStep(TestUiBase): Click.id(Constants.Dashboard.Overview.NextSteps.StateDropDown.ID, wait_for_page=True) Click.link_text( - Constants.Dashboard.Overview.NextSteps.StateDropDown.COMPLETED_LINK_TEXT, wait_for_page=True) + Constants.Dashboard.Overview.NextSteps. + StateDropDown.COMPLETED_LINK_TEXT, + wait_for_page=True) Click.id(Constants.Dashboard.Overview.NextSteps.StateDropDown.ID, wait_for_page=True) Frontend.Overview.validate_next_steps_order( @@ -206,15 +220,16 @@ class TestNextStep(TestUiBase): cl_content = API.Checklist.create_checklist(user_content) DB.Checklist.state_changed( "name", cl_content['name'], Constants.ChecklistStates.Review.TEXT) - new_cl_uuid = DB.Checklist.get_recent_checklist_uuid(cl_content['name'])[ - 0] + new_cl_uuid = DB.Checklist.get_recent_checklist_uuid( + cl_content['name'])[0] API.Checklist.add_checklist_next_step(user_content, new_cl_uuid) Frontend.User.login( user_content['pr_email'], Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(user_content) Frontend.Overview.next_steps_filter_by_files() Frontend.Overview.validate_associated_files( - Constants.Dashboard.Overview.NextSteps.FilterByFileDropDown.FILE0_LINK_TEXT) + Constants.Dashboard.Overview.NextSteps. + FilterByFileDropDown.FILE0_LINK_TEXT) @exception() def test_all_vf_gitlab_repo_files_can_be_chosen_in_new_ns(self): @@ -239,7 +254,7 @@ class TestNextStep(TestUiBase): self.user_content['session_token'] = "token " + \ API.User.login_user(self.user_content['el_email']) API.GitLab.git_clone_push(self.user_content) - cl_content = API.Checklist.create_checklist(self.user_content) + API.Checklist.create_checklist(self.user_content) FEUser.login(self.user_content['el_email'], Constants.Default.Password.TEXT) FEOverview.click_on_vf(self.user_content) diff --git a/tests/uiTests/test_notification_for_new_user.py b/tests/uiTests/test_notification_for_new_user.py index 720caab..076760c 100644 --- a/tests/uiTests/test_notification_for_new_user.py +++ b/tests/uiTests/test_notification_for_new_user.py @@ -1,49 +1,44 @@ - -# ============LICENSE_START========================================== -# org.onap.vvp/test-engine -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the “License”); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -import logging - -from django.conf import settings +# ============LICENSE_START========================================== +# org.onap.vvp/test-engine +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the “License”); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. from iceci.decorator.exception_decor import exception from services.constants import Constants from services.logging_service import LoggingServiceFactory -from services.session import session from services.types import API, DB, Frontend from tests.uiTests.test_ui_base import TestUiBase @@ -82,10 +77,16 @@ class TestNotificationForNewUser(TestUiBase): Frontend.User.go_to_notifications() notificationIDs = DB.User.get_notification_id_by_email( user_content['email']) - notification_list = [user_content['full_name'] + " joined " + user_content['vfName'], - user_content['el_name'] + - " joined " + user_content['vfName'], - user_content['pr_name'] + " joined " + user_content['vfName']] + notification_list = [ + user_content['full_name'] + + " joined " + + user_content['vfName'], + user_content['el_name'] + + " joined " + + user_content['vfName'], + user_content['pr_name'] + + " joined " + + user_content['vfName']] Frontend.User.validate_notifications( notificationIDs, notification_list) @@ -105,4 +106,4 @@ class TestNotificationForNewUser(TestUiBase): notifications_num = DB.User.get_not_seen_notifications_number_by_email( self.user_content['pr_email'], is_negative=True) assert(notifications_num == "0") - Frontend.User.check_notification_number_is_not_presented() + Frontend.User.check_notification_number_is_not_presented() diff --git a/tests/uiTests/test_overview.py b/tests/uiTests/test_overview.py index 31db2f7..e58f4ea 100644 --- a/tests/uiTests/test_overview.py +++ b/tests/uiTests/test_overview.py @@ -53,7 +53,8 @@ class TestOverview(TestUiBase): @exception() def test_engagement_validation_details_update_when_cl_closed(self): user_content = API.VirtualFunction.create_engagement() - cl_name = Constants.Dashboard.Checklist.ChecklistDefaultNames.AIC_INSTANTIATION + cl_name = Constants.Dashboard.Checklist.\ + ChecklistDefaultNames.AIC_INSTANTIATION DB.Checklist.state_changed( "name", cl_name, Constants.ChecklistStates.Review.TEXT) cl_uuid = DB.Checklist.get_recent_checklist_uuid(cl_name)[0] diff --git a/tests/uiTests/test_portal_homepage.py b/tests/uiTests/test_portal_homepage.py index 19846c8..7995f44 100644 --- a/tests/uiTests/test_portal_homepage.py +++ b/tests/uiTests/test_portal_homepage.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -46,10 +45,12 @@ from tests.uiTests.test_ui_base import TestUiBase logger = LoggingServiceFactory.get_logger() + class TestPortalHomepage(TestUiBase): @exception() def test_homepage(self): - ''' Portal home page sanity, click on links, varify buttons and headlines. ''' + ''' Portal home page sanity, click on links, varify + buttons and headlines. ''' Frontend.General.re_open(settings.ICE_PORTAL_URL) Frontend.General.verify_home_elements() - Frontend.General.go_to_signup_from_homepage() + Frontend.General.go_to_signup_from_homepage() diff --git a/tests/uiTests/test_progress_bar.py b/tests/uiTests/test_progress_bar.py index bb5fa21..b1a168c 100644 --- a/tests/uiTests/test_progress_bar.py +++ b/tests/uiTests/test_progress_bar.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. diff --git a/tests/uiTests/test_rados_perms.py b/tests/uiTests/test_rados_perms.py index 6143edc..dccd6d3 100644 --- a/tests/uiTests/test_rados_perms.py +++ b/tests/uiTests/test_rados_perms.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -40,6 +39,7 @@ from wheel.signatures import assertTrue from iceci.decorator.exception_decor import exception from services.constants import Constants +from services.frontend.base_actions.wait import Wait from services.logging_service import LoggingServiceFactory from services.types import API from tests.uiTests.test_ui_base import TestUiBase @@ -48,33 +48,39 @@ logger = LoggingServiceFactory.get_logger() class TestRadosPermissions(TestUiBase): - + def create_bucket_and_validate_users(self): user_content = API.VirtualFunction.create_engagement( wait_for_gitlab=True) - print("***********STAGE = ",user_content['vfStage']) - API.VirtualFunction.set_eng_stage(user_content, Constants.EngagementStages.ACTIVE) - bucket_id = user_content['engagement_manual_id'] + "_" + user_content['vfName'].lower() + API.VirtualFunction.set_eng_stage( + user_content, Constants.EngagementStages.ACTIVE) + bucket_id = user_content['engagement_manual_id'] + \ + "_" + user_content['vfName'].lower() + Wait.bucket_to_create(bucket_id) bucket = API.Rados.get_bucket(bucket_id) assertTrue(API.Rados.is_bucket_ready(bucket_id)) assertTrue(bucket != "None") - #validate users added to bucket + # validate users added to bucket grants = API.Rados.get_bucket_grants(bucket_id) count = 0 for g in grants: - if g.id == user_content['full_name']: + if g.id == user_content['uuid']: count = +1 - + assertTrue(count > 0) return bucket, user_content @exception() def test_permissions_stage_validated(self): bucket, user_content = self.create_bucket_and_validate_users() - API.VirtualFunction.set_eng_stage(user_content, Constants.EngagementStages.VALIDATED) - bucket_id = user_content['engagement_manual_id'] + "_" + user_content['vfName'].lower() - assertTrue(API.Rados.users_of_bucket_ready_after_complete(bucket_id, user_content['full_name'])) + API.VirtualFunction.set_eng_stage( + user_content, Constants.EngagementStages.VALIDATED) + bucket_id = user_content['engagement_manual_id'] + \ + "_" + user_content['vfName'].lower() + assertTrue( + API.Rados.users_of_bucket_ready_after_complete( + bucket_id, user_content['full_name'])) bucket = API.Rados.get_bucket(bucket_id) assertTrue(API.Rados.is_bucket_ready(bucket_id)) assertTrue(bucket != "None") @@ -92,8 +98,11 @@ class TestRadosPermissions(TestUiBase): bucket, user_content = self.create_bucket_and_validate_users() API.VirtualFunction.set_eng_stage( user_content, Constants.EngagementStages.COMPLETED) - bucket_id = user_content['engagement_manual_id'] + "_" + user_content['vfName'].lower() - assertTrue(API.Rados.users_of_bucket_ready_after_complete(bucket_id, user_content['full_name'])) + bucket_id = user_content['engagement_manual_id'] + \ + "_" + user_content['vfName'].lower() + assertTrue( + API.Rados.users_of_bucket_ready_after_complete( + bucket_id, user_content['full_name'])) assertTrue(API.Rados.is_bucket_ready(bucket_id)) bucket = API.Rados.get_bucket(bucket_id) grants = API.Rados.get_bucket_grants(bucket_id) diff --git a/tests/uiTests/test_remove_user_from_eng.py b/tests/uiTests/test_remove_user_from_eng.py index dd76d31..1c0513a 100644 --- a/tests/uiTests/test_remove_user_from_eng.py +++ b/tests/uiTests/test_remove_user_from_eng.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -53,64 +52,103 @@ class TestRemoveUserFromEng(TestUiBase): def setUpClass(cls): super(TestRemoveUserFromEng, cls).setUpClass() - cls.user_content = API.VirtualFunction.create_engagement(wait_for_gitlab=False) - + cls.user_content = API.VirtualFunction.create_engagement( + wait_for_gitlab=False) + @exception() def test_remove_user_with_admin(self): - second_user_email, invite_token, invite_url = API.VirtualFunction.invite_team_member(self.user_content) - invited_user = API.User.signup_invited_user(ServiceProvider.MainServiceProvider, second_user_email, invite_token, invite_url, - self.user_content) - Frontend.User.login(Constants.Users.Admin.EMAIL, Constants.Default.Password.TEXT) - Frontend.Dashboard.statuses_search_vf(self.user_content['engagement_manual_id'], self.user_content['vfName']) + second_user_email, invite_token, invite_url = \ + API.VirtualFunction.invite_team_member( + self.user_content) + invited_user = API.User.signup_invited_user( + ServiceProvider.MainServiceProvider, + second_user_email, + invite_token, + invite_url, + self.user_content) + Frontend.User.login( + Constants.Users.Admin.EMAIL, + Constants.Default.Password.TEXT) + Frontend.Dashboard.statuses_search_vf( + self.user_content['engagement_manual_id'], + self.user_content['vfName']) Frontend.Overview.remove_user_from_eng_team(invited_user["full_name"]) - - + @exception() def test_remove_user_with_reviewer(self): - second_user_email, invite_token, invite_url = API.VirtualFunction.invite_team_member(self.user_content) - invited_user = API.User.signup_invited_user(ServiceProvider.MainServiceProvider, second_user_email, invite_token, invite_url, - self.user_content) - Frontend.User.login(self.user_content['el_email'], Constants.Default.Password.TEXT) + second_user_email, invite_token, invite_url = \ + API.VirtualFunction.invite_team_member( + self.user_content) + invited_user = API.User.signup_invited_user( + ServiceProvider.MainServiceProvider, + second_user_email, + invite_token, + invite_url, + self.user_content) + Frontend.User.login( + self.user_content['el_email'], + Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(self.user_content) Frontend.Overview.remove_user_from_eng_team(invited_user["full_name"]) - - + @exception() def test_remove_user_with_peer_reviewer(self): - second_user_email, invite_token, invite_url = API.VirtualFunction.invite_team_member(self.user_content) - invited_user = API.User.signup_invited_user(ServiceProvider.MainServiceProvider, second_user_email, invite_token, invite_url, - self.user_content) - Frontend.User.login(self.user_content['pr_email'], Constants.Default.Password.TEXT) + second_user_email, invite_token, invite_url = \ + API.VirtualFunction.invite_team_member( + self.user_content) + invited_user = API.User.signup_invited_user( + ServiceProvider.MainServiceProvider, + second_user_email, + invite_token, + invite_url, + self.user_content) + Frontend.User.login( + self.user_content['pr_email'], + Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(self.user_content) Frontend.Overview.remove_user_from_eng_team(invited_user["full_name"]) - - + @exception() def test_negative_remove_reviewer_from_eng(self): - Frontend.User.login(self.user_content["pr_email"], Constants.Default.Password.TEXT) + Frontend.User.login( + self.user_content["pr_email"], + Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(self.user_content) - Frontend.Overview.remove_user_from_eng_team(self.user_content["el_name"], True) - - + Frontend.Overview.remove_user_from_eng_team( + self.user_content["el_name"], True) + @exception() def test_negative_remove_peer_reviewer_from_eng(self): - Frontend.User.login(self.user_content['el_email'], Constants.Default.Password.TEXT) + Frontend.User.login( + self.user_content['el_email'], + Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(self.user_content) - Frontend.Overview.remove_user_from_eng_team(self.user_content["pr_name"], True) - - + Frontend.Overview.remove_user_from_eng_team( + self.user_content["pr_name"], True) + @exception() def test_negative_remove_creator_from_eng(self): - Frontend.User.login(self.user_content['el_email'], Constants.Default.Password.TEXT) + Frontend.User.login( + self.user_content['el_email'], + Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(self.user_content) - Frontend.Overview.remove_user_from_eng_team(self.user_content["full_name"], True) - - + Frontend.Overview.remove_user_from_eng_team( + self.user_content["full_name"], True) + @exception() def test_negative_remove_contact_user_from_eng(self): - second_user_email, invite_token, invite_url = API.VirtualFunction.add_contact(self.user_content) - invited_user = API.User.signup_invited_user(ServiceProvider.MainServiceProvider, second_user_email, invite_token, invite_url, - self.user_content, "true", True) + second_user_email, invite_token, invite_url = \ + API.VirtualFunction.add_contact( + self.user_content) + invited_user = API.User.signup_invited_user( + ServiceProvider.MainServiceProvider, + second_user_email, + invite_token, + invite_url, + self.user_content, + "true", + True) Frontend.User.login(second_user_email, Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(self.user_content) - Frontend.Overview.remove_user_from_eng_team(invited_user["full_name"], True) + Frontend.Overview.remove_user_from_eng_team( + invited_user["full_name"], True) diff --git a/tests/uiTests/test_reset_password.py b/tests/uiTests/test_reset_password.py index abdaa69..1e7d6a1 100644 --- a/tests/uiTests/test_reset_password.py +++ b/tests/uiTests/test_reset_password.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -54,24 +53,33 @@ class TestResetPassword(TestUiBase): def setUpClass(cls): super(TestResetPassword, cls).setUpClass() - cls.user_content = API.VirtualFunction.create_engagement(wait_for_gitlab=False) - + cls.user_content = API.VirtualFunction.create_engagement( + wait_for_gitlab=False) + @exception() def test_reset_password(self): Frontend.General.send_reset_password(self.user_content['email']) DB.User.set_new_temp_password(self.user_content['email']) resetPasswURL = Helper.get_reset_passw_url(self.user_content['email']) Frontend.General.re_open(resetPasswURL) - Frontend.User.login(self.user_content['email'], Constants.Default.Password.TEXT, - Constants.UpdatePassword.Title.CSS, "css") - logger.debug("\nReset URL: %s \nTemp Password: %s \nUser Email: %s" % (resetPasswURL, - Constants.Default.Password.TEXT, self.user_content['email'])) + Frontend.User.login( + self.user_content['email'], + Constants.Default.Password.TEXT, + Constants.UpdatePassword.Title.CSS, + "css") + logger.debug("\nReset URL: %s \nTemp Password: %s \nUser Email: %s" % ( + resetPasswURL, Constants.Default.Password.TEXT, + self.user_content['email'])) Frontend.User.reset_password() logger.debug("Logout and verify new password works") Frontend.User.logout() logger.debug("Login with updated password") - Frontend.User.login(self.user_content['email'], Constants.Default.Password.NewPass.TEXT) + Frontend.User.login( + self.user_content['email'], + Constants.Default.Password.NewPass.TEXT) Frontend.User.logout() logger.debug("Logout and change password back to 'iceusers'") DB.User.set_password_to_default(self.user_content['email']) - Frontend.User.login(self.user_content['email'], Constants.Default.Password.TEXT) + Frontend.User.login( + self.user_content['email'], + Constants.Default.Password.TEXT) diff --git a/tests/uiTests/test_rgwa_credentials.py b/tests/uiTests/test_rgwa_credentials.py index 334b818..15992f9 100644 --- a/tests/uiTests/test_rgwa_credentials.py +++ b/tests/uiTests/test_rgwa_credentials.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -46,6 +45,7 @@ from utils.cryptography import CryptographyText logger = LoggingServiceFactory.get_logger() + class TestRGWACredentials(TestUiBase): user_content = None access_key = None diff --git a/tests/uiTests/test_sanity.py b/tests/uiTests/test_sanity.py index 1a32215..5acc952 100644 --- a/tests/uiTests/test_sanity.py +++ b/tests/uiTests/test_sanity.py @@ -1,4 +1,3 @@ - # ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== @@ -59,7 +58,8 @@ class TestSanity(TestUiBase): def setUpClass(cls): super(TestSanity, cls).setUpClass() - cls.user_content_api = API.User.create_new_user_content_login_with_api() + cls.user_content_api = \ + API.User.create_new_user_content_login_with_api() cls.user_content = API.VirtualFunction.create_engagement() @exception() @@ -76,11 +76,14 @@ class TestSanity(TestUiBase): DB.Checklist.update_decisions(checklistUuid, checklistName) Frontend.User.relogin( - engLeadEmail, Constants.Default.Password.TEXT, engagement_manual_id) + engLeadEmail, + Constants.Default.Password.TEXT, + engagement_manual_id) Frontend.Checklist.click_on_checklist(user_content, checklistName) Frontend.Checklist.validate_reject_is_enabled() Frontend.Checklist.review_state_actions_and_validations( - checklistName, user_content['vfName'], Constants.ChecklistStates.Review.TEXT) + checklistName, user_content['vfName'], + Constants.ChecklistStates.Review.TEXT) Frontend.Checklist.cl_to_next_stage(actualVfNameid) engPreeRiviewerLeadEmail = DB.Checklist.get_pr_email(checklistUuid) @@ -107,8 +110,11 @@ class TestSanity(TestUiBase): def test_admin_set_stage(self): user_content = API.VirtualFunction.create_engagement( wait_for_gitlab=False) - stages = [Constants.EngagementStages.INTAKE, Constants.EngagementStages.ACTIVE, - Constants.EngagementStages.VALIDATED, Constants.EngagementStages.COMPLETED] + stages = [ + Constants.EngagementStages.INTAKE, + Constants.EngagementStages.ACTIVE, + Constants.EngagementStages.VALIDATED, + Constants.EngagementStages.COMPLETED] Frontend.User.login( Constants.Users.Admin.EMAIL, Constants.Default.Password.TEXT) Frontend.Dashboard.statuses_search_vf( @@ -125,9 +131,11 @@ class TestSanity(TestUiBase): Name: test_invite_new_user Steps: - Create new APIUser via SignUp request-->Login with This One--> build "activationUrl"--> + Create new APIUser via SignUp request-->Login with This One--> + build "activationUrl"--> Validation of successful activate--> - close Wizard --> Logout-->login-->Open Wizard--> fill all fields in all Tab's(4)--> + close Wizard --> Logout-->login-->Open Wizard--> + fill all fields in all Tab's(4)--> build inviteURL from email--> reopen browser with inviteURL--> Validate fields filled's in SignUp form """ @@ -145,7 +153,8 @@ class TestSanity(TestUiBase): Frontend.User.login( user_content['email'], Constants.Default.Password.TEXT) Wait.text_by_css( - Constants.Dashboard.LeftPanel.Title.CSS, Constants.Dashboard.LeftPanel.Title.TEXT) + Constants.Dashboard.LeftPanel.Title.CSS, + Constants.Dashboard.LeftPanel.Title.TEXT) logger.debug("click_on on + Dashboard") Click.id(Constants.Dashboard.LeftPanel.AddEngagement.ID) # Wizard @@ -160,15 +169,26 @@ class TestSanity(TestUiBase): Frontend.General.re_open(inviterURL) actualInvitedEmail = Get.value_by_name("email") Helper.internal_assert(inviteEmail, actualInvitedEmail) - signUpURLforContact = DB.User.get_contact_signup_url(enguuid, uuid, vendor_contact["email"], - vendor_contact["full_name"], vendor_contact["phone"], vendor_contact["company"]) + signUpURLforContact = DB.User.get_contact_signup_url( + enguuid, + uuid, + vendor_contact["email"], + vendor_contact["full_name"], + vendor_contact["phone"], + vendor_contact["company"]) Frontend.General.re_open(signUpURLforContact) actualInvitedEmail = Get.value_by_name(Constants.Signup.Email.NAME) Helper.internal_assert(vendor_contact["email"], actualInvitedEmail) Helper.internal_assert( - "+" + vendor_contact["phone"], Get.value_by_name(Constants.Signup.Phone.NAME)) + "+" + vendor_contact["phone"], + Get.value_by_name( + Constants.Signup.Phone.NAME)) Helper.internal_assert( - vendor_contact["full_name"], Get.value_by_name(Constants.Signup.FullName.NAME)) + vendor_contact["full_name"], + Get.value_by_name( + Constants.Signup.FullName.NAME)) Helper.internal_assert( - vendor_contact["company"], Get.value_by_name(Constants.Signup.Company.NAME)) + vendor_contact["company"], + Get.value_by_name( + Constants.Signup.Company.NAME)) diff --git a/tests/uiTests/test_set_stage.py b/tests/uiTests/test_set_stage.py index b9dc7de..6e01360 100644 --- a/tests/uiTests/test_set_stage.py +++ b/tests/uiTests/test_set_stage.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -49,67 +48,113 @@ logger = LoggingServiceFactory.get_logger() class TestSetStage(TestUiBase): @exception() def test_set_eng_stages(self): - user_content = API.VirtualFunction.create_engagement(wait_for_gitlab=False) - Frontend.User.login(user_content['el_email'], Constants.Default.Password.TEXT) - stages = [Constants.EngagementStages.INTAKE, Constants.EngagementStages.ACTIVE, Constants.EngagementStages.VALIDATED, - Constants.EngagementStages.COMPLETED] + user_content = API.VirtualFunction.create_engagement( + wait_for_gitlab=False) + Frontend.User.login( + user_content['el_email'], + Constants.Default.Password.TEXT) + stages = [ + Constants.EngagementStages.INTAKE, + Constants.EngagementStages.ACTIVE, + Constants.EngagementStages.VALIDATED, + Constants.EngagementStages.COMPLETED] Frontend.Overview.click_on_vf(user_content) for idx, stage in enumerate(stages[:-1]): next_stage = stages[(idx + 1) % len(stages)] - Frontend.Overview.check_stage_next_steps(stage, user_content['engagement_uuid']) + Frontend.Overview.check_stage_next_steps( + stage, user_content['engagement_uuid']) Frontend.Overview.change_engagement_stage(next_stage) Frontend.General.refresh() - if Frontend.Overview.check_stage_notifications(next_stage) is False: - raise Exception("Activity log for set stage wasn't found for stage %s" % next_stage) + if Frontend.Overview.check_stage_notifications( + next_stage) is False: + raise Exception( + "Activity log for set stage wasn't found for stage %s" % + next_stage) @exception() def test_set_eng_stages_via_pr_reviewer(self): - user_content = API.VirtualFunction.create_engagement(wait_for_gitlab=False) - Frontend.User.login(user_content['pr_email'], Constants.Default.Password.TEXT) - stages = [Constants.EngagementStages.INTAKE, Constants.EngagementStages.ACTIVE, Constants.EngagementStages.VALIDATED, - Constants.EngagementStages.COMPLETED] + user_content = API.VirtualFunction.create_engagement( + wait_for_gitlab=False) + Frontend.User.login( + user_content['pr_email'], + Constants.Default.Password.TEXT) + stages = [ + Constants.EngagementStages.INTAKE, + Constants.EngagementStages.ACTIVE, + Constants.EngagementStages.VALIDATED, + Constants.EngagementStages.COMPLETED] Frontend.Overview.click_on_vf(user_content) for idx, stage in enumerate(stages[:-1]): next_stage = stages[(idx + 1) % len(stages)] - Frontend.Overview.check_stage_next_steps(stage, user_content['engagement_uuid']) + Frontend.Overview.check_stage_next_steps( + stage, user_content['engagement_uuid']) Frontend.Overview.change_engagement_stage(next_stage) Frontend.General.refresh() - if Frontend.Overview.check_stage_notifications(next_stage) is False: - raise Exception("Activity log for set stage wasn't found for stage %s" % next_stage) + if Frontend.Overview.check_stage_notifications( + next_stage) is False: + raise Exception( + "Activity log for set stage wasn't found for stage %s" % + next_stage) - @exception() def test_admin_ro_set_stage_negative(self): - user_content = API.VirtualFunction.create_engagement(wait_for_gitlab=False) - stages = [Constants.EngagementStages.INTAKE, Constants.EngagementStages.ACTIVE, Constants.EngagementStages.VALIDATED, - Constants.EngagementStages.COMPLETED] - Frontend.User.login(Constants.Users.AdminRO.EMAIL, Constants.Default.Password.TEXT) - Frontend.Dashboard.statuses_search_vf(user_content['engagement_manual_id'], user_content['vfName']) + user_content = API.VirtualFunction.create_engagement( + wait_for_gitlab=False) + stages = [ + Constants.EngagementStages.INTAKE, + Constants.EngagementStages.ACTIVE, + Constants.EngagementStages.VALIDATED, + Constants.EngagementStages.COMPLETED] + Frontend.User.login( + Constants.Users.AdminRO.EMAIL, + Constants.Default.Password.TEXT) + Frontend.Dashboard.statuses_search_vf( + user_content['engagement_manual_id'], + user_content['vfName']) for idx, stage in enumerate(stages[:-1]): next_stage = stages[(idx + 1) % len(stages)] - Frontend.Overview.change_engagement_stage(next_stage, is_negative=True) + Frontend.Overview.change_engagement_stage( + next_stage, is_negative=True) logger.debug("Admin_ro failed to change stage to %s" % stage) - + @exception() def test_set_eng_stages_negative(self): - user_content = API.VirtualFunction.create_engagement(wait_for_gitlab=False) - stages = [Constants.EngagementStages.INTAKE, Constants.EngagementStages.ACTIVE, Constants.EngagementStages.VALIDATED, - Constants.EngagementStages.COMPLETED] - Frontend.User.login(user_content['email'], Constants.Default.Password.TEXT) + user_content = API.VirtualFunction.create_engagement( + wait_for_gitlab=False) + stages = [ + Constants.EngagementStages.INTAKE, + Constants.EngagementStages.ACTIVE, + Constants.EngagementStages.VALIDATED, + Constants.EngagementStages.COMPLETED] + Frontend.User.login( + user_content['email'], + Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(user_content) for idx, stage in enumerate(stages[:-1]): next_stage = stages[(idx + 1) % len(stages)] - Frontend.Overview.change_engagement_stage(next_stage, is_negative=True) - logger.debug("User %s failed to change stage to %s" % (user_content['email'], stage)) + Frontend.Overview.change_engagement_stage( + next_stage, is_negative=True) + logger.debug( + "User %s failed to change stage to %s" % + (user_content['email'], stage)) @exception() def test_set_eng_stages_negative_via_pr(self): - user_content = API.VirtualFunction.create_engagement(wait_for_gitlab=False) - stages = [Constants.EngagementStages.INTAKE, Constants.EngagementStages.ACTIVE, Constants.EngagementStages.VALIDATED, - Constants.EngagementStages.COMPLETED] - Frontend.User.login(user_content['pr_email'], Constants.Default.Password.TEXT) + user_content = API.VirtualFunction.create_engagement( + wait_for_gitlab=False) + stages = [ + Constants.EngagementStages.INTAKE, + Constants.EngagementStages.ACTIVE, + Constants.EngagementStages.VALIDATED, + Constants.EngagementStages.COMPLETED] + Frontend.User.login( + user_content['pr_email'], + Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(user_content) for idx, stage in enumerate(stages[:-1]): next_stage = stages[(idx + 1) % len(stages)] - Frontend.Overview.change_engagement_stage(next_stage, is_negative=False) - logger.debug("User %s failed to change stage to %s" % (user_content['pr_email'], stage)) + Frontend.Overview.change_engagement_stage( + next_stage, is_negative=False) + logger.debug( + "User %s failed to change stage to %s" % + (user_content['pr_email'], stage)) diff --git a/tests/uiTests/test_ssh_key.py b/tests/uiTests/test_ssh_key.py index 24db555..dc958d0 100644 --- a/tests/uiTests/test_ssh_key.py +++ b/tests/uiTests/test_ssh_key.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -37,13 +36,11 @@ # # ECOMP is a trademark and service mark of AT&T Intellectual Property. ''' - Created on Sep 19, 2016 - @author: Tomer Cohen - Purpose: Test SSH Public Key validation, positive and negative. Steps: - Create user and activate the user account. - - Modal window: add VF, add vendor contact, invite team member, add a valid SSH key. + - Modal window: add VF, add vendor contact, invite team member, + add a valid SSH key. - Go to account page. - Clear SSH key text-box and add an invalid SSH key. - Verify error message. @@ -73,7 +70,9 @@ class TestSSHKey(TestUiBase): def setUp(self): super(TestSSHKey, self).setUp() - Frontend.User.login(self.user_content['email'], Constants.Default.Password.TEXT) + Frontend.User.login( + self.user_content['email'], + Constants.Default.Password.TEXT) @exception() def test_ssh_key_valid(self): diff --git a/tests/uiTests/test_ui_base.py b/tests/uiTests/test_ui_base.py index d4f1a62..26dd2a5 100644 --- a/tests/uiTests/test_ui_base.py +++ b/tests/uiTests/test_ui_base.py @@ -1,41 +1,40 @@ - -# ============LICENSE_START========================================== -# org.onap.vvp/test-engine -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the “License”); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ============LICENSE_START========================================== +# org.onap.vvp/test-engine +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the “License”); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. import logging import platform import sys @@ -85,8 +84,12 @@ class TestUiBase(unittest.TestCase): self.fullClassName = __name__ self.className = self.__class__.__name__ - logger.debug("---------------------- TestCase - Start - Class " + - self.className + " Function " + self._testMethodName + " ----------------------") + logger.debug( + "---------------------- TestCase - Start - Class " + + self.className + + " Function " + + self._testMethodName + + " ----------------------") self.ice_driver = session.get_driver() @@ -111,12 +114,17 @@ class TestUiBase(unittest.TestCase): self.endTime = timer() self.testDuration = str(self.endTime - self.startTime) self.results() - if self.one_web_driver_enabled is None or not self.one_web_driver_enabled: + if self.one_web_driver_enabled is None \ + or not self.one_web_driver_enabled: session.ice_driver.quit() else: self.go_to_web_page(Constants.Default.LoginURL.TEXT) - logger.debug("---------------------- TestCase - End - Class " + self.className + - " Function " + self._testMethodName + " ----------------------\n") + logger.debug( + "---------------------- TestCase - End - Class " + + self.className + + " Function " + + self._testMethodName + + " ----------------------\n") try: logging.getLogger().info("BB") finally: @@ -133,14 +141,27 @@ class TestUiBase(unittest.TestCase): @logFuncEntry def results(self): - params = {"testType": "E2E Test", "testFeature": self.className, - "testResult": "PASS", "testName": self.funcName, "duration": self.testDuration} + params = { + "testType": "E2E Test", + "testFeature": self.className, + "testResult": "PASS", + "testName": self.funcName, + "duration": self.testDuration} if (session.errorCounter == 0): - DBGeneral.insert_results(params["testType"], params["testFeature"], params[ - "testResult"], params["testName"], params['duration']) + DBGeneral.insert_results( + params["testType"], + params["testFeature"], + params["testResult"], + params["testName"], + params['duration']) else: params["testResult"] = "FAIL" # Mark test as fail. # Add the errors to notes column in table. params["notes"] = session.errorList - DBGeneral.insert_results(params["testType"], params["testFeature"], params[ - "testResult"], params["testName"], params['duration'], params["notes"]) + DBGeneral.insert_results( + params["testType"], + params["testFeature"], + params["testResult"], + params["testName"], + params['duration'], + params["notes"]) diff --git a/tests/uiTests/test_user_profile_settings.py b/tests/uiTests/test_user_profile_settings.py index 9b5952e..8a25e02 100644 --- a/tests/uiTests/test_user_profile_settings.py +++ b/tests/uiTests/test_user_profile_settings.py @@ -1,5 +1,4 @@ - -# ============LICENSE_START========================================== +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -38,7 +37,6 @@ # ECOMP is a trademark and service mark of AT&T Intellectual Property. from iceci.decorator.exception_decor import exception from services.constants import Constants -from services.frontend.base_actions.wait import Wait from services.logging_service import LoggingServiceFactory from services.types import API, Frontend, DB from tests.uiTests.test_ui_base import TestUiBase @@ -54,11 +52,14 @@ class TestUserProfileSettings(TestUiBase): def setUpClass(cls): super(TestUserProfileSettings, cls).setUpClass() - cls.user_content = API.VirtualFunction.create_engagement(wait_for_gitlab=False) + cls.user_content = API.VirtualFunction.create_engagement( + wait_for_gitlab=False) def setUp(self): super(TestUserProfileSettings, self).setUp() - Frontend.User.login(self.user_content['email'], Constants.Default.Password.TEXT) + Frontend.User.login( + self.user_content['email'], + Constants.Default.Password.TEXT) @exception() def test_user_profile_settings_page_exists(self): @@ -68,8 +69,10 @@ class TestUserProfileSettings(TestUiBase): def test_user_profile_checkboxes(self): Frontend.User.go_to_user_profile_settings() Frontend.User.check_user_profile_settings_checkboxes() - DB.User.validate_user_profile_settings_in_db(self.user_content['email'], False) + DB.User.validate_user_profile_settings_in_db( + self.user_content['email'], False) Frontend.General.refresh() Frontend.User.validate_user_profile_settings_checkboxes(False) Frontend.User.check_user_profile_settings_checkboxes() - DB.User.validate_user_profile_settings_in_db(self.user_content['email'], True) + DB.User.validate_user_profile_settings_in_db( + self.user_content['email'], True) diff --git a/tests/uiTests/test_validate_signup.py b/tests/uiTests/test_validate_signup.py index 424239c..dce246f 100644 --- a/tests/uiTests/test_validate_signup.py +++ b/tests/uiTests/test_validate_signup.py @@ -1,41 +1,40 @@ - -# ============LICENSE_START========================================== -# org.onap.vvp/test-engine -# =================================================================== -# Copyright © 2017 AT&T Intellectual Property. All rights reserved. -# =================================================================== -# -# Unless otherwise specified, all software contained herein is licensed -# under the Apache License, Version 2.0 (the “License”); -# you may not use this software except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# -# -# Unless otherwise specified, all documentation contained herein is licensed -# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); -# you may not use this documentation except in compliance with the License. -# You may obtain a copy of the License at -# -# https://creativecommons.org/licenses/by/4.0/ -# -# Unless required by applicable law or agreed to in writing, documentation -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ============LICENSE_END============================================ -# -# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# ============LICENSE_START========================================== +# org.onap.vvp/test-engine +# =================================================================== +# Copyright © 2017 AT&T Intellectual Property. All rights reserved. +# =================================================================== +# +# Unless otherwise specified, all software contained herein is licensed +# under the Apache License, Version 2.0 (the “License”); +# you may not use this software except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# +# Unless otherwise specified, all documentation contained herein is licensed +# under the Creative Commons License, Attribution 4.0 Intl. (the “License”); +# you may not use this documentation except in compliance with the License. +# You may obtain a copy of the License at +# +# https://creativecommons.org/licenses/by/4.0/ +# +# Unless required by applicable law or agreed to in writing, documentation +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ============LICENSE_END============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. from iceci.decorator.exception_decor import exception from services.constants import Constants from services.types import API, Frontend, DB @@ -50,30 +49,40 @@ class TestValidateSignup(TestUiBase): def setUpClass(cls): super(TestValidateSignup, cls).setUpClass() - cls.user_content = API.VirtualFunction.create_engagement(wait_for_gitlab=False) - + cls.user_content = API.VirtualFunction.create_engagement( + wait_for_gitlab=False) + @exception() def test_create_and_activateUser(self): '''Create user with rest API, login and activate.''' user_data = API.User.create_new_user() - Frontend.User.login(user_data['email'], Constants.Default.Password.TEXT, Constants.Toast.ID) - Frontend.General.verify_toast_message(Constants.Dashboard.ActivateMsg.Fail.TEXT) + Frontend.User.login( + user_data['email'], + Constants.Default.Password.TEXT, + Constants.Toast.ID) + Frontend.General.verify_toast_message( + Constants.Dashboard.ActivateMsg.Fail.TEXT) activationUrl = DB.User.get_activation_url(user_data['email']) Frontend.General.re_open(activationUrl) - Frontend.User.login(user_data['email'], Constants.Default.Password.TEXT) - Frontend.General.verify_toast_message(Constants.Dashboard.ActivateMsg.Success.TEXT) - + Frontend.User.login( + user_data['email'], + Constants.Default.Password.TEXT) + Frontend.General.verify_toast_message( + Constants.Dashboard.ActivateMsg.Success.TEXT) + @exception() def test_activate_user_and_validate_account(self): '''Go to Account page and validate details after signup and login.''' - Frontend.User.login(self.user_content['email'], Constants.Default.Password.TEXT) + Frontend.User.login( + self.user_content['email'], + Constants.Default.Password.TEXT) Frontend.User.go_to_account() Frontend.General.form_validate_company(self.user_content['vendor']) Frontend.General.form_validate_name(self.user_content['full_name']) Frontend.General.form_validate_email(self.user_content['email']) Frontend.General.form_validate_phone(Constants.Default.Phone.TEXT) Frontend.General.form_validate_ssh("") # No SSH key. - + @exception() def test_signup_page_sanity(self): ''' @@ -92,9 +101,13 @@ class TestValidateSignup(TestUiBase): Frontend.General.form_enter_name(Helper.rand_string("randomString")) Frontend.General.form_enter_email(Helper.rand_string("email")) Frontend.General.form_enter_phone(Constants.Default.Phone.TEXT) - Frontend.General.form_enter_password(Helper.rand_string("randomString")) - Frontend.General.form_check_checkbox(Constants.Signup.RegularEmail.XPATH) - Frontend.General.form_check_checkbox(Constants.Signup.AcceptTerms.XPATH) + Frontend.General.form_enter_password( + Helper.rand_string("randomString")) + Frontend.General.form_check_checkbox( + Constants.Signup.RegularEmail.XPATH) + Frontend.General.form_check_checkbox( + Constants.Signup.AcceptTerms.XPATH) Frontend.General.click_on_submit() - Frontend.General.verify_toast_message(Constants.Signup.Toast.Captcha.TEXT) + Frontend.General.verify_toast_message( + Constants.Signup.Toast.Captcha.TEXT) Frontend.General.go_to_login_from_signup() -- cgit 1.2.3-korg