Showing
6 changed files
with
107 additions
and
43 deletions
... | ... | @@ -97,8 +97,9 @@ Resource playtender_tende |
97 | 97 | [Arguments] ${username} ${plan_uaid} ${field_name} |
98 | 98 | [Documentation] Отримати інформацію із плану, користуючись ідентіфікатором плану та назвою поля ${field_name}. |
99 | 99 | |
100 | - open plan page by uaid ${plan_uaid} | |
101 | - ${value} = get plan field value by name ${field_name} | |
100 | + open plan page by uaid ${plan_uaid} ${False} | |
101 | + ${field_name} = set variable plan.${field_name}.value | |
102 | + ${value} = get field_value by field_name on opened page ${field_name} | |
102 | 103 | [Return] ${value} |
103 | 104 | |
104 | 105 | ######################################################################################################################## | ... | ... |
... | ... | @@ -71,6 +71,34 @@ fill item form in opened popup |
71 | 71 | ${additional_classifications} = get from dictionary by keys ${data} additionalClassifications |
72 | 72 | 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} |
73 | 73 | |
74 | +get value by locator on opened page | |
75 | + [Arguments] ${locator} ${type}=${None} | |
76 | + [Documentation] отримує значення з відповідного локатору і якщо потрібно перетворює до відповідного типу | |
77 | + | |
78 | + __private__set_element_visible_in_browser_area ${locator} | |
79 | + ${value} = get value by locator ${locator} | |
80 | + ${value} = convert to specified type ${value} ${type} | |
81 | + [Return] ${value} | |
82 | + | |
83 | +get field_value by field_name on opened page | |
84 | + [Arguments] ${field_name} | |
85 | + [Documentation] повертає інформацію з відкритої сторінки, користуючись назвою поля ${field_name}. | |
86 | + ... для назви поля повинен бути вказаний відповідний локатор (!вкінці змінної повинно бути слово locator), | |
87 | + ... і якщо потрібно тип поля окремою змінною (!locator замінюється на type) зі значенням [string,integer,float] | |
88 | + | |
89 | + ${field_name_prepared} = replace string ${field_name} .[ _ | |
90 | + ${field_name_prepared} = replace string ${field_name_prepared} ]. _ | |
91 | + ${field_name_prepared} = replace string ${field_name_prepared} . _ | |
92 | + ${field_name_prepared} = replace string ${field_name_prepared} [ _ | |
93 | + ${field_name_prepared} = replace string ${field_name_prepared} ] _ | |
94 | + ${field_locator_variable_name} = set variable ${field_name_prepared}_locator | |
95 | + ${field_type_variable_name} = set variable ${field_name_prepared}_type | |
96 | + ${field_type_variable_exists} = run keyword and return status variable should exist ${${field_type_variable_name}} | |
97 | + ${field_type} = set variable if ${field_type_variable_exists} == ${True} ${${field_type_variable_name}} ${None} | |
98 | + ${field_locator} = set variable ${${field_locator_variable_name}} | |
99 | + ${field_value} = get value by locator on opened page ${field_locator} ${field_type} | |
100 | + [Return] ${field_value} | |
101 | + | |
74 | 102 | ######################################################################################################################## |
75 | 103 | #################################################### COMMON HELPERS #################################################### |
76 | 104 | ######################################################################################################################## | ... | ... |
1 | 1 | *** Settings *** |
2 | 2 | |
3 | 3 | Resource playtender_common.robot |
4 | +Resource playtender_plan_variables.robot | |
4 | 5 | |
5 | 6 | *** Keywords *** |
6 | 7 | |
... | ... | @@ -25,10 +26,12 @@ open plan form by uaid |
25 | 26 | click visible element and wait until page contains element ${plan_edit_btn_locator} ${plan_form_locator} |
26 | 27 | |
27 | 28 | open plan page by uaid |
28 | - [Arguments] ${uaid} | |
29 | + [Arguments] ${uaid} ${refresh}=${True} | |
29 | 30 | [Documentation] відкриває сторінку з планом |
30 | 31 | |
31 | - open site page and wait content element ${broker_baseurl}/plan/${uaid} | |
32 | + ${current_location} = get location | |
33 | + ${needed_location} = set variable ${broker_baseurl}/plan/${uaid} | |
34 | + run keyword if '${current_location}' != '${needed_location}' or ${refresh} == ${True} open site page and wait content element ${needed_location} | |
32 | 35 | ${is_plan_found} = get is element exist ${plan_view_checker_element_locator} |
33 | 36 | return from keyword if ${is_plan_found} == ${True} |
34 | 37 | ${is_plan_not_found} = get is 404 page | ... | ... |
playtender_plan_variables.robot
0 → 100644
1 | +*** Variables *** | |
2 | + | |
3 | +# plan form | |
4 | +${plan_form_submit_success_msg} = дочекайтесь опублікування на сайті уповноваженого органу | |
5 | +${plan_form_locator} = id=plan-form | |
6 | +${plan_form_general_panel_edit_btn_locator} = jquery=#General .panel-heading .js-form-popup-update | |
7 | +${plan_form_procurement_method_type_input_locator} = id=planform-procurement_method_type | |
8 | +${plan_form_budget_id_input_locator} = id=planform-budget_id | |
9 | +${plan_form_project_id_input_locator} = id=planform-project_id | |
10 | +${plan_form_project_name_input_locator} = id=planform-project_name | |
11 | +${plan_form_title_input_locator} = id=planform-title | |
12 | +${plan_form_year_input_locator} = id=planform-year | |
13 | +${plan_form_tender_start_date_input_locator} = id=planform-tender_start_date | |
14 | +${plan_form_value_amount_input_locator} = id=planform-value_amount | |
15 | +${plan_form_value_currency_input_locator} = id=planform-value_currency | |
16 | +${plan_form_classification_edit_btn_locator} = jquery=.field-planform-classification_id .js-classification-input-wrapper [data-toggle="classification"] | |
17 | +${plan_form_additional_classification_edit_btn_locator} = jquery=.field-planform-additional_classification_ids .js-additional-classification-input-wrapper [data-toggle="additional-classification"] | |
18 | +${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"] | |
19 | +${plan_form_add_item_btn_locator} = jquery=#Items .js-form-popup-add | |
20 | +${plan_form_update_item_btn_locator_tpl} = jquery=#Items .js-form-popup-panel:nth(%index%) .panel-heading .js-form-popup-update | |
21 | +${plan_form_remove_item_btn_locator_tpl} = jquery=#Items .js-form-popup-panel[data-title*="%title%"] .panel-heading .js-form-popup-remove | |
22 | +${plan_form_update_buyer_btn_locator} = jquery=#Buyer .js-form-popup-update | |
23 | +${plan_form_submit_btn_locator} = jquery=#plan-form .js-submit-btn | |
24 | +${plan_created_checker_element_locator} = id=plan-part-pjax | |
25 | + | |
26 | +# plan view | |
27 | +${plan_view_checker_element_locator} = id=plan-general-info | |
28 | +${plan_sync_element_locator} = jquery=#aside-part-pjax .status-label .fa-refresh | |
29 | +${plan_uaid_text_locator} = jquery=#plan-general-info .plan-id .value | |
30 | +${plan_edit_btn_locator} = jquery=#aside-part-pjax a[href*='plan/update'] | |
31 | +# -- for viewer -- | |
32 | +${plan_tender_procurementMethodType_value_locator} = jquery=#plan-general-info .procurement-method-type.hidden | |
33 | +${plan_budget_amount_value_locator} = jquery=#plan-general-info .budget-amount.hidden | |
34 | +${plan_budget_amount_value_type} = float | |
35 | +${plan_budget_description_value_locator} = jquery=#plan-general-info .budget-description .value | |
36 | +${plan_budget_currency_value_locator} = jquery=#plan-general-info .budget-currency.hidden | |
37 | +${plan_budget_id_value_locator} = jquery=#plan-general-info .budget-id .value | |
38 | +${plan_procuringEntity_name_value_locator} = jquery=#plan-general-info .organization .definitions__list .organization_name.hidden .value | |
39 | +${plan_procuringEntity_identifier_scheme_value_locator} = jquery=#plan-general-info .organization .definitions__list .identifier_scheme.hidden .value | |
40 | +${plan_procuringEntity_identifier_id_value_locator} = jquery=#plan-general-info .organization .definitions__list .identifier_code .value | |
41 | +${plan_procuringEntity_identifier_legalName_value_locator} = jquery=#plan-general-info .organization .definitions__list .identifier_legal_name.hidden .value | |
42 | +${plan_classification_description_value_locator} = jquery=#plan-general-info .main-classification-description.hidden | |
43 | +${plan_classification_scheme_value_locator} = jquery=#plan-general-info .main-classification-scheme.hidden | |
44 | +${plan_classification_id_value_locator} = jquery=#plan-general-info .main-classification-code.hidden | |
45 | +${plan_tender_tenderPeriod_startDate_value_locator} = jquery=#plan-general-info .tender-start-date-source.hidden | |
46 | +${plan_items_0_description_value_locator} = jquery=.items-wrapper .pseudo-table .pseudo-table__row:nth(1) .textvalue | |
47 | +${plan_items_1_description_value_locator} = jquery=.items-wrapper .pseudo-table .pseudo-table__row:nth(2) .textvalue | |
48 | + | |
49 | +# plan index + search | |
50 | +${plan_search_form_locator} = id=plan-filter-form | |
51 | +${plan_search_form_query_input_locator} = jquery=#plan-filter-form .dynamic-search-query input | |
52 | +${plan_search_form_result_locator_tpl} = jquery=#plan-list .lots__item .lot__characteristic li:contains(%query%) | |
\ No newline at end of file | ... | ... |
1 | 1 | # -*- coding: utf-8 - |
2 | -from robot.libraries.BuiltIn import BuiltIn | |
3 | -from iso8601 import parse_date | |
4 | 2 | import re |
5 | 3 | |
4 | +from iso8601 import parse_date | |
5 | +from robot.libraries.BuiltIn import BuiltIn | |
6 | + | |
6 | 7 | |
7 | 8 | def get_library(): |
8 | 9 | return BuiltIn().get_library_instance('Selenium2Library') |
... | ... | @@ -83,11 +84,14 @@ def set_element_scroll_into_view(locator): |
83 | 84 | ) |
84 | 85 | |
85 | 86 | |
86 | -# return text from hidden element | |
87 | -def get_invisible_text(locator): | |
87 | +# return text/value by specified locator | |
88 | +def get_value_by_locator(locator): | |
88 | 89 | element = get_library()._element_find(locator, None, True) |
89 | 90 | text = get_webdriver_instance().execute_script( |
90 | - 'return jQuery(arguments[0]).text();', | |
91 | + 'var $element = jQuery(arguments[0]);' | |
92 | + 'if($element.is("input[type=checkbox]")) return $element.is(":checked") ? "1":"0";' | |
93 | + 'if($element.is("input,textarea,select")) return $element.val();' | |
94 | + 'return $element.text();', | |
91 | 95 | element |
92 | 96 | ) |
93 | 97 | return text |
... | ... | @@ -126,6 +130,16 @@ def convert_float_to_string(number): |
126 | 130 | return repr(float(number)) |
127 | 131 | |
128 | 132 | |
133 | +# convert any variable to specified type | |
134 | +def convert_to_specified_type(value, type): | |
135 | + value = "%s" % (value) | |
136 | + if type == 'integer': | |
137 | + value = int(value) | |
138 | + if type == 'float': | |
139 | + value = float(value) | |
140 | + return value | |
141 | + | |
142 | + | |
129 | 143 | # prepare isodate in needed format |
130 | 144 | def isodate_format(isodate, format): |
131 | 145 | iso_dt = parse_date(isodate) | ... | ... |
... | ... | @@ -57,40 +57,6 @@ ${item_form_popup_delivery_end_date_input_locator} = jquery=.fanc |
57 | 57 | ${buyer_form_popup_legal_name_input_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content [id$='-procuring_entity_name'] |
58 | 58 | ${buyer_form_popup_identifier_id_input_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content [id$='-procuring_entity_identifier_code'] |
59 | 59 | |
60 | -# plan form | |
61 | -${plan_form_submit_success_msg} = дочекайтесь опублікування на сайті уповноваженого органу | |
62 | -${plan_form_locator} = id=plan-form | |
63 | -${plan_form_general_panel_edit_btn_locator} = jquery=#General .panel-heading .js-form-popup-update | |
64 | -${plan_form_procurement_method_type_input_locator} = id=planform-procurement_method_type | |
65 | -${plan_form_budget_id_input_locator} = id=planform-budget_id | |
66 | -${plan_form_project_id_input_locator} = id=planform-project_id | |
67 | -${plan_form_project_name_input_locator} = id=planform-project_name | |
68 | -${plan_form_title_input_locator} = id=planform-title | |
69 | -${plan_form_year_input_locator} = id=planform-year | |
70 | -${plan_form_tender_start_date_input_locator} = id=planform-tender_start_date | |
71 | -${plan_form_value_amount_input_locator} = id=planform-value_amount | |
72 | -${plan_form_value_currency_input_locator} = id=planform-value_currency | |
73 | -${plan_form_classification_edit_btn_locator} = jquery=.field-planform-classification_id .js-classification-input-wrapper [data-toggle="classification"] | |
74 | -${plan_form_additional_classification_edit_btn_locator} = jquery=.field-planform-additional_classification_ids .js-additional-classification-input-wrapper [data-toggle="additional-classification"] | |
75 | -${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"] | |
76 | -${plan_form_add_item_btn_locator} = jquery=#Items .js-form-popup-add | |
77 | -${plan_form_update_item_btn_locator_tpl} = jquery=#Items .js-form-popup-panel:nth(%index%) .panel-heading .js-form-popup-update | |
78 | -${plan_form_remove_item_btn_locator_tpl} = jquery=#Items .js-form-popup-panel[data-title*="%title%"] .panel-heading .js-form-popup-remove | |
79 | -${plan_form_submit_btn_locator} = jquery=#plan-form .js-submit-btn | |
80 | -${plan_form_update_buyer_btn_locator} = jquery=#Buyer .js-form-popup-update | |
81 | -${plan_created_checker_element_locator} = id=plan-part-pjax | |
82 | - | |
83 | -# plan view | |
84 | -${plan_view_checker_element_locator} = id=plan-general-info | |
85 | -${plan_sync_element_locator} = jquery=#aside-part-pjax .status-label .fa-refresh | |
86 | -${plan_uaid_text_locator} = jquery=#plan-general-info .plan-id .value | |
87 | -${plan_edit_btn_locator} = jquery=#aside-part-pjax a[href*='plan/update'] | |
88 | - | |
89 | -# plan index + search | |
90 | -${plan_search_form_locator} = id=plan-filter-form | |
91 | -${plan_search_form_query_input_locator} = jquery=#plan-filter-form .dynamic-search-query input | |
92 | -${plan_search_form_result_locator_tpl} = jquery=#plan-list .lots__item .lot__characteristic li:contains(%query%) | |
93 | - | |
94 | 60 | # tender form |
95 | 61 | ${tender_form_submit_success_msg} = дочекайтесь опублікування на сайті уповноваженого органу. |
96 | 62 | ${tender_form_locator} = id=tender-form | ... | ... |
Please
register
or
login
to post a comment