Advertisement
yboi

Untitled

Jul 29th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.46 KB | None | 0 0
  1. *** Setting ***
  2. Library Selenium2Screenshots
  3. Library String
  4. Library DateTime
  5.  
  6. *** Variables ***
  7. ${locator.tenderId} jquery=h3
  8. ${locator.title} jquery=tender-subject-info>div.row:contains("Назва закупівлі:")>:eq(1)>
  9. ${locator.description} jquery=tender-subject-info>div.row:contains("Детальний опис закупівлі:")>:eq(1)>
  10. ${locator.minimalStep.amount} jquery=tender-subject-info>div.row:contains("Мінімальний крок аукціону, грн.:")>:eq(1)>
  11. ${locator.procuringEntity.name} jquery=customer-info>div.row:contains("Найменування:")>:eq(1)>
  12. ${locator.value.amount} jquery=tender-subject-info>div.row:contains("Повний доступний бюджет закупівлі, грн.:")>:eq(1)>
  13. ${locator.tenderPeriod.startDate} jquery=tender-procedure-info>div.row:contains("Початок прийому пропозицій:")>:eq(1)>
  14. ${locator.tenderPeriod.endDate} jquery=tender-procedure-info>div.row:contains("Завершення прийому пропозицій:")>:eq(1)>
  15. ${locator.enquiryPeriod.startDate} jquery=tender-procedure-info>div.row:contains("Початок періоду уточнень:")>:eq(1)>
  16. ${locator.enquiryPeriod.endDate} jquery=tender-procedure-info>div.row:contains("Завершення періоду уточнень:")>:eq(1)>
  17.  
  18. *** Keywords ***
  19. Підготувати клієнт для користувача
  20. [Arguments] @{ARGUMENTS}
  21. [Documentation] Відкрити брaвзер, створити обєкт api wrapper, тощо
  22. ... ${ARGUMENTS[0]} == username
  23. Open Browser ${BROKERS['${USERS.users['${ARGUMENTS[0]}'].broker}'].url} ${USERS.users['${ARGUMENTS[0]}'].browser} alias=${ARGUMENTS[0]}
  24. Set Window Size @{USERS.users['${ARGUMENTS[0]}'].size}
  25. Set Window Position @{USERS.users['${ARGUMENTS[0]}'].position}
  26.  
  27. # login
  28. Wait Until Page Contains Element name=siteLogin 100
  29. Input text name=siteLogin ${BROKERS['${USERS.users['${username}'].broker}'].login}
  30. Input text name=sitePass ${BROKERS['${USERS.users['${username}'].broker}'].password}
  31. Click Button xpath=.//*[@id='table1']/tbody/tr/td/form/p[3]/input
  32.  
  33. Wait Until Page Contains Element jquery=a[href="/cabinet"]
  34. Click Element jquery=a[href="/cabinet"]
  35. Wait Until Page Contains Element name=email 100
  36. Input text name=email mail
  37. Sleep 1
  38. Input text name=email ${USERS.users['${username}'].login}
  39. Sleep 2
  40. Input text name=psw ${USERS.users['${username}'].password}
  41. Wait Until Page Contains Element xpath=//button[contains(@class, 'btn')][./text()='Вхід в кабінет'] 100
  42. Click Element xpath=//button[contains(@class, 'btn')][./text()='Вхід в кабінет']
  43.  
  44. Створити тендер
  45. [Arguments] @{ARGUMENTS}
  46. [Documentation]
  47. ... ${ARGUMENTS[0]} == username
  48. ... ${ARGUMENTS[1]} == tender_data
  49.  
  50. ${items}= Get From Dictionary ${ARGUMENTS[1].data} items
  51. ${title}= Get From Dictionary ${ARGUMENTS[1].data} title
  52. ${description}= Get From Dictionary ${ARGUMENTS[1].data} description
  53. ${budget}= Get From Dictionary ${ARGUMENTS[1].data.value} amount
  54. ${step_rate}= Get From Dictionary ${ARGUMENTS[1].data.minimalStep} amount
  55. ${items_description}= Get From Dictionary ${ARGUMENTS[1].data} description
  56. ${quantity}= Get From Dictionary ${items[0]} quantity
  57. ${countryName}= Get From Dictionary ${ARGUMENTS[1].data.procuringEntity.address} countryName
  58. ${delivery_end_date}= Get From Dictionary ${items[0].deliveryDate} endDate
  59. ${delivery_end_date}= convert_date_to_slash_format ${delivery_end_date}
  60. ${cpv}= Get From Dictionary ${items[0].classification} description_ua
  61. ${cpv_id}= Get From Dictionary ${items[0].classification} id
  62. ${cpv_id1}= String.Replace String ${cpv_id} - _
  63. ${dkpp_desc}= Get From Dictionary ${items[0].additionalClassifications[0]} description
  64. ${dkpp_id}= Get From Dictionary ${items[0].additionalClassifications[0]} id
  65. ${dkpp_id1}= String.Replace String ${dkpp_id} - _
  66. ${enquiry_end_date}= Get From Dictionary ${ARGUMENTS[1].data.enquiryPeriod} endDate
  67. ${enquiry_end_date}= convert_date_to_slash_format ${enquiry_end_date}
  68. ${end_date}= Get From Dictionary ${ARGUMENTS[1].data.tenderPeriod} endDate
  69. ${end_date}= convert_date_to_slash_format ${end_date}
  70.  
  71. Selenium2Library.Switch Browser ${ARGUMENTS[0]}
  72. Wait Until Page Contains Element jquery=a[href="/tenders/new"] 100
  73. Click Element jquery=a[href="/tenders/new"]
  74. Wait Until Page Contains Element name=tender_title 100
  75. Input text name=tender_title ${title}
  76. Wait Until Page Contains Element name=tender_description 100
  77. Input text name=tender_description ${description}
  78. Wait Until Page Contains Element name=tender_value_amount 100
  79. Input text name=tender_value_amount ${budget}
  80. Wait Until Page Contains Element name=tender_minimalStep_amount 100
  81. Input text name=tender_minimalStep_amount ${step_rate}
  82. Wait Until Page Contains Element name=items[0][item_description] 100
  83. Input text name=items[0][item_description] ${items_description}
  84. Wait Until Page Contains Element name=items[0][item_quantity] 100
  85. Input text name=items[0][item_quantity] ${quantity}
  86. Wait Until Page Contains Element name=items[0][item_deliveryAddress_countryName] 100
  87. Input text name=items[0][item_deliveryAddress_countryName] ${countryName}
  88. Wait Until Page Contains Element name=items[0][item_deliveryDate_endDate] 100
  89. Input text name=items[0][item_deliveryDate_endDate] ${delivery_end_date}
  90. Wait Until Page Contains Element xpath=//a[contains(@data-class, 'cpv')][./text()='Визначити за довідником'] 100
  91. Click Element xpath=//a[contains(@data-class, 'cpv')][./text()='Визначити за довідником']
  92. Select Frame xpath=//iframe[contains(@src,'/js/classifications/cpv/uk.htm?relation=true')]
  93. Input text id=search ${cpv}
  94. Wait Until Page Contains ${cpv_id}
  95. Click Element xpath=//a[contains(@id,'${cpv_id1}')]
  96. Click Element xpath=.//*[@id='select']
  97. Unselect Frame
  98. Wait Until Page Contains Element xpath=//a[contains(@data-class, 'dkpp')][./text()='Визначити за довідником'] 100
  99. Click Element xpath=//a[contains(@data-class, 'dkpp')][./text()='Визначити за довідником']
  100. Select Frame xpath=//iframe[contains(@src,'/js/classifications/dkpp/uk.htm?relation=true')]
  101. Input text id=search ${dkpp_desc}
  102. Wait Until Page Contains ${dkpp_id}
  103. Click Element xpath=//a[contains(@id,'${dkpp_id1}')]
  104. Click Element xpath=.//*[@id='select']
  105. Unselect Frame
  106. Wait Until Page Contains Element name=tender_enquiryPeriod_endDate 100
  107. Input text name=tender_enquiryPeriod_endDate ${enquiry_end_date}
  108. Wait Until Page Contains Element name=tender_tenderPeriod_endDate 100
  109. Input text name=tender_tenderPeriod_endDate ${end_date}
  110. Run Keyword if '${mode}' == 'multi' Додати предмет items
  111. Wait Until Page Contains Element name=do 100
  112. Click Element name=do
  113. Wait Until Page Contains Element xpath=//a[contains(@class, 'button pubBtn')] 100
  114. Click Element xpath=//a[contains(@class, 'button pubBtn')]
  115. Wait Until Page Contains Тендер опубліковано 100
  116. ${tender_UAid}= Get Text xpath=//*/section[6]/table/tbody/tr[2]/td[2]
  117. ${id}= Get Text xpath=//*/section[6]/table/tbody/tr[1]/td[2]
  118. ${Ids} Create List ${tender_UAid} ${id}
  119. [return] ${Ids}
  120.  
  121. Додати предмет
  122. [Arguments] @{ARGUMENTS}
  123. [Documentation]
  124. ... ${ARGUMENTS[0]} == items
  125. ${dkpp_desc1}= Get From Dictionary ${items[1].additionalClassifications[0]} description
  126. ${dkpp_id11}= Get From Dictionary ${items[1].additionalClassifications[0]} id
  127. ${dkpp_1id}= Replace String ${dkpp_id11} - _
  128. ${dkpp_desc2}= Get From Dictionary ${items[2].additionalClassifications[0]} description
  129. ${dkpp_id2}= Get From Dictionary ${items[2].additionalClassifications[0]} id
  130. ${dkpp_id2_1}= Replace String ${dkpp_id2} - _
  131. ${dkpp_desc3}= Get From Dictionary ${items[3].additionalClassifications[0]} description
  132. ${dkpp_id3}= Get From Dictionary ${items[3].additionalClassifications[0]} id
  133. ${dkpp_id3_1}= Replace String ${dkpp_id3} - _
  134.  
  135. Wait Until Page Contains Element xpath=//a[contains(@class, 'addMultiItem')][./text()='Додати предмет закупівлі']
  136. Click Element xpath=//a[contains(@class, 'addMultiItem')][./text()='Додати предмет закупівлі']
  137. Wait Until Page Contains Element name=items[1][item_description] 100
  138. Input text name=items[1][item_description] ${description}
  139. Wait Until Page Contains Element name=items[1][item_quantity] 100
  140. Input text name=items[1][item_quantity] ${quantity}
  141. Wait Until Page Contains Element xpath=(//a[contains(@data-class, 'cpv')][./text()='Визначити за довідником'])[2] 100
  142. Click Element xpath=(//a[contains(@data-class, 'cpv')][./text()='Визначити за довідником'])[2]
  143. Select Frame xpath=//iframe[contains(@src,'/js/classifications/cpv/uk.htm?relation=true')]
  144. Input text id=search ${cpv}
  145. Wait Until Page Contains ${cpv_id}
  146. Click Element xpath=//a[contains(@id,'${cpv_id1}')]
  147. Click Element xpath=.//*[@id='select']
  148. Unselect Frame
  149. Wait Until Page Contains Element xpath=(//a[contains(@data-class, 'dkpp')][./text()='Визначити за довідником'])[2] 100
  150. Click Element xpath=(//a[contains(@data-class, 'dkpp')][./text()='Визначити за довідником'])[2]
  151. Select Frame xpath=//iframe[contains(@src,'/js/classifications/dkpp/uk.htm?relation=true')]
  152. Input text id=search ${dkpp_desc1}
  153. Wait Until Page Contains ${dkpp_id11}
  154. Click Element xpath=//a[contains(@id,'${dkpp_1id}')]
  155. Click Element xpath=.//*[@id='select']
  156. Unselect Frame
  157. Wait Until Page Contains Element xpath=//a[contains(@class, 'addMultiItem')][./text()='Додати предмет закупівлі']
  158. Click Element xpath=//a[contains(@class, 'addMultiItem')][./text()='Додати предмет закупівлі']
  159. Wait Until Page Contains Element name=items[2][item_description] 100
  160. Input text name=items[2][item_description] ${description}
  161. Wait Until Page Contains Element name=items[2][item_quantity] 100
  162. Input text name=items[2][item_quantity] ${quantity}
  163. Wait Until Page Contains Element xpath=(//a[contains(@data-class, 'cpv')][./text()='Визначити за довідником'])[3] 100
  164. Click Element xpath=(//a[contains(@data-class, 'cpv')][./text()='Визначити за довідником'])[3]
  165. Select Frame xpath=//iframe[contains(@src,'/js/classifications/cpv/uk.htm?relation=true')]
  166. Input text id=search ${cpv}
  167. Wait Until Page Contains ${cpv_id}
  168. Click Element xpath=//a[contains(@id,'${cpv_id1}')]
  169. Click Element xpath=.//*[@id='select']
  170. Unselect Frame
  171. Wait Until Page Contains Element xpath=(//a[contains(@data-class, 'dkpp')][./text()='Визначити за довідником'])[3] 100
  172. Click Element xpath=(//a[contains(@data-class, 'dkpp')][./text()='Визначити за довідником'])[3]
  173. Select Frame xpath=//iframe[contains(@src,'/js/classifications/dkpp/uk.htm?relation=true')]
  174. Input text id=search ${dkpp_desc2}
  175. Wait Until Page Contains ${dkpp_id2}
  176. Click Element xpath=//a[contains(@id,'${dkpp_id2_1}')]
  177. Click Element xpath=.//*[@id='select']
  178. Unselect Frame
  179. Wait Until Page Contains Element xpath=//a[contains(@class, 'addMultiItem')][./text()='Додати предмет закупівлі']
  180. Click Element xpath=//a[contains(@class, 'addMultiItem')][./text()='Додати предмет закупівлі']
  181. Wait Until Page Contains Element name=items[3][item_description] 100
  182. Input text name=items[3][item_description] ${description}
  183. Wait Until Page Contains Element name=items[3][item_quantity] 100
  184. Input text name=items[3][item_quantity] ${quantity}
  185. Wait Until Page Contains Element xpath=(//a[contains(@data-class, 'cpv')][./text()='Визначити за довідником'])[4] 100
  186. Click Element xpath=(//a[contains(@data-class, 'cpv')][./text()='Визначити за довідником'])[4]
  187. Select Frame xpath=//iframe[contains(@src,'/js/classifications/cpv/uk.htm?relation=true')]
  188. Input text id=search ${cpv}
  189. Wait Until Page Contains ${cpv_id}
  190. Click Element xpath=//a[contains(@id,'${cpv_id1}')]
  191. Click Element xpath=.//*[@id='select']
  192. Unselect Frame
  193. Wait Until Page Contains Element xpath=(//a[contains(@data-class, 'dkpp')][./text()='Визначити за довідником'])[4] 100
  194. Click Element xpath=(//a[contains(@data-class, 'dkpp')][./text()='Визначити за довідником'])[4]
  195. Select Frame xpath=//iframe[contains(@src,'/js/classifications/dkpp/uk.htm?relation=true')]
  196. Input text id=search ${dkpp_desc3}
  197. Wait Until Page Contains ${dkpp_id3}
  198. Click Element xpath=//a[contains(@id,'${dkpp_id3_1}')]
  199. Click Element xpath=.//*[@id='select']
  200. Unselect Frame
  201. Wait Until Page Contains Element name=tender_enquiryPeriod_endDate 100
  202. Input text name=tender_enquiryPeriod_endDate ${enquiry_end_date}
  203. Wait Until Page Contains Element name=tender_tenderPeriod_endDate 100
  204. Input text name=tender_tenderPeriod_endDate ${end_date}
  205.  
  206.  
  207. Пошук тендера по ідентифікатору
  208. [Arguments] @{ARGUMENTS}
  209. [Documentation]
  210. ... ${ARGUMENTS[0]} == username
  211. ... ${ARGUMENTS[1]} == tenderId
  212. ... ${ARGUMENTS[2]} == id
  213. Switch browser ${ARGUMENTS[0]}
  214. ${current_location}= Get Location
  215. Run keyword if '${BROKERS['${USERS.users['${username}'].broker}'].url}/#/tenderDetailes/${ARGUMENTS[2]}'=='${current_location}' Reload Page
  216. Go to ${BROKERS['${USERS.users['${username}'].broker}'].url}
  217. Wait Until Page Contains E-TENDER - центр електронної торгівлі 10
  218. sleep 1
  219. Input Text jquery=input[ng-change='search()'] ${ARGUMENTS[1]}
  220. Click Link jquery=a[ng-click='search()']
  221. sleep 2
  222. ${last_note_id}= Add pointy note jquery=a[href^="#/tenderDetailes"] Found tender with tenderID "${ARGUMENTS[1]}" width=200 position=bottom
  223. sleep 1
  224. Remove element ${last_note_id}
  225. Click Link jquery=a[href^="#/tenderDetailes"]
  226. Wait Until Page Contains ${ARGUMENTS[1]} 10
  227. sleep 1
  228. Capture Page Screenshot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement