Advertisement
yboi

Untitled

Jul 23rd, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.98 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. ${INITIAL_TENDER_DATA}= prepare_test_tender_data
  21. [return] ${INITIAL_TENDER_DATA}
  22.  
  23. Підготувати клієнт для користувача
  24. [Arguments] @{ARGUMENTS}
  25. [Documentation] Відкрити брaвзер, створити обєкт api wrapper, тощо
  26. ... ${ARGUMENTS[0]} == username
  27. Open Browser ${BROKERS['${USERS.users['${ARGUMENTS[0]}'].broker}'].url} ${USERS.users['${ARGUMENTS[0]}'].browser} alias=${ARGUMENTS[0]}
  28. Set Window Size @{USERS.users['${ARGUMENTS[0]}'].size}
  29. Set Window Position @{USERS.users['${ARGUMENTS[0]}'].position}
  30.  
  31. # login
  32. Wait Until Page Contains Element name=siteLogin 100
  33. Input text name=siteLogin ${BROKERS['${USERS.users['${username}'].broker}'].login}
  34. Input text name=sitePass ${BROKERS['${USERS.users['${username}'].broker}'].password}
  35. Click Button xpath=.//*[@id='table1']/tbody/tr/td/form/p[3]/input
  36.  
  37. Wait Until Page Contains Element jquery=a[href="/cabinet"]
  38. Click Element jquery=a[href="/cabinet"]
  39. Wait Until Page Contains Element name=email 100
  40. Input text name=email 1
  41. Sleep 1
  42. Input text name=email ${USERS.users['${username}'].login}
  43. Sleep 2
  44. #Wait Until Page Contains Element name=psw 100
  45. Input text name=psw ${USERS.users['${username}'].password}
  46. Wait Until Page Contains Element xpath=//button[contains(@class, 'btn')][./text()='Вхід в кабінет'] 100
  47. Click Element xpath=//button[contains(@class, 'btn')][./text()='Вхід в кабінет']
  48.  
  49. Створити тендер
  50. [Arguments] @{ARGUMENTS}
  51. [Documentation]
  52. ... ${ARGUMENTS[0]} == username
  53. ... ${ARGUMENTS[1]} == tender_data
  54.  
  55. ${items}= Get From Dictionary ${ARGUMENTS[1].data} items
  56. ${title}= Get From Dictionary ${ARGUMENTS[1].data} title
  57. ${description}= Get From Dictionary ${ARGUMENTS[1].data} description
  58. ${budget}= Get From Dictionary ${ARGUMENTS[1].data.value} amount
  59. ${step_rate}= Get From Dictionary ${ARGUMENTS[1].data.minimalStep} amount
  60. ${items_description}= Get From Dictionary ${ARGUMENTS[1].data} description
  61. ${quantity}= Get From Dictionary ${items[0]} quantity
  62. ${countryName}= Get From Dictionary ${ARGUMENTS[1].data.procuringEntity.address} countryName
  63. ${delivery_end_date}= Get From Dictionary ${items[0].deliveryDate} endDate
  64. ${delivery_end_date}= convert_date_to_etender_format ${delivery_end_date}
  65. ${cpv}= Get From Dictionary ${items[0].classification} description_ua
  66. ${cpv_id}= Get From Dictionary ${items[0].classification} id
  67. ${dkpp_desc}= Get From Dictionary ${items[0].additionalClassifications[0]} description
  68. ${dkpp_id}= Get From Dictionary ${items[0].additionalClassifications[0]} id
  69. ${enquiry_end_date}= Get From Dictionary ${ARGUMENTS[1].data.enquiryPeriod} endDate
  70. ${enquiry_end_date}= convert_date_to_etender_format ${enquiry_end_date}
  71. ${end_date}= Get From Dictionary ${ARGUMENTS[1].data.tenderPeriod} endDate
  72. ${end_date}= convert_date_to_etender_format ${end_date}
  73.  
  74. Selenium2Library.Switch Browser ${ARGUMENTS[0]}
  75. Wait Until Page Contains Element jquery=a[href="/tenders/new"] 100
  76. Click Element jquery=a[href="/tenders/new"]
  77. Wait Until Page Contains Element name=tender_title 100
  78. Input text name=tender_title ${title}
  79. Wait Until Page Contains Element name=tender_description 100
  80. Input text name=tender_description ${description}
  81. Wait Until Page Contains Element name=tender_value_amount 100
  82. Input text name=tender_value_amount ${budget}
  83. Wait Until Page Contains Element name=tender_minimalStep_amount 100
  84. Input text name=tender_minimalStep_amount ${step_rate}
  85. Wait Until Page Contains Element name=items[0][item_description] 100
  86. Input text name=items[0][item_description] ${items_description}
  87. Wait Until Page Contains Element name=items[0][item_quantity] 100
  88. Input text name=items[0][item_quantity] ${quantity}
  89. Wait Until Page Contains Element name=items[0][item_deliveryAddress_countryName] 100
  90. Input text name=items[0][item_deliveryAddress_countryName] ${countryName}
  91. Wait Until Page Contains Element name=items[0][item_deliveryDate_endDate] 100
  92. Input text name=items[0][item_deliveryDate_endDate] ${delivery_end_date}
  93. Wait Until Page Contains Element xpath=//a[contains(@data-class, 'cpv')][./text()='Визначити за довідником'] 100
  94. Click Element xpath=//a[contains(@data-class, 'cpv')][./text()='Визначити за довідником']
  95. Select Frame xpath=//iframe[contains(@src,'/js/classifications/cpv/uk.htm?relation=true')]
  96. Input text id=search ${cpv}
  97. #Sleep 2
  98. Wait Until Page Contains ${cpv_id}
  99. Click Element xpath=//a[contains(@class,'jstree-anchor')]
  100. Click Element xpath=.//*[@id='select']
  101. Unselect Frame
  102. Wait Until Page Contains Element xpath=//a[contains(@data-class, 'dkpp')][./text()='Визначити за довідником'] 100
  103. Click Element xpath=//a[contains(@data-class, 'dkpp')][./text()='Визначити за довідником']
  104. Select Frame xpath=//iframe[contains(@src,'/js/classifications/dkpp/uk.htm?relation=true')]
  105. Input text id=search ${dkpp_desc}
  106. #Sleep 2
  107. Wait Until Page Contains ${dkpp_id}
  108. Click Element xpath=//a[contains(@id,'${dkpp_id}')]
  109. Click Element xpath=.//*[@id='select']
  110. Unselect Frame
  111. Wait Until Page Contains Element name=tender_enquiryPeriod_endDate 100
  112. Input text name=tender_enquiryPeriod_endDate ${enquiry_end_date}
  113. Wait Until Page Contains Element name=tender_tenderPeriod_endDate 100
  114. Input text name=tender_tenderPeriod_endDate ${end_date}
  115. DEBUG
  116.  
  117. Пошук тендера по ідентифікатору
  118. [Arguments] @{ARGUMENTS}
  119. [Documentation]
  120. ... ${ARGUMENTS[0]} == username
  121. ... ${ARGUMENTS[1]} == tenderId
  122. ... ${ARGUMENTS[2]} == id
  123. Switch browser ${ARGUMENTS[0]}
  124. ${current_location}= Get Location
  125. Run keyword if '${BROKERS['${USERS.users['${username}'].broker}'].url}/#/tenderDetailes/${ARGUMENTS[2]}'=='${current_location}' Reload Page
  126. Go to ${BROKERS['${USERS.users['${username}'].broker}'].url}
  127. Wait Until Page Contains E-TENDER - центр електронної торгівлі 10
  128. sleep 1
  129. Input Text jquery=input[ng-change='search()'] ${ARGUMENTS[1]}
  130. Click Link jquery=a[ng-click='search()']
  131. sleep 2
  132. ${last_note_id}= Add pointy note jquery=a[href^="#/tenderDetailes"] Found tender with tenderID "${ARGUMENTS[1]}" width=200 position=bottom
  133. sleep 1
  134. Remove element ${last_note_id}
  135. Click Link jquery=a[href^="#/tenderDetailes"]
  136. Wait Until Page Contains ${ARGUMENTS[1]} 10
  137. sleep 1
  138. Capture Page Screenshot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement