Skip to content

Commit

Permalink
update feature
Browse files Browse the repository at this point in the history
updated
  • Loading branch information
lqthang2204 committed Oct 29, 2024
1 parent 2316e72 commit 65cc05e
Show file tree
Hide file tree
Showing 7 changed files with 293 additions and 198 deletions.
22 changes: 11 additions & 11 deletions Utilities/common_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def action_page(self, element_page, action, driver, value, wait, dict_save_value
element.clear()
elif action.__eq__('hover-over'):
self.mouse_action(element, driver, action, device)
elif action.__eq__('scroll'):
self.scroll_to_element(element, driver, False, device, False)
else:
logger.error("Can not execute %s with element have is %s", action)
assert False, "Not support action in framework"
Expand Down Expand Up @@ -900,34 +902,33 @@ def execute_action(self, page, action_id, driver, wait, table, dict_save_value,
platform_name, action_elements['timeout'], True)
if self.check_field_exist(action_elements, 'inputType') and result == "PASS":
type_action = action_elements['inputType']
if type_action in ["click", "text"]:
if type_action in ["click", "text", "scroll"]:
self.action_page(locator, type_action, driver, value, action_elements['timeout'],
dict_save_value, platform_name, context, count_number=0)
else:
self.action_page(locator, "text", driver, type_action, action_elements['timeout'],
dict_save_value, platform_name, context, count_number=0)
is_break = self.check_status_to_break_loop(is_loop, index, arr_list_action)
is_break = self.check_status_to_break_loop(is_loop, index, arr_list_action, result)
except Exception as e:
logger.error("can not execute action % with element have value %s in framework", type_action, locator['value'])
assert False, "can not execute action with element have value" + locator + "in framework"
elif self.check_field_exist(action_elements, 'condition') and self.check_field_exist(action_elements,
'timeout') is False:
try:
self.wait_element_for_status(locator, action_elements['condition'], driver, platform_name, wait,
result = self.wait_element_for_status(locator, action_elements['condition'], driver, platform_name, wait,
False)
if self.check_field_exist(action_elements, 'inputType'):
type_action = action_elements['inputType']
if type_action in ["click", "text"]:
if type_action in ["click", "text", "scroll"]:
self.action_page(locator, type_action, driver, value, wait, dict_save_value,
platform_name, context, count_number=0)
else:
self.action_page(locator, "text", driver, type_action, wait, dict_save_value, platform_name,
context, count_number=0)
is_break = self.check_status_to_break_loop(is_loop, index, arr_list_action)
else:
self.wait_element_for_status(locator, action_elements['condition'], driver, platform_name,
wait, False)
is_break = self.check_status_to_break_loop(is_loop, index, arr_list_action)
is_break = self.check_status_to_break_loop(is_loop, index, arr_list_action, result)
except Exception as e:
logger.error("can not execute action % with element have value %s in framework", type_action,
locator['value'])
Expand All @@ -937,14 +938,13 @@ def execute_action(self, page, action_id, driver, wait, table, dict_save_value,
try:
if self.check_field_exist(action_elements, 'inputType'):
type_action = action_elements['inputType']
if type_action in ["click", "text"]:
if type_action in ["click", "text", "scroll"]:
self.action_page(locator, type_action, driver, value, wait, dict_save_value,
platform_name, context, count_number=0)
is_break = self.check_status_to_break_loop(is_loop, index, arr_list_action)
else:
self.action_page(locator, "text", driver, type_action, wait, dict_save_value, platform_name,
context, count_number=0)
is_break = self.check_status_to_break_loop(is_loop, index, arr_list_action)
is_break = self.check_status_to_break_loop(is_loop, index, arr_list_action)
except Exception as e:
logger.error("can not execute action % with element have value %s in framework", type_action,
locator.value)
Expand All @@ -961,8 +961,8 @@ def check_field_exist(self, dict, key):
except Exception as e:
logger.warning(f'{str(e)}, ignore this error as this field is not exist')
return False
def check_status_to_break_loop(self, is_loop, index, array):
if index == len(array) - 1 and is_loop:
def check_status_to_break_loop(self, is_loop, index, array, result):
if index == len(array) - 1 and is_loop and result in ["PASS"]:
return True
return False

Expand Down
25 changes: 16 additions & 9 deletions features/scenarios/web/techOneAu.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Feature: run regression tech one
And I perform login-page action
And I change the page spec to index_t1_page
And I perform javascript getTitle
And I wait 1 seconds
And I wait for element menu-ci with text "Forms" to be DISPLAYED
And I wait for element search-field to be DISPLAYED
And I type "Applications Application" into element search-field
Expand Down Expand Up @@ -80,8 +81,8 @@ Feature: run regression tech one
And I wait for element element-page with text "Preferred" to be ENABLED
And I click element element-page with text "Preferred"
And I wait for element spinner to be NOT_DISPLAYED
# And I scroll to element header with text "Citizenship and Cultural Details"
And I scroll to element header with text "Nationality and Cultural Details"
And I scroll to element header with text "Citizenship and Cultural Details"
And I perform Scroll_to_element action
And I wait for element spinner to be NOT_DISPLAYED
# And I wait for element button-field-country to be ENABLED
# And I click element button-field-country
Expand Down Expand Up @@ -179,9 +180,9 @@ Feature: run regression tech one
| Field | Value | Status | Helpers |
| saved-button | Saved | DISPLAYED | CONTAINS |
| saved-button | #74bd00 | DISPLAYED | BACKGROUND-COLOR |
And I wait 1 seconds
And I change the page spec to Educational_Background
And I wait for element state_education to be DISPLAYED
And I wait 1 seconds
And I verify that following elements with below attributes
| Field | Value | Status | Helpers |
| Highest-School-Level-Completed | Year 8 or below | DISPLAYED | |
Expand Down Expand Up @@ -217,11 +218,14 @@ Feature: run regression tech one
And I wait for element value_criteria_field_index_2 to be ENABLED
And I click element value_criteria_field_index_2
And I clear text from element value_criteria_field_index_2
And I type "HE Term 3" into element value_criteria_field_index_2
And I wait for element option_criteria_field_value with text "HE Term 3" to be ENABLED
And I click element option_criteria_field_value with text "HE Term 3"
And I click element cbb_filter_field
And I perform select_option_value action
# And I type "HE Term 3" into element value_criteria_field_index_2
# And I wait for element option_criteria_field_value with text "study " to be ENABLED
# And I click element option_criteria_field_value with text "HE Term 3"
And I click element Natural_Language_Keywords
And I type "CQ18" into element Natural_Language_Keywords
# And I type "CQ18" into element Natural_Language_Keywords
And I type "0417" into element Natural_Language_Keywords
And I wait for element button_ok_filter to be ENABLED
And I click element button_ok_filter
# And I wait for element spinner to be DISPLAYED
Expand Down Expand Up @@ -273,8 +277,11 @@ Feature: run regression tech one
And I wait for element search_toggle to be ENABLED
And I click element search_toggle
And I wait for element SearchButton to be ENABLED
And I loop 10 times for wait-assess-status-for-course action with polling is 5 seconds
And I wait 2 seconds
And I wait 1 seconds
And I loop 20 times for wait-assess-status-for-course action with polling is 5 seconds
And I wait for element manage_offer_button to be ENABLED
And I click element manage_offer_button
And I wait 100000 seconds
@T1 @register-student @norun
Expand Down
Loading

0 comments on commit 65cc05e

Please sign in to comment.