<commit_before>*** Settings ***
Library  Selenium2Screenshots
Library  String
Library  DateTime
Library  newtend_service.py

*** Variables ***
${locator.title}                     xpath=//div[@ng-bind="tender.title"]
${locator.description}               xpath=//div[@ng-bind="tender.description"]
${locator.edit.description}          name=tenderDescription
${locator.value.amount}              xpath=//div[@ng-bind="tender.value.amount"]
${locator.minimalStep.amount}        xpath=//div[@ng-bind="tender.minimalStep.amount"]
${locator.tenderId}                  xpath=//a[@class="ng-binding ng-scope"]
${locator.procuringEntity.name}      xpath=//div[@ng-bind="tender.procuringEntity.name"]
${locator.enquiryPeriod.StartDate}   id=start-date-qualification
${locator.enquiryPeriod.endDate}     id=end-date-qualification
${locator.tenderPeriod.startDate}    id=start-date-registration
${locator.tenderPeriod.endDate}      id=end-date-registration
${locator.items[0].deliveryAddress}                             id=deliveryAddress
${locator.items[0].deliveryDate.endDate}                        id=end-date-delivery
${locator.items[0].description}                                 xpath=//div[@ng-bind="item.description"]
${locator.items[0].classification.scheme}                       id=classifier
${locator.items[0].classification.scheme.title}                 xpath=//label[contains(., "Классификатор CPV")]
${locator.items[0].additional_classification[0].scheme}         id=classifier2
${locator.items[0].additional_classification[0].scheme.title}   xpath=//label[@for="classifier2"]
${locator.items[0].quantity}                                    id=quantity
${locator.items[0].unit.name}                                   xpath=//span[@class="unit ng-binding"]
${locator.edit_tender}     xpath=//button[@ng-if="actions.can_edit_tender"]
${locator.edit.add_item}   xpath=//a[@class="icon-black plus-black remove-field ng-scope"]
${locator.save}            xpath=//button[@class="btn btn-lg btn-default cancel pull-right ng-binding"]
${locator.QUESTIONS[0].title}         xpath=//span[@class="user ng-binding"]
${locator.QUESTIONS[0].description}   xpath=//span[@class="question-description ng-binding"]
${locator.QUESTIONS[0].date}          xpath=//span[@class="date ng-binding"]

*** Keywords ***
Підготувати дані для оголошення тендера
  ${INITIAL_TENDER_DATA}=  prepare_test_tender_data
  ${INITIAL_TENDER_DATA}=  Add_data_for_GUI_FrontEnds  ${INITIAL_TENDER_DATA}
  ${INITIAL_TENDER_DATA}=  Update_data_for_Newtend  ${INITIAL_TENDER_DATA}
  [return]   ${INITIAL_TENDER_DATA}

Підготувати клієнт для користувача
  [Arguments]  @{ARGUMENTS}
  [Documentation]  Відкрити браузер, створити об’єкт api wrapper, тощо
  ...      ${ARGUMENTS[0]} ==  username
  Open Browser
  ...      ${USERS.users['${ARGUMENTS[0]}'].homepage}
  ...      ${USERS.users['${ARGUMENTS[0]}'].browser}
  ...      alias=${ARGUMENTS[0]}
  Set Window Size   @{USERS.users['${ARGUMENTS[0]}'].size}
  Set Window Position   @{USERS.users['${ARGUMENTS[0]}'].position}
  Run Keyword If   '${username}' != 'Newtend_Viewer'   Login

Login
  Wait Until Page Contains Element   id=indexpage_login   20
  Click Element   id=indexpage_login
  Wait Until Page Contains Element   id=password   20
  Input text   id=login-email   ${USERS.users['${username}'].login}
  Input text   id=password   ${USERS.users['${username}'].password}
  Click Element   id=submit-login-button
  Wait Until Page Contains Element   xpath =//a[@class="close-modal-dialog"]  20
  Go to   ${USERS.users['${ARGUMENTS[0]}'].homepage}
#  Wait Until Page Contains Element   xpath=//div[@class="introjs-overlay"]   20

