Commit 764e0dc331a64c977f5efacc305191c96496d90b

Authored by Playtenders
1 parent fbdac002

esco

This diff could not be displayed because it is too large.
  1 +# -*- coding: utf-8 -
  2 +from iso8601 import parse_date
  3 +from datetime import datetime
  4 +from robot.libraries.BuiltIn import BuiltIn
  5 +from robot.output import librarylogger
  6 +import urllib
  7 +import urllib3
  8 +
  9 +def get_library():
  10 + return BuiltIn().get_library_instance('Selenium2Library')
  11 +
  12 +
  13 +def get_webdriver_instance():
  14 + return get_library()._current_browser()
  15 +
  16 +
  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
  21 +
  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 +
  27 +def convert_isodate_to_site_datetime(isodate):
  28 + iso_dt = parse_date(isodate)
  29 + date_string = iso_dt.strftime("%d.%m.%Y %H:%M")
  30 + return date_string
  31 +
  32 +def convert_date_for_compare(datestr):
  33 + return datetime.strptime(datestr, "%d.%m.%Y %H:%M").strftime("%Y-%m-%d %H:%M")
  34 +
  35 +
  36 +def procuring_entity_name(tender_data):
  37 + tender_data.data.procuringEntity['name'] = u"ТОВ \"ПлейТендер\""
  38 + tender_data.data.procuringEntity['name_en'] = u"TOV \"playtender\""
  39 + tender_data.data.procuringEntity.identifier['id'] = u"1234567890-playtender"
  40 + tender_data.data.procuringEntity.identifier['legalName'] = u"ТОВ \"ПлейТендер\""
  41 + tender_data.data.procuringEntity.identifier['legalName_en'] = u"TOV \"playtender\""
  42 + if 'address' in tender_data.data.procuringEntity:
  43 + tender_data.data.procuringEntity.address['region'] = u"Житомирська область"
  44 + tender_data.data.procuringEntity.address['postalCode'] = u"123123"
  45 + tender_data.data.procuringEntity.address['locality'] = u"населений пункт"
  46 + tender_data.data.procuringEntity.address['streetAddress'] = u"адреса"
  47 + if 'contactPoint' in tender_data.data.procuringEntity:
  48 + tender_data.data.procuringEntity.contactPoint['name'] = u"Замовник Тест"
  49 + tender_data.data.procuringEntity.contactPoint['name_en'] = u"Test"
  50 + tender_data.data.procuringEntity.contactPoint['email'] = u"chuzhin@mail.ua"
  51 + tender_data.data.procuringEntity.contactPoint['telephone'] = u"+3801111111111"
  52 + tender_data.data.procuringEntity.contactPoint['url'] = u"http://playtender.com.ua"
  53 + return tender_data
  54 +
  55 +def split_take_item(value, separator, index):
  56 + librarylogger.console('split_take_item')
  57 + librarylogger.console(value)
  58 + librarylogger.console(separator)
  59 + librarylogger.console(index)
  60 + return value.split(separator)[int(index)]
  61 +
  62 +
  63 +def split_take_slice(value, separator, _from=None, to=None):
  64 + librarylogger.console(value)
  65 + librarylogger.console(separator)
  66 + librarylogger.console(_from)
  67 + librarylogger.console(to)
  68 + l = value.split(separator)
  69 + if to:
  70 + l = l[:int(to)]
  71 + if _from:
  72 + l = l[int(_from):]
  73 + return l
  74 +
  75 +def split_take_slice_from(value, separator, _from):
  76 + librarylogger.console('split_take_slice_from')
  77 + return split_take_slice(value, separator, _from)
  78 +
  79 +def split_take_slice_to(value, separator, to):
  80 + librarylogger.console('split_take_slice_to')
  81 + return split_take_slice(value, separator, to=to)
  82 +
  83 +def join(l, separator):
  84 + librarylogger.console('join')
  85 + librarylogger.console(l)
  86 + return separator.join(l)
  87 +
  88 +
  89 +def get_invisible_text(locator):
  90 + element = get_library()._element_find(locator, False, True)
  91 + text = get_webdriver_instance().execute_script('return jQuery(arguments[0]).text();', element)
  92 + return text
  93 +
  94 +
  95 +def get_text_excluding_children(locator):
  96 + element = get_library()._element_find(locator, False, True)
  97 + text = get_webdriver_instance().execute_script("""
  98 + return jQuery(arguments[0]).contents().filter(function() {
  99 + return this.nodeType == Node.TEXT_NODE;
  100 + }).text();
  101 + """, element)
  102 + return text.strip()
  103 +
  104 +def convert_float_to_string(number):
  105 + return format(number, '.2f')
  106 +
  107 +def convert_date_for_compare_ex(datestr):
  108 + return datetime.strptime(datestr, "%d.%m.%Y %H:%M").strftime("%Y-%m-%d %H:%M+02:00")
  109 +
  110 +def convert_date_for_compare_ex2(datestr):
  111 + return datetime.strptime(datestr, "%d.%m.%Y %H:%M").strftime("%Y-%m-%d %H:%M+02:00")
  112 +
  113 +def download_file(url, file_name, output_dir):
  114 + urllib.urlretrieve(url, ('{}/{}'.format(output_dir, file_name)))
  115 +
  116 +def multiply_hundred(number):
  117 + return number*100
  118 +
  119 +def inject_urllib3():
  120 + import urllib3.contrib.pyopenssl
  121 + urllib3.contrib.pyopenssl.inject_into_urllib3()
  122 +
