Blame view

op_robot_tests/tests_files/brokers/prom.robot 5.05 KB
1
*** Settings ***
Andrew Yanovych authored
2 3 4
Library  Selenium2Screenshots
Library  String
Library  DateTime
selurvedu authored
5 6
Library  Selenium2Library
Library  Collections
7 8

*** Variables ***
selurvedu authored
9 10
${HOMEPAGE}     http://my.dz-test.net/cabinet/sign-in?sp=1&next=%2Fcabinet%2Fpurchases%2Fstate_purchase
${BROWSER}      chrome
11 12
${LOGIN}        r.zaporozhets@smartweb.com.ua
${PASSWORD}     1234
Andrew Yanovych authored
13 14

*** Keywords ***
15
Підготувати дані для оголошення тендера
16 17 18
  ${INITIAL_TENDER_DATA}=  prepare_prom_test_tender_data
  [return]   ${INITIAL_TENDER_DATA}
Andrew Yanovych authored
19 20
Підготувати клієнт для користувача
  [Arguments]  ${username}
21 22
  log many  @{ARGUMENTS}
  log  ${username}
Andrew Yanovych authored
23 24 25
  [Documentation]  Відкрити брaвзер, створити обєкт api wrapper, тощо
  Open Browser   ${BROKERS['${USERS.users['${username}'].broker}'].url}   ${USERS.users['${username}'].browser}   alias=${username}
  Set Window Position   @{USERS.users['${username}'].position}
26
  #Set Window Size       @{USERS.users['${username}'].size}
Andrew Yanovych authored
27 28
  Log Variables
29
Go to homepage
30 31
    [Arguments]  ${username}
    Switch Browser  ${username}
32 33 34
    Go To   ${HOMEPAGE}

Login
Roman Zaporozhets authored
35
    Wait Until Page Contains Element    id=phone_email   100
36 37 38 39 40 41 42
    Input text    id=phone_email    ${LOGIN}
    Input text    id=password    ${PASSWORD}
    Click Button    id=submit_login_button

Створити тендер
    [Arguments]  @{ARGUMENTS}
    log many  @{ARGUMENTS}
43
    Go to homepage   ${ARGUMENTS[0]}
44
45 46 47
    Login

    ${start_date}=    Get From Dictionary  ${ARGUMENTS[1].data.tenderPeriod}   startDate
48
    ${start_date}=   convert_date_to_prom_format   ${start_date}
49
    ${end_date}=      Get From Dictionary  ${ARGUMENTS[1].data.tenderPeriod}   endDate
50
    ${end_date}=   convert_date_to_prom_format   ${end_date}
51
    ${enquiry_end_date}=      Get From Dictionary  ${ARGUMENTS[1].data.enquiryPeriod}   endDate
52
    ${enquiry_end_date}=   convert_date_to_prom_format   ${enquiry_end_date}
53 54 55 56 57 58 59 60

    ${items}=  Get From Dictionary    ${ARGUMENTS[1].data}   items
    ${delivery_date}=  Get From Dictionary    ${items[0].deliveryDate}   endDate
    ${title}=   Get From Dictionary    ${ARGUMENTS[1].data}   title
    ${description}=  Get From Dictionary    ${ARGUMENTS[1].data}   description
    ${quantity}=  Get From Dictionary    ${items[0]}   quantity
    ${budget}=  Get From Dictionary    ${ARGUMENTS[1].data.value}   amount
    ${step_rate}=  Get From Dictionary    ${ARGUMENTS[1].data.minimalStep}   amount
61 62
    ${cpv}=  Get From Dictionary    ${items[0].classification}   scheme
    ${dkpp}=  Get From Dictionary    ${items[0].additionalClassifications[0]}   scheme
63
64
    Wait Until Page Contains Element     id=js-btn-0
65
    Click Element    id=js-btn-0
66
    Wait Until Page Contains Element     id=title
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
    Input text    id=title      ${title}
    Input text    id=descr      ${description}
    Input text    id=quantity      ${quantity}
    Input text    id=amount      ${budget}
    Click Element    xpath=//a[contains(@data-target, 'container-cpv')]
    Click Element    xpath=//div[contains(@class, 'qa_container_cpv_popup')]//input[@type='checkbox'][@value='16662']
    Click Element    xpath=//div[contains(@class, 'qa_container_cpv_popup')]//a[contains(@data-target, 'classifiers-inputs-cpv')]

    Click Element    xpath=//a[contains(@data-target, 'container-dkpp')]
    Click Element    xpath=//div[contains(@class, 'qa_container_dkpp_popup')]//input[@type='checkbox'][@value='4']
    Click Element    xpath=//div[contains(@class, 'qa_container_dkpp_popup')]//a[contains(@data-target, 'classifiers-inputs-dkpp')]
    Input text  id=dt_enquiry   ${enquiry_end_date}
    Input text  id=dt_tender_start   ${start_date}
    Input text  id=dt_tender_end    ${end_date}
    Input text  id=step   ${step_rate}
    Click Button    id=submit_button
83
84 85
    Wait Until Page Contains Element     xpath=//td[@id="qa_state_purchase_id"]/p
selurvedu authored
86
    ${id}=   Wait Until Keyword Succeeds   240sec   2sec   Get tender id
87
    [return]  ${id}
88
selurvedu authored
89
Get tender id
90 91
    ${id}=  Get Text  xpath=//td[@id="qa_state_purchase_id"]/p
    Should Not Be Equal As Strings   ${id}   ожидание...
92 93
    [return]  ${id}
Andrew Yanovych authored
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
Пошук тендера по ідентифікатору
  [Arguments]  @{ARGUMENTS}
  [Documentation]
  ...      ${ARGUMENTS[0]} ==  username
  ...      ${ARGUMENTS[1]} ==  tenderId
  ...      ${ARGUMENTS[2]} ==  id
  Switch browser   ${ARGUMENTS[0]}
  ${current_location}=   Get Location
  Run keyword if   '${BROKERS['${USERS.users['${username}'].broker}'].url}/#/tenderDetailes/${ARGUMENTS[2]}'=='${current_location}'  Reload Page
  Go to   ${BROKERS['${USERS.users['${username}'].broker}'].url}
  Wait Until Page Contains   Допороговые закупки Украины   10
  sleep  1
  Input Text   id=search  ${ARGUMENTS[1]}
  Click Button   id=search_submit
  sleep  2
  ${last_note_id}=  Add pointy note   jquery=a[href^="#/tenderDetailes"]   Found tender with tenderID "${ARGUMENTS[1]}"   width=200  position=bottom
  sleep  1
  Remove element   ${last_note_id}
  Click Link    jquery=a[href^="#/tenderDetailes"]
  Wait Until Page Contains    ${ARGUMENTS[1]}   10
  sleep  1
Roman Zaporozhets authored
115 116
  Capture Page Screenshot