Створити тендер
  [Arguments]  @{ARGUMENTS}
  [Documentation]
  ...      ${ARGUMENTS[0]} ==  username
  ...      ${ARGUMENTS[1]} ==  initial_tender_data
## Initialisation
  #${prepared_tender_data}=   Add_data_for_GUI_FrontEnds   ${ARGUMENTS[1]}
  ${INITIAL_TENDER_DATA}=  Add_data_for_GUI_FrontEnds  ${INITIAL_TENDER_DATA}
  ${INITIAL_TENDER_DATA}=  Update_data_for_Newtend  ${INITIAL_TENDER_DATA}
  ${items}=         Get From Dictionary   ${INITIAL_TENDER_DATA.data}               items
  ${title}=         Get From Dictionary   ${INITIAL_TENDER_DATA.data}               title
  ${description}=   Get From Dictionary   ${INITIAL_TENDER_DATA.data}               description
  ${budget}=        Get From Dictionary   ${INITIAL_TENDER_DATA.data.value}         amount
  ${step_rate}=     Get From Dictionary   ${INITIAL_TENDER_DATA.data.minimalStep}   amount
  ${start_date}=           Get From Dictionary   ${INITIAL_TENDER_DATA.data.tenderPeriod}    startDate
  ${end_date}=             Get From Dictionary   ${INITIAL_TENDER_DATA.data.tenderPeriod}    endDate
  ${enquiry_start_date}=   Get From Dictionary   ${INITIAL_TENDER_DATA.data.enquiryPeriod}   startDate
  ${enquiry_end_date}=     Get From Dictionary   ${INITIAL_TENDER_DATA.data.enquiryPeriod}   endDate

  Selenium2Library.Switch Browser    ${ARGUMENTS[0]}
  Go To                              ${USERS.users['${username}'].homepage}
  Wait Until Page Contains Element   xpath=//a[@href="#/create-tender"]   100
  Click Link                         xpath=//a[@href="#/create-tender"]
  Wait Until Page Contains           Новый тендер   100
# Input fields tender
  Input text   name=tenderName       ${title}<commit_msg>Drop INITIAL_TENDER_DATA in brokers/newtend.robot<commit_after>*** Settings ***
Library  Selenium2Screenshots
Library  String
Library  DateTime
Library  newtend_service.py

*** Variables ***
${locator.title}                     xpath=//div[@ng-bind="tender.title"]
${locator.description}               xpath=//div[@ng-bind="tender.description"]
${locator.edit.description}          name=tenderDescription
${locator.value.amount}              xpath=//div[@ng-bind="tender.<EMAIL>"]
${locator.minimalStep.amount}        xpath=//div[@ng-bind="tender.minimalStep.amount"]
${locator.tenderId}                  xpath=//a[@class="ng-binding ng-scope"]
${locator.procuringEntity.name}      xpath=//div[@ng-bind="tender.procuringEntity.name"]
${locator.enquiryPeriod.StartDate}   id=start-date-qualification
${locator.enquiryPeriod.endDate}     id=end-date-qualification
${locator.tenderPeriod.startDate}    id=start-date-registration
${locator.tenderPeriod.endDate}      id=end-date-registration
${locator.items[0].deliveryAddress}                             id=deliveryAddress
${locator.items[0].deliveryDate.endDate}                        id=end-date-delivery
${locator.items[0].description}                                 xpath=//div[@ng-bind="item.description"]
${locator.items[0].classification.scheme}                       id=classifier
${locator.items[0].classification.scheme.title}                 xpath=//label[contains(., "Классификатор CPV")]
${locator.items[0].additional_classification[0].scheme}         id=classifier2
${locator.items[0].additional_classification[0].scheme.title}   xpath=//label[@for="classifier2"]
${locator.items[0].quantity}                                    id=quantity
${locator.items[0].unit.name}                                   xpath=//span[@class="unit ng-binding"]
${locator.edit_tender}     xpath=//button[@ng-if="actions.can_edit_tender"]
${locator.edit.add_item}   xpath=//a[@class="icon-black plus-black remove-field ng-scope"]
${locator.save}            xpath=//button[@class="btn btn-lg btn-default cancel pull-right ng-binding"]
${locator.QUESTIONS[0].title}         xpath=//span[@class="user ng-binding"]
${locator.QUESTIONS[0].description}   xpath=//span[@class="question-description ng-binding"]
${locator.QUESTIONS[0].date}          xpath=//span[@class="date ng-binding"]

