From 433a8256e31f755f5e236491bbe39d3db24d6d6d Mon Sep 17 00:00:00 2001 From: Edan Binshtok Date: Wed, 18 Oct 2017 07:56:58 +0300 Subject: Align CI test test and JJB Add vendor agnostic CI test to align Add Tox and maven docker Issue Id: VVP-15 Change-Id: I69f0c1036e6f72b62bddc822544c55200af7b37d Signed-off-by: Edan Binshtok --- tests/uiTests/test_bucket_e2e.py | 82 ++++++++++++++++------------- tests/uiTests/test_checklist_validations.py | 15 ++++-- tests/uiTests/test_left_nav_panel.py | 7 ++- tests/uiTests/test_login_with_new_user.py | 35 +++++++----- tests/uiTests/test_next_step.py | 10 ++-- tests/uiTests/test_overview.py | 12 ++--- tests/uiTests/test_sanity.py | 9 ++-- 7 files changed, 96 insertions(+), 74 deletions(-) (limited to 'tests/uiTests') diff --git a/tests/uiTests/test_bucket_e2e.py b/tests/uiTests/test_bucket_e2e.py index d72af48..73e18ca 100644 --- a/tests/uiTests/test_bucket_e2e.py +++ b/tests/uiTests/test_bucket_e2e.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -54,87 +54,95 @@ logger = LoggingServiceFactory.get_logger() class TestBucketE2E(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() - print("***********bucket_id = ",bucket_id) + API.VirtualFunction.set_eng_stage( + user_content, Constants.EngagementStages.ACTIVE) + bucket_id = user_content[ + 'engagement_manual_id'] + "_" + user_content['vfName'].lower() 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'])) - #validate users added to bucket + assertTrue(API.Rados.users_of_bucket_ready_after_created( + bucket_id, user_content['full_name'])) + # 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']: count = +1 - + assertTrue(count > 0) return bucket, user_content @exception() def test_validate_bucket_created(self): bucket, user_content = self.create_bucket_and_validate_users() - #create upload file - str_content = Helper.rand_string("randomString") + Helper.rand_string("randomNumber") + # create upload file + str_content = Helper.rand_string( + "randomString") + Helper.rand_string("randomNumber") fileName = Helper.rand_string("randomString") - bucket_id = user_content['engagement_manual_id']+"_"+user_content['vfName'].lower() + bucket_id = user_content[ + 'engagement_manual_id'] + "_" + user_content['vfName'].lower() bucket = API.Rados.get_bucket(bucket_id) assertTrue(API.Rados.is_bucket_ready(bucket_id)) - key = bucket.new_key(fileName+'.dat') + key = bucket.new_key(fileName + '.dat') key.set_contents_from_string(str_content) pprint(key.generate_url(expires_in=400)) # DOWNLOAD AN OBJECT (TO A FILE) - key = bucket.get_key(fileName+'.dat') - key.get_contents_to_filename('/home/'+fileName+'.dat') + key = bucket.get_key(fileName + '.dat') + key.get_contents_to_filename('/home/' + fileName + '.dat') key.delete() - + @exception() def test_validate_bucket_removed(self): bucket, user_content = self.create_bucket_and_validate_users() - #set Completed Stage + # set Completed Stage API.VirtualFunction.set_eng_stage( user_content, Constants.EngagementStages.COMPLETED) - #validate users removed from bucket - 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'])) + # validate users removed from bucket + 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)) assertTrue(bucket != "None") - #try create upload file - must failed - str_content = Helper.rand_string("randomString") + Helper.rand_string("randomNumber") + # try create upload file - must failed + str_content = Helper.rand_string( + "randomString") + Helper.rand_string("randomNumber") fileName = Helper.rand_string("randomString") bucket = API.Rados.get_bucket(bucket_id) assertTrue(API.Rados.is_bucket_ready(bucket_id)) - key = bucket.new_key(fileName+'.dat') + key = bucket.new_key(fileName + '.dat') key.set_contents_from_string(str_content) pprint(key.generate_url(expires_in=400)) # DOWNLOAD AN OBJECT (TO A FILE) - key = bucket.get_key(fileName+'.dat') - key.get_contents_to_filename('/home/'+fileName+'.dat') + key = bucket.get_key(fileName + '.dat') + key.get_contents_to_filename('/home/' + fileName + '.dat') key.delete() - + @exception() def test_validate_upload_download_image_with_bucket_user(self): bucket, user_content = self.create_bucket_and_validate_users() - #connect to bucket with specific user - bucket_id = user_content['engagement_manual_id']+"_"+user_content['vfName'].lower() + # connect to bucket with specific user + bucket_id = user_content[ + 'engagement_manual_id'] + "_" + user_content['vfName'].lower() access_key = DBUser.get_access_key(user_content['uuid']) secret_key = DBUser.get_access_secret(user_content['uuid']) 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) - #create upload file with user - str_content = Helper.rand_string("randomString") + Helper.rand_string("randomNumber") + bucket_for_specific_user = API.Rados.get_bucketfor_specific_user( + bucket_id, access_key, secret) + assertTrue(bucket_for_specific_user != None) + # create upload file with user + str_content = Helper.rand_string( + "randomString") + Helper.rand_string("randomNumber") fileName = Helper.rand_string("randomString") - key = bucket_for_specific_user.new_key(fileName+'.dat') + key = bucket_for_specific_user.new_key(fileName + '.dat') key.set_contents_from_string(str_content) pprint(key.generate_url(expires_in=3600)) # DOWNLOAD AN OBJECT (TO A FILE) - key = bucket_for_specific_user.get_key(fileName+'.dat') - key.get_contents_to_filename('/home/'+fileName+'.dat') + key = bucket_for_specific_user.get_key(fileName + '.dat') + key.get_contents_to_filename('/home/' + fileName + '.dat') key.delete() - diff --git a/tests/uiTests/test_checklist_validations.py b/tests/uiTests/test_checklist_validations.py index c89fa25..07d303c 100644 --- a/tests/uiTests/test_checklist_validations.py +++ b/tests/uiTests/test_checklist_validations.py @@ -105,7 +105,8 @@ class TestChecklistValidations(TestUiBase): engagement_manual_id = newObjWithChecklist[2] actualVfNameid = newObjWithChecklist[3] checklistName = newObjWithChecklist[5] - DB.Checklist.state_changed("uuid", checklistUuid, 'review') + DB.Checklist.state_changed( + "uuid", checklistUuid, Constants.ChecklistStates.Review.TEXT) DB.Checklist.update_decisions(checklistUuid, checklistName) Frontend.User.relogin( @@ -154,7 +155,8 @@ class TestChecklistValidations(TestUiBase): engagement_manual_id = newObjWithChecklist[2] actualVfNameid = newObjWithChecklist[3] checklistName = newObjWithChecklist[5] - DB.Checklist.state_changed("uuid", checklistUuid, 'review') + DB.Checklist.state_changed( + "uuid", checklistUuid, Constants.ChecklistStates.Review.TEXT) DB.Checklist.update_decisions(checklistUuid, checklistName) Frontend.User.relogin( engLeadEmail, Constants.Default.Password.TEXT, engagement_manual_id) @@ -186,7 +188,8 @@ class TestChecklistValidations(TestUiBase): actualVfNameid = newObjWithChecklist[3] myVfName = newObjWithChecklist[4] checklistName = newObjWithChecklist[5] - DB.Checklist.state_changed("uuid", checklistUuid, 'review') + DB.Checklist.state_changed( + "uuid", checklistUuid, Constants.ChecklistStates.Review.TEXT) DB.Checklist.update_decisions(checklistUuid, checklistName) Frontend.User.relogin( @@ -228,7 +231,8 @@ class TestChecklistValidations(TestUiBase): @exception() def test_reject_anytime_checklist(self): cl_content = API.Checklist.create_checklist(self.user_content_api) - DB.Checklist.state_changed("name", cl_content['name'], 'review') + 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) Frontend.Checklist.search_by_manual_id( @@ -238,7 +242,8 @@ class TestChecklistValidations(TestUiBase): Frontend.Checklist.click_on_checklist( 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, 'archive') + DB.Checklist.state_changed( + "uuid", recent_checklist_uuid, Constants.ChecklistStates.Archive.TEXT) @exception() def test_clone_decision_auditlogs(self): diff --git a/tests/uiTests/test_left_nav_panel.py b/tests/uiTests/test_left_nav_panel.py index 74a78ad..236097d 100644 --- a/tests/uiTests/test_left_nav_panel.py +++ b/tests/uiTests/test_left_nav_panel.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -150,7 +150,7 @@ class TestLeftNavPanel(TestUiBase): myVfName = self.user_content[ 'engagement_manual_id'] + ": " + self.user_content['vfName'] actualVfNameid = "clickable-" + myVfName - actualVfName = Get.by_id(actualVfNameid) + actualVfName = Get.by_id(actualVfNameid, True) Helper.internal_assert(myVfName, actualVfName) Click.id(actualVfNameid) uuid = DB.General.select_where_email( @@ -176,7 +176,6 @@ class TestLeftNavPanel(TestUiBase): DB.VirtualFunction.remove_engagement_from_recent( self.user_content['vf_uuid']) Frontend.General.refresh() - Wait.id_to_dissappear(self.left_panel_eng_id) Frontend.Dashboard.statuses_search_vf( self.user_content['engagement_manual_id'], self.user_content['vfName']) Wait.text_by_id(self.left_panel_eng_id, self.eng_title) diff --git a/tests/uiTests/test_login_with_new_user.py b/tests/uiTests/test_login_with_new_user.py index 8018b1a..d7d1bda 100644 --- a/tests/uiTests/test_login_with_new_user.py +++ b/tests/uiTests/test_login_with_new_user.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -137,7 +137,7 @@ class TestLoginPageWithNewUser(TestUiBase): vfFullName = user_content[ 'engagement_manual_id'] + ": " + user_content['vfName'] actualVfNameid = "clickable-" + vfFullName - Click.id(actualVfNameid,wait_for_page=True) + 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[ @@ -203,13 +203,15 @@ class TestLoginPageWithNewUser(TestUiBase): 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["email"], actualInvitedEmail) Helper.internal_assert( "+" + 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)) + signupCompany = Get.value_by_name(Constants.Signup.Company.NAME, True) Helper.internal_assert( - service_provider_internal["company"], Get.value_by_name(Constants.Signup.Company.NAME)) + service_provider_internal["company"], signupCompany) @exception() def test_create_2_new_users(self): @@ -295,11 +297,8 @@ 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) - # Fetch one is_service_provider_contact user ID. - enguuid = DB.General.select_where( - "uuid", "ice_engagement", "engagement_manual_id", engagement_manual_id, 1) invitation_token = DB.User.select_invitation_token("invitation_token", "ice_invitation", "engagement_uuid", - enguuid, vendor_contact["email"], 1) + 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) @@ -313,6 +312,8 @@ class TestLoginPageWithNewUser(TestUiBase): 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) @@ -384,18 +385,24 @@ class TestLoginPageWithNewUser(TestUiBase): # SignUp for MainServiceProviderSponsorContact engagement_manual_id = DB.General.select_where( "engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) - # Fetch one is_service_provider_contact user ID. - enguuid = DB.General.select_where( - "uuid", "ice_engagement", "engagement_manual_id", engagement_manual_id, 1) + invitation_token = DB.User.select_invitation_token("invitation_token", "ice_invitation", "engagement_uuid", - enguuid, service_provider_internal["email"], 1) + 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) - activationUrl2 = DB.User.get_activation_url(service_provider_internal["email"]) + 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 diff --git a/tests/uiTests/test_next_step.py b/tests/uiTests/test_next_step.py index 036d466..cf1e00c 100644 --- a/tests/uiTests/test_next_step.py +++ b/tests/uiTests/test_next_step.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -204,7 +204,8 @@ class TestNextStep(TestUiBase): API.User.login_user(user_content['el_email']) Wait.page_has_loaded() cl_content = API.Checklist.create_checklist(user_content) - DB.Checklist.state_changed("name", cl_content['name'], 'review') + 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] API.Checklist.add_checklist_next_step(user_content, new_cl_uuid) @@ -221,7 +222,8 @@ class TestNextStep(TestUiBase): user_content['session_token'] = "token " + \ API.User.login_user(user_content['el_email']) checklist = API.Checklist.create_checklist(user_content) - DB.Checklist.state_changed("uuid", checklist['uuid'], 'review') + DB.Checklist.state_changed( + "uuid", checklist['uuid'], Constants.ChecklistStates.Review.TEXT) Frontend.User.relogin( user_content['el_email'], 'iceusers') eng_id = "clickable-%s: %s" % ( diff --git a/tests/uiTests/test_overview.py b/tests/uiTests/test_overview.py index 2045acc..31db2f7 100644 --- a/tests/uiTests/test_overview.py +++ b/tests/uiTests/test_overview.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -45,7 +45,6 @@ from services.logging_service import LoggingServiceFactory from services.types import API, Frontend, DB from tests.uiTests.test_ui_base import TestUiBase - logger = LoggingServiceFactory.get_logger() @@ -54,9 +53,10 @@ class TestOverview(TestUiBase): @exception() def test_engagement_validation_details_update_when_cl_closed(self): user_content = API.VirtualFunction.create_engagement() - API.GitLab.git_clone_push(user_content) - cl_uuid = DB.General.select_where_and('uuid', Constants.DBConstants.IceTables.CHECKLIST, 'engagement_id', user_content['engagement_uuid'], - 'name', Constants.Dashboard.Checklist.ChecklistDefaultNames.AIC_INSTANTIATION, 1) + 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] vf_staff_emails = [user_content['el_email'], user_content[ 'pr_email'], Constants.Users.Admin.EMAIL] API.Checklist.move_cl_to_closed(cl_uuid, vf_staff_emails) diff --git a/tests/uiTests/test_sanity.py b/tests/uiTests/test_sanity.py index 8399e12..1a32215 100644 --- a/tests/uiTests/test_sanity.py +++ b/tests/uiTests/test_sanity.py @@ -1,5 +1,5 @@ - -# ============LICENSE_START========================================== + +# ============LICENSE_START========================================== # org.onap.vvp/test-engine # =================================================================== # Copyright © 2017 AT&T Intellectual Property. All rights reserved. @@ -71,7 +71,8 @@ class TestSanity(TestUiBase): engagement_manual_id = newObjWithChecklist[2] actualVfNameid = newObjWithChecklist[3] checklistName = newObjWithChecklist[5] - DB.Checklist.state_changed("uuid", checklistUuid, 'review') + DB.Checklist.state_changed( + "uuid", checklistUuid, Constants.ChecklistStates.Review.TEXT) DB.Checklist.update_decisions(checklistUuid, checklistName) Frontend.User.relogin( @@ -79,7 +80,7 @@ class TestSanity(TestUiBase): 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'], "review") + checklistName, user_content['vfName'], Constants.ChecklistStates.Review.TEXT) Frontend.Checklist.cl_to_next_stage(actualVfNameid) engPreeRiviewerLeadEmail = DB.Checklist.get_pr_email(checklistUuid) -- cgit 1.2.3-korg