Commit a03804985c59105c0e6a78cb1d231a036a0a4c39
1 parent
edd76b4f
plan
- added: getting plan attrbite value
Showing
6 changed files
with
114 additions
and
42 deletions
@@ -86,4 +86,13 @@ Resource playtender_plan. | @@ -86,4 +86,13 @@ Resource playtender_plan. | ||
86 | open plan form by uaid ${plan_uaid} | 86 | open plan form by uaid ${plan_uaid} |
87 | ${delete_item_btn_locator} = replace string ${plan_form_remove_item_btn_locator_tpl} %title% ${item_id} | 87 | ${delete_item_btn_locator} = replace string ${plan_form_remove_item_btn_locator_tpl} %title% ${item_id} |
88 | click removing form item and wait success result ${delete_item_btn_locator} | 88 | click removing form item and wait success result ${delete_item_btn_locator} |
89 | - save plan form and wait synchronization | ||
89 | + save plan form and wait synchronization | ||
90 | + | ||
91 | +Отримати інформацію із плану | ||
92 | + [Arguments] ${username} ${plan_uaid} ${field_name} | ||
93 | + [Documentation] Отримати інформацію із плану, користуючись ідентіфікатором плану та назвою поля ${field_name}. | ||
94 | + | ||
95 | + open plan page by uaid ${plan_uaid} ${False} | ||
96 | + ${field_name} = set variable plan.${field_name}.value | ||
97 | + ${value} = get field_value by field_name on opened page ${field_name} | ||
98 | + [Return] ${value} |
@@ -71,6 +71,34 @@ fill item form in opened popup | @@ -71,6 +71,34 @@ fill item form in opened popup | ||
71 | ${additional_classifications} = get from dictionary by keys ${data} additionalClassifications | 71 | ${additional_classifications} = get from dictionary by keys ${data} additionalClassifications |
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} | 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 | #################################################### COMMON HELPERS #################################################### | 103 | #################################################### COMMON HELPERS #################################################### |
76 | ######################################################################################################################## | 104 | ######################################################################################################################## |
1 | *** Settings *** | 1 | *** Settings *** |
2 | 2 | ||
3 | Resource playtender_common.robot | 3 | Resource playtender_common.robot |
4 | +Resource playtender_plan_variables.robot | ||
4 | 5 | ||
5 | *** Keywords *** | 6 | *** Keywords *** |
6 | 7 | ||
@@ -25,10 +26,12 @@ open plan form by uaid | @@ -25,10 +26,12 @@ open plan form by uaid | ||
25 | click visible element and wait until page contains element ${plan_edit_btn_locator} ${plan_form_locator} | 26 | click visible element and wait until page contains element ${plan_edit_btn_locator} ${plan_form_locator} |
26 | 27 | ||
27 | open plan page by uaid | 28 | open plan page by uaid |
28 | - [Arguments] ${uaid} | 29 | + [Arguments] ${uaid} ${refresh}=${True} |
29 | [Documentation] відкриває сторінку з планом | 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 | ${is_plan_found} = get is element exist ${plan_view_checker_element_locator} | 35 | ${is_plan_found} = get is element exist ${plan_view_checker_element_locator} |
33 | return from keyword if ${is_plan_found} == ${True} | 36 | return from keyword if ${is_plan_found} == ${True} |
34 | ${is_plan_not_found} = get is 404 page | 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_submit_btn_locator} = jquery=#plan-form .js-submit-btn | ||
23 | +${plan_created_checker_element_locator} = id=plan-part-pjax | ||
24 | + | ||
25 | +# plan view | ||
26 | +${plan_view_checker_element_locator} = id=plan-general-info | ||
27 | +${plan_sync_element_locator} = jquery=#aside-part-pjax .status-label .fa-refresh | ||
28 | +${plan_uaid_text_locator} = jquery=#plan-general-info .plan-id .value | ||
29 | +${plan_edit_btn_locator} = jquery=#aside-part-pjax a[href*='plan/update'] | ||
30 | +# -- for viewer -- | ||
31 | +${plan_tender_procurementMethodType_value_locator} = jquery=#plan-general-info .procurement-method-type.hidden | ||
32 | +${plan_budget_amount_value_locator} = jquery=#plan-general-info .budget-amount.hidden | ||
33 | +${plan_budget_amount_value_type} = float | ||
34 | +${plan_budget_description_value_locator} = jquery=#plan-general-info .budget-description .value | ||
35 | +${plan_budget_currency_value_locator} = jquery=#plan-general-info .budget-currency.hidden | ||
36 | +${plan_budget_id_value_locator} = jquery=#plan-general-info .budget-id .value | ||
37 | +${plan_procuringEntity_name_value_locator} = jquery=#plan-general-info .organization .definitions__list .organization_name.hidden .value | ||
38 | +${plan_procuringEntity_identifier_scheme_value_locator} = jquery=#plan-general-info .organization .definitions__list .identifier_scheme.hidden .value | ||
39 | +${plan_procuringEntity_identifier_id_value_locator} = jquery=#plan-general-info .organization .definitions__list .identifier_code .value | ||
40 | +${plan_procuringEntity_identifier_legalName_value_locator} = jquery=#plan-general-info .organization .definitions__list .identifier_legal_name.hidden .value | ||
41 | +${plan_classification_description_value_locator} = jquery=#plan-general-info .main-classification-description.hidden | ||
42 | +${plan_classification_scheme_value_locator} = jquery=#plan-general-info .main-classification-scheme.hidden | ||
43 | +${plan_classification_id_value_locator} = jquery=#plan-general-info .main-classification-code.hidden | ||
44 | +${plan_tender_tenderPeriod_startDate_value_locator} = jquery=#plan-general-info .tender-start-date-source.hidden | ||
45 | +${plan_items_0_description_value_locator} = jquery=.items-wrapper .pseudo-table .pseudo-table__row:nth(1) .textvalue | ||
46 | +${plan_items_1_description_value_locator} = jquery=.items-wrapper .pseudo-table .pseudo-table__row:nth(2) .textvalue | ||
47 | + | ||
48 | +# plan index + search | ||
49 | +${plan_search_form_locator} = id=plan-filter-form | ||
50 | +${plan_search_form_query_input_locator} = jquery=#plan-filter-form .dynamic-search-query input | ||
51 | +${plan_search_form_result_locator_tpl} = jquery=#plan-list .lots__item .lot__characteristic li:contains(%query%) |
1 | # -*- coding: utf-8 - | 1 | # -*- coding: utf-8 - |
2 | -from robot.libraries.BuiltIn import BuiltIn | ||
3 | -from iso8601 import parse_date | ||
4 | import re | 2 | import re |
5 | 3 | ||
4 | +from iso8601 import parse_date | ||
5 | +from robot.libraries.BuiltIn import BuiltIn | ||
6 | + | ||
6 | 7 | ||
7 | def get_library(): | 8 | def get_library(): |
8 | return BuiltIn().get_library_instance('Selenium2Library') | 9 | return BuiltIn().get_library_instance('Selenium2Library') |
@@ -83,11 +84,14 @@ def set_element_scroll_into_view(locator): | @@ -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 | element = get_library()._element_find(locator, None, True) | 89 | element = get_library()._element_find(locator, None, True) |
89 | text = get_webdriver_instance().execute_script( | 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 | element | 95 | element |
92 | ) | 96 | ) |
93 | return text | 97 | return text |
@@ -126,6 +130,16 @@ def convert_float_to_string(number): | @@ -126,6 +130,16 @@ def convert_float_to_string(number): | ||
126 | return repr(float(number)) | 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 | # prepare isodate in needed format | 143 | # prepare isodate in needed format |
130 | def isodate_format(isodate, format): | 144 | def isodate_format(isodate, format): |
131 | iso_dt = parse_date(isodate) | 145 | iso_dt = parse_date(isodate) |
@@ -45,37 +45,4 @@ ${item_form_popup_description_en_input_locator} = jquery=.fanc | @@ -45,37 +45,4 @@ ${item_form_popup_description_en_input_locator} = jquery=.fanc | ||
45 | ${item_form_popup_quantity_input_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content [id$='-quantity'] | 45 | ${item_form_popup_quantity_input_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content [id$='-quantity'] |
46 | ${item_form_popup_unit_input_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content [id$='-unit_id'] | 46 | ${item_form_popup_unit_input_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content [id$='-unit_id'] |
47 | ${item_form_popup_classification_edit_btn_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content .js-classification-input-wrapper [data-toggle="classification"] | 47 | ${item_form_popup_classification_edit_btn_locator} = jquery=.fancybox-is-open:last .fancybox-slide--current .fancybox-content .js-classification-input-wrapper [data-toggle="classification"] |
48 | -${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"] | ||
49 | - | ||
50 | -# plan form | ||
51 | -${plan_form_submit_success_msg} = дочекайтесь опублікування на сайті уповноваженого органу | ||
52 | -${plan_form_locator} = id=plan-form | ||
53 | -${plan_form_general_panel_edit_btn_locator} = jquery=#General .panel-heading .js-form-popup-update | ||
54 | -${plan_form_procurement_method_type_input_locator} = id=planform-procurement_method_type | ||
55 | -${plan_form_budget_id_input_locator} = id=planform-budget_id | ||
56 | -${plan_form_project_id_input_locator} = id=planform-project_id | ||
57 | -${plan_form_project_name_input_locator} = id=planform-project_name | ||
58 | -${plan_form_title_input_locator} = id=planform-title | ||
59 | -${plan_form_year_input_locator} = id=planform-year | ||
60 | -${plan_form_tender_start_date_input_locator} = id=planform-tender_start_date | ||
61 | -${plan_form_value_amount_input_locator} = id=planform-value_amount | ||
62 | -${plan_form_value_currency_input_locator} = id=planform-value_currency | ||
63 | -${plan_form_classification_edit_btn_locator} = jquery=.field-planform-classification_id .js-classification-input-wrapper [data-toggle="classification"] | ||
64 | -${plan_form_additional_classification_edit_btn_locator} = jquery=.field-planform-additional_classification_ids .js-additional-classification-input-wrapper [data-toggle="additional-classification"] | ||
65 | -${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 | -${plan_form_add_item_btn_locator} = jquery=#Items .js-form-popup-add | ||
67 | -${plan_form_update_item_btn_locator_tpl} = jquery=#Items .js-form-popup-panel:nth(%index%) .panel-heading .js-form-popup-update | ||
68 | -${plan_form_remove_item_btn_locator_tpl} = jquery=#Items .js-form-popup-panel[data-title*="%title%"] .panel-heading .js-form-popup-remove | ||
69 | -${plan_form_submit_btn_locator} = jquery=#plan-form .js-submit-btn | ||
70 | -${plan_created_checker_element_locator} = id=plan-part-pjax | ||
71 | - | ||
72 | -# plan view | ||
73 | -${plan_view_checker_element_locator} = id=plan-general-info | ||
74 | -${plan_sync_element_locator} = jquery=#aside-part-pjax .status-label .fa-refresh | ||
75 | -${plan_uaid_text_locator} = jquery=#plan-general-info .plan-id .value | ||
76 | -${plan_edit_btn_locator} = jquery=#aside-part-pjax a[href*='plan/update'] | ||
77 | - | ||
78 | -# plan index + search | ||
79 | -${plan_search_form_locator} = id=plan-filter-form | ||
80 | -${plan_search_form_query_input_locator} = jquery=#plan-filter-form .dynamic-search-query input | ||
81 | -${plan_search_form_result_locator_tpl} = jquery=#plan-list .lots__item .lot__characteristic li:contains(%query%) | ||
48 | +${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"] |
Please
register
or
login
to post a comment