Commit 20aac0bb2b4d00e69770194c6d7d3fa9ed000409

Authored by Oleksandr Iskryzhytskyi
2 parents 74e6f158 edd76b4f

Merge branch 'v3' into v3-dev

... ... @@ -9,4 +9,6 @@ __pycache__/
9 9 /*.egg-info/
10 10 *.egg
11 11
12   -/.idea
\ No newline at end of file
  12 +/.idea
  13 +test.robot
  14 +/test_output
\ No newline at end of file
... ...
... ... @@ -14,6 +14,7 @@ Resource playtender_tende
14 14
15 15 init environment ${username}
16 16 open browser ${broker_baseurl} ${broker_browser} alias=${broker_username}
  17 + add cookie robottest 1 # for detecting from site side
17 18 set window size @{browser_default_size}
18 19 set window position @{browser_default_position}
19 20 set site language by code ${broker_language_code}
... ... @@ -29,19 +30,26 @@ Resource playtender_tende
29 30 ... адаптовані дані tender_data. Різниця між початковими даними і кінцевими буде виведена в консоль під
30 31 ... час запуску тесту.
31 32
32   - # @todo
33   - # adjusting procuring entity with site user
34   -
  33 + ${tender_data_keys} = get dictionary keys ${tender_data['data']}
  34 + run keyword if ${is_test_role_owner} and 'procuringEntity' in ${tender_data_keys} prepare procuring entity data ${tender_data['data']['procuringEntity']}
  35 + #run keyword if ${is_test_role_owner} and 'buyers' in ${tender_data_keys} prepare buyers data ${tender_data['data']['buyers']}
35 36 [Return] ${tender_data}
36 37
  38 +########################################################################################################################
  39 +#################################################### PLAN KEYWORDS #####################################################
  40 +########################################################################################################################
  41 +
37 42 Створити план
38 43 [Arguments] ${user} ${plan_data}
39 44 [Documentation] Створити план з початковими даними plan_data. Повернути uaid створеного плану.
40 45
  46 + # check buyers
  47 + ${buyers_count} = get length ${plan_data['data']['buyers']}
  48 + run keyword if ${buyers_count} != 1 fail Buyer must be one
  49 +
41 50 open new plan form
42 51 fill plan form ${plan_data['data']}
43   - submit form and check result ${plan_form_submit_btn_locator} ${plan_form_submit_success_msg} ${plan_created_checker_element_locator}
44   - wait until page does not contain element with reloading ${plan_sync_element_locator}
  52 + save plan form and wait synchronization
45 53 ${plan_uaid} = get text ${plan_uaid_text_locator}
46 54 [Return] ${plan_uaid}
47 55
... ... @@ -52,9 +60,38 @@ Resource playtender_tende
52 60 open plan page by uaid ${plan_uaid}
53 61
54 62 Пошук плану по ідентифікатору
55   - [Arguments] ${username} ${tenderId}
56   - [Documentation] Знайти план з uaid рівним tender_uaid.
57   - search plan ${tenderId}
  63 + [Arguments] ${username} ${plan_uaid}
  64 + [Documentation] Знайти план за зазначеним plan_uaid.
  65 +
  66 + open plan search form
  67 + input to search form and wait results ${plan_search_form_query_input_locator} ${plan_uaid} ${plan_search_form_result_locator_tpl}
  68 +
  69 +Внести зміни в план
  70 + [Arguments] ${username} ${plan_uaid} ${fieldname} ${fieldvalue}
  71 + [Documentation] Змінити значення поля fieldname на fieldvalue для плана із зазначеним plan_uaid.
  72 +
  73 + ${plan_data} = generate dictionary from field path and value ${fieldname} ${fieldvalue}
  74 + open plan form by uaid ${plan_uaid}
  75 + fill plan form ${plan_data}
  76 + save plan form and wait synchronization
  77 +
  78 +Додати предмет закупівлі в план
  79 + [Arguments] ${username} ${plan_uaid} ${item_data}
  80 + [Documentation] Додати дані про предмет item до плану plan_uaid.
  81 +
  82 + open plan form by uaid ${plan_uaid}
  83 + ${items} = create list ${item_data}
  84 + fill plan form items ${items}
  85 + save plan form and wait synchronization
  86 +
  87 +Видалити предмет закупівлі плану
  88 + [Arguments] ${username} ${plan_uaid} ${item_id}
  89 + [Documentation] Видалити з плану plan_uaid предмет з item_id в описі.
  90 +
  91 + open plan form by uaid ${plan_uaid}
  92 + ${delete_item_btn_locator} = replace string ${plan_form_remove_item_btn_locator_tpl} %title% ${item_id}
  93 + click removing form item and wait success result ${delete_item_btn_locator}
  94 + save plan form and wait synchronization
58 95
59 96 Отримати інформацію із плану
60 97 [Arguments] ${username} ${tender_uaid} ${field_name}
... ... @@ -62,6 +99,10 @@ Resource playtender_tende
62 99
63 100 get information from the plan ${tender_uaid} ${field_name}
64 101
  102 +########################################################################################################################
  103 +################################################### TENDER KEYWORDS ####################################################
  104 +########################################################################################################################
  105 +
65 106 Створити тендер
66 107 [Arguments] ${user} ${tender_data}
67 108 [Documentation] Створити тендер з початковими даними tender_data. Повернути uaid створеного тендера.
... ...
... ... @@ -13,6 +13,8 @@ ${broker_username} =
13 13 ${broker_baseurl} =
14 14 ${broker_browser} =
15 15 ${broker_language_code} = uk
  16 +${test_role} =
  17 +${is_test_role_owner} =
16 18
17 19 @{browser_default_size} = ${1200} ${1000}
18 20 @{browser_default_position} = ${0} ${0}
... ... @@ -28,6 +30,9 @@ init environment
28 30 set global variable ${broker_username} ${username}
29 31 set global variable ${broker_baseurl} ${BROKERS['${broker}'].basepage}
30 32 set global variable ${broker_browser} ${USERS.users['${broker_username}'].browser}
  33 + set global variable ${test_role} ${ROLE}
  34 + ${is_test_role_owner} = set variable if '${test_role}' == 'tender_owner' ${True} ${False}
  35 + set global variable ${is_test_role_owner} ${is_test_role_owner}
31 36
32 37 set site language by code
33 38 [Arguments] ${language_code}
... ... @@ -185,6 +190,7 @@ fill lot form in opened popup
185 190 click visible element ${tender_form_general_panel_add_document_btn_locator}
186 191 Choose File xpath=//input[@type='file'] ${file_path}
187 192 submit current visible popup
  193 +
188 194 ########################################################################################################################
189 195 #################################################### COMMON HELPERS ####################################################
190 196 ########################################################################################################################
... ... @@ -196,6 +202,22 @@ click visible element
196 202 __private__set_element_visible_in_browser_area ${locator}
197 203 click element ${locator}
198 204
  205 +click visible element and wait until page contains element
  206 + [Arguments] ${locator} ${checker_element_locator} ${waiting_timeout}=30s ${waiting_error}=Another element was not shown after clicking on specific element
  207 + [Documentation] перевіряє видимість і клікає по елементу
  208 +
  209 + click visible element ${locator}
  210 + wait until page contains element ${checker_element_locator} ${waiting_timeout} ${waiting_error}
  211 +
  212 +click removing form item and wait success result
  213 + [Arguments] ${locator}
  214 + [Documentation] натискає кнопку видалення, очікує успішне повідомлення і закриває повідомлення
  215 +
  216 + click visible element ${locator}
  217 + wait until alert is visible
  218 + click visible element ${alert_confirm_btn_locator}
  219 + wait until page does not contain element ${alert_confirm_btn_locator}
  220 +
199 221 input text to visible input
200 222 [Arguments] ${locator} ${text}
201 223 [Documentation] перевіряє чи елемент видимий у вікні браузера, після чого заповнює його
... ... @@ -203,11 +225,18 @@ input text to visible input
203 225 __private__set_element_visible_in_browser_area ${locator}
204 226 input text ${locator} ${text}
205 227
  228 +input text to visible input and press enter
  229 + [Arguments] ${locator} ${text}
  230 + [Documentation] перевіряє чи елемент видимий у вікні браузера, після чого заповнює його і імітує натиснення кнопки Enter
  231 +
  232 + input text to visible input ${locator} ${text}
  233 + press key ${locator} \\13
  234 +
206 235 input text to exist visible input
207 236 [Arguments] ${locator} ${text}
208 237 [Documentation] перевіряє чи елемент існує і видимий у вікні браузера, після чого заповнює його
209 238
210   - ${input_exists} = __private__get_is_element_exist ${locator}
  239 + ${input_exists} = get is element exist ${locator}
211 240 run keyword if ${input_exists} == ${True} input text to visible input ${locator} ${text}
212 241 ... ELSE __private__log input ${locator} does not exist
213 242
... ... @@ -229,7 +258,7 @@ input datetime to exist visible input
229 258 [Arguments] ${locator} ${isodate} ${format}=%d.%m.%Y %H:%M
230 259 [Documentation] перевіряє чи елемент видимий у вікні браузера, після чого заповнює його відформатовоною датою
231 260
232   - ${input_exists} = __private__get_is_element_exist ${locator}
  261 + ${input_exists} = get is element exist ${locator}
233 262 run keyword if ${input_exists} == ${True} input date to visible input ${locator} ${isodate} ${format}
234 263 ... ELSE __private__log input ${locator} does not exist
235 264
... ... @@ -244,7 +273,7 @@ input number to exist visible input
244 273 [Arguments] ${locator} ${text}
245 274 [Documentation] перевіряє чи елемент існує і видимий у вікні браузера, після чого заповнює його
246 275
247   - ${input_exists} = __private__get_is_element_exist ${locator}
  276 + ${input_exists} = get is element exist ${locator}
248 277 run keyword if ${input_exists} == ${True} input number to visible input ${locator} ${text}
249 278 ... ELSE __private__log input ${locator} does not exist
250 279
... ... @@ -255,6 +284,14 @@ input month.year of date to visible input
255 284 ${value} = isodate format ${isodate} %m.%Y
256 285 input text to visible input ${locator} ${value}
257 286
  287 +input to search form and wait results
  288 + [Arguments] ${query_input_locator} ${query} ${result_locator_tpl}
  289 + [Documentation] заповнює форму і очікує результат по шаблону селектора
  290 +
  291 + input text to visible input and press enter ${query_input_locator} ${query}
  292 + ${result_locator} = replace string ${result_locator_tpl} %query% ${query}
  293 + wait until page contains element with reloading ${result_locator}
  294 +
258 295 select from visible list by value
259 296 [Arguments] ${locator} ${value}
260 297 [Documentation] робить елемент видимим, після чого заповнює його
... ... @@ -299,8 +336,15 @@ select classification by array of code attributes
299 336 \ run keyword if ${disabled} == ${False} __private__select_classification_code_in_opened_popup ${code_attributes['id']} ${code_attributes['scheme']}
300 337 submit current visible popup
301 338
  339 +open site page and wait content element
  340 + [Arguments] ${url} ${waiting_timeout}=5s ${waiting_error}=Opening page fails
  341 + [Documentation] переходить по посиланню і чекає контенту сторінки
  342 +
  343 + go to ${url}
  344 + wait until page contains element ${page_content_locator} ${waiting_timeout} ${waiting_error}
  345 +
302 346 open page and wait element by locator
303   - [Arguments] ${url} ${waiting_element_locator} ${waiting_timeout}=30s ${waiting_error}=Opened page does not have specified element locator
  347 + [Arguments] ${url} ${waiting_element_locator} ${waiting_timeout}=5s ${waiting_error}=Opened page does not have specified element locator
304 348 [Documentation] переходить по посиланню і чекає поки елемент не буде знайдений на сторінці
305 349
306 350 go to ${url}
... ... @@ -320,6 +364,8 @@ submit current visible popup
320 364 click visible element ${popup_opened_last_submit_btn_locator}
321 365 sleep ${popup_transaction_time}
322 366 ${popup_last_locator} = set variable id=${popup_last_id}
  367 + ${popup_exists} = get is element exist ${popup_last_locator}
  368 + return from keyword if ${popup_exists} == ${False}
323 369 wait until page does not contain element ${popup_last_locator} 30s Current popup was not hidden
324 370
325 371 submit form and check result
... ... @@ -354,11 +400,18 @@ close current visible alert
354 400
355 401 click visible element ${alert_opened_close_btn_locator}
356 402
  403 +wait until page contains element with reloading
  404 + [Arguments] ${locator} ${retry}=5m ${retry_interval}=2s
  405 + [Documentation] чекає поки елемент не з'явиться на сторінці з перезавантаженням сторінки
  406 +
  407 + ${result} = get is element exist ${locator}
  408 + run keyword if ${result} == ${False} wait until keyword succeeds ${retry} ${retry_interval} reload page and fail if element does not exist ${locator}
  409 +
357 410 wait until page does not contain element with reloading
358 411 [Arguments] ${locator} ${retry}=5m ${retry_interval}=2s
359 412 [Documentation] чекає поки елемент не пропаде зі сторінки з перезавантаженням сторінки
360 413
361   - ${result} = __private__get_is_element_exist ${locator}
  414 + ${result} = get is element exist ${locator}
362 415 run keyword if ${result} == ${True} wait until keyword succeeds ${retry} ${retry_interval} reload page and fail if element exists ${locator}
363 416
364 417 wait until tab content is visible
... ... @@ -374,9 +427,30 @@ reload page and fail if element exists
374 427 [Documentation] перезавантажує сторінку і фейлить тест якщо елемент присутній
375 428
376 429 reload page
377   - ${exists} = __private__get_is_element_exist ${locator}
  430 + ${exists} = get is element exist ${locator}
378 431 run keyword if ${exists} == ${True} fail
379 432
  433 +reload page and fail if element does not exist
  434 + [Arguments] ${locator}
  435 + [Documentation] перезавантажує сторінку і фейлить тест якщо елемент відсутній
  436 +
  437 + reload page
  438 + ${exists} = get is element exist ${locator}
  439 + run keyword if ${exists} == ${False} fail
  440 +
  441 +get is 404 page
  442 + [Documentation] перевіряє чи поточна сторінка з 404 помилкою
  443 +
  444 + ${exists} = get is element exist ${error_page_404_checker_element_locator}
  445 + [Return] ${exists}
  446 +
  447 +wait until 404 page disappears
  448 + [Arguments] ${retry}=5m ${retry_interval}=2s
  449 + [Documentation] оновлює сторінку і чекає поки не пропаде 404 помилка
  450 +
  451 + ${result} = get is 404 page
  452 + run keyword if ${result} == ${True} wait until keyword succeeds ${retry} ${retry_interval} reload page and fail if element exists ${error_page_404_checker_element_locator}
  453 +
380 454 Click and wait for the search
381 455 [Arguments] ${click_locator} ${wanted_locator} ${timeout}
382 456 [Documentation] Натиснути и дочекатися пошуку
... ... @@ -397,13 +471,6 @@ __private__log
397 471 log ${msg}
398 472 log to console ${msg}
399 473
400   -__private__get_is_element_exist
401   - [Arguments] ${locator}
402   - [Documentation] повертає чи елемент присутній на сторінці
403   -
404   - ${result} = run keyword and return status page should contain element ${locator}
405   - [Return] ${result}
406   -
407 474 __private__get_element_attribute
408 475 [Arguments] ${locator} ${attribute}
409 476 [Documentation] повертає значення атрибуту для вказаного елементу
... ... @@ -451,13 +518,12 @@ __private__select_classification_code_in_opened_popup
451 518 run keyword if ${scheme_is_none} == ${False} and '${scheme}' not in ${site_allowed_schemes} __private__log Scheme "${scheme}" is needed to implement.
452 519 return from keyword if ${scheme_is_none} == ${False} and '${scheme}' not in ${site_allowed_schemes}
453 520 ${scheme_tab_locator} = replace string ${classification_popup_scheme_tab_locator_tpl} %scheme% ${scheme}
454   - ${scheme_tab_exists} = __private__get_is_element_exist ${scheme_tab_locator}
  521 + ${scheme_tab_exists} = get is element exist ${scheme_tab_locator}
455 522 run keyword if ${scheme_tab_exists} == ${True} click visible element ${scheme_tab_locator}
456 523 run keyword if ${scheme_tab_exists} == ${True} wait until tab content is visible ${scheme_tab_locator}
457 524 ... ELSE __private__log Classification scheme tab ${scheme} does not exist
458 525 # seraching code
459   - input text to visible input ${classification_popup_search_input_locator} ${code}
460   - press key ${classification_popup_search_input_locator} \\13
  526 + input text to visible input and press enter ${classification_popup_search_input_locator} ${code}
461 527 ${code} = convert to string ${code}
462 528 ${code_item_locator} = replace string ${classification_popup_serach_item_locator_tpl} %code% ${code}
463 529 wait until page contains element ${code_item_locator} 60s Specified classification code was not found
... ...
... ... @@ -4,16 +4,44 @@ Resource playtender_commo
4 4
5 5 *** Keywords ***
6 6
  7 +update plan queue
  8 + [Documentation] запускає оновлення планів з ЦБД і додає їх в чергу, тобто синхронізація може відбутися не відразу
  9 + ... поточна сторіка повертається
  10 +
  11 + ${current_url} = get location
  12 + go to ${broker_baseurl}/utils/queue-plan-update
  13 + go to ${current_url}
  14 +
7 15 open new plan form
8 16 [Documentation] відкриття сторінки створення плану
9 17
10 18 open page and wait element by locator ${broker_baseurl}/plan/create ${plan_form_locator}
11 19
  20 +open plan form by uaid
  21 + [Arguments] ${plan_uaid}
  22 + [Documentation] відкриття сторінки редагування плану
  23 +
  24 + open plan page by uaid ${plan_uaid}
  25 + click visible element and wait until page contains element ${plan_edit_btn_locator} ${plan_form_locator}
  26 +
12 27 open plan page by uaid
13 28 [Arguments] ${uaid}
14 29 [Documentation] відкриває сторінку з планом
15 30
16   - open page and wait element by locator ${broker_baseurl}/plan/${uaid} ${plan_view_checker_element_locator}
  31 + open site page and wait content element ${broker_baseurl}/plan/${uaid}
  32 + ${is_plan_found} = get is element exist ${plan_view_checker_element_locator}
  33 + return from keyword if ${is_plan_found} == ${True}
  34 + ${is_plan_not_found} = get is 404 page
  35 + ${is_needed_to_update_and_wait_sync} = set variable if ${is_test_role_owner} == ${False} and ${is_plan_not_found} ${True} ${False}
  36 + run keyword if ${is_needed_to_update_and_wait_sync} update plan queue
  37 + run keyword if ${is_needed_to_update_and_wait_sync} wait until 404 page disappears
  38 + ${is_plan_found} = get is element exist ${plan_view_checker_element_locator}
  39 + run keyword if ${is_plan_found} == ${False} fail Opening plan page by uaid fails.
  40 +
  41 +open plan search form
  42 + [Documentation] відкриває сторінку з пошуком планів
  43 +
  44 + open page and wait element by locator ${broker_baseurl}/plans ${plan_search_form_locator}
17 45
18 46 fill plan form
19 47 [Arguments] ${data}
... ... @@ -60,7 +88,11 @@ fill plan form items
60 88 [Documentation] заповнення номенклатури плану
61 89
62 90 :FOR ${item_attributes} IN @{item_attributes_array}
63   - \ click visible element ${plan_form_add_item_btn_locator}
  91 + \ ${item_update_index} = get from dictionary by keys ${item_attributes} list_index
  92 + \ ${item_update_index_string} = convert to string ${item_update_index}
  93 + \ ${open_form_btn_locator} = replace string ${plan_form_update_item_btn_locator_tpl} %index% ${item_update_index_string}
  94 + \ run keyword if condition is not none ${item_update_index} click visible element ${open_form_btn_locator}
  95 + \ run keyword if condition is none ${item_update_index} click visible element ${plan_form_add_item_btn_locator}
64 96 \ wait until popup is visible
65 97 \ fill item form in opened popup ${item_attributes}
66 98 \ run keyword and ignore error submit current visible popup
... ... @@ -75,22 +107,11 @@ fill plan form buyers
75 107 \ fill buyer form in opened popup ${buyer_attributes}
76 108 \ run keyword and ignore error submit current visible popup
77 109
78   -search plan
79   - [Arguments] ${tenderId}
80   - [Documentation] пошук плану по tenderId
81   -
82   - Go To ${broker_baseurl}/plans
83   - Wait Until Page Contains Element ${form_search_plan} 10
84   - input text to visible input ${search_plan_input} ${tenderId}
85   - click visible element ${button_search_plan}
86   -# Sleep 1
87   - ${passed}= Run Keyword And Return Status Wait Until Keyword Succeeds 360 s 0 s Search and find a plan
88   - Run Keyword Unless ${passed} Fatal Error Тендер не знайдено за 360 секунд
89   - Wait Until Page Does Not Contain Element ${search_plan_list-pjax}
90   - click visible element ${search_plan_result}
91   -
92   -Search and find a plan
93   - Click and wait for the search ${button_search_plan} ${search_plan_result} 8
  110 +save plan form and wait synchronization
  111 + [Documentation] натискає кнопку "Зберегти" і чекає синхронізації плану
  112 +
  113 + submit form and check result ${plan_form_submit_btn_locator} ${plan_form_submit_success_msg} ${plan_created_checker_element_locator}
  114 + wait until page does not contain element with reloading ${plan_sync_element_locator}
94 115
95 116 get information from the plan
96 117 [Arguments] ${tender_uaid} ${key}
... ...
  1 +# -*- coding: utf-8 -
1 2 from robot.libraries.BuiltIn import BuiltIn
2 3 from iso8601 import parse_date
  4 +import re
3 5
4 6
5 7 def get_library():
... ... @@ -17,12 +19,18 @@ def get_variable_is_none(variable):
17 19 return False
18 20
19 21
20   -# check if condition is not none type and run specified keyword
  22 +# run specified keyword if condition is not none type
21 23 def run_keyword_if_condition_is_not_none(condition, name, *args):
22 24 if get_variable_is_none(condition) == False:
23 25 BuiltIn().run_keyword(name, *args)
24 26
25 27
  28 +# run specified keyword if condition is none type
  29 +def run_keyword_if_condition_is_none(condition, name, *args):
  30 + if get_variable_is_none(condition) == True:
  31 + BuiltIn().run_keyword(name, *args)
  32 +
  33 +
26 34 # return value for *keys (nested) in `element` (dict).
27 35 def get_from_dictionary_by_keys(element, *keys):
28 36 if not isinstance(element, dict):
... ... @@ -39,6 +47,33 @@ def get_from_dictionary_by_keys(element, *keys):
39 47 return _element
40 48
41 49
  50 +# returns if element exists on page. optimization
  51 +def get_is_element_exist(locator):
  52 + jquery_locator = convert_locator_to_jquery(locator)
  53 + if get_variable_is_none(jquery_locator) == False:
  54 + jquery_locator = jquery_locator.replace('"', '\\"')
  55 + length = get_webdriver_instance().execute_script('return $("' + jquery_locator + '").length;')
  56 + return length > 0
  57 +
  58 + try:
  59 + get_library()._element_find(locator, None, True)
  60 + except Exception:
  61 + return False
  62 + return True
  63 +
  64 +
  65 +# convert locator to jquery locator
  66 +def convert_locator_to_jquery(locator):
  67 + locator_params = locator.split('=', 1)
  68 + if locator_params[0] == 'id':
  69 + return '#' + locator_params[1]
  70 + if locator_params[0] == 'jquery':
  71 + return locator_params[1]
  72 + if locator_params[0] == 'css':
  73 + return locator_params[1]
  74 + return None
  75 +
  76 +
42 77 # set scroll to element in view
43 78 def set_element_scroll_into_view(locator):
44 79 element = get_library()._element_find(locator, None, True)
... ... @@ -97,6 +132,72 @@ def isodate_format(isodate, format):
97 132 return iso_dt.strftime(format)
98 133
99 134
  135 +# prepare data
  136 +def prepare_procuring_entity_data(data):
  137 + try:
  138 + data['name'] = u"Playtender"
  139 + data.identifier['id'] = u"playtender"
  140 + data.identifier['legalName'] = u"Playtender"
  141 + data.identifier['scheme'] = u"UA-EDR"
  142 + if 'name_en' in data:
  143 + data['name_en'] = u"Playtender"
  144 + if 'legalName_en' in data.identifier:
  145 + data.identifier['legalName_en'] = u"Playtender"
  146 + if 'address' in data:
  147 + data.address['countryName'] = u"Україна"
  148 + data.address['locality'] = u"Київ"
  149 + data.address['postalCode'] = u"01111"
  150 + data.address['region'] = u"місто Київ"
  151 + data.address['streetAddress'] = u"вулиця Тестова, 220, 8"
  152 + if 'contactPoint' in data:
  153 + data.contactPoint['email'] = u"chuzhin@mail.ua"
  154 + data.contactPoint['faxNumber'] = u"+3801111111111"
  155 + data.contactPoint['telephone'] = u"+3801111111111"
  156 + data.contactPoint['name'] = u"Test"
  157 + if 'name_en' in data.contactPoint:
  158 + data.contactPoint['name_en'] = u"Test"
  159 + data.contactPoint['url'] = u"https://playtender.com.ua"
  160 + except Exception:
  161 + raise Exception('data is not a dictionary')
  162 +
  163 +
  164 +# prepare data
  165 +def prepare_buyers_data(data):
  166 + if type(data) is not list:
  167 + raise Exception('data is not a list')
  168 +
  169 + # preventing console errors about changing buyer data in cases
  170 + if len(data) != 1:
  171 + return
  172 +
  173 + item = next(iter(data), None)
  174 + item['name'] = u"Playtender"
  175 + item.identifier['id'] = u"playtender"
  176 + item.identifier['legalName'] = u"Playtender"
  177 + item.identifier['scheme'] = u"UA-EDR"
  178 +
  179 +
  180 +# prepare dictionary from field path + value
  181 +def generate_dictionary_from_field_path_and_value(path, value):
  182 + data = dict()
  183 + path_keys_list = path.split('.')
  184 + if len(path_keys_list) > 1:
  185 + key = path_keys_list.pop(0)
  186 + value = generate_dictionary_from_field_path_and_value('.'.join(path_keys_list), value)
  187 + indexRegex = re.compile(r'(\[(\d+)\]$)')
  188 + matchObj = indexRegex.search(key)
  189 + print matchObj
  190 + if matchObj:
  191 + key = indexRegex.sub('', key)
  192 + value['list_index'] = matchObj.group(2)
  193 + value = [value]
  194 + data[key] = value
  195 + else:
  196 + data = dict()
  197 + data[path] = value
  198 + return data
  199 +
  200 +
100 201 #Percentage conversion
101 202 def multiply_hundred(number):
102 203 return number*100
... ...
... ... @@ -2,15 +2,22 @@
2 2
3 3 ${kekv_schemes} = ["KEKV", "КЕКВ"]
4 4 ${site_allowed_schemes} = ["ДК021", "ДК015", "ДК018", "ДК003", "specialNorms", "INN", "ATC"]
  5 +${page_content_locator} = jquery=.page__content
5 6
6   -# common
  7 +# alerts
7 8 ${alert_opened_locator} = jquery=.jconfirm:last .content
  9 +${alert_confirm_btn_locator} = jquery=.jconfirm:last .buttons .js-btn-confirm
8 10 ${alert_opened_close_btn_locator} = jquery=.jconfirm:last .closeIcon
9 11 ${alert_message_contains_text_locator_tpl} = jquery=.jconfirm:last .message:contains(%text%)
  12 +
  13 +# popups
10 14 ${popup_opened_last_locator} = jquery=.fancybox-is-open:last
11 15 ${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 16 ${popup_opened_content_locator} = jquery=.fancybox-is-open .fancybox-slide--current .fancybox-content # for checking if it's visible
13 17
  18 +# error pages
  19 +${error_page_404_checker_element_locator} = jquery=.site-error[data-error-code="404"]
  20 +
14 21 # language
15 22 ${language_selector_active_element_locator} = jquery=.languages.page-header__languages .languages__btn
16 23 ${language_selector_active_element_code_attribute_name} = data-language-code
... ... @@ -22,7 +29,7 @@ ${language_selector_list_element_locator_tpl} = jquery=.lang
22 29 ${classification_popup_opened_content_locator} = jquery=.fancybox-is-open .fancybox-slide--current .fancybox-content.classification-modal # for checking if it's visible
23 30 ${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 31 ${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%")
  32 +${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 33
27 34 # authorization
28 35 ${login_popup_open_locator} = jquery=.page__header a[data-action="login"]
... ... @@ -64,24 +71,24 @@ ${plan_form_classification_edit_btn_locator} = jquery=.fiel
64 71 ${plan_form_additional_classification_edit_btn_locator} = jquery=.field-planform-additional_classification_ids .js-additional-classification-input-wrapper [data-toggle="additional-classification"]
65 72 ${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"]
66 73 ${plan_form_add_item_btn_locator} = jquery=#Items .js-form-popup-add
  74 +${plan_form_update_item_btn_locator_tpl} = jquery=#Items .js-form-popup-panel:nth(%index%) .panel-heading .js-form-popup-update
  75 +${plan_form_remove_item_btn_locator_tpl} = jquery=#Items .js-form-popup-panel[data-title*="%title%"] .panel-heading .js-form-popup-remove
67 76 ${plan_form_submit_btn_locator} = jquery=#plan-form .js-submit-btn
68 77 ${plan_created_checker_element_locator} = id=plan-part-pjax
69 78 ${plan_form_add_buyer_btn_locator} = jquery=#Buyer .js-form-popup-update
70 79 ${plan_form_add_buyer_legalName_input_locator} = jquery=#planform-procuring_entity_name
71 80 ${plan_form_add_buyer_id_input_locator} = jquery=#planform-procuring_entity_identifier_code
72 81
73   -#search plan
74   -${button_search_plan} xpath=//button[@class='btn btn-default js-submit-btn']
75   -${form_search_plan} id=plansearchform-query
76   -${search_plan_input} xpath=//input[@data-ds='query-input']
77   -${search_plan_list-pjax} jquery=#plan-list-pjax.loading-wrapper
78   -#${search_plan_result} xpath=(//div[@id='plan-list-pjax'])//a[contains(@href, '/plan/')][1]
79   -${search_plan_result} jquery=a[class="lot__title"]
80   -
81 82 # plan view
82 83 ${plan_view_checker_element_locator} = id=plan-general-info
83 84 ${plan_sync_element_locator} = jquery=#aside-part-pjax .status-label .fa-refresh
84 85 ${plan_uaid_text_locator} = jquery=#plan-general-info .plan-id .value
  86 +${plan_edit_btn_locator} = jquery=#aside-part-pjax a[href*='plan/update']
  87 +
  88 +# plan index + search
  89 +${plan_search_form_locator} = id=plan-filter-form
  90 +${plan_search_form_query_input_locator} = jquery=#plan-filter-form .dynamic-search-query input
  91 +${plan_search_form_result_locator_tpl} = jquery=#plan-list .lots__item .lot__characteristic li:contains(%query%)
85 92
86 93 # tender form
87 94 ${tender_form_submit_success_msg} = Закупівля створена, дочекайтесь опублікування на сайті уповноваженого органу.
... ...
Please register or login to post a comment