playtender_plan.robot
10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
*** Settings ***
Resource playtender_common.robot
Resource playtender_plan_variables.robot
*** Keywords ***
update plan queue
[Documentation] запускає оновлення планів з ЦБД і додає їх в чергу, тобто синхронізація може відбутися не відразу
... поточна сторіка повертається
${current_url} = get location
go to ${broker_baseurl}/utils/queue-plan-update
go to ${current_url}
open new plan form
[Documentation] відкриття сторінки створення плану
open page and wait element by locator ${broker_baseurl}/plan/create ${plan_form_locator}
open plan form by uaid
[Arguments] ${plan_uaid}
[Documentation] відкриття сторінки редагування плану
open plan page by uaid ${plan_uaid}
click visible element and wait until page contains element ${plan_edit_btn_locator} ${plan_form_locator}
open plan page by uaid
[Arguments] ${uaid} ${refresh}=${True}
[Documentation] відкриває сторінку з планом
${current_location} = get location
${needed_location} = set variable ${broker_baseurl}/plan/${uaid}
run keyword if '${current_location}' != '${needed_location}' or ${refresh} == ${True} open site page and wait content element ${needed_location}
${is_plan_found} = get is element exist ${plan_view_checker_element_locator}
return from keyword if ${is_plan_found} == ${True}
${is_plan_not_found} = get is 404 page
${is_needed_to_update_and_wait_sync} = set variable if ${is_test_role_owner} == ${False} and ${is_plan_not_found} ${True} ${False}
run keyword if ${is_needed_to_update_and_wait_sync} update plan queue
run keyword if ${is_needed_to_update_and_wait_sync} wait until 404 page disappears
${is_plan_found} = get is element exist ${plan_view_checker_element_locator}
run keyword if ${is_plan_found} == ${False} fail Opening plan page by uaid fails.
open plan search form
[Documentation] відкриває сторінку з пошуком планів
open page and wait element by locator ${broker_baseurl}/plans ${plan_search_form_locator}
fill plan form
[Arguments] ${data}
[Documentation] заповнення відкритої форми з масива даних
fill plan general info ${data}
${items} = get from dictionary by keys ${data} items
run keyword if condition is not none ${items} fill plan form items ${items}
${buyers} = get from dictionary by keys ${data} buyers
run keyword if condition is not none ${buyers} fill plan form buyers ${buyers}
fill plan general info
[Arguments] ${data}
[Documentation] заповнює приховані поля + відкриває попап основних даних, заповнює його і закриває
# hidden inputs
${budget_id} = get from dictionary by keys ${data} budget id
run keyword if condition is not none ${budget_id} input text to hidden input ${plan_form_budget_id_input_locator} ${budget_id}
${project_id} = get from dictionary by keys ${data} budget project id
run keyword if condition is not none ${project_id} input text to hidden input ${plan_form_project_id_input_locator} ${project_id}
${project_name} = get from dictionary by keys ${data} budget project name
run keyword if condition is not none ${project_name} input text to hidden input ${plan_form_project_name_input_locator} ${project_name}
# general info
open popup by btn locator ${plan_form_general_panel_edit_btn_locator}
${procurement_method_type} = get from dictionary by keys ${data} tender procurementMethodType
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}
${budget_description} = get from dictionary by keys ${data} budget description
run keyword if condition is not none ${budget_description} input text to visible input ${plan_form_title_input_locator} ${budget_description}
${tender_start_date} = get from dictionary by keys ${data} tender tenderPeriod startDate
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}
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}
${amount} = get from dictionary by keys ${data} budget amount
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}
${currency} = get from dictionary by keys ${data} budget currency
run keyword if condition is not none ${currency} select from visible list by value ${plan_form_value_currency_input_locator} ${currency}
${classification} = get from dictionary by keys ${data} classification
run keyword if condition is not none ${classification} select classification by code attributes ${plan_form_classification_edit_btn_locator} ${classification}
${additional_classifications} = get from dictionary by keys ${data} additionalClassifications
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}
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}
submit current visible popup
fill plan form items
[Arguments] ${item_attributes_array}
[Documentation] заповнення номенклатури плану
:FOR ${item_attributes} IN @{item_attributes_array}
\ ${item_update_index} = get from dictionary by keys ${item_attributes} list_index
\ ${item_update_index_string} = convert to string ${item_update_index}
\ ${open_form_btn_locator} = replace string ${plan_form_update_item_btn_locator_tpl} %index% ${item_update_index_string}
\ run keyword if condition is not none ${item_update_index} click visible element ${open_form_btn_locator}
\ run keyword if condition is none ${item_update_index} click visible element ${plan_form_add_item_btn_locator}
\ wait until popup is visible
\ fill item form in opened popup ${item_attributes}
\ run keyword and ignore error submit current visible popup
fill plan form buyers
[Arguments] ${buyer_attributes_array}
[Documentation] заповнення замовника плану
:FOR ${buyer_attributes} IN @{buyer_attributes_array}
\ click visible element ${plan_form_update_buyer_btn_locator}
\ wait until popup is visible
\ fill buyer form in opened popup ${buyer_attributes}
\ submit current visible popup
fill buyer form in opened popup
[Arguments] ${data}
[Documentation] заповнює відкриту форму згідно вказаних даних про замовника
${legal_name} = get from dictionary by keys ${data} identifier legalName
run keyword if condition is not none ${legal_name} input text to visible input ${buyer_form_popup_legal_name_input_locator} ${legal_name}
${identifier_id} = get from dictionary by keys ${data} identifier id
run keyword if condition is not none ${identifier_id} input text to visible input ${buyer_form_popup_identifier_id_input_locator} ${identifier_id}
save plan form and wait synchronization
[Documentation] натискає кнопку "Зберегти" і чекає синхронізації плану
submit form and check result ${plan_form_submit_btn_locator} ${plan_form_submit_success_msg} ${plan_created_checker_element_locator}
wait until page does not contain element with reloading ${plan_sync_element_locator}