@@ -2248,9 +2248,9 @@ Save Proposal @@ -2248,9 +2248,9 @@ Save Proposal
2248 ### BOF - Esco ### 2248 ### BOF - Esco ###
2249 Run Keyword If '${arguments[2]}' == 'awards[4].complaintPeriod.endDate' JsOpenAwardByIndex 4 2249 Run Keyword If '${arguments[2]}' == 'awards[4].complaintPeriod.endDate' JsOpenAwardByIndex 4
2250 Run Keyword And Return If '${arguments[2]}' == 'awards[4].complaintPeriod.endDate' get_invisible_text jquery=.award-list-wrapper:first .panel-collapse.in .complaint-period-end-date.hidden 2250 Run Keyword And Return If '${arguments[2]}' == 'awards[4].complaintPeriod.endDate' get_invisible_text jquery=.award-list-wrapper:first .panel-collapse.in .complaint-period-end-date.hidden
2251 - Run Keyword And Return If '${arguments[2]}' == 'minimalStepPercentage' get_invisible_text jquery=.minimal-step-percentage-source.hidden  
2252 - Run Keyword And Return If '${arguments[2]}' == 'yearlyPaymentsPercentageRange' get_invisible_text jquery=.yearly-payments-percentage-range-source.hidden  
2253 - Run Keyword And Return If '${arguments[2]}' == 'fundingKind' get_invisible_text jquery=.funding-kind-source.hidden 2251 + Run Keyword And Return If '${arguments[2]}' == 'minimalStepPercentage' get_invisible_text jquery=#tender-general-info > p.minimal-step-percentage-source.hidden
  2252 + Run Keyword And Return If '${arguments[2]}' == 'yearlyPaymentsPercentageRange' get_invisible_text jquery=#tender-general-info > p.yearly-payments-percentage-range-source.hidden
  2253 + Run Keyword And Return If '${arguments[2]}' == 'fundingKind' get_invisible_text jquery=#tender-general-info > p.funding-kind-source.hidden
2254 ### EOF - Esco ### 2254 ### EOF - Esco ###
2255 2255
2256 Fail Потрібна реалізація в "Отримати інформацію із тендера" 2256 Fail Потрібна реалізація в "Отримати інформацію із тендера"
@@ -2281,6 +2281,9 @@ Save Proposal @@ -2281,6 +2281,9 @@ Save Proposal
2281 Run Keyword And Return If 'minimalStep.valueAddedTaxIncluded' == '${arguments[2]}' Отримати інформацію із лоту minimalStep.valueAddedTaxIncluded ${arguments[1]} 2281 Run Keyword And Return If 'minimalStep.valueAddedTaxIncluded' == '${arguments[2]}' Отримати інформацію із лоту minimalStep.valueAddedTaxIncluded ${arguments[1]}
2282 Run Keyword And Return If 'auctionPeriod.startDate' == '${arguments[2]}' get_invisible_text jquery=#accordionLots .panel-collapse.in .lot-info-wrapper .auction-period-start-date.hidden 2282 Run Keyword And Return If 'auctionPeriod.startDate' == '${arguments[2]}' get_invisible_text jquery=#accordionLots .panel-collapse.in .lot-info-wrapper .auction-period-start-date.hidden
2283 Run Keyword And Return If 'auctionPeriod.endDate' == '${arguments[2]}' get_invisible_text jquery=#accordionLots .panel-collapse.in .lot-info-wrapper .auction-period-end-date.hidden 2283 Run Keyword And Return If 'auctionPeriod.endDate' == '${arguments[2]}' get_invisible_text jquery=#accordionLots .panel-collapse.in .lot-info-wrapper .auction-period-end-date.hidden
  2284 + Run Keyword And Return If 'minimalStepPercentage' == '${arguments[2]}' Get invisible text number by locator jquery=#accordionLots .lot-info-wrapper:first .minimal-step-percentage-source.hidden
  2285 + Run Keyword And Return If 'fundingKind' == '${arguments[2]}' get_invisible_text jquery=#accordionLots .lot-info-wrapper:first .funding-kind-source.hidden
  2286 + Run Keyword And Return If 'yearlyPaymentsPercentageRange' == '${arguments[2]}' Get invisible text number by locator jquery=#accordionLots .lot-info-wrapper:first .yearly-payments-percentage-range-source.hidden
2284 2287
2285 Collapse Lot ${arguments[1]} 2288 Collapse Lot ${arguments[1]}
2286 [return] playtender.lot.default 2289 [return] playtender.lot.default
@@ -5,6 +5,7 @@ from robot.libraries.BuiltIn import BuiltIn @@ -5,6 +5,7 @@ from robot.libraries.BuiltIn import BuiltIn
5 from robot.output import librarylogger 5 from robot.output import librarylogger
6 import urllib 6 import urllib
7 import urllib3 7 import urllib3
  8 +#import decimal
8 9
9 def get_library(): 10 def get_library():
10 return BuiltIn().get_library_instance('Selenium2Library') 11 return BuiltIn().get_library_instance('Selenium2Library')
Please register or login to post a comment