Commit fa5393b2e9105551a6be925c9324afb2bc1d7cab
1 parent
80214a15
common
- added: cookie for detecting robottest from site side plans - added: updating procuringEntity in plan data
Showing
4 changed files
with
56 additions
and
3 deletions
@@ -13,6 +13,7 @@ Resource playtender_plan. | @@ -13,6 +13,7 @@ Resource playtender_plan. | ||
13 | 13 | ||
14 | init environment ${username} | 14 | init environment ${username} |
15 | open browser ${broker_baseurl} ${broker_browser} alias=${broker_username} | 15 | open browser ${broker_baseurl} ${broker_browser} alias=${broker_username} |
16 | + add cookie robottest 1 # for detecting from site side | ||
16 | set window size @{browser_default_size} | 17 | set window size @{browser_default_size} |
17 | set window position @{browser_default_position} | 18 | set window position @{browser_default_position} |
18 | set site language by code ${broker_language_code} | 19 | set site language by code ${broker_language_code} |
@@ -28,9 +29,9 @@ Resource playtender_plan. | @@ -28,9 +29,9 @@ Resource playtender_plan. | ||
28 | ... адаптовані дані tender_data. Різниця між початковими даними і кінцевими буде виведена в консоль під | 29 | ... адаптовані дані tender_data. Різниця між початковими даними і кінцевими буде виведена в консоль під |
29 | ... час запуску тесту. | 30 | ... час запуску тесту. |
30 | 31 | ||
31 | - # @todo | ||
32 | - # adjusting procuring entity with site user | ||
33 | - | 32 | + ${tender_data_keys} = get dictionary keys ${tender_data['data']} |
33 | + run keyword if '${test_role}' == 'tender_owner' and 'procuringEntity' in ${tender_data_keys} prepare procuring entity data ${tender_data['data']['procuringEntity']} | ||
34 | + #run keyword if '${test_role}' == 'tender_owner' and 'buyers' in ${tender_data_keys} prepare buyers data ${tender_data['data']['buyers']} | ||
34 | [Return] ${tender_data} | 35 | [Return] ${tender_data} |
35 | 36 | ||
36 | Створити план | 37 | Створити план |
@@ -13,6 +13,7 @@ ${broker_username} = | @@ -13,6 +13,7 @@ ${broker_username} = | ||
13 | ${broker_baseurl} = | 13 | ${broker_baseurl} = |
14 | ${broker_browser} = | 14 | ${broker_browser} = |
15 | ${broker_language_code} = uk | 15 | ${broker_language_code} = uk |
16 | +${test_role} = | ||
16 | 17 | ||
17 | @{browser_default_size} = ${1200} ${1000} | 18 | @{browser_default_size} = ${1200} ${1000} |
18 | @{browser_default_position} = ${0} ${0} | 19 | @{browser_default_position} = ${0} ${0} |
@@ -28,6 +29,7 @@ init environment | @@ -28,6 +29,7 @@ init environment | ||
28 | set global variable ${broker_username} ${username} | 29 | set global variable ${broker_username} ${username} |
29 | set global variable ${broker_baseurl} ${BROKERS['${broker}'].basepage} | 30 | set global variable ${broker_baseurl} ${BROKERS['${broker}'].basepage} |
30 | set global variable ${broker_browser} ${USERS.users['${broker_username}'].browser} | 31 | set global variable ${broker_browser} ${USERS.users['${broker_username}'].browser} |
32 | + set global variable ${test_role} ${ROLE} | ||
31 | 33 | ||
32 | set site language by code | 34 | set site language by code |
33 | [Arguments] ${language_code} | 35 | [Arguments] ${language_code} |
@@ -24,6 +24,10 @@ fill plan form | @@ -24,6 +24,10 @@ fill plan form | ||
24 | [Arguments] ${data} | 24 | [Arguments] ${data} |
25 | [Documentation] заповнення форми з масива даних | 25 | [Documentation] заповнення форми з масива даних |
26 | 26 | ||
27 | + # check buyers | ||
28 | + ${buyers_count} = get length ${data['buyers']} | ||
29 | + run keyword if ${buyers_count} != 1 fail Buyer must be one | ||
30 | + | ||
27 | # hidden inputs | 31 | # hidden inputs |
28 | ${budget_id} = get from dictionary by keys ${data} budget id | 32 | ${budget_id} = get from dictionary by keys ${data} budget id |
29 | run keyword if condition is not none ${budget_id} input text to hidden input ${plan_form_budget_id_input_locator} ${budget_id} | 33 | run keyword if condition is not none ${budget_id} input text to hidden input ${plan_form_budget_id_input_locator} ${budget_id} |
1 | +# -*- coding: utf-8 - | ||
1 | from robot.libraries.BuiltIn import BuiltIn | 2 | from robot.libraries.BuiltIn import BuiltIn |
2 | from iso8601 import parse_date | 3 | from iso8601 import parse_date |
3 | 4 | ||
@@ -95,3 +96,48 @@ def convert_float_to_string(number): | @@ -95,3 +96,48 @@ def convert_float_to_string(number): | ||
95 | def isodate_format(isodate, format): | 96 | def isodate_format(isodate, format): |
96 | iso_dt = parse_date(isodate) | 97 | iso_dt = parse_date(isodate) |
97 | return iso_dt.strftime(format) | 98 | return iso_dt.strftime(format) |
99 | + | ||
100 | + | ||
101 | +# prepare data | ||
102 | +def prepare_procuring_entity_data(data): | ||
103 | + try: | ||
104 | + data['name'] = u"Playtender" | ||
105 | + data.identifier['id'] = u"playtender" | ||
106 | + data.identifier['legalName'] = u"Playtender" | ||
107 | + data.identifier['scheme'] = u"UA-EDR" | ||
108 | + if 'name_en' in data: | ||
109 | + data['name_en'] = u"Playtender" | ||
110 | + if 'legalName_en' in data.identifier: | ||
111 | + data.identifier['legalName_en'] = u"Playtender" | ||
112 | + if 'address' in data: | ||
113 | + data.address['countryName'] = u"Україна" | ||
114 | + data.address['locality'] = u"Київ" | ||
115 | + data.address['postalCode'] = u"01111" | ||
116 | + data.address['region'] = u"місто Київ" | ||
117 | + data.address['streetAddress'] = u"вулиця Тестова, 220, 8" | ||
118 | + if 'contactPoint' in data: | ||
119 | + data.contactPoint['email'] = u"chuzhin@mail.ua" | ||
120 | + data.contactPoint['faxNumber'] = u"+3801111111111" | ||
121 | + data.contactPoint['telephone'] = u"+3801111111111" | ||
122 | + data.contactPoint['name'] = u"Test" | ||
123 | + if 'name_en' in data.contactPoint: | ||
124 | + data.contactPoint['name_en'] = u"Test" | ||
125 | + data.contactPoint['url'] = u"https://playtender.com.ua" | ||
126 | + except Exception: | ||
127 | + raise Exception('data is not a dictionary') | ||
128 | + | ||
129 | + | ||
130 | +# prepare data | ||
131 | +def prepare_buyers_data(data): | ||
132 | + if type(data) is not list: | ||
133 | + raise Exception('data is not a list') | ||
134 | + | ||
135 | + # preventing console errors about changing buyer data in cases | ||
136 | + if len(data) != 1: | ||
137 | + return | ||
138 | + | ||
139 | + item = next(iter(data), None) | ||
140 | + item['name'] = u"Playtender" | ||
141 | + item.identifier['id'] = u"playtender" | ||
142 | + item.identifier['legalName'] = u"Playtender" | ||
143 | + item.identifier['scheme'] = u"UA-EDR" |
Please
register
or
login
to post a comment