aboutsummaryrefslogtreecommitdiffstats
path: root/services/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'services/frontend')
-rw-r--r--services/frontend/base_actions/get.py22
-rw-r--r--services/frontend/base_actions/wait.py19
-rw-r--r--services/frontend/fe_checklist.py3
-rw-r--r--services/frontend/fe_dashboard.py10
-rw-r--r--services/frontend/fe_detailed_view.py8
-rw-r--r--services/frontend/fe_general.py25
-rw-r--r--services/frontend/fe_invite.py9
-rw-r--r--services/frontend/fe_overview.py5
-rw-r--r--services/frontend/fe_user.py15
-rw-r--r--services/frontend/fe_wizard.py13
10 files changed, 83 insertions, 46 deletions
diff --git a/services/frontend/base_actions/get.py b/services/frontend/base_actions/get.py
index 8735c1b..5fb801a 100644
--- a/services/frontend/base_actions/get.py
+++ b/services/frontend/base_actions/get.py
@@ -1,5 +1,5 @@
-
-# ============LICENSE_START==========================================
+
+# ============LICENSE_START==========================================
# org.onap.vvp/test-engine
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -37,6 +37,7 @@
#
# ECOMP is a trademark and service mark of AT&T Intellectual Property.
from services.frontend.base_actions.wait import Wait
+from services.helper import Helper
from services.session import session
@@ -98,8 +99,10 @@ class Get:
raise Exception(errorMsg, attr_name_value)
@staticmethod
- def value_by_name(attr_name_value):
+ def value_by_name(attr_name_value, wait_for_page=False):
try:
+ if wait_for_page:
+ Wait.page_has_loaded()
Wait.name(attr_name_value)
return session.ice_driver.find_element_by_name(attr_name_value).get_attribute("value")
except Exception as e:
@@ -125,3 +128,16 @@ class Get:
except Exception as e:
errorMsg = "Failed to get if it's selected by id:" + attr_id_value
raise Exception(errorMsg, attr_id_value)
+
+ @staticmethod
+ def is_checkbox_selected_by_id(attr_id_value, wait_for_page=False):
+ try:
+ if wait_for_page:
+ Wait.page_has_loaded()
+ Wait.id(attr_id_value)
+ return Helper.internal_assert_boolean_true_false(
+ session.ice_driver.find_element_by_id(
+ attr_id_value).get_attribute("value"), "on")
+ except Exception as e:
+ errorMsg = "Failed to get if it's selected by id:" + attr_id_value
+ raise Exception(errorMsg, attr_id_value)
diff --git a/services/frontend/base_actions/wait.py b/services/frontend/base_actions/wait.py
index 50eff08..a699917 100644
--- a/services/frontend/base_actions/wait.py
+++ b/services/frontend/base_actions/wait.py
@@ -196,17 +196,18 @@ class Wait:
@staticmethod
def page_has_loaded():
- countwait_untilelement_to_be_presented_by_id = 0
for _ in range(Constants.FEConstants.RETRIES_NUMBER):
- httpRequests = session.ice_driver.execute_script(
- 'return window.angular ? window.angular.element("body").injector().get("$http").pendingRequests.length : 1;')
- if(str(httpRequests) == "0"):
+ try:
+ httpRequests = session.ice_driver.execute_script(
+ 'return window.angular ? window.angular.element("body").injector().get("$http").pendingRequests.length : 1;')
+ if(str(httpRequests) == "0"):
+ time.sleep(session.wait_until_time_pause)
+ return
+ logger.debug(
+ "Checking if {} page is loaded. ".format(session.ice_driver.current_url))
time.sleep(session.wait_until_time_pause)
- return
- logger.debug(
- "Checking if {} page is loaded. ".format(session.ice_driver.current_url))
- time.sleep(session.wait_until_time_pause)
- countwait_untilelement_to_be_presented_by_id += 1
+ except Exception as exception:
+ continue
raise Exception("Page loading took too much time")
diff --git a/services/frontend/fe_checklist.py b/services/frontend/fe_checklist.py
index 75f957a..3afc472 100644
--- a/services/frontend/fe_checklist.py
+++ b/services/frontend/fe_checklist.py
@@ -600,7 +600,7 @@ class FEChecklist:
if checklist_uuid is None:
checklist_uuid = DBGeneral.select_where_not_and_order_by_desc(
'uuid', Constants.DBConstants.IceTables.CHECKLIST, 'name', checklistName, 'state', Constants.ChecklistStates.Archive.TEXT, 'create_time')[0]
- Click.id("checklist-" + checklist_uuid)
+ Click.id("checklist-" + checklist_uuid, True)
@staticmethod
def validate_reject_is_enabled():
@@ -752,4 +752,3 @@ class FEChecklist:
"Jenkins log could not be viewed.")
Click.id(Constants.Dashboard.Modal.CLOSE_BUTTON_ID)
return log
-
diff --git a/services/frontend/fe_dashboard.py b/services/frontend/fe_dashboard.py
index 0df66d4..b8d51b5 100644
--- a/services/frontend/fe_dashboard.py
+++ b/services/frontend/fe_dashboard.py
@@ -1,5 +1,5 @@
-
-# ============LICENSE_START==========================================
+
+# ============LICENSE_START==========================================
# org.onap.vvp/test-engine
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -221,21 +221,21 @@ class FEDashboard:
eng_manual_id = user_content['engagement_manual_id'] + ":"
Wait.text_by_id(engSearchID, eng_manual_id)
logger.debug("Engagement found (searched by engagement_manual_id)")
- FEGeneral.refresh()
+ FEGeneral.smart_refresh()
logger.debug("Search engagement by VF name")
# Search by VF name.
Enter.text_by_id(
Constants.Dashboard.Statuses.SearchBox.ID, user_content['vfName'])
Wait.text_by_id(engSearchID, eng_manual_id)
logger.debug("Engagement found (searched by VF name)")
- FEGeneral.refresh()
+ FEGeneral.smart_refresh()
logger.debug("Search engagement by VFC")
# Search by VFC.
Enter.text_by_id(
Constants.Dashboard.Statuses.SearchBox.ID, vfcName)
Wait.text_by_id(engSearchID, eng_manual_id)
logger.debug("Engagement found (searched by VFC)")
- FEGeneral.refresh()
+ FEGeneral.smart_refresh()
logger.debug("Negative search: search by random string")
# Search by VFC.
Enter.text_by_id(Constants.Dashboard.Statuses.SearchBox.ID,
diff --git a/services/frontend/fe_detailed_view.py b/services/frontend/fe_detailed_view.py
index bf9a5bf..556e7a7 100644
--- a/services/frontend/fe_detailed_view.py
+++ b/services/frontend/fe_detailed_view.py
@@ -1,5 +1,5 @@
-
-# ============LICENSE_START==========================================
+
+# ============LICENSE_START==========================================
# org.onap.vvp/test-engine
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -40,7 +40,7 @@ import time
from selenium.webdriver.support.ui import Select
-from services.constants import Constants
+from services.constants import Constants, ServiceProvider
from services.database.db_general import DBGeneral
from services.frontend.base_actions.click import Click
from services.frontend.base_actions.enter import Enter
@@ -237,7 +237,7 @@ class FEDetailedView:
session.ice_driver.find_element_by_name("extRefID").click()
Enter.text_by_name("extRefID", Helper.rand_string("randomNumber"))
Select(session.ice_driver.find_element_by_id(
- Constants.Dashboard.DetailedView.VFC.Choose_Company.ID)).select_by_visible_text("AT&T")
+ Constants.Dashboard.DetailedView.VFC.Choose_Company.ID)).select_by_visible_text(ServiceProvider.MainServiceProvider)
Click.id(Constants.Dashboard.DetailedView.VFC.Save_button.ID)
return vfcName
diff --git a/services/frontend/fe_general.py b/services/frontend/fe_general.py
index c6832cb..b3f97b4 100644
--- a/services/frontend/fe_general.py
+++ b/services/frontend/fe_general.py
@@ -1,5 +1,5 @@
-
-# ============LICENSE_START==========================================
+
+# ============LICENSE_START==========================================
# org.onap.vvp/test-engine
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -54,6 +54,7 @@ from services.session import session
logger = LoggingServiceFactory.get_logger()
+
class FEGeneral(Helper):
@staticmethod
@@ -103,16 +104,32 @@ class FEGeneral(Helper):
@staticmethod
def refresh():
- try: # Click on element in UI, by CSS locator.
+ try:
session.ice_driver.refresh()
Wait.page_has_loaded()
- # If failed - count the failure and add the error to list of errors.
except Exception as e:
errorMsg = "Could not refresh the page."
logger.error(errorMsg)
raise Exception(errorMsg, e)
@staticmethod
+ def smart_refresh():
+ session.ice_driver.refresh()
+ i = 0
+ success = False
+ while not success and i < 2:
+ try:
+ Wait.page_has_loaded()
+ success = True
+ break
+ except:
+ i += 1
+ time.sleep(1)
+ pass
+ if not success:
+ raise Exception("Failed to wait for refresh")
+
+ @staticmethod
def select_vendor_from_list(vendor):
Wait.name(Constants.Signup.Company.NAME)
Select(session.ice_driver.find_element_by_name(
diff --git a/services/frontend/fe_invite.py b/services/frontend/fe_invite.py
index 405581c..cb84262 100644
--- a/services/frontend/fe_invite.py
+++ b/services/frontend/fe_invite.py
@@ -157,7 +157,8 @@ class FEInvite:
user_content['el_email'] = engLeadEmail
uuid = DBGeneral.select_where_email(
"uuid", "ice_user_profile", user_content['email'])
- sponsor = ["AT&T", 'aaaaaa', inviteEmail, '3058000000']
+ sponsor = [ServiceProvider.MainServiceProvider, 'aaaaaa', inviteEmail,
+ '3058000000']
invitation_token = DBUser.select_invitation_token(
"invitation_token", "ice_invitation", "engagement_uuid", engagement_id, inviteEmail, 1)
signUpURLforContact = DBUser.get_contact_signup_url(
@@ -181,7 +182,8 @@ class FEInvite:
@staticmethod
def invite_x_users_and_verify_VF_appers_for_invited(user_content, engName):
- inviteEmail = Helper.rand_string('randomString') + "@intl." + ServiceProvider.email
+ inviteEmail = Helper.rand_string('randomString') + "@" \
+ + ServiceProvider.email
vflist = FEInvite.create_x_vfs(user_content, engName, x=3)
for vfName in vflist:
# Fetch one AT&T user ID.
@@ -192,7 +194,8 @@ class FEInvite:
engName = engagement_manual_id + ": " + vfName
vf_left_nav_id = "clickable-" + engName
Click.id(vf_left_nav_id)
- FEWizard.invite_team_members_modal(inviteEmail)
+ FEWizard.invite_team_members_modal(inviteEmail,
+ wait_modal_to_disappear=False)
FEGeneral.refresh()
# validations
FEInvite.validations_for_user2(user_content, inviteEmail, vflist)
diff --git a/services/frontend/fe_overview.py b/services/frontend/fe_overview.py
index 8d05f0c..3764e2c 100644
--- a/services/frontend/fe_overview.py
+++ b/services/frontend/fe_overview.py
@@ -58,6 +58,7 @@ from services.session import session
logger = LoggingServiceFactory.get_logger()
+
class FEOverview:
@staticmethod
@@ -65,9 +66,9 @@ class FEOverview:
vfFullName = user_content[
'engagement_manual_id'] + ": " + user_content['vfName']
Enter.text_by_id(Constants.Dashboard.LeftPanel.SearchBox.ID, user_content[
- 'vfName'])
+ 'vfName'], True)
Click.id(Constants.Dashboard.LeftPanel.SearchBox.Results.ID %
- user_content['vfName'])
+ user_content['vfName'], True)
Wait.text_by_id(
Constants.Dashboard.Overview.Title.ID, vfFullName)
diff --git a/services/frontend/fe_user.py b/services/frontend/fe_user.py
index 91cf7eb..eb25d23 100644
--- a/services/frontend/fe_user.py
+++ b/services/frontend/fe_user.py
@@ -1,5 +1,5 @@
-
-# ============LICENSE_START==========================================
+
+# ============LICENSE_START==========================================
# org.onap.vvp/test-engine
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
@@ -55,6 +55,7 @@ from services.session import session
logger = LoggingServiceFactory.get_logger()
+
class FEUser:
@staticmethod
@@ -343,24 +344,24 @@ class FEUser:
def validate_user_profile_settings_checkboxes(checked):
Wait.page_has_loaded()
receive_emails = Get.is_selected_by_id(
- Constants.Dashboard.Avatar.Account.UserProfileSettings.ReceiveEmailsID, wait_for_page=True)
+ Constants.Dashboard.Avatar.Account.UserProfileSettings.ReceiveEmailsID, True)
Helper.internal_assert(receive_emails, checked)
receive_notifications = \
Get.is_selected_by_id(
- Constants.Dashboard.Avatar.Account.UserProfileSettings.ReceiveNotificationsID)
+ Constants.Dashboard.Avatar.Account.UserProfileSettings.ReceiveNotificationsID, True)
receive_email_every_time = \
Get.is_selected_by_id(
- Constants.Dashboard.Avatar.Account.UserProfileSettings.ReceiveEmailEveryTimeID)
+ Constants.Dashboard.Avatar.Account.UserProfileSettings.ReceiveEmailEveryTimeID, True)
Helper.internal_assert(receive_email_every_time, checked)
receive_digest_email = \
Get.is_selected_by_id(
- Constants.Dashboard.Avatar.Account.UserProfileSettings.ReceiveDigestEmailID, wait_for_page=True)
+ Constants.Dashboard.Avatar.Account.UserProfileSettings.ReceiveDigestEmailID, True)
Helper.internal_assert(receive_digest_email, not checked)
@staticmethod
def compare_notifications_count_for_user(expected_count):
Wait.text_by_id(
- Constants.Dashboard.Avatar.Notifications.Count.ID, expected_count, wait_for_page=True)
+ Constants.Dashboard.Avatar.Notifications.Count.ID, expected_count, True)
@staticmethod
def check_notification_number_is_not_presented():
diff --git a/services/frontend/fe_wizard.py b/services/frontend/fe_wizard.py
index 777fe52..df5087d 100644
--- a/services/frontend/fe_wizard.py
+++ b/services/frontend/fe_wizard.py
@@ -51,6 +51,7 @@ from services.session import session
logger = LoggingServiceFactory.get_logger()
+
class FEWizard:
E2Edate = None
@@ -126,7 +127,7 @@ class FEWizard:
Enter.text_by_name("phone", phone)
Click.css(Constants.SubmitButton.CSS)
Wait.name_to_dissappear("Add AT&T Sponsor")
- sponsor = {"company": "AT&T", "full_name": fullname,
+ sponsor = {"company": ServiceProvider.MainServiceProvider, "full_name": fullname,
"email": email, "phone": phone}
return sponsor
@@ -179,7 +180,7 @@ class FEWizard:
raise Exception(errorMsg)
@staticmethod
- def invite_team_members_modal(email):
+ def invite_team_members_modal(email, wait_modal_to_disappear=True):
try:
Click.id(
Constants.Dashboard.Overview.TeamMember.ID, wait_for_page=True)
@@ -188,11 +189,9 @@ class FEWizard:
Enter.text_by_name("email", email)
Wait.text_by_css(
Constants.SubmitButton.CSS, Constants.Dashboard.Wizard.InviteTeamMembers.Button.TEXT)
- Wait.css_to_dissappear(
- '.inviteMembers-form button[disabled="disabled"].btn.btn-primary')
- Wait.css(".inviteMembers-form button.btn.btn-primary")
- Click.css(".inviteMembers-form button.btn.btn-primary")
- Wait.modal_to_dissappear()
+ Click.css(".inviteMembers-form button.btn.btn-primary", True)
+ if wait_modal_to_disappear:
+ Wait.modal_to_dissappear()
# If failed - count the failure and add the error to list of errors.
except Exception as e:
errorMsg = "FAILED in PopUp Invite Team Members. Exception=" + \