*** Keywords ***
Підготувати дані для оголошення тендера
  ${INITIAL_TENDER_DATA}=  prepare_test_tender_data
  ${INITIAL_TENDER_DATA}=  Add_data_for_GUI_FrontEnds  ${INITIAL_TENDER_DATA}
  ${INITIAL_TENDER_DATA}=  Update_data_for_Newtend  ${INITIAL_TENDER_DATA}
  [return]   ${INITIAL_TENDER_DATA}

Підготувати клієнт для користувача
  [Arguments]  @{ARGUMENTS}
  [Documentation]  Відкрити браузер, створити об’єкт api wrapper, тощо
  ...      ${ARGUMENTS[0]} ==  username
  Open Browser
  ...      ${USERS.users['${ARGUMENTS[0]}'].homepage}
  ...      ${USERS.users['${ARGUMENTS[0]}'].browser}
  ...      alias=${ARGUMENTS[0]}
  Set Window Size   @{USERS.users['${ARGUMENTS[0]}'].size}
  Set Window Position   @{USERS.users['${ARGUMENTS[0]}'].position}
  Run Keyword If   '${username}' != 'Newtend_Viewer'   Login

Login
  Wait Until Page Contains Element   id=indexpage_login   20
  Click Element   id=indexpage_login
  Wait Until Page Contains Element   id=password   20
  Input text   id=login-email   ${USERS.users['${username}'].login}
  Input text   id=password   ${USERS.users['${username}'].password}
  Click Element   id=submit-login-button
  Wait Until Page Contains Element   xpath =//a[@class="close-modal-dialog"]  20
  Go to   ${USERS.users['${ARGUMENTS[0]}'].homepage}
#  Wait Until Page Contains Element   xpath=//div[@class="introjs-overlay"]   20

Створити тендер
  [Arguments]  @{ARGUMENTS}
  [Documentation]
  ...      ${ARGUMENTS[0]} ==  username
  ...      ${ARGUMENTS[1]} ==  tender_data
## Initialisation
  ${prepared_tender_data}=  Add_data_for_GUI_FrontEnds  ${ARGUMENTS[1]}
  ${prepared_tender_data}=  Update_data_for_Newtend  ${prepared_tender_data}
  ${items}=         Get From Dictionary   ${prepared_tender_data.data}               items
  ${title}=         Get From Dictionary   ${prepared_tender_data.data}               title
  ${description}=   Get From Dictionary   ${prepared_tender_data.data}               description
  ${budget}=        Get From Dictionary   ${prepared_tender_data.data.value}         amount
  ${step_rate}=     Get From Dictionary   ${prepared_tender_data.data.minimalStep}   amount
  ${start_date}=           Get From Dictionary   ${prepared_tender_data.data.tenderPeriod}    startDate
  ${end_date}=             Get From Dictionary   ${prepared_tender_data.data.tenderPeriod}    endDate
  ${enquiry_start_date}=   Get From Dictionary   ${prepared_tender_data.data.enquiryPeriod}   startDate
  ${enquiry_end_date}=     Get From Dictionary   ${prepared_tender_data.data.enquiryPeriod}   endDate

  Selenium2Library.Switch Browser    ${ARGUMENTS[0]}
  Go To                              ${USERS.users['${username}'].homepage}
  Wait Until Page Contains Element   xpath=//a[@href="#/create-tender"]   100
  Click Link                         xpath=//a[@href="#/create-tender"]
  Wait Until Page Contains           Новый тендер   100
# Input fields tender
  Input text   name=tenderName       ${title}
{'fraction_non_alphanumeric': 0.14105342504475643, 'fraction_numerical': 0.008103269575049468, 'mean_word_length': 3.3076298701298703, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2487627', 'n_tokens_mistral': 3516, 'n_tokens_neox': 3481, 'n_words': 557}