Commit 19e6269f5bb986f93f9d03a3ecac4131ec53405b

Authored by Playtenders
1 parent 4e6eff14

rename files

Showing 1 changed file with 183 additions and 0 deletions
  1 +*** Settings ***
  2 +
  3 +Resource playtender_common.robot
  4 +Resource playtender_plan_variables.robot
  5 +
  6 +*** Keywords ***
  7 +
  8 +update plan queue
  9 + [Documentation] запускає оновлення планів з ЦБД і додає їх в чергу, тобто синхронізація може відбутися не відразу
  10 + ... поточна сторіка повертається
  11 +
  12 + ${current_url} = get location
  13 + go to ${broker_baseurl}/utils/queue-plan-update
  14 + go to ${current_url}
  15 +
  16 +open new plan form
  17 + [Documentation] відкриття сторінки створення плану
  18 +
  19 + open page and wait element by locator ${broker_baseurl}/plan/create ${plan_form_locator}
  20 +
  21 +open plan form by uaid
  22 + [Arguments] ${plan_uaid}
  23 + [Documentation] відкриття сторінки редагування плану
  24 +
  25 + open plan page by uaid ${plan_uaid}
  26 + click visible element and wait until page contains element ${plan_edit_btn_locator} ${plan_form_locator}
  27 +
  28 +open plan page by uaid
  29 + [Arguments] ${uaid} ${refresh}=${True}
  30 + [Documentation] відкриває сторінку з планом
  31 +
  32 + ${current_location} = get location
  33 + ${needed_location} = set variable ${broker_baseurl}/plan/${uaid}
  34 + run keyword if '${current_location}' != '${needed_location}' or ${refresh} == ${True} open site page and wait content element ${needed_location}
  35 + log many 1
  36 + ${is_plan_found} = get is element exist ${plan_view_checker_element_locator}
  37 + log many 2
  38 + return from keyword if ${is_plan_found} == ${True}
  39 + log many 3
  40 + ${is_plan_not_found} = get is 404 page
  41 + ${is_needed_to_update_and_wait_sync} = set variable if ${is_test_role_owner} == ${False} and ${is_plan_not_found} ${True} ${False}
  42 + run keyword if ${is_needed_to_update_and_wait_sync} update plan queue
  43 + run keyword if ${is_needed_to_update_and_wait_sync} wait until 404 page disappears
  44 + ${is_plan_found} = get is element exist ${plan_view_checker_element_locator}
  45 + run keyword if ${is_plan_found} == ${False} fail Opening plan page by uaid fails.
  46 +
  47 +open plan search form
  48 + [Documentation] відкриває сторінку з пошуком планів
  49 +
  50 + open page and wait element by locator ${broker_baseurl}/plans ${plan_search_form_locator}
  51 +
  52 +fill plan form
  53 + [Arguments] ${data}
  54 + [Documentation] заповнення відкритої форми з масива даних
  55 +
  56 + fill plan general info ${data}
  57 + ${items} = get from dictionary by keys ${data} items
  58 + run keyword if condition is not none ${items} fill plan form items ${items}
  59 + ${buyers} = get from dictionary by keys ${data} buyers
  60 + run keyword if condition is not none ${buyers} fill plan form buyers ${buyers}
  61 +#Пока не передает Дятлов
  62 + ${budget_breakdowns} = get from dictionary by keys ${data} budget breakdown
  63 + run keyword if condition is not none ${budget_breakdowns} fill plan form budgetbreakdowns ${budget_breakdowns}
  64 +# fill plan form budgetbreakdowns
  65 +
  66 +fill plan general info
  67 + [Arguments] ${data}
  68 + [Documentation] заповнює приховані поля + відкриває попап основних даних, заповнює його і закриває
  69 +
  70 + # hidden inputs
  71 + ${budget_id} = get from dictionary by keys ${data} budget id
  72 + run keyword if condition is not none ${budget_id} input text to hidden input ${plan_form_budget_id_input_locator} ${budget_id}
  73 + ${project_id} = get from dictionary by keys ${data} budget project id
  74 + run keyword if condition is not none ${project_id} input text to hidden input ${plan_form_project_id_input_locator} ${project_id}
  75 + ${project_name} = get from dictionary by keys ${data} budget project name
  76 + run keyword if condition is not none ${project_name} input text to hidden input ${plan_form_project_name_input_locator} ${project_name}
  77 +
  78 + # general info
  79 + open popup by btn locator ${plan_form_general_panel_edit_btn_locator}
  80 + ${procurement_method_type} = get from dictionary by keys ${data} tender procurementMethodType
  81 + run keyword if condition is not none ${procurement_method_type} select from visible list by value ${plan_form_procurement_method_type_input_locator} ${procurement_method_type}
  82 + ${budget_description} = get from dictionary by keys ${data} budget description
  83 + run keyword if condition is not none ${budget_description} input text to visible input ${plan_form_title_input_locator} ${budget_description}
  84 + ${tender_start_date} = get from dictionary by keys ${data} tender tenderPeriod startDate
  85 + run keyword if condition is not none ${tender_start_date} select from visible list by year of date ${plan_form_year_input_locator} ${tender_start_date}
  86 + run keyword if condition is not none ${tender_start_date} input month.year of date to visible input ${plan_form_tender_start_date_input_locator} ${tender_start_date}
  87 + ${amount} = get from dictionary by keys ${data} budget amount
  88 + run keyword and ignore error run keyword if condition is not none ${amount} input number to visible input ${plan_form_value_amount_input_locator} ${amount}
  89 + ${currency} = get from dictionary by keys ${data} budget currency
  90 + run keyword if condition is not none ${currency} select from visible list by value ${plan_form_value_currency_input_locator} ${currency}
  91 + ${classification} = get from dictionary by keys ${data} classification
  92 + run keyword if condition is not none ${classification} select classification by code attributes ${plan_form_classification_edit_btn_locator} ${classification}
  93 + ${additional_classifications} = get from dictionary by keys ${data} additionalClassifications
  94 + run keyword if condition is not none ${additional_classifications} select classification by array of code attributes ${plan_form_additional_classification_edit_btn_locator} ${additional_classifications} ${None} ${kekv_schemes}
  95 + run keyword if condition is not none ${additional_classifications} select classification by array of code attributes ${plan_form_kekv_classification_edit_btn_locator} ${additional_classifications} ${kekv_schemes}
  96 + Execute Javascript $('[id$="planform-test_mode"]').click()
  97 + submit current visible popup
  98 +
  99 +fill plan form items
  100 + [Arguments] ${item_attributes_array}
  101 + [Documentation] заповнення номенклатури плану
  102 +
  103 + :FOR ${item_attributes} IN @{item_attributes_array}
  104 + \ ${item_update_index} = get from dictionary by keys ${item_attributes} list_index
  105 + \ ${item_update_index_string} = convert to string ${item_update_index}
  106 + \ ${open_form_btn_locator} = replace string ${plan_form_update_item_btn_locator_tpl} %index% ${item_update_index_string}
  107 + \ run keyword if condition is not none ${item_update_index} click visible element ${open_form_btn_locator}
  108 + \ run keyword if condition is none ${item_update_index} click visible element ${plan_form_add_item_btn_locator}
  109 + \ wait until popup is visible
  110 + \ fill plan item form in opened popup ${item_attributes}
  111 + \ run keyword and ignore error submit current visible popup
  112 +
  113 +fill plan item form in opened popup
  114 + [Arguments] ${data}
  115 +
  116 + fill item form in opened popup ${data}
  117 +
  118 + ${delivery_end_date} = get from dictionary by keys ${data} deliveryDate endDate
  119 + run keyword if condition is not none ${delivery_end_date} run keyword and ignore error input date to input ${item_form_popup_delivery_end_date_input_locator} ${delivery_end_date}
  120 +
  121 +fill plan form buyers
  122 + [Arguments] ${buyer_attributes_array}
  123 + [Documentation] заповнення замовника плану
  124 +
  125 + :FOR ${buyer_attributes} IN @{buyer_attributes_array}
  126 + \ click visible element ${plan_form_update_buyer_btn_locator}
  127 + \ wait until popup is visible
  128 + \ fill buyer form in opened popup ${buyer_attributes}
  129 + \ submit current visible popup
  130 +
  131 +fill buyer form in opened popup
  132 + [Arguments] ${data}
  133 + [Documentation] заповнює відкриту форму згідно вказаних даних про замовника
  134 +
  135 + ${legal_name} = get from dictionary by keys ${data} identifier legalName
  136 + run keyword if condition is not none ${legal_name} input text to visible input ${buyer_form_popup_legal_name_input_locator} ${legal_name}
  137 + ${identifier_id} = get from dictionary by keys ${data} identifier id
  138 + run keyword if condition is not none ${identifier_id} input text to visible input ${buyer_form_popup_identifier_id_input_locator} ${identifier_id}
  139 +
  140 +fill plan form budgetbreakdowns
  141 + [Arguments] ${budgetbreakdowns_attributes_array}
  142 + [Documentation] заповнення Джерел фінансування плану
  143 +
  144 + click visible element ${plan_form_update_budgetbreakdowns_btn_locator}
  145 + wait until popup is visible
  146 + :FOR ${budgetbreakdowns_attributes} IN @{budgetbreakdowns_attributes_array}
  147 + \ click visible element ${plan_form_add_budgetbreakdowns_btn_locator}
  148 + \ wait until page does not contain element ${popup_dynamic_form_loading_element_locator}
  149 + \ fill budgetbreakdowns form in opened popup ${budgetbreakdowns_attributes}
  150 +### \ submit current visible popup
  151 +## click visible element ${plan_form_add_budgetbreakdowns_btn_locator}
  152 +## wait until page does not contain element ${popup_dynamic_form_loading_element_locator}
  153 +## fill budgetbreakdowns form in opened popup
  154 +# fill budgetbreakdowns form in opened popup ${budgetbreakdowns_attributes}
  155 + submit current visible popup
  156 +
  157 +fill budgetbreakdowns form in opened popup
  158 + [Arguments] ${data}
  159 + [Documentation] заповнює відкриту форму згідно вказаних даних про Джерела фінансування
  160 +
  161 + ${title} = get from dictionary by keys ${data} title
  162 + run keyword if condition is not none ${title} select from visible list by label ${plan_budgetbreakdowns_form_popup_title_input_locator} ${title}
  163 + ${value_amount} = get from dictionary by keys ${data} value amount
  164 + run keyword if condition is not none ${value_amount} input number to visible input ${plan_budgetbreakdowns_value_amount_input_locator} ${value_amount}
  165 +## input number to visible input ${plan_budgetbreakdowns_value_amount_input_locator} 56333.77
  166 + ${description} = get from dictionary by keys ${data} description
  167 + run keyword if condition is not none ${description} input text to visible input ${plan_budgetbreakdowns_description_input_locator} ${description}
  168 +## input text to visible input ${plan_budgetbreakdowns_description_input_locator} description
  169 +
  170 +save plan form and wait synchronization
  171 + [Documentation] натискає кнопку "Зберегти" і чекає синхронізації плану
  172 +
  173 + submit form and check result ${plan_form_submit_btn_locator} ${plan_form_submit_success_msg} ${plan_created_checker_element_locator}
  174 + wait until page does not contain element with reloading ${plan_sync_element_locator}
  175 +
  176 +delete plan
  177 + [Arguments] ${data}
  178 + [Documentation] натискає кнопку "Скасувати рядок плану" і видаляє план
  179 +
  180 + click visible element ${plan_delete_btn_locator}
  181 + ${reason} = get from dictionary by keys ${data} reason
  182 + run keyword if condition is not none ${reason} input text to visible input ${plan_form_delete_reason_value_locator} ${reason}
  183 + submit form and check result ${plan_form_delete_sucess_btn_locator} ${plan_form_delete_submit_success_msg}
... ...
Please register or login to post a comment