Commit 2b98ccd3acacd4b0684c24228265f65b808bf741

Authored by Oleksandr Iskryzhytskyi
1 parent 633d97c4

- added: creating plan form

- added: code structure + common helpers
@@ -8,3 +8,5 @@ __pycache__/ @@ -8,3 +8,5 @@ __pycache__/
8 /[bs]dist/ 8 /[bs]dist/
9 /*.egg-info/ 9 /*.egg-info/
10 *.egg 10 *.egg
  11 +
  12 +/.idea
No preview for this file type
1 *** Settings *** 1 *** Settings ***
2 -Library String  
3 -Library DateTime  
4 -Library playtender_service.py  
5 2
6 -*** Variables *** 3 +Resource playtender_common.robot
  4 +Resource playtender_plan.robot
7 5
8 -${planFormSubmitSuccessMessage} = План закупівлі створений, дочекайтесь опублікування на сайті уповноваженого органу.  
9 -${planEditButton} = div#plan-part-pjax.pjax-container.pjax-layout-container div.aside__inner span.btn-new__inner span.btn-new__text 6 +*** Variables ***
10 7
11 *** Keywords *** 8 *** Keywords ***
12 -Підготувати дані для оголошення тендера  
13 - [Arguments] ${username} ${tender_data} ${param3}  
14 - [return] ${tender_data}  
15 9
16 Підготувати клієнт для користувача 10 Підготувати клієнт для користувача
17 - [Arguments] ${username}  
18 - [Documentation] Відкрити браузер, створити об’єкт api wrapper, тощо  
19 - Open Browser ${BROKERS['playtender'].homepage} ${USERS.users['${username}'].browser} alias=${username}  
20 - Set Window Size @{USERS.users['${username}'].size}  
21 - Set Window Position @{USERS.users['${username}'].position}  
22 - inject_urllib3  
23 - Login ${username}  
24 -  
25 -Login  
26 - [Arguments] ${username}  
27 - Run Keyword And Ignore Error Click Element xpath=//button[@class='languages__btn js-popup-open-initiator']  
28 - Run Keyword And Ignore Error Wait Until Element Is Visible xpath=//*[contains(@data-language, '1')] 60  
29 - Run Keyword And Ignore Error Click Link xpath=//*[contains(@data-language, '1')]  
30 -  
31 - #Go To ${USERS.users['${username}'].homepage}  
32 -  
33 - Wait Until Element Is Visible xpath=//a[@data-action='login'] 60  
34 - Click Link xpath=//a[(@data-action='login') and contains(.,'Увійти')]  
35 - Wait Until Page Contains Element id=loginform-email 60  
36 - Input text id=loginform-email ${USERS.users['${username}'].login}  
37 - Input text id=loginform-password ${USERS.users['${username}'].password}  
38 - Click Button xpath=//button[(@class='btn btn-lg w-lg-x2 btn-success js-submit-btn') and contains(.,'Увійти')]  
39 - Wait Until Page Contains Активні 60  
40 - Set Global Variable ${playtender_LOGIN_USER} ${username}  
41 -  
42 -Wait For Page Create Tender  
43 - [Arguments] ${url}  
44 - Go To ${url}  
45 - Sleep 10  
46 - Wait Until Page Contains Element xpath=//form[@id="tender-form"] 60  
47 -  
48 -Створити тендер  
49 - [Arguments] ${user} ${tender_data}  
50 - ${tender_data}= procuring_entity_name ${tender_data}  
51 - ${tender_data_keys}= Get Dictionary Keys ${tender_data.data}  
52 - ${procurementMethodType} = Set Variable If 'procurementMethodType' in ${tender_data_keys} ${tender_data.data.procurementMethodType} belowThreshold  
53 - Set To Dictionary ${USERS.users['${playtender_LOGIN_USER}']} tender_methodtype=${procurementMethodType}  
54 -  
55 - # change organization info  
56 - #UserChangeOrgnizationInfo ${tender_data.data.procuringEntity}  
57 -  
58 -# Run Keyword If '${SUITE_NAME}' == 'Tests Files.Complaints' Go To ${BROKERS['playtender'].basepage}/utils/config?tacceleration=${BROKERS['playtender'].intervals.belowThreshold.accelerator}  
59 - Run Keyword If '${SUITE_NAME}' == 'Tests Files.Complaints' and '${procurementMethodType}' == 'belowThreshold' Go To ${BROKERS['playtender'].basepage}/utils/config?tacceleration=360  
60 - Run Keyword If '${procurementMethodType}' == 'negotiation' Go To ${BROKERS['playtender'].basepage}/utils/config?tacceleration=1080  
61 - Run Keyword If '${procurementMethodType}' == 'aboveThresholdUA.defense' Go To ${BROKERS['playtender'].basepage}/utils/config?tacceleration=720  
62 -  
63 - Selenium2Library.Switch Browser ${user}  
64 - Run Keyword If '${procurementMethodType}' == 'belowThreshold' and 'lots' not in ${tender_data_keys} Wait Until Keyword Succeeds 100 s 10 s Wait For Page Create Tender ${BROKERS['playtender'].basepage}/tender/create?type=${procurementMethodType}&multilot=0  
65 - Run Keyword If '${procurementMethodType}' != 'belowThreshold' or 'lots' in ${tender_data_keys} Wait Until Keyword Succeeds 100 s 10 s Wait For Page Create Tender ${BROKERS['playtender'].basepage}/tender/create?type=${procurementMethodType}  
66 - Wait Until Page Contains Element xpath=//form[@id="tender-form"] 60  
67 -  
68 - ### BOF - Reporting ###  
69 - Run Keyword And Return If '${procurementMethodType}' == 'reporting' Створити тендер без лотів ${user} ${tender_data}  
70 - Run Keyword And Return If '${procurementMethodType}' == 'belowThreshold' and 'lots' not in ${tender_data_keys} Створити тендер без лотів ${user} ${tender_data}  
71 - ### EOF - Reporting ###  
72 -  
73 - ${title}= Get From Dictionary ${tender_data.data} title  
74 - ${description}= Get From Dictionary ${tender_data.data} description  
75 - ${playtender_proc_type}= Convert_to_Lowercase ${procurementMethodType}  
76 - ${playtender_proc_type}= Remove String ${playtender_proc_type} \.  
77 -  
78 - Run Keyword If '${mode}' in 'belowThreshold below_funders' and ${number_of_lots} != 0 Click Element xpath=//input[@id='tenderbelowthresholdform-is_multilot']  
79 - Input text id=tender${playtender_proc_type}form-title ${title}  
80 - Run Keyword If 'cause' in ${tender_data_keys} Select From List By Value id=tender${playtender_proc_type}form-cause ${tender_data.data.cause}  
81 - Run Keyword If 'causeDescription' in ${tender_data_keys} Input text id=tender${playtender_proc_type}form-cause_description ${tender_data.data.causeDescription}  
82 - Run Keyword If 'title_en' in ${tender_data_keys} Input Text With Checking Input Isset \#tender${playtender_proc_type}form-title_en ${tender_data.data.title_en}  
83 - Input text id=tender${playtender_proc_type}form-description ${description}  
84 - Run Keyword If 'description_en' in ${tender_data_keys} Input Text With Checking Input Isset \#tender${playtender_proc_type}form-description_en ${tender_data.data.description_en}  
85 - Run Keyword If 'fundingKind' in ${tender_data_keys} Select From List By Value id=tender${playtender_proc_type}form-funding_kind ${tender_data.data.fundingKind}  
86 - Run Keyword If 'NBUdiscountRate' in ${tender_data_keys} Input Float Multiply100 \#tender${playtender_proc_type}form-nbu_discount_rate ${tender_data.data.NBUdiscountRate}  
87 - Click Element id=tender${playtender_proc_type}form-value_added_tax_included  
88 - Run Keyword If 'mainProcurementCategory' in ${tender_data_keys} Select From List By Value id=tender${playtender_proc_type}form-main_procurement_category ${tender_data.data.mainProcurementCategory}  
89 - Run Keyword If '${procurementMethodType}' == 'belowThreshold' Створити тендер enquiryPeriod.startDate ${playtender_proc_type} ${tender_data.data.enquiryPeriod.startDate}  
90 - Run Keyword If '${procurementMethodType}' == 'belowThreshold' Створити тендер enquiryPeriod.endDate ${playtender_proc_type} ${tender_data.data.enquiryPeriod.endDate}  
91 - Run Keyword If '${procurementMethodType}' == 'belowThreshold' Створити тендер tenderPeriod.startDate ${playtender_proc_type} ${tender_data.data.tenderPeriod.startDate}  
92 - Run Keyword If '${procurementMethodType}' != 'negotiation' Створити тендер tenderPeriod.end_date ${playtender_proc_type} ${tender_data.data.tenderPeriod.endDate}  
93 - Select Checkbox id=tender${playtender_proc_type}form-quick_mode  
94 - Run Keyword If '${SUITE_NAME}' == 'Tests Files.Complaints' Select Checkbox id=tender${playtender_proc_type}form-auction_skip_mode  
95 -  
96 - ### BOF - BelowFunders ###  
97 - Run Keyword If 'funders' in ${tender_data_keys} Створити тендер Funder ${tender_data.data.funders[0]}  
98 - ### EOF - BelowFunders ###  
99 -  
100 - Click Element xpath=//*[contains(@href, '#collapseLots')]  
101 - Sleep 1  
102 - JsSetScrollToElementBySelector \#collapseLots  
103 - Click Element xpath=//span[@data-confirm-text='Ви впевнені що бажаєте видалити поточний лот?']  
104 - Click Element xpath=//div[contains(@class, 'jconfirm-box')]//button[contains(text(), 'Так')] 11 + [Arguments] ${username}
  12 + [Documentation] Відкриває переглядач на потрібній сторінці, готує api wrapper, тощо.
105 13
106 - ${items}= Get From Dictionary ${tender_data.data} items  
107 - ${lots}= Get From Dictionary ${tender_data.data} lots  
108 - Set To Dictionary ${USERS.users['${playtender_LOGIN_USER}']} lots=${lots}  
109 - ${lots_length}= Get Length ${lots} 14 + init environment ${username}
  15 + open browser ${broker_baseurl} ${broker_browser} alias=${broker_username}
  16 + set window size @{browser_default_size}
  17 + set window position @{browser_default_position}
  18 + set site language by code ${broker_language_code}
  19 + login to site ${USERS.users['${broker_username}']}
110 20
111 - : FOR ${INDEX} IN RANGE 0 ${lots_length}  
112 - \ Sleep 2  
113 -#cat \ Click Element xpath=//a[@href='#add-lots']  
114 - \ Execute Javascript $( 'a[href="#add-lots"]' ).trigger( 'click' )  
115 - \ Sleep 2  
116 - \ Wait Until Page Contains Товар/послуга № 60  
117 - \ Click Element jquery=div[data-type="lot"].active span[data-confirm-text="Ви впевнені що бажаєте видалити поточний товар/послугу?"]  
118 - \ Click Element xpath=//div[contains(@class, 'jconfirm-box')]//button[contains(text(), 'Так')]  
119 - \ Sleep 1  
120 - \ Run Keyword If 'features' in ${tender_data_keys} Додати лот ${lots[${INDEX}]} ${INDEX} ${procurementMethodType} ${items} ${tender_data.data.features}  
121 - \ Run Keyword If 'features' not in ${tender_data_keys} Додати лот Ex2 ${lots[${INDEX}]} ${INDEX} ${procurementMethodType} ${items}  
122 -  
123 - Run Keyword If 'features' in ${tender_data_keys} Click Element xpath=//*[contains(@href, '#collapseFeatures')]  
124 - Sleep 1  
125 - Run Keyword If 'features' in ${tender_data_keys} Add Features Ex ${tender_data.data.features} tenderer ${procurementMethodType} div[@id='collapseFeatures']  
126 -  
127 - ${Ids}= Створити тендер Збереження форми  
128 - [return] ${Ids}  
129 -  
130 -Створити тендер без лотів  
131 - [Arguments] ${user} ${tender_data}  
132 - ${tender_data_keys}= Get Dictionary Keys ${tender_data.data}  
133 - ${procurementMethodType}= Get From Dictionary ${USERS.users['${playtender_LOGIN_USER}']} tender_methodtype  
134 - ${budget}= convert_float_to_string ${tender_data.data.value.amount}  
135 - ${playtender_proc_type}= Convert_to_Lowercase ${procurementMethodType}  
136 - ${playtender_proc_type}= Remove String ${playtender_proc_type} \.  
137 -  
138 - # fill general data  
139 - Дочекатися І Клікнути xpath=//a[contains(@data-url,'#general-form-popup')]  
140 - Input text id=tender${playtender_proc_type}form-title ${tender_data.data.title}  
141 - Input text id=tender${playtender_proc_type}form-description ${tender_data.data.description}  
142 - JsSetScrollToElementBySelector \#tender${playtender_proc_type}form-value_amount  
143 - Input text id=tender${playtender_proc_type}form-value_amount ${budget}  
144 - Select From List By Value id=tender${playtender_proc_type}form-value_currency ${tender_data.data.value.currency}  
145 - Run Keyword If ${tender_data.data.value.valueAddedTaxIncluded} Click Element id=tender${playtender_proc_type}form-value_added_tax_included  
146 - Run Keyword If '${procurementMethodType}' == 'belowThreshold' Input Float \#tender${playtender_proc_type}form-min_step_amount ${tender_data.data.minimalStep.amount}  
147 - Run Keyword If '${procurementMethodType}' == 'belowThreshold' Створити тендер enquiryPeriod.startDate ${playtender_proc_type} ${tender_data.data.enquiryPeriod.startDate}  
148 - Run Keyword If '${procurementMethodType}' == 'belowThreshold' Створити тендер enquiryPeriod.endDate ${playtender_proc_type} ${tender_data.data.enquiryPeriod.endDate}  
149 - Run Keyword If '${procurementMethodType}' == 'belowThreshold' Створити тендер tenderPeriod.startDate ${playtender_proc_type} ${tender_data.data.tenderPeriod.startDate}  
150 - Run Keyword If '${procurementMethodType}' == 'belowThreshold' Створити тендер tenderPeriod.end_date ${playtender_proc_type} ${tender_data.data.tenderPeriod.endDate}  
151 - Run Keyword If '${procurementMethodType}' == 'belowThreshold' Select Checkbox id=tender${playtender_proc_type}form-quick_mode  
152 - Scroll To Element xpath=//div[contains(@id,"general-form-popup")]//a[contains(@class,'btn btn-success js-popup-submit')]  
153 - Дочекатися і Клікнути xpath=//div[contains(@id,"general-form-popup")]//a[contains(@class,'btn btn-success js-popup-submit')]  
154 -  
155 - # fill items  
156 -# Click Element xpath=//*[contains(@href, '#collapseItems')]  
157 -# Sleep 1  
158 -# JsSetScrollToElementBySelector \#collapseItems  
159 - Scroll To Element xpath=//form[@id="tender-form"]//a[contains(@class,'btn btn-default btn-update js-form-popup-add')]  
160 - Wait Until Element Is Visible xpath=//form[@id="tender-form"]//a[contains(@class,'btn btn-default btn-update js-form-popup-add')] 6  
161 - Sleep 3  
162 - Дочекатися і Клікнути xpath=//form[@id="tender-form"]//a[contains(@class,"btn btn-default btn-update js-form-popup-add")]  
163 - Wait Until Page Contains Element xpath=//div[contains(@class,"modal modal-form js-form-popup fancybox-content")] 60  
164 -# Wait Until Page Contains Товар/послуга № 60  
165 -# Wait Until Page Contains Товар/послуга № 60  
166 -# Click Element xpath=//span[@data-confirm-text='Ви впевнені що бажаєте видалити поточний товар/послугу?']  
167 -# Click Element xpath=//div[contains(@class, 'jconfirm-box')]//button[contains(text(), 'Так')]  
168 -  
169 - ${items}= Get From Dictionary ${tender_data.data} items  
170 - ${items_length}= Get Length ${items}  
171 -  
172 - : FOR ${INDEX} IN RANGE 0 ${items_length}  
173 -# \ JsSetScrollToElementBySelector \#collapseItems a[href='#add-items']  
174 -# \ Click Element jquery=#collapseItems a[href="#add-items"]  
175 -# \ Sleep 2  
176 -# \ Додати предмет By Wrapper \#collapseItems div[data-type='item'].active ${items[${INDEX}]} ${procurementMethodType}  
177 -# \ Додати предмет By Wrapper //*[@class="modal modal-form js-form-popup fancybox-content"] ${items[${INDEX}]} ${procurementMethodType}  
178 - \ Додати предмет By Wrapper \.modal.modal-form.js-form-popup.fancybox-content ${items[${INDEX}]} ${procurementMethodType}  
179 -  
180 - Run Keyword If '${procurementMethodType}' == 'reporting' Додати постачальника For Reporting Fake  
181 -  
182 - ${Ids}= Створити тендер Збереження форми  
183 - [return] ${Ids}  
184 -  
185 -#Wait For UAID  
186 -# Sleep 5  
187 -# Reload Page  
188 -# ${tender_UAid}= Get Text xpath=//*[contains(@class, 'tender-id')]//*[@class='value']  
189 -  
190 -#Клацнути і дочекатися  
191 -# [Arguments] ${click_locator} ${wanted_locator} ${timeout}  
192 -# [Documentation]  
193 -# ... click_locator: Where to click  
194 -# ... wanted_locator: What are we waiting for  
195 -# ... timeout: Timeout  
196 -# Click Element ${click_locator}  
197 -# Sleep 3  
198 -# Wait Until Page Contains Element ${wanted_locator} ${timeout}  
199 -  
200 -Клацнути і дочекатися пошук  
201 - [Arguments] ${click_locator} ${wanted_locator} ${timeout}  
202 - [Documentation]  
203 - ... click_locator: Where to click  
204 - ... wanted_locator: What are we waiting for  
205 - ... timeout: Timeout  
206 - Press key ${click_locator} \\13  
207 - Sleep 3  
208 - Wait Until Page Contains Element ${wanted_locator} ${timeout}  
209 -  
210 -Wait For Sync Tender  
211 - [Arguments] ${timeout}  
212 - ${passed}= Run Keyword And Return Status Wait Until Keyword Succeeds ${timeout} s 0 s Wait For Sync Tender Finish  
213 - Run Keyword Unless ${passed} Fatal Error Sync Finish not finish in ${timeout} sec 21 +Підготувати дані для оголошення тендера
  22 + [Arguments] ${username} ${tender_data} ${role_name}
  23 + [Documentation] Адаптувати початкові дані для створення тендера. Наприклад, змінити дані про procuringEntity на дані
  24 + ... про користувача tender_owner на майданчику. Перевіряючи значення аргументу role_name, можна адаптувати
  25 + ... різні дані для різних ролей (наприклад, необхідно тільки для ролі tender_owner забрати з початкових
  26 + ... даних поле mode: test, а для інших ролей не потрібно робити нічого). Це ключове слово викликається в
  27 + ... циклі для кожної ролі, яка бере участь в поточному сценарії. З ключового слова потрібно повернути
  28 + ... адаптовані дані tender_data. Різниця між початковими даними і кінцевими буде виведена в консоль під
  29 + ... час запуску тесту.
214 30
215 -Wait For Sync Tender Finish  
216 - Sleep 3  
217 - Reload Page  
218 - Page Should Not Contain Element id=tender-sync-info 31 + # @todo
  32 + # adjusting procuring entity with site user
219 33
220 -### BOF - PLANNING ### 34 + [Return] ${tender_data}
221 35
222 Створити план 36 Створити план
223 - [Arguments] ${user} ${plan_data}  
224 - ${plan_data}= procuring_entity_name ${plan_data}  
225 - ${data}= Get From Dictionary ${plan_data} data  
226 - ${data_keys}= Get Dictionary Keys ${data}  
227 - ${start_date}= convert_isodate_to_site_date_plan ${data.tender.tenderPeriod.startDate}  
228 - ${budget_keys}= Get Dictionary Keys ${data.budget}  
229 -### ${classificationWrapper}= Set Variable \//div[@id="general-form-popup"]  
230 - ${classificationWrapper}= Set Variable \div[id$="general-form-popup"] 37 + [Arguments] ${user} ${plan_data}
  38 + [Documentation] Створити план з початковими даними plan_data. Повернути uaid створеного плану.
231 39
232 - ## preparing  
233 -# UserChangeOrgnizationInfo ${data.procuringEntity}  
234 -  
235 - ## load form page  
236 - Go To ${BROKERS['playtender'].basepage}/plan/create  
237 - Wait Until Page Contains Element xpath=//form[@id="plan-form"] 60  
238 -  
239 - ## filling form  
240 - Дочекатися І Клікнути xpath=//a[contains(@data-url,'#general-form-popup')]  
241 - Select From List By Value id=planform-procurement_method_type ${data.tender.procurementMethodType}  
242 - Run Keyword If 'period' in ${budget_keys} input datetime \#planform-period_start_date ${data.budget.period.startDate}  
243 - Run Keyword If 'period' in ${budget_keys} input datetime \#planform-period_end_date ${data.budget.period.endDate}  
244 - JsInputHiddenText \#planform-budget_id ${data.budget.id}  
245 - Input text id=planform-title ${data.budget.description}  
246 - Input Float \#planform-value_amount ${data.budget.amount}  
247 - Select From List By Value id=planform-value_currency ${data.budget.currency}  
248 - JsInputHiddenText \#planform-project_id ${data.budget.project.id}  
249 - JsInputHiddenText \#planform-project_name ${data.budget.project.name}  
250 - Input text id=planform-tender_start_date ${start_date}  
251 - InputClassificationByWrapper ${classificationWrapper} ${data.classification.id}  
252 - Run Keyword If 'additionalClassifications' in ${data_keys} InputAdditionalClassificationsByWrapper ${classificationWrapper} ${data.additionalClassifications}  
253 - Scroll To Element xpath=//div[contains(@id,"general-form-popup")]//a[contains(@class,"btn btn-success js-popup-submit")]  
254 - Дочекатися і Клікнути xpath=//div[contains(@id,"general-form-popup")]//a[contains(@class,"btn btn-success js-popup-submit")]  
255 - Run Keyword If 'items' in ${data_keys} InputPlanItems ${data}  
256 -  
257 - ## submit form  
258 - Дочекатися і Клікнути xpath=//*[@id='submitBtn']  
259 - Wait Until Page Contains ${planFormSubmitSuccessMessage} 60  
260 - CheckAlertMessageAndCloseIt  
261 - Wait For Sync Tender 360  
262 - ${plan_id} Get Text jquery=#plan-general-info .plan-id .value  
263 - [Return] ${plan_id}  
264 -  
265 -Пошук плану по ідентифікатору  
266 - [Arguments] ${username} ${tenderId}  
267 -  
268 - Run Keyword If '${ROLE}' == 'viewer' Go To ${BROKERS['playtender'].basepage}/utils/plan-sync?planid=${tenderId}  
269 - Run Keyword If '${ROLE}' == 'viewer' Sleep 5  
270 - ${planNotSynced}= Run Keyword And Return Status Page Should Contain fail  
271 - Run Keyword If '${ROLE}' == 'viewer' and ${planNotSynced} Go To ${BROKERS['playtender'].basepage}/utils/queue-plan-update  
272 - Run Keyword If '${ROLE}' == 'viewer' and ${planNotSynced} Sleep 30  
273 -  
274 - Go To ${BROKERS['playtender'].basepage}/plans  
275 - Wait Until Page Contains Element id=plansearchform-query 60  
276 -#cat Input Text id=plansearchform-query ${tenderId}  
277 -#cat Click Element jquery=#plan-search-form .js-submit-btn  
278 - Input Text xpath=//input[@data-ds='query-input'] ${tenderId}  
279 - Click Element xpath=//button[@class='btn btn-default js-submit-btn']  
280 -#cat Press key xpath=//input[@data-ds='query-input'] \\13  
281 - Sleep 1  
282 - ${passed}= Run Keyword And Return Status Wait Until Keyword Succeeds 360 s 0 s Шукати і знайти план  
283 - Run Keyword Unless ${passed} Fatal Error Тендер не знайдено за 360 секунд  
284 -  
285 - Wait Until Page Does Not Contain Element jquery=#plan-list-pjax.loading-wrapper  
286 - Capture Page Screenshot  
287 - Click Element xpath=(//div[@id='plan-list-pjax'])//a[contains(@href, '/plan/')][1]  
288 - Sleep 5  
289 -  
290 -Шукати і знайти план  
291 - Клацнути і дочекатися пошук xpath=//button[@class='btn btn-default js-submit-btn'] xpath=(//div[@id='plan-list-pjax'])//a[contains(@href, '/plan/')][1] 5 40 + open new plan form
  41 + fill plan form ${plan_data['data']}
  42 + submit form and check result ${plan_form_submit_btn_locator} ${plan_form_submit_success_msg} ${plan_created_checker_element_locator}
  43 + wait until page does not contain element with reloading ${plan_sync_element_locator}
  44 + ${plan_uaid} = get text ${plan_uaid_text_locator}
  45 + [Return] ${plan_uaid}
292 46
293 Оновити сторінку з планом 47 Оновити сторінку з планом
294 - [Arguments] ${username} ${tenderId}  
295 -  
296 - Reload Page  
297 - Sleep 2s  
298 -  
299 -Внести зміни в план  
300 - [Arguments] @{ARGUMENTS}  
301 - [Documentation]  
302 - ... ${ARGUMENTS[0]} = username  
303 - ... ${ARGUMENTS[1]} = ${TENDER_UAID}  
304 - ... ${ARGUMENTS[2]} = key  
305 - ... ${ARGUMENTS[3]} = value  
306 -  
307 - PlanFormOpenByUAID ${ARGUMENTS[1]}  
308 - Run Keyword If '${ARGUMENTS[2]}' == 'budget.amount' Input text id=planform-value_amount ${ARGUMENTS[3]}  
309 - Run Keyword If '${ARGUMENTS[2]}' == 'budget.description' Input text id=planform-title ${ARGUMENTS[3]}  
310 - Run Keyword If '${ARGUMENTS[2]}' == 'items[0].deliveryDate.endDateitem'  
311 -# ... PlanUpdateItemDeliveryEndDate \#collapseItems .tab-content .tab-pane:first ${ARGUMENTS[3]}  
312 - ... PlanUpdateItemDeliveryEndDateNew \#collapseItems .tab-content .tab-pane:first ${ARGUMENTS[3]}  
313 - Run Keyword If '${ARGUMENTS[2]}' == 'items[0].quantity' JsTabShowAndScroll ul.form-nav-tabs a[data-toggle='tab'][href='#collapseItems']  
314 - Run Keyword If '${ARGUMENTS[2]}' == 'items[0].quantity' JsTabShowAndScroll \#collapseItems .nav li:first a  
315 - Run Keyword If '${ARGUMENTS[2]}' == 'items[0].quantity'  
316 - ... PlanUpdateItemQuantity \#collapseItems .tab-content .tab-pane:first ${ARGUMENTS[3]}  
317 - PlanUpdateSave  
318 -  
319 -Додати предмет закупівлі в план  
320 - [Arguments] ${username} ${uaid} ${item_data}  
321 -  
322 - PlanFormOpenByUAID ${uaid}  
323 - InputPlanOneItem ${item_data}  
324 - PlanUpdateSave  
325 -  
326 -Видалити предмет закупівлі плану  
327 - [Arguments] ${username} ${uaid} ${item_key}  
328 -  
329 - PlanFormOpenByUAID ${uaid}  
330 - JsTabShowAndScroll ul.form-nav-tabs a[data-toggle='tab'][href='#collapseItems']  
331 - Click Element jquery=#collapseItems .nav li[data-title^='${item_key}']  
332 - Sleep 1  
333 - Click Element jquery=#collapseItems .nav li[data-title^='${item_key}'] .js-dynamic-form-remove  
334 - Wait Until Page Contains Ви впевнені що бажаєте видали обрану номенклатуру? 60  
335 - Click Element xpath=//div[contains(@class, 'jconfirm-box')]//button[contains(@class, 'btn btn-default waves-effect waves-light btn-lg')]  
336 - PlanUpdateSave  
337 -  
338 -Отримати інформацію із плану  
339 - [Arguments] ${username} ${uaid} ${key}  
340 - ${item0Wrapper}= Set Variable \#accordionItems .panel:nth(0) .panel-collapse:first  
341 - ${item1Wrapper}= Set Variable \#accordionItems .panel:nth(1) .panel-collapse:first  
342 - ${budget}= get_invisible_text jquery=#general-info .budget-amount  
343 -  
344 - PlanOpenByUAID ${uaid}  
345 - JsSetScrollToElementBySelector \#general-info  
346 - Run Keyword And Return If '${key}' == 'tender.procurementMethodType' get_invisible_text jquery=#general-info .procurement-method-type  
347 - Run Keyword And Return If '${key}' == 'budget.amount' Convert To Number ${budget}  
348 - Run Keyword And Return If '${key}' == 'budget.description' get_text jquery=#general-info .budget-description .value  
349 - Run Keyword And Return If '${key}' == 'budget.currency' get_invisible_text jquery=#general-info .budget-currency  
350 - Run Keyword And Return If '${key}' == 'budget.id' get_text jquery=#general-info .budget-id .value  
351 - Run Keyword And Return If '${key}' == 'budget.project.id' get_invisible_text jquery=#general-info .budget-project-id  
352 - Run Keyword And Return If '${key}' == 'budget.project.name' get_invisible_text jquery=#general-info .budget-project-name  
353 - Run Keyword And Return If '${key}' == 'classification.description' get_invisible_text jquery=#general-info .main-classification-description  
354 - Run Keyword And Return If '${key}' == 'classification.scheme' get_invisible_text jquery=#general-info .main-classification-scheme  
355 - Run Keyword And Return If '${key}' == 'classification.id' get_invisible_text jquery=#general-info .main-classification-code  
356 - Run Keyword And Return If '${key}' == 'tender.tenderPeriod.startDate' get_invisible_text jquery=#general-info .tender-start-date-source  
357 - ${procuringEntityNeedToBeVisible}= Run Keyword And Return Status Should Start With ${key} procuringEntity  
358 - Run Keyword If ${procuringEntityNeedToBeVisible} JsSetScrollToElementBySelector \#procuring-entity-info  
359 - Run Keyword And Return If '${key}' == 'procuringEntity.name' get_invisible_text jquery=#procuring-entity-info .name  
360 - Run Keyword And Return If '${key}' == 'procuringEntity.identifier.scheme' get_invisible_text jquery=#procuring-entity-info .identifier-scheme  
361 - Run Keyword And Return If '${key}' == 'procuringEntity.identifier.id' get_invisible_text jquery=#procuring-entity-info .identifier-code  
362 - Run Keyword And Return If '${key}' == 'procuringEntity.identifier.legalName' get_text jquery=#procuring-entity-info .legal-name .value  
363 - ${item0NeedToBeVisible}= Run Keyword And Return Status Should Start With ${key} items[0]  
364 - Run Keyword If ${item0NeedToBeVisible} JsCollapseShowAndScroll ${item0Wrapper}  
365 - Run Keyword And Return If '${key}' == 'items[0].description' get_text jquery=div#accordionItems.panel-group div.panel.panel-default .panel-collapse.collapse.in div.panel-body div#w1.item-info-wrapper.info-wrapper p.title span.value  
366 - Run Keyword And Return If '${key}' == 'items[0].quantity' Get invisible text number by locator jquery=${item0Wrapper} .item-info-wrapper .quantity-source  
367 - Run Keyword And Return If '${key}' == 'items[0].deliveryDate.endDate' get_invisible_text jquery=${item0Wrapper} .item-info-wrapper .delivery-end-date-source  
368 - Run Keyword And Return If '${key}' == 'items[0].unit.code' get_invisible_text jquery=${item0Wrapper} .item-info-wrapper .unit-code-source  
369 - Run Keyword And Return If '${key}' == 'items[0].unit.name' get_invisible_text jquery=${item0Wrapper} .item-info-wrapper .unit-title-source  
370 - Run Keyword And Return If '${key}' == 'items[0].classification.description' get_invisible_text jquery=${item0Wrapper} .item-info-wrapper .main-classification-description  
371 - Run Keyword And Return If '${key}' == 'items[0].classification.scheme' get_invisible_text jquery=${item0Wrapper} .item-info-wrapper .main-classification-scheme  
372 - Run Keyword And Return If '${key}' == 'items[0].classification.id' get_invisible_text jquery=${item0Wrapper} .item-info-wrapper .main-classification-code  
373 - ${item1NeedToBeVisible}= Run Keyword And Return Status Should Start With ${key} items[1]  
374 - Run Keyword If ${item1NeedToBeVisible} JsCollapseShowAndScroll ${item1Wrapper}  
375 - Run Keyword And Return If '${key}' == 'items[1].description' get_text jquery=${item1Wrapper} .item-info-wrapper .title .value  
376 - Run Keyword And Return If '${key}' == 'items[1].quantity' Get invisible text number by locator jquery=${item1Wrapper} .item-info-wrapper .quantity-source  
377 - Run Keyword And Return If '${key}' == 'items[1].deliveryDate.endDate' get_invisible_text jquery=${item1Wrapper} .item-info-wrapper .delivery-end-date-source  
378 - Run Keyword And Return If '${key}' == 'items[1].unit.code' get_invisible_text jquery=${item1Wrapper} .item-info-wrapper .unit-code-source  
379 - Run Keyword And Return If '${key}' == 'items[1].unit.name' get_invisible_text jquery=${item1Wrapper} .item-info-wrapper .unit-title-source  
380 - Run Keyword And Return If '${key}' == 'items[1].classification.description' get_invisible_text jquery=${item1Wrapper} .item-info-wrapper .main-classification-description  
381 - Run Keyword And Return If '${key}' == 'items[1].classification.scheme' get_invisible_text jquery=${item1Wrapper} .item-info-wrapper .main-classification-scheme  
382 - Run Keyword And Return If '${key}' == 'items[1].classification.id' get_invisible_text jquery=${item1Wrapper} .item-info-wrapper .main-classification-code  
383 - Fail NotImplemented  
384 -  
385 -### EOF - PLANNING ###  
386 -  
387 -### BOF - HELPERS ###  
388 -  
389 -UserChangeOrgnizationInfo  
390 - [Arguments] ${data}  
391 -  
392 - ${keys}= Get Dictionary Keys ${data}  
393 -  
394 - Go To ${BROKERS['playtender'].basepage}/user/profile  
395 - Wait Until Page Contains Інформація про компанію 60  
396 - Sleep 1  
397 -  
398 - Run Keyword If 'name' in ${keys} Input text id=profileform-organization_name ${data.name}  
399 - Run Keyword If 'identifier' in ${keys} Input text id=profileform-organization_edrpou ${data.identifier.id}  
400 - Run Keyword If 'address' in ${keys} JsSetScrollToElementBySelector \#profileform-organization_region_id  
401 - Run Keyword If 'address' in ${keys} Select From List By Label jquery=#profileform-organization_region_id ${data.address.region}  
402 - Run Keyword If 'address' in ${keys} Input Text jquery=#profileform-organization_postal_code ${data.address.postalCode}  
403 - Run Keyword If 'address' in ${keys} Input Text jquery=#profileform-organization_locality ${data.address.locality}  
404 - Run Keyword If 'address' in ${keys} Input Text jquery=#profileform-organization_street_address ${data.address.streetAddress}  
405 -  
406 - JsSetScrollToElementBySelector \#user-profile-form .js-submit-btn  
407 - Click Element jquery=\#user-profile-form .js-submit-btn  
408 - Sleep 1  
409 - Wait Until Page Contains Контактна інформація успішно оновлена 60  
410 - Click Element xpath=//div[contains(@class, 'jconfirm-box')]//button[contains(@class, 'btn btn-default waves-effect waves-light btn-lg')]  
411 -  
412 -InputClassificationByWrapper  
413 - [Arguments] ${wrapper} ${classification_id}  
414 -  
415 -# Click Element jquery=${wrapper} a[href='#classification']  
416 -### Дочекатися І Клікнути xpath=//a[contains(@data-target,'#planform-classification_id')]  
417 -### Дочекатися І Клікнути xpath=${wrapper}//a[contains(@data-target,'-classification_id')]  
418 - Дочекатися І Клікнути jquery=${wrapper} a[data-target$="-classification_id"]  
419 -#cat Wait Until Element Is Visible xpath=//div[contains(@id, 'classification-modal')]//h4[contains(@id, 'classificationModalLabel')]  
420 - Wait Until Page Contains Element xpath=//div[contains(@id, 'classification-modal')]//h4[contains(@id, 'classificationModalLabel')]  
421 -#cat Sleep 1  
422 - Input text jquery=#classification-modal .js-search-wrapper .js-input ${classification_id}  
423 -# Input text xpath=//div[contains(@id, 'classification-modal')]//input[@class='form-control js-input'] ${classification_id}  
424 -#cat Input text xpath=//div[contains(@id, 'classification-modal')]//input[@class='form-control js-input'] 99999999-9  
425 -# Press key xpath=//div[contains(@id, 'classification-modal')]//input[@class='form-control js-input'] \\13  
426 -# Sleep 1  
427 - Wait Until Page Contains Element xpath=//div[contains(@id, 'classification-modal')]//strong[contains(., '${classification_id}')] 60  
428 - Click Element xpath=//div[contains(@id, 'classification-modal')]//strong[contains(., '${classification_id}')]  
429 -#cat Click Element xpath=//div[contains(@id, 'classification-modal')]//i[@class='jstree-icon jstree-checkbox']  
430 - Click Element jquery=#classification-modal div.modal-footer div.buttons-wrapper button.btn.btn-default.waves-effect.waves-light.js-submit  
431 -# Click Element xpath=//div[contains(@id, 'classification-modal')]//button[contains(@class, 'btn btn-default waves-effect waves-light js-submit')]  
432 -# Sleep 1  
433 -  
434 -InputAdditionalClassificationsByWrapper  
435 - [Arguments] ${wrapper} ${additionalClassifications}  
436 -  
437 -## Wait Until Element Is Visible xpath=${wrapper}//a[contains(@data-target,"additional_classification_ids")] 2  
438 -# Wait Until Element Is Visible jquery=${wrapper} a[href='#additionalclassification'] 2  
439 -## Дочекатися І Клікнути xpath=${wrapper}//a[contains(@data-target,"additional_classification_ids")]  
440 - Дочекатися І Клікнути jquery=${wrapper} a[data-target$="additional_classification_ids"]  
441 - Wait Until Element Is Visible jquery=${wrapper} a[data-target$="additional_classification_ids"] 2  
442 -# Wait Until Element Is Visible xpath=//div[contains(@id, 'additional-classification-modal')]//h4[contains(@id, 'additionalClassificationModalLabel')]  
443 - Wait Until Element Is Visible jquery=#additional-classification-modal #addclstab0 .js-search-wrapper .js-input  
444 - Sleep 1  
445 -  
446 - ${count}= Get Length ${additionalClassifications}  
447 - : FOR ${INDEX} IN RANGE 0 ${count}  
448 - \ Continue For Loop If '${additionalClassifications[${INDEX}].scheme}' == 'ДКПП' or '${additionalClassifications[${INDEX}].scheme}' == 'UA-ROAD' or '${additionalClassifications[${INDEX}].scheme}' == 'GMDN'  
449 - \ Click Element jquery=#additional-classification-modal .nav a[data-toggle="tab"][data-scheme="${additionalClassifications[${INDEX}].scheme}"]  
450 - \ Wait Until Element Is Visible jquery=#additional-classification-modal .tab-pane.tree-wrapper.active input.js-input  
451 - \ Input text jquery=#additional-classification-modal .tab-pane.tree-wrapper.active input.js-input ${additionalClassifications[${INDEX}].id}  
452 - \ Press key jquery=#additional-classification-modal .tab-pane.tree-wrapper.active input.js-input \\13  
453 - \ Sleep 2  
454 - \ Wait Until Page Contains Element jquery=#additional-classification-modal .tab-pane.tree-wrapper.active .tree.js-search-tree strong:contains("${additionalClassifications[${INDEX}].id}") 60  
455 - \ Click Element jquery=#additional-classification-modal .tab-pane.tree-wrapper.active .tree.js-search-tree li:first i.jstree-checkbox  
456 -  
457 - Click Element xpath=//div[contains(@id, 'additional-classification-modal')]//button[contains(@class, 'js-submit')]  
458 -# Sleep 1  
459 -  
460 -InputPlanItems  
461 - [Arguments] ${data}  
462 - ${items}= Get From Dictionary ${data} items  
463 - ${count}= Get Length ${items}  
464 -  
465 - : FOR ${INDEX} IN RANGE 0 ${count}  
466 - \ InputPlanOneItem ${items[${INDEX}]}  
467 -  
468 -InputPlanOneItem  
469 - [Arguments] ${data}  
470 -# ${wrapper}= Set Variable \#collapseItems .tab-content .tab-pane.active  
471 - ${wrapper}= Set Variable \div.modal-form.js-form-popup.fancybox-content  
472 -### div.modal-content div.form-group.form-simple-group  
473 - ${wrapper_classification}= Set Variable \div.modal modal-form js-form-popup fancybox-content  
474 -## div.modal.modal-form.js-form-popup.fancybox-content  
475 - ${wrapper_classification_x}= Set Variable \//div[@class="modal modal-form js-form-popup fancybox-content"]  
476 - ${keys}= Get Dictionary Keys ${data}  
477 -  
478 - JsTabShowAndScroll ul.form-nav-tabs a[data-toggle='tab'][href='#collapseItems']  
479 -# Click Element jquery=#collapseItems a[href="#add-items"]  
480 - Scroll To Element xpath=//*[@id="plan-form"]//a[@class='btn btn-default btn-update js-form-popup-add']  
481 - Дочекатися і Клікнути xpath=//*[@id="plan-form"]//a[@class='btn btn-default btn-update js-form-popup-add']  
482 - Sleep 2  
483 - Wait Until Element Is Visible jquery=${wrapper} [id$='-description'] 3  
484 - Input text jquery=${wrapper} [id$='-description'] ${data.description}  
485 -## Wait Until Element Is Visible xpath=//input[contains(@class,'form-control js-title')] 3  
486 -## Input text xpath=//input[contains(@class,'form-control js-title')] ${data.description}  
487 - PlanUpdateItemQuantity ${wrapper} ${data.quantity}  
488 -### PlanUpdateItemQuantity ${wrapper} 40  
489 - JsSetScrollToElementBySelector ${wrapper} [id$='-unit_id']  
490 -### Click Element xpath=//span[@class='select2-selection__rendered'][contains(@id,'id-container')][contains(.,'Одиниці виміру')]  
491 -# Click Element jquery=${wrapper} [id$='-unit_id']  
492 -# Wait Until Element Is Visible jquery=${wrapper} [id$='-unit_id'] 3  
493 - Wait Until Page Contains Element jquery=${wrapper} [id$='-unit_id'] 3  
494 -### Execute Javascript $('${wrapper} select2-selection select2-selection--single').trigger("click")  
495 - Click Element jquery=${wrapper} span.select2-selection__rendered  
496 - Input text xpath=//span[contains(@class,'select2-search select2-search--dropdown')]//input[contains(@class,'select2-search__field')] ${data.unit.name}  
497 - Press key xpath=//span[contains(@class,'select2-search select2-search--dropdown')]//input[contains(@class,'select2-search__field')] \\13  
498 -# Select From List By Label jquery=${wrapper} [id$='-unit_id'] ${data.unit.name}  
499 - InputClassificationByWrapper ${wrapper} ${data.classification.id}  
500 -### InputClassificationByWrapper ${wrapper_classification} ${data.classification.id}  
501 - Run Keyword If 'additionalClassifications' in ${keys}  
502 - ... InputAdditionalClassificationsByWrapper ${wrapper} ${data.additionalClassifications}  
503 -# PlanUpdateItemDeliveryEndDate ${wrapper} ${data.deliveryDate.endDate}  
504 - PlanUpdateItemDeliveryEndDateNew ${wrapper} ${data.deliveryDate.endDate}  
505 - Дочекатися і Клікнути jquery=${wrapper} a.btn.btn-success.js-popup-submit  
506 -  
507 -TenderOpenByUAID  
508 - [Arguments] ${uaid}  
509 -  
510 - Go To ${BROKERS['playtender'].basepage}/tender/${uaid}  
511 - Wait Until Page Contains Закупівля ${uaid} 60  
512 -  
513 -TenderFormOpenByUAID  
514 - [Arguments] ${uaid}  
515 -  
516 - TenderOpenByUAID ${uaid}  
517 - Click Element xpath=//a[contains(@href, '/tender/update')][1]  
518 - Sleep 1  
519 - Wait Until Page Contains Element id=tender-form 60  
520 - Sleep 1  
521 -  
522 -PlanOpenByUAID  
523 - [Arguments] ${uaid}  
524 -  
525 - Go To ${BROKERS['playtender'].basepage}/plan/${uaid}  
526 - Wait Until Page Contains ${uaid} 60  
527 -# Wait Until Page Contains План ${uaid} 60  
528 -  
529 -PlanFormOpenByUAID  
530 - [Arguments] ${uaid}  
531 -  
532 - PlanOpenByUAID ${uaid}  
533 -# Click Element xpath=//a[contains(@href, '/plan/update')][1]  
534 - Дочекатися і Клікнути jquery=${planEditButton}  
535 - Wait Until Page Contains Element xpath=//a[contains(@data-url,'#general-form-popup')] 60  
536 -# Wait Until Page Contains Редагування 60  
537 - Sleep 1  
538 -  
539 -PlanUpdateItemQuantity  
540 - [Arguments] ${wrapper} ${quantity}  
541 - ${quantity_srt}= Convert To String ${quantity}  
542 -  
543 - JsSetScrollToElementBySelector ${wrapper} [id$='-quantity']  
544 - Input text jquery=${wrapper} [id$='-quantity'] ${quantity_srt}  
545 -  
546 -PlanUpdateItemDeliveryEndDate  
547 - [Arguments] ${wrapper} ${delivery_end_date}  
548 - ${date}= convert_isodate_to_site_datetime ${delivery_end_date}  
549 -  
550 - JsInputHiddenText ${wrapper} [id$='-delivery_end_date'] ${date}  
551 -  
552 -PlanUpdateItemDeliveryEndDateNew  
553 - [Arguments] ${wrapper} ${delivery_end_date}  
554 - ${date}= convert_isodate_to_site_date ${delivery_end_date}  
555 -  
556 - JsInputHiddenText ${wrapper} [id$='-delivery_end_date'] ${date}  
557 -  
558 -PlanUpdateSave  
559 -  
560 - JsSetScrollToElementBySelector \#submitBtn  
561 - Click Element xpath=//*[@id='submitBtn']  
562 - Sleep 1  
563 - Wait Until Page Contains План оновлений, дочекайтесь опублікування на сайті уповноваженого органу. 60  
564 - Click Element xpath=//div[contains(@class, 'jconfirm-box')]//button[contains(@class, 'btn btn-default waves-effect waves-light btn-lg')]  
565 - Wait For Sync Tender 60  
566 -  
567 -JsInputHiddenText  
568 - [Arguments] ${selector} ${text}  
569 -  
570 - Execute JavaScript jQuery("${selector}").val("${text}");  
571 -  
572 -JsSetScrollToElementBySelector  
573 - [Arguments] ${selector}  
574 -  
575 - Execute JavaScript scrollToElement("${selector}", 0, 10);  
576 - Sleep 100ms  
577 -  
578 -JsCollapseShowAndScroll  
579 - [Arguments] ${selector}  
580 -  
581 - Execute JavaScript jQuery("${selector}").collapse("show");  
582 - Sleep 500ms  
583 - JsSetScrollToElementBySelector ${selector}  
584 -  
585 -JsTabShowAndScroll  
586 - [Arguments] ${selector}  
587 -  
588 - Execute JavaScript jQuery("${selector}").tab("show");  
589 - Sleep 300ms  
590 - JsSetScrollToElementBySelector ${selector}  
591 -  
592 -GetDictionaryKeyExist [Arguments] ${Dictionary Name} ${Key}  
593 - Run Keyword And Return Status Dictionary Should Contain Key ${Dictionary Name} ${Key}  
594 -  
595 -GetValueFromDictionaryByKey [Arguments] ${Dictionary Name} ${Key}  
596 - ${KeyIsPresent}= Run Keyword And Return Status Dictionary Should Contain Key ${Dictionary Name} ${Key}  
597 - ${Value}= Run Keyword If ${KeyIsPresent} Get From Dictionary ${Dictionary Name} ${Key}  
598 - Return From Keyword ${Value}  
599 -  
600 -GenerateFakeDocument  
601 - ${file_path} ${file_name} ${file_content}= op_robot_tests.tests_files.service_keywords.Create Fake Doc  
602 - [return] ${file_path}  
603 -  
604 -GenerateFakeText  
605 - ${text}= Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.  
606 - [return] ${text}  
607 -  
608 -WaitPageSyncing  
609 - [Arguments] ${timeout}  
610 - ${passed}= Run Keyword And Return Status Wait Until Keyword Succeeds ${timeout} s 0 s GetPageSyncingStatus  
611 - Run Keyword Unless ${passed} Fatal Error Sync Finish not finish in ${timeout} sec  
612 -  
613 -GetPageSyncingStatus  
614 - Sleep 2  
615 - Reload Page  
616 - Sleep 1  
617 - Page Should Not Contain Element jquery=.wrapper .card-box .fa.fa-refresh  
618 -  
619 -WaitTenderAuctionEnd  
620 - [Arguments] ${timeout}  
621 - ${passed}= Run Keyword And Return Status Wait Until Keyword Succeeds ${timeout} s 0 s GetTenderAuctionEndStatus  
622 - Run Keyword Unless ${passed} Fatal Error Tender not changed status from active.auction in ${timeout} sec  
623 -  
624 -GetTenderAuctionEndStatus  
625 - Sleep 60  
626 - Reload Page  
627 - Sleep 5  
628 - ${tenderStatus}= get_invisible_text xpath=//*[contains(@class, 'hidden opstatus')]  
629 - Should Not Be Equal As Strings ${tenderStatus} active.auction  
630 -  
631 -Input Float  
632 - [Arguments] ${input_jquery_selector} ${value}  
633 - ${value}= convert_float_to_string ${value}  
634 - Input Text jquery=${input_jquery_selector} ${value}  
635 -  
636 -Input Float Multiply100  
637 - [Arguments] ${input_jquery_selector} ${value}  
638 - ${value}= multiply_hundred ${value}  
639 - Input Float ${input_jquery_selector} ${value}  
640 -  
641 -Input DateTime  
642 - [Arguments] ${input_jquery_selector} ${date}  
643 - ${date}= convert_datetime_for_delivery ${date}  
644 - ${date}= Convert Date ${date} %d.%m.%Y %H:%M  
645 - Input Text jquery=${input_jquery_selector} ${date}  
646 -  
647 -Input DateTime XPath  
648 - [Arguments] ${input_selector} ${date}  
649 - ${date}= convert_datetime_for_delivery ${date}  
650 - ${date}= Convert Date ${date} %d.%m.%Y %H:%M  
651 - Input Text xpath=//${input_selector} ${date}  
652 -  
653 -Input Converted DateTime  
654 - [Arguments] ${input_jquery_selector} ${date}  
655 - Input Text jquery=${input_jquery_selector} ${date}  
656 - sleep 1s  
657 - execute javascript $("${input_jquery_selector}").blur();  
658 - sleep 100ms  
659 -  
660 -Input Text With Checking Input Isset  
661 - [Arguments] ${input_jquery_selector} ${text}  
662 - Log ${input_jquery_selector}  
663 - ${input_isset}= Run Keyword And Return Status Page Should Contain Element jquery=${input_jquery_selector}  
664 - Run Keyword If ${input_isset} Input Text jquery=${input_jquery_selector} ${text}  
665 -  
666 -Input Text With Checking Input Isset XPath  
667 - [Arguments] ${input_selector} ${text}  
668 - Log ${input_selector}  
669 - ${input_isset}= Run Keyword And Return Status Page Should Contain Element xpath=//${input_selector}  
670 - Run Keyword If ${input_isset} Input Text xpath=//${input_selector} ${text}  
671 -  
672 -Select From List By Label With Checking Input Isset XPath  
673 - [Arguments] ${input_selector} ${text}  
674 - Log ${input_selector}  
675 - ${input_isset}= Run Keyword And Return Status Page Should Contain Element xpath=//${input_selector}  
676 - Run Keyword If ${input_isset} Select From List By Label xpath=//${input_selector} ${text}  
677 -  
678 -GetInputProcTypeByProcurementMethodType  
679 - [Arguments] ${procurementMethodType}  
680 - ${playtender_proc_type}= Convert_to_Lowercase ${procurementMethodType}  
681 - ${playtender_proc_type}= Remove String ${playtender_proc_type} \.  
682 - ${playtender_proc_type}= Set Variable If '${playtender_proc_type}' == 'belowthreshold' ${EMPTY} ${playtender_proc_type}  
683 - [return] ${playtender_proc_type}  
684 -  
685 -### EOF - HELPERS ###  
686 -  
687 -Дочекатися і Клікнути  
688 - [Arguments] ${locator}  
689 - Wait Until Keyword Succeeds 15 x 1 s Element Should Be Visible ${locator}  
690 - Scroll To Element ${locator}  
691 - Click Element ${locator}  
692 -  
693 -Scroll To Element  
694 - [Arguments] ${locator}  
695 - ${elem_vert_pos}= Get Vertical Position ${locator}  
696 - Execute Javascript window.scrollTo(0,${elem_vert_pos - 300}); 48 + [Arguments] ${username} ${plan_uaid}
  49 + [Documentation] Оновити сторінку з планом для отримання потенційно оновлених даних.
697 50
698 -CheckAlertMessageAndCloseIt  
699 - Дочекатися і Клікнути xpath=//div[@class='closeIcon'][contains(.,'×')]  
  51 + open plan page by uaid ${plan_uaid}
  1 +*** Settings ***
  2 +
  3 +Library Selenium2Library
  4 +Library String
  5 +Library Collections
  6 +Library playtender_service.py
  7 +Resource playtender_variables.robot
  8 +
  9 +*** Variables ***
  10 +
  11 +${broker} = playtender
  12 +${broker_username} =
  13 +${broker_baseurl} =
  14 +${broker_browser} =
  15 +${broker_language_code} = uk
  16 +
  17 +@{browser_default_size} = ${1200} ${1000}
  18 +@{browser_default_position} = ${0} ${0}
  19 +
  20 +${popup_transaction_time} = 600ms
  21 +
  22 +*** Keywords ***
  23 +
  24 +init environment
  25 + [Arguments] ${username}
  26 + [Documentation] ініціює необхідні глобальні змінні
  27 +
  28 + set global variable ${broker_username} ${username}
  29 + set global variable ${broker_baseurl} ${BROKERS['${broker}'].basepage}
  30 + set global variable ${broker_browser} ${USERS.users['${broker_username}'].browser}
  31 +
  32 +set site language by code
  33 + [Arguments] ${language_code}
  34 + [Documentation] змінити мову сайту
  35 +
  36 + ${is_equal} = __private__check_site_language_code ${language_code}
  37 + run keyword if ${is_equal} == ${False} __private__open_site_language_dropdown_and_select_language_by_code ${language_code}
  38 +
  39 +login to site
  40 + [Arguments] ${user_data}
  41 + [Documentation] авторизувати вказаного користувача, масив повинен містити login, password
  42 +
  43 + click visible element ${login_popup_open_locator}
  44 + wait until popup is visible
  45 + input text to visible input ${login_popup_login_input_locator} ${user_data['login']}
  46 + input text to visible input ${login_popup_password_input_locator} ${user_data['password']}
  47 + click visible element ${login_popup_submit_btn_locator}
  48 + wait until page contains element ${user_logged_checker_element_locator} 30s User can not login
  49 +
  50 +fill item form in opened popup
  51 + [Arguments] ${data}
  52 + [Documentation] заповнює відкриту форму згідно вказаних даних
  53 +
  54 + ${description} = get from dictionary by keys ${data} description
  55 + run keyword if condition is not none ${description} input text to visible input ${item_form_popup_description_input_locator} ${description}
  56 + ${description_ru} = get from dictionary by keys ${data} description_ru
  57 + run keyword if condition is not none ${description_ru} input text to exist visible input ${item_form_popup_description_ru_input_locator} ${description_ru}
  58 + ${description_en} = get from dictionary by keys ${data} description_en
  59 + run keyword if condition is not none ${description_en} input text to exist visible input ${item_form_popup_description_ru_input_locator} ${description_en}
  60 + ${quantity} = get from dictionary by keys ${data} quantity
  61 + run keyword if condition is not none ${quantity} input number to visible input ${item_form_popup_quantity_input_locator} ${quantity}
  62 + ${unit} = get from dictionary by keys ${data} unit name
  63 + run keyword if condition is not none ${unit} select from visible list by label ${item_form_popup_unit_input_locator} ${unit}
  64 + ${classification} = get from dictionary by keys ${data} classification
  65 + run keyword if condition is not none ${classification} select classification by code attributes ${item_form_popup_classification_edit_btn_locator} ${classification}
  66 + ${additional_classifications} = get from dictionary by keys ${data} additionalClassifications
  67 + run keyword if condition is not none ${additional_classifications} select classification by array of code attributes ${item_form_popup_additional_classification_edit_btn_locator} ${additional_classifications}
  68 +
  69 +########################################################################################################################
  70 +#################################################### COMMON HELPERS ####################################################
  71 +########################################################################################################################
  72 +
  73 +click visible element
  74 + [Arguments] ${locator}
  75 + [Documentation] перевіряє видимість і клікає по елементу
  76 +
  77 + __private__set_element_visible_in_browser_area ${locator}
  78 + click element ${locator}
  79 +
  80 +input text to visible input
  81 + [Arguments] ${locator} ${text}
  82 + [Documentation] перевіряє чи елемент видимий у вікні браузера, після чого заповнює його
  83 +
  84 + __private__set_element_visible_in_browser_area ${locator}
  85 + input text ${locator} ${text}
  86 +
  87 +input text to exist visible input
  88 + [Arguments] ${locator} ${text}
  89 + [Documentation] перевіряє чи елемент існує і видимий у вікні браузера, після чого заповнює його
  90 +
  91 + ${input_exists} = __private__get_is_element_exist ${locator}
  92 + run keyword if ${input_exists} == ${True} input text to visible input ${locator} ${text}
  93 + ... ELSE __private__log input ${locator} does not exist
  94 +
  95 +input date to visible input
  96 + [Arguments] ${locator} ${isodate} ${format}=%d.%m.%Y
  97 + [Documentation] перевіряє чи елемент видимий у вікні браузера, після чого заповнює його відформатовоною датою
  98 +
  99 + __private__set_element_visible_in_browser_area ${locator}
  100 + ${date} = isodate format ${isodate} ${format}
  101 + input text ${locator} ${date}
  102 +
  103 +input datetime to visible input
  104 + [Arguments] ${locator} ${isodate} ${format}=%d.%m.%Y %H:%M
  105 + [Documentation] перевіряє чи елемент видимий у вікні браузера, після чого заповнює його відформатовоною датою
  106 +
  107 + input date to visible input ${locator} ${isodate} ${format}
  108 +
  109 +input number to visible input
  110 + [Arguments] ${locator} ${number}
  111 + [Documentation] робить елемент видимим, число перетворює в строку і записує в поле
  112 +
  113 + ${number} = convert float to string ${number}
  114 + input text to visible input ${locator} ${number}
  115 +
  116 +input month.year of date to visible input
  117 + [Arguments] ${locator} ${isodate}
  118 + [Documentation] робить елемент видимим, витягує місяць.рік і записує в поле
  119 +
  120 + ${value} = isodate format ${isodate} %m.%Y
  121 + input text to visible input ${locator} ${value}
  122 +
  123 +select from visible list by value
  124 + [Arguments] ${locator} ${value}
  125 + [Documentation] робить елемент видимим, після чого заповнює його
  126 +
  127 + __private__set_element_visible_in_browser_area ${locator}
  128 + select from list by value ${locator} ${value}
  129 + trigger input change event ${locator}
  130 +
  131 +select from visible list by label
  132 + [Arguments] ${locator} ${label}
  133 + [Documentation] робить елемент видимим, після чого заповнює його
  134 +
  135 + __private__set_element_visible_in_browser_area ${locator}
  136 + select from hidden list by label ${locator} ${label}
  137 + trigger input change event ${locator}
  138 +
  139 +select from visible list by year of date
  140 + [Arguments] ${locator} ${isodate}
  141 + [Documentation] робить елемент видимим, витягує рік і обирає в списку
  142 +
  143 + ${value} = isodate format ${isodate} %Y
  144 + select from visible list by value ${locator} ${value}
  145 +
  146 +select classification by code attributes
  147 + [Arguments] ${btn_locator} ${code_attributes}
  148 + [Documentation] натискає кнопку відкриття попапу класифікатора і чекає поки він відмалюється, шукає відповідний код і закриває попап
  149 +
  150 + ${code_attributes_array} = create list ${code_attributes}
  151 + select classification by array of code attributes ${btn_locator} ${code_attributes_array}
  152 +
  153 +select classification by array of code attributes
  154 + [Arguments] ${btn_locator} ${code_attributes_array} ${include_schemes}=${None} ${exclude_schemes}=${None}
  155 + [Documentation] натискає кнопку відкриття попапу класифікатора і чекає поки він відмалюється, шукає відповідні коди і закриває попап
  156 +
  157 + ${include_schemes_is_none}= get variable is none ${include_schemes}
  158 + ${exclude_schemes_is_none}= get variable is none ${exclude_schemes}
  159 +
  160 + open popup by btn locator ${btn_locator} ${classification_popup_opened_content_locator}
  161 + :FOR ${code_attributes} IN @{code_attributes_array}
  162 + \ ${disabled} = set variable if ${include_schemes_is_none} == ${False} and '${code_attributes['scheme']}' not in ${include_schemes} ${True} ${False}
  163 + \ ${disabled} = set variable if ${exclude_schemes_is_none} == ${False} and '${code_attributes['scheme']}' in ${exclude_schemes} ${True} ${disabled}
  164 + \ run keyword if ${disabled} == ${False} __private__select_classification_code_in_opened_popup ${code_attributes['id']} ${code_attributes['scheme']}
  165 + submit current visible popup
  166 +
  167 +open page and wait element by locator
  168 + [Arguments] ${url} ${waiting_element_locator} ${waiting_timeout}=30s ${waiting_error}=Opened page does not have specified element locator
  169 + [Documentation] переходить по посиланню і чекає поки елемент не буде знайдений на сторінці
  170 +
  171 + go to ${url}
  172 + wait until page contains element ${waiting_element_locator} ${waiting_timeout} ${waiting_error}
  173 +
  174 +open popup by btn locator
  175 + [Arguments] ${btn_locator} ${popup_locator}=${None}
  176 + [Documentation] натискає кнопку відкриття попапу і чекає поки він відмалюється
  177 +
  178 + click visible element ${btn_locator}
  179 + wait until popup is visible ${popup_locator}
  180 +
  181 +submit current visible popup
  182 + [Documentation] натискає кнопку сабміту в поточному попапі і чекає поки він закриється
  183 +
  184 + ${popup_last_id} = __private__get_element_attribute ${popup_opened_last_locator} id
  185 + click visible element ${popup_opened_last_submit_btn_locator}
  186 + sleep ${popup_transaction_time}
  187 + ${popup_last_locator} = set variable id=${popup_last_id}
  188 + wait until page does not contain element ${popup_last_locator} 30s Current popup was not hidden
  189 +
  190 +submit form and check result
  191 + [Arguments] ${submit_btn_locator} ${wait_msg}=${None} ${wait_element_locator}=${None}
  192 + [Documentation] сабмітить форму і чекає повідомлення (якщо задано) + елемент (якщо задано)
  193 +
  194 + click visible element ${submit_btn_locator}
  195 + run keyword if condition is not none ${wait_msg} wait until alert is visible ${wait_msg}
  196 + run keyword if condition is not none ${wait_msg} close current visible alert
  197 + run keyword if condition is not none ${wait_element_locator} wait until page contains element ${wait_element_locator} 60s Element was not shown after form submitting
  198 +
  199 +wait until popup is visible
  200 + [Arguments] ${popup_locator}=${None} ${waiting_timeout}=30s ${waiting_error}=Opened popup still not visible
  201 + [Documentation] чекає поки попап не стане видимим на сторінці
  202 +
  203 + ${popup_locator_is_none} = get variable is none ${popup_locator}
  204 + ${popup_locator} = set variable if ${popup_locator_is_none} == ${False} ${popup_locator} ${popup_opened_content_locator}
  205 + wait until element is visible ${popup_locator} ${waiting_timeout} ${waiting_error}
  206 +
  207 +wait until alert is visible
  208 + [Arguments] ${message}=${None}
  209 + [Documentation] чекає поки не з'явиться алерт
  210 +
  211 + ${message_is_none} = get variable is none ${message}
  212 + ${message} = convert to string ${message}
  213 + ${alert_message_locator} = replace string ${alert_message_contains_text_locator_tpl} %text% ${message}
  214 + run keyword if ${message_is_none} == ${True} wait until page contains element ${alert_opened_locator} 60s Alert was not shown
  215 + run keyword if ${message_is_none} == ${False} wait until page contains element ${alert_message_locator} 60s Alert was not shown
  216 +
  217 +close current visible alert
  218 + [Documentation] закриває поточний alert
  219 +
  220 + click visible element ${alert_opened_close_btn_locator}
  221 +
  222 +wait until page does not contain element with reloading
  223 + [Arguments] ${locator} ${retry}=5m ${retry_interval}=2s
  224 + [Documentation] чекає поки елемент не пропаде зі сторінки з перезавантаженням сторінки
  225 +
  226 + ${result} = __private__get_is_element_exist ${locator}
  227 + run keyword if ${result} == ${True} wait until keyword succeeds ${retry} ${retry_interval} reload page and fail if element exists ${locator}
  228 +
  229 +wait until tab content is visible
  230 + [Arguments] ${tab_link} ${waiting_timeout}=30s ${waiting_error}=Opened tab still not visible
  231 + [Documentation] чекає поки контент вказаного табу не буде видимим
  232 +
  233 + ${tab_link_href} = __private__get_element_attribute ${tab_link} href
  234 + ${tab_content_locator} = set variable jquery=${tab_link_href}
  235 + wait until element is visible ${tab_content_locator} ${waiting_timeout} ${waiting_error}
  236 +
  237 +reload page and fail if element exists
  238 + [Arguments] ${locator}
  239 + [Documentation] перезавантажує сторінку і фейлить тест якщо елемент присутній
  240 +
  241 + reload page
  242 + ${exists} = __private__get_is_element_exist ${locator}
  243 + run keyword if ${exists} == ${True} fail
  244 +
  245 +########################################################################################################################
  246 +################################################### PRIVATE KEYWORDS ###################################################
  247 +########################################################################################################################
  248 +
  249 +__private__log
  250 + [Arguments] ${msg}
  251 + [Documentation] пише в логи
  252 +
  253 + log ${msg}
  254 + log to console ${msg}
  255 +
  256 +__private__get_is_element_exist
  257 + [Arguments] ${locator}
  258 + [Documentation] повертає чи елемент присутній на сторінці
  259 +
  260 + ${result} = run keyword and return status page should contain element ${locator}
  261 + [Return] ${result}
  262 +
  263 +__private__get_element_attribute
  264 + [Arguments] ${locator} ${attribute}
  265 + [Documentation] повертає значення атрибуту для вказаного елементу
  266 +
  267 + ${value} = get element attribute ${locator}@${attribute}
  268 + [Return] ${value}
  269 +
  270 +__private__set_element_visible_in_browser_area
  271 + [Arguments] ${locator}
  272 + [Documentation] робить елемент видимим у вікні браузера
  273 +
  274 + set element scroll into view ${locator}
  275 +
  276 +__private__get_site_language_code
  277 + [Documentation] повертає код поточної мови сайта
  278 +
  279 + ${current_language_code} = __private__get_element_attribute ${language_selector_active_element_locator} ${language_selector_active_element_code_attribute_name}
  280 + [Return] ${current_language_code}
  281 +
  282 +__private__check_site_language_code
  283 + [Arguments] ${language_code}
  284 + [Documentation] повертає чи поточна мова сайту відповідає вказаній
  285 +
  286 + ${current_language_code} = __private__get_site_language_code
  287 + ${is_equal} = set variable if "${current_language_code}" == "${language_code}" ${True} ${False}
  288 + [Return] ${is_equal}
  289 +
  290 +__private__open_site_language_dropdown_and_select_language_by_code
  291 + [Arguments] ${language_code}
  292 + [Documentation] відкриває випадаючий список мов, обрає потрібну, чекає перезавантаження сторінки
  293 +
  294 + click visible element ${language_selector_open_element_locator}
  295 + ${language_selector_list_element_locator} = replace string ${language_selector_list_element_locator_tpl} %code% ${language_code}
  296 + click element ${language_selector_list_element_locator}
  297 + ${language_selector_active_element_locator} = replace string ${language_selector_active_element_by_code_locator_tpl} %code% ${language_code}
  298 + wait until page contains element ${language_selector_active_element_locator} 30s Language have not changed
  299 +
  300 +__private__select_classification_code_in_opened_popup
  301 + [Arguments] ${code} ${scheme}=${None}
  302 + [Documentation] в поточний попап з класифікатором перемикає схему, шукає заданий код в полі пошуку і обирає його
  303 +
  304 + # check scheme
  305 + ${scheme_is_none} = get variable is none ${scheme}
  306 + ${scheme} = convert to string ${scheme}
  307 + run keyword if ${scheme_is_none} == ${False} and '${scheme}' not in ${site_allowed_schemes} __private__log Scheme "${scheme}" is needed to implement.
  308 + return from keyword if ${scheme_is_none} == ${False} and '${scheme}' not in ${site_allowed_schemes}
  309 + ${scheme_tab_locator} = replace string ${classification_popup_scheme_tab_locator_tpl} %scheme% ${scheme}
  310 + ${scheme_tab_exists} = __private__get_is_element_exist ${scheme_tab_locator}
  311 + run keyword if ${scheme_tab_exists} == ${True} click visible element ${scheme_tab_locator}
  312 + run keyword if ${scheme_tab_exists} == ${True} wait until tab content is visible ${scheme_tab_locator}
  313 + ... ELSE __private__log Classification scheme tab ${scheme} does not exist
  314 + # seraching code
  315 + input text to visible input ${classification_popup_search_input_locator} ${code}
  316 + press key ${classification_popup_search_input_locator} \\13
  317 + ${code} = convert to string ${code}
  318 + ${code_item_locator} = replace string ${classification_popup_serach_item_locator_tpl} %code% ${code}
  319 + wait until page contains element ${code_item_locator} 60s Specified classification code was not found
  320 + click visible element ${code_item_locator}
  1 +*** Settings ***
  2 +
  3 +Resource playtender_common.robot
  4 +
  5 +*** Keywords ***
  6 +
  7 +open new plan form
  8 + [Documentation] відкриття сторінки створення плану
  9 +
  10 + open page and wait element by locator ${broker_baseurl}/plan/create ${plan_form_locator}
  11 +
  12 +open plan page by uaid
  13 + [Arguments] ${uaid}
  14 + [Documentation] відкриває сторінку з планом
  15 +
  16 + open page and wait element by locator ${broker_baseurl}/plan/${uaid} ${plan_view_checker_element_locator}
  17 +
  18 +fill plan form
  19 + [Arguments] ${data}
  20 + [Documentation] заповнення форми з масива даних
  21 +
  22 + # hidden inputs
  23 + ${budget_id} = get from dictionary by keys ${data} budget id
  24 + run keyword if condition is not none ${budget_id} input text to hidden input ${plan_form_budget_id_input_locator} ${budget_id}
  25 + ${project_id} = get from dictionary by keys ${data} budget project id
  26 + run keyword if condition is not none ${project_id} input text to hidden input ${plan_form_project_id_input_locator} ${project_id}
  27 + ${project_name} = get from dictionary by keys ${data} budget project name
  28 + run keyword if condition is not none ${project_name} input text to hidden input ${plan_form_project_name_input_locator} ${project_name}
  29 +
  30 + # general info
  31 + open popup by btn locator ${plan_form_general_panel_edit_btn_locator}
  32 + ${procurement_method_type} = get from dictionary by keys ${data} tender procurementMethodType
  33 + 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}
  34 + ${budget_description} = get from dictionary by keys ${data} budget description
  35 + run keyword if condition is not none ${budget_description} input text to visible input ${plan_form_title_input_locator} ${budget_description}
  36 + ${tender_start_date} = get from dictionary by keys ${data} tender tenderPeriod startDate
  37 + 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}
  38 + 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}
  39 + ${amount} = get from dictionary by keys ${data} budget amount
  40 + run keyword if condition is not none ${amount} input number to visible input ${plan_form_value_amount_input_locator} ${amount}
  41 + ${currency} = get from dictionary by keys ${data} budget currency
  42 + run keyword if condition is not none ${currency} select from visible list by value ${plan_form_value_currency_input_locator} ${currency}
  43 + ${classification} = get from dictionary by keys ${data} classification
  44 + run keyword if condition is not none ${classification} select classification by code attributes ${plan_form_classification_edit_btn_locator} ${classification}
  45 + ${additional_classifications} = get from dictionary by keys ${data} additionalClassifications
  46 + 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}
  47 + 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}
  48 + submit current visible popup
  49 +
  50 + # items
  51 + ${items} = get from dictionary by keys ${data} items
  52 + run keyword if condition is not none ${items} fill plan form items ${items}
  53 +
  54 +fill plan form items
  55 + [Arguments] ${item_attributes_array}
  56 + [Documentation] заповнення номенклатури плану
  57 +
  58 + :FOR ${item_attributes} IN @{item_attributes_array}
  59 + \ click visible element ${plan_form_add_item_btn_locator}
  60 + \ wait until popup is visible
  61 + \ fill item form in opened popup ${item_attributes}
  62 + \ submit current visible popup
  63 +
1 -# -*- coding: utf-8 -  
2 -from iso8601 import parse_date  
3 -from datetime import datetime  
4 from robot.libraries.BuiltIn import BuiltIn 1 from robot.libraries.BuiltIn import BuiltIn
5 -from robot.output import librarylogger  
6 -import urllib  
7 -import urllib3 2 +from iso8601 import parse_date
  3 +
8 4
9 def get_library(): 5 def get_library():
10 return BuiltIn().get_library_instance('Selenium2Library') 6 return BuiltIn().get_library_instance('Selenium2Library')
@@ -14,121 +10,88 @@ def get_webdriver_instance(): @@ -14,121 +10,88 @@ def get_webdriver_instance():
14 return get_library()._current_browser() 10 return get_library()._current_browser()
15 11
16 12
17 -def convert_datetime_for_delivery(isodate):  
18 - iso_dt = parse_date(isodate)  
19 - date_string = iso_dt.strftime("%Y-%m-%d %H:%M")  
20 - return date_string 13 +# return of variable is None
  14 +def get_variable_is_none(variable):
  15 + if variable is None:
  16 + return True
  17 + return False
21 18
22 -def convert_isodate_to_site_date(isodate):  
23 - iso_dt = parse_date(isodate)  
24 - date_string = iso_dt.strftime("%d.%m.%Y")  
25 - return date_string  
26 19
27 -def convert_isodate_to_site_date_plan(isodate):  
28 - iso_dt = parse_date(isodate)  
29 - date_string = iso_dt.strftime("%m.%Y")  
30 - return date_string 20 +# check if condition is not none type and run specified keyword
  21 +def run_keyword_if_condition_is_not_none(condition, name, *args):
  22 + if get_variable_is_none(condition) == False:
  23 + BuiltIn().run_keyword(name, *args)
31 24
32 -def convert_isodate_to_site_datetime(isodate):  
33 - iso_dt = parse_date(isodate)  
34 - date_string = iso_dt.strftime("%d.%m.%Y %H:%M")  
35 - return date_string  
36 -  
37 -def convert_date_for_compare(datestr):  
38 - return datetime.strptime(datestr, "%d.%m.%Y %H:%M").strftime("%Y-%m-%d %H:%M")  
39 -  
40 -  
41 -def procuring_entity_name(tender_data):  
42 - tender_data.data.procuringEntity['name'] = u"ТОВ \"ПлейТендер\""  
43 - tender_data.data.procuringEntity['name_en'] = u"TOV \"playtender\""  
44 - tender_data.data.procuringEntity.identifier['id'] = u"1234567890-playtender"  
45 - tender_data.data.procuringEntity.identifier['legalName'] = u"ТОВ \"ПлейТендер\""  
46 - tender_data.data.procuringEntity.identifier['legalName_en'] = u"TOV \"playtender\""  
47 - if 'address' in tender_data.data.procuringEntity:  
48 - tender_data.data.procuringEntity.address['region'] = u"Житомирська область"  
49 - tender_data.data.procuringEntity.address['postalCode'] = u"123123"  
50 - tender_data.data.procuringEntity.address['locality'] = u"населений пункт"  
51 - tender_data.data.procuringEntity.address['streetAddress'] = u"адреса"  
52 - if 'contactPoint' in tender_data.data.procuringEntity:  
53 - tender_data.data.procuringEntity.contactPoint['name'] = u"Замовник Тест"  
54 - tender_data.data.procuringEntity.contactPoint['name_en'] = u"Test"  
55 - tender_data.data.procuringEntity.contactPoint['email'] = u"chuzhin@mail.ua"  
56 - tender_data.data.procuringEntity.contactPoint['telephone'] = u"+3801111111111"  
57 - tender_data.data.procuringEntity.contactPoint['url'] = u"http://playtender.com.ua"  
58 - return tender_data  
59 -  
60 -def split_take_item(value, separator, index):  
61 - librarylogger.console('split_take_item')  
62 - librarylogger.console(value)  
63 - librarylogger.console(separator)  
64 - librarylogger.console(index)  
65 - return value.split(separator)[int(index)]  
66 -  
67 -  
68 -def split_take_slice(value, separator, _from=None, to=None):  
69 - librarylogger.console(value)  
70 - librarylogger.console(separator)  
71 - librarylogger.console(_from)  
72 - librarylogger.console(to)  
73 - l = value.split(separator)  
74 - if to:  
75 - l = l[:int(to)]  
76 - if _from:  
77 - l = l[int(_from):]  
78 - return l  
79 -  
80 -def split_take_slice_from(value, separator, _from):  
81 - librarylogger.console('split_take_slice_from')  
82 - return split_take_slice(value, separator, _from)  
83 -  
84 -def split_take_slice_to(value, separator, to):  
85 - librarylogger.console('split_take_slice_to')  
86 - return split_take_slice(value, separator, to=to)  
87 -  
88 -def split_NBU(text):  
89 - text = text[:-1]  
90 - return text  
91 25
92 -def division_hundred(number):  
93 - return number/100 26 +# return value for *keys (nested) in `element` (dict).
  27 +def get_from_dictionary_by_keys(element, *keys):
  28 + if not isinstance(element, dict):
  29 + raise AttributeError('keys_exists() expects dict as first argument.')
  30 + if len(keys) == 0:
  31 + raise AttributeError('keys_exists() expects at least two arguments, one given.')
  32 +
  33 + _element = element
  34 + for key in keys:
  35 + try:
  36 + _element = _element[key]
  37 + except KeyError:
  38 + return None
  39 + return _element
94 40
95 -def join(l, separator):  
96 - librarylogger.console('join')  
97 - librarylogger.console(l)  
98 - return separator.join(l)  
99 41
  42 +# set scroll to element in view
  43 +def set_element_scroll_into_view(locator):
  44 + element = get_library()._element_find(locator, None, True)
  45 + get_webdriver_instance().execute_script(
  46 + 'var $el = jQuery(arguments[0]); if($el.length) $el.get(0).scrollIntoView();',
  47 + element
  48 + )
100 49
  50 +
  51 +# return text from hidden element
101 def get_invisible_text(locator): 52 def get_invisible_text(locator):
102 - element = get_library()._element_find(locator, False, True)  
103 - text = get_webdriver_instance().execute_script('return jQuery(arguments[0]).text();', element) 53 + element = get_library()._element_find(locator, None, True)
  54 + text = get_webdriver_instance().execute_script(
  55 + 'return jQuery(arguments[0]).text();',
  56 + element
  57 + )
104 return text 58 return text
105 -  
106 59
107 -def get_text_excluding_children(locator):  
108 - element = get_library()._element_find(locator, False, True)  
109 - text = get_webdriver_instance().execute_script("""  
110 - return jQuery(arguments[0]).contents().filter(function() {  
111 - return this.nodeType == Node.TEXT_NODE;  
112 - }).text();  
113 - """, element)  
114 - return text.strip()  
115 60
116 -def convert_float_to_string(number):  
117 - return repr(float(number));  
118 -  
119 -def convert_date_for_compare_ex(datestr):  
120 - return datetime.strptime(datestr, "%d.%m.%Y %H:%M").strftime("%Y-%m-%d %H:%M+02:00") 61 +# input text to hidden input
  62 +def input_text_to_hidden_input(locator, text):
  63 + element = get_library()._element_find(locator, None, True)
  64 + get_webdriver_instance().execute_script(
  65 + 'jQuery(arguments[0]).val("' + text.replace('"', '\\"') + '");',
  66 + element
  67 + )
  68 +
  69 +
  70 +# select option by label for hidden select
  71 +def select_from_hidden_list_by_label(locator, label):
  72 + element = get_library()._element_find(locator, None, True)
  73 + get_webdriver_instance().execute_script(
  74 + 'var $option = jQuery("option:contains(' + label.replace('"', '\\"') + ')", arguments[0]);' +
  75 + 'if($option.length) jQuery(arguments[0]).val($option.attr("value"));',
  76 + element
  77 + )
121 78
122 -def convert_date_for_compare_ex2(datestr):  
123 - return datetime.strptime(datestr, "%d.%m.%Y %H:%M").strftime("%Y-%m-%d %H:%M+02:00")  
124 79
125 -def download_file(url, file_name, output_dir):  
126 - urllib.urlretrieve(url, ('{}/{}'.format(output_dir, file_name))) 80 +# trigger change event for input by locator
  81 +def trigger_input_change_event(locator):
  82 + element = get_library()._element_find(locator, None, True)
  83 + get_webdriver_instance().execute_script(
  84 + 'var $el = jQuery(arguments[0]); if($el.length) $el.trigger("change");',
  85 + element
  86 + )
127 87
128 -def multiply_hundred(number):  
129 - return number*100  
130 88
131 -def inject_urllib3():  
132 - import urllib3.contrib.pyopenssl  
133 - urllib3.contrib.pyopenssl.inject_into_urllib3()  
134 - 89 +# convert all numners to string
  90 +def convert_float_to_string(number):
  91 + return repr(float(number))
  92 +
  93 +
  94 +# prepare isodate in needed format
  95 +def isodate_format(isodate, format):
  96 + iso_dt = parse_date(isodate)
  97 + return iso_dt.strftime(format)
  1 +*** Variables ***
  2 +
  3 +${kekv_schemes} = ["KEKV", "КЕКВ"]
  4 +${site_allowed_schemes} = ["ДК021", "ДК015", "ДК018", "ДК003", "specialNorms", "INN", "ATC"]
  5 +
  6 +# common
  7 +${alert_opened_locator} = jquery=.jconfirm:last .content
  8 +${alert_opened_close_btn_locator} = jquery=.jconfirm:last .closeIcon
  9 +${alert_message_contains_text_locator_tpl} = jquery=.jconfirm:last .message:contains(%text%)
  10 +${popup_opened_last_locator} = jquery=.fancybox-is-open:last
  11 +${popup_opened_last_submit_btn_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .modal-footer:last .js-submit,.fancybox-is-open:last .fancybox-slide--current .modal-footer:last .js-popup-submit
  12 +${popup_opened_content_locator} = jquery=.fancybox-is-open .fancybox-slide--current .fancybox-content # for checking if it's visible
  13 +
  14 +# language
  15 +${language_selector_active_element_locator} = jquery=.languages.page-header__languages .languages__btn
  16 +${language_selector_active_element_code_attribute_name} = data-language-code
  17 +${language_selector_open_element_locator} = jquery=.languages.page-header__languages .js-popup-open-initiator
  18 +${language_selector_active_element_by_code_locator_tpl} = jquery=.languages.page-header__languages .languages__btn[data-language-code='%code%']
  19 +${language_selector_list_element_locator_tpl} = jquery=.languages.page-header__languages .popup.languages__menu .languages__link[data-language-code='%code%']
  20 +
  21 +# classification popup
  22 +${classification_popup_opened_content_locator} = jquery=.fancybox-is-open .fancybox-slide--current .fancybox-content.classification-modal # for checking if it's visible
  23 +${classification_popup_scheme_tab_locator_tpl} = jquery=.fancybox-is-open .fancybox-slide--current .fancybox-content.classification-modal .nav a[data-toggle="tab"][data-scheme="%scheme%"]
  24 +${classification_popup_search_input_locator} = jquery=.fancybox-is-open .fancybox-slide--current .fancybox-content.classification-modal .js-search-wrapper:visible .js-input
  25 +${classification_popup_serach_item_locator_tpl} = jquery=.fancybox-is-open .fancybox-slide--current .fancybox-content.classification-modal .js-search-wrapper:visible .js-search-tree strong:contains("%code%")
  26 +
  27 +# authorization
  28 +${login_popup_open_locator} = jquery=.page__header a[data-action="login"]
  29 +${login_popup_login_input_locator} = id=loginform-email
  30 +${login_popup_password_input_locator} = id=loginform-password
  31 +${login_popup_submit_btn_locator} = jquery=#login-form .js-submit-btn
  32 +${user_logged_checker_element_locator} = id=notifications-button # елемент для перевірки чи авторизований користувач
  33 +
  34 +# item form
  35 +${item_form_popup_description_input_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content [id$='-description']
  36 +${item_form_popup_description_ru_input_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content [id$='-description_ru']
  37 +${item_form_popup_description_en_input_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content [id$='-description_en']
  38 +${item_form_popup_quantity_input_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content [id$='-quantity']
  39 +${item_form_popup_unit_input_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content [id$='-unit_id']
  40 +${item_form_popup_classification_edit_btn_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content .js-classification-input-wrapper [data-toggle="classification"]
  41 +${item_form_popup_additional_classification_edit_btn_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content .js-additional-classification-input-wrapper [data-toggle="additional-classification"]
  42 +
  43 +# plan form
  44 +${plan_form_submit_success_msg} = дочекайтесь опублікування на сайті уповноваженого органу
  45 +${plan_form_locator} = id=plan-form
  46 +${plan_form_general_panel_edit_btn_locator} = jquery=#General .panel-heading .js-form-popup-update
  47 +${plan_form_procurement_method_type_input_locator} = id=planform-procurement_method_type
  48 +${plan_form_budget_id_input_locator} = id=planform-budget_id
  49 +${plan_form_project_id_input_locator} = id=planform-project_id
  50 +${plan_form_project_name_input_locator} = id=planform-project_name
  51 +${plan_form_title_input_locator} = id=planform-title
  52 +${plan_form_year_input_locator} = id=planform-year
  53 +${plan_form_tender_start_date_input_locator} = id=planform-tender_start_date
  54 +${plan_form_value_amount_input_locator} = id=planform-value_amount
  55 +${plan_form_value_currency_input_locator} = id=planform-value_currency
  56 +${plan_form_classification_edit_btn_locator} = jquery=.field-planform-classification_id .js-classification-input-wrapper [data-toggle="classification"]
  57 +${plan_form_additional_classification_edit_btn_locator} = jquery=.field-planform-additional_classification_ids .js-additional-classification-input-wrapper [data-toggle="additional-classification"]
  58 +${plan_form_kekv_classification_edit_btn_locator} = jquery=.field-planform-additional_classification_ids_kekv .js-additional-classification-input-wrapper [data-toggle="additional_classification_ids_kekv"]
  59 +${plan_form_add_item_btn_locator} = jquery=#Items .js-form-popup-add
  60 +${plan_form_submit_btn_locator} = jquery=#plan-form .js-submit-btn
  61 +${plan_created_checker_element_locator} = id=plan-part-pjax
  62 +
  63 +# plan view
  64 +${plan_view_checker_element_locator} = id=plan-general-info
  65 +${plan_sync_element_locator} = jquery=#aside-part-pjax .status-label .fa-refresh
  66 +${plan_uaid_text_locator} = jquery=#plan-general-info .plan-id .value
Please register or login to post a comment