playtender_bid.robot 9.17 KB
*** Settings ***

Resource                                                        playtender_common.robot
Resource                                                        playtender_variables.robot
Resource                                                        playtender_bid_variables.robot

*** Keywords ***


fill bid form
    [Arguments]                                                 ${tender_uaid}  ${bid}  ${lots_ids}  ${features_ids}
    [Documentation]                                             Подати цінову пропозицію bid для тендера tender_uaid на лоти lots_ids (якщо lots_ids != None) з неціновими показниками features_ids (якщо features_ids != None).

    click visible element                                       ${bid_form_open_btn_locator}
    capture page screenshot
    wait until popup is visible
    ${value} =                                                  get from dictionary by keys  ${bid}  value  amount
    ${amount} =                                                 run keyword if condition is not none  ${value}  convert_float_to_string  ${bid.data.value.amount}
    run keyword if condition is not none                        ${value}  input number to exist visible input   ${bid_form_value_amount_input_locator}  ${amount}
    ${value_yearly_payments_percentage} =                       get from dictionary by keys  ${bid}  value  yearlyPaymentsPercentage
    ${yearly_payments_percentage} =                             run keyword if condition is not none  ${value_yearly_payments_percentage}  convert_float_to_string  ${bid.data.value.yearlyPaymentsPercentage}
    run keyword if condition is not none                        ${value}  input number5 to exist visible input   ${bid_form_value_yearly_payments_percentage_input_locator}  ${yearly_payments_percentage}
    ${contract_duration_years} =                                get from dictionary by keys  ${bid}  value  contractDuration  years
    run keyword if condition is not none                        ${contract_duration_years}  input text to exist visible input   ${bid_form_value_contract_duration_years_input_locator}  ${bid.data.value.contractDuration.years}
    ${contract_duration_days} =                                 get from dictionary by keys  ${bid}  value  contractDuration  days
    run keyword if condition is not none                        ${contract_duration_days}  input text to exist visible input   ${bid_form_value_contract_duration_days_input_locator}  ${bid.data.value.contractDuration.days}
    ${annual_costs_reduction} =                                 get from dictionary by keys  ${bid}  value  annualCostsReduction
    run keyword if condition is not none                        ${annual_costs_reduction}  Подати цінову пропозицію Esco AnnualCostsReduction  ${value.annualCostsReduction}
#    ${lots} =                                                   get from dictionary by keys  ${data}  lots
    run keyword if condition is not none                        ${lots_ids}  fill bid form lots  ${bid}
#    run keyword if condition is none                            ${lots_ids}  fill bid form whithout lots  ${bid}
#    ${features} =                                               get from dictionary by keys  ${data}  features
#    run keyword if condition is not none                        ${features_ids}  fill bid form features  ${bid}  ${tender_form_general_panel_add_feature_btn_locator}
    fill bid required documents_all
    submit form and check result                                ${bid_form_submit_btn_locator}  ${bid_form_submit_success_msg}  ${tender_created_checker_element_locator}

fill bid form lots
    [Arguments]                                                 ${bid}  ${lots_ids}  ${features_ids}
    [Documentation]                                             Заповнити лотову цінову пропозицію bid для тендера tender_uaid на лоти lots_ids з неціновими показниками features_ids (якщо features_ids != None).

    ${lots} =                                                   get from dictionary by keys  ${bid}  lotValues
    ${lots_length} =                                            Get Length  ${lots}
    : FOR  ${INDEX}  IN RANGE  0  ${lots_length}
    \  ${amount} =                                              convert_float_to_string  ${bid.data.value.amount}
    \  run keyword and ignore error                             input number to exist visible input   ${bid_form_value_amount_input_locator}  ${amount}
    \  ${self_qualified} =                                      get from dictionary by keys  ${bid}  selfQualified
    \  run keyword and ignore error                             ${self_qualified}  click visible element  ${bid_form_value_self_qualified_input_locator}
    \  ${self_eligible} =                                       get from dictionary by keys  ${bid}  selfEligible
    \  run keyword if condition is not none                     ${self_eligible}  click visible element  ${bid_form_value_self_eligible_input_locator}
    \  run keyword if condition is not none                     ${features_ids}  fill bid form features  ${bid.data.parameters}

fill bid form features
    [Arguments]                                                 ${bid_parameters}
    [Documentation]                                             Заповнити нецінові показники цінової пропозиції.

    ${features_length} =                                        Get Length  ${bid_parameters}
    : FOR  ${INDEX}  IN RANGE  0  ${features_length}
    \  ${bid_form_feature_input_locator}                        replace string  ${bid_form_feature_input_locator_tpl}  %title%  ${features[${INDEX}]['code']}
    \  Run Keyword And Ignore Error                             click visible element  ${bid_form_feature_input_locator}
    \  Run Keyword And Ignore Error                             Select From List By Label     ${bid_form_feature_input_locator}  ${features[${INDEX}]['value']}

Подати цінову пропозицію Esco AnnualCostsReduction
    [Arguments]                                                 ${values}
    [Documentation]                                             Заповнити цінову пропозицію Esco (параметр AnnualCostsReduction).

    ${input_index } =                                           set variable  1
    : FOR  ${value}  IN  @{values}
    \  ${bid_form_value_annual_costs_reduction_input_locator}  replace string  ${bid_form_value_annual_costs_reduction_input_locator_tpl}  %index%  ${input_index}
    \  input float                                             ${bid_form_value_annual_costs_reduction_input_locator}  ${value}
    \  ${input_index} =                                        evaluate  ${input_index} + 1

fill bid required documents_all
    [Arguments]                                                 ${values}
    [Documentation]                                             Додати фейковий документ до цінової пропозиції при створенні.

    ${file_path}  ${file_name}  ${file_content} =               create_fake_doc
    click visible element                                       ${bid_form_add_document_all_btn_locator}
    choose file                                                 ${add_file_to_form_locator}  ${file_path}
    wait until element is visible                               ${bid_form_add_document_type_input_locator}  ${waiting_timeout}  ${waiting_error}
#    submit current visible popup
    Run Keyword And Ignore Error                                Select From List By Value  ${bid_form_add_document_type_input_locator}  qualificationDocuments
    click visible element                                       ${bid_form_add_document_description_btn_locator}
    wait until element is visible                               ${bid_form_add_document_description_input_locator}  ${waiting_timeout}  ${waiting_error}
    input text to exist visible input                           ${bid_form_add_document_description_input_locator}  test2
    click visible element                                       ${bid_form_add_document_close_description_btn_locator}

fill bid form edit
    [Arguments]                                                 ${tender_uaid}  ${fieldname}  ${fieldvalue}
    [Documentation]                                             Змінити поле fieldname на fieldvalue цінової пропозиції користувача username для тендера tender_uaid.

    click visible element                                       ${bid_form_open_btn_locator}
    wait until popup is visible
    Run Keyword If                                              '${fieldname}' == 'lotValues[0].value.amount' and '${mode}' != 'esco'  Run Keywords
    ...  ${amount} =                                            convert_float_to_string  ${fieldvalue}
    ...  input number to exist visible input                    ${bid_form_value_amount_input_locator}  ${amount}
    submit form and check result                                ${bid_form_submit_btn_locator}  ${bid_form_submit_edit_success_msg}  ${tender_created_checker_element_locator}