<commit_before>*** Settings ***
Documentation     INFUND-917: As an academic partner i want to input my finances according to the JES field headings, so that i enter my figures into the correct sections
...
...               INFUND-918: As an academic partner i want to be able to mark my finances as complete, so that the lead partner can have confidence in my finances
...
...               INFUND-2399: As a Academic partner I want to be able to add my finances including decimals for accurate recording of my finances
...
...               INFUND-8347: Update 'Your project costs' for academics
Suite Setup       Custom Suite Setup
Suite Teardown    Close browser and delete emails
Force Tags        Email    Applicant
Resource          ../../../../resources/defaultResources.robot
Resource          ../../Applicant_Commons.robot


*** Variables ***

*** Test Cases ***
Academic finances should be editable when lead marks them as complete
    [Documentation]    INFUND-2314
    [Tags]    HappyPath
    [Setup]    Lead applicant marks the finances as complete
    Given Log in as a different user          ${test_mailbox_one}+<EMAIL>    ${correct_password}
    When the user navigates to the academic application finances
    And the user clicks the button/link       link=Your project costs
    Then the user should not see the element  css=#incurred-staff[readonly]
    [Teardown]    Lead applicant marks the finances as incomplete

Academic finance validations
    [Documentation]    INFUND-2399
    [Tags]
    [Setup]    Log in as a different user    ${test_mailbox_one}+<EMAIL>    ${correct_password}
    When the user navigates to the academic application finances
    And the user clicks the button/link  link=Your project costs
    And the applicant enters invalid inputs
    And Mark academic finances as complete
    Then the user should see an error    This field should be 0 or higher.
    Then the user should see an error    This field cannot be left blank.
    And the user should see the element  css=.error-summary-list
    And the field should not contain the currency symbol

Academic finance calculations
    [Documentation]    INFUND-917, INFUND-2399
    [Tags]
    Given the user navigates to the academic application finances
    When the user clicks the button/link  link=Your project costs
    And the academic partner fills the finances
    Then the calculations should be correct and the totals rounded to the second decimal

Large pdf upload not allowed
    [Documentation]    INFUND-2720
    [Tags]    Upload
    When the academic partner uploads a file      ${too_large_pdf}
    Then the user should get an error page        ${too_large_pdf_validation_error}
    And the user should see the text in the page  Attempt to upload a large file
    [Teardown]    the user goes back to the previous page

Non pdf uploads not allowed
    [Documentation]    INFUND-2720
    [Tags]    Upload
    When the academic partner uploads a file  ${text_file}
    Then the user should see an error         ${wrong_filetype_validation_error}

Lead applicant can't upload a JeS file
    [Documentation]    INFUND-2720
    [Tags]
    [Setup]    log in as a different user     &{lead_applicant_credentials}
    Given the user navigates to the academic application finances
    When the user clicks the button/link      link=Your project costs
    Then the user should not see the element  css=.upload-section label

Academics upload
    [Documentation]    INFUND-917
    [Tags]    HappyPath
    [Setup]    log in as a different user              ${test_mailbox_one}+<EMAIL>    ${correct_password}
    When the user navigates to the academic application finances
    And the user clicks the button/link                link=Your project costs
    When the academic partner uploads a file           ${valid_pdf}
    Then the user should not see the text in the page  No file currently uploaded
    And the user should see the element                link=testing.pdf (opens in a new window)
    And the user waits for the file to be scanned by the anti virus software

Academic partner can view the file on the finances
    [Documentation]    INFUND-917
    [Tags]    HappyPath
    When the user opens the link in new window  ${valid_pdf}
    Then the user should not see an error in the page

Academic partner can view the file on the finances overview
    [Documentation]    INFUND-917
    [Tags]
    When the user navigates to the finance overview of the academic
    Then the user should not see an error in the page
    [Teardown]    the user goes back to the previous page

Lead applicant can't view the file on the finances page
    [Documentation]    INFUND-917
    [Tags]
    [Setup]    log in as a different user              &{lead_applicant_credentials}
    When the user navigates to the academic application finances
    And the user clicks the button/link                link=Your project costs
    Then the user should not see the text in the page  ${valid_pdf}

Academic finances JeS link showing
    [Documentation]    INFUND-2402, INFUND-8347
    [Tags]
    [Setup]    log in as a different user     ${test_mailbox_one}+<EMAIL>    ${correct_password}
    When the user navigates to the academic application finances
    Then the user should not see the element  link=Your funding
    And the user should see the element       jQuery=td:contains("100%")
    When the user clicks the button/link      link=Your project costs
    Then the user can see JeS details
<commit_msg>IFS-2693 added the check before maeking finance complete<commit_after>*** Settings ***
Documentation     INFUND-917: As an academic partner i want to input my finances according to the JES field headings, so that i enter my figures into the correct sections
...
...               INFUND-918: As an academic partner i want to be able to mark my finances as complete, so that the lead partner can have confidence in my finances
...
...               INFUND-2399: As a Academic partner I want to be able to add my finances including decimals for accurate recording of my finances
...
...               INFUND-8347: Update 'Your project costs' for academics
Suite Setup       Custom Suite Setup
Suite Teardown    Close browser and delete emails
Force Tags        Email    Applicant
Resource          ../../../../resources/defaultResources.robot
Resource          ../../Applicant_Commons.robot


*** Variables ***

*** Test Cases ***
Academic finances should be editable when lead marks them as complete
    [Documentation]    INFUND-2314
    [Tags]    HappyPath
    [Setup]    Lead applicant marks the finances as complete
    Given Log in as a different user          ${test_<EMAIL>_<EMAIL>    ${correct_password}
    When the user navigates to the academic application finances
    And the user clicks the button/link       link=Your project costs
    Then the user should not see the element  css=#incurred-staff[readonly]
    [Teardown]    Lead applicant marks the finances as incomplete

Academic finance validations
    [Documentation]    INFUND-2399
    [Tags]
    [Setup]    Log in as a different user    ${test_mailbox_one}+<EMAIL>    ${correct_password}
    When the user navigates to the academic application finances
    And the user clicks the button/link  link=Your project costs
    And the applicant enters invalid inputs
    And Mark academic finances as complete
    Then the user should see an error    This field should be 0 or higher.
    Then the user should see an error    This field cannot be left blank.
    And the user should see the element  css=.error-summary-list
    And the field should not contain the currency symbol

Academic finance calculations
    [Documentation]    INFUND-917, INFUND-2399
    [Tags]
    Given the user navigates to the academic application finances
    When the user clicks the button/link  link=Your project costs
    And the academic partner fills the finances
    Then the calculations should be correct and the totals rounded to the second decimal

Large pdf upload not allowed
    [Documentation]    INFUND-2720
    [Tags]    Upload
    When the academic partner uploads a file      ${too_large_pdf}
    Then the user should get an error page        ${too_large_pdf_validation_error}
    And the user should see the text in the page  Attempt to upload a large file
    [Teardown]    the user goes back to the previous page

Non pdf uploads not allowed
    [Documentation]    INFUND-2720
    [Tags]    Upload
    When the academic partner uploads a file  ${text_file}
    Then the user should see an error         ${wrong_filetype_validation_error}

Lead applicant can't upload a JeS file
    [Documentation]    INFUND-2720
    [Tags]
    [Setup]    log in as a different user     &{lead_applicant_credentials}
    Given the user navigates to the academic application finances
    When the user clicks the button/link      link=Your project costs
    Then the user should not see the element  css=.upload-section label

Academics upload
    [Documentation]    INFUND-917
    [Tags]    HappyPath
    [Setup]    log in as a different user              ${test_mailbox_<EMAIL>}+<EMAIL>    ${correct_password}
    When the user navigates to the academic application finances
    And the user clicks the button/link                link=Your project costs
    When the academic partner uploads a file           ${valid_pdf}
    Then the user should not see the text in the page  No file currently uploaded
    And the user should see the element                link=testing.pdf (opens in a new window)
    And the user waits for the file to be scanned by the anti virus software

Academic partner can view the file on the finances
    [Documentation]    INFUND-917
    [Tags]    HappyPath
    When the user opens the link in new window  ${valid_pdf}
    Then the user should not see an error in the page

Academic partner can view the file on the finances overview
    [Documentation]    INFUND-917
    [Tags]
    When the user navigates to the finance overview of the academic
    Then the user should not see an error in the page
    [Teardown]    the user goes back to the previous page

Lead applicant can't view the file on the finances page
    [Documentation]    INFUND-917
    [Tags]
    [Setup]    log in as a different user              &{lead_applicant_credentials}
    When the user navigates to the academic application finances
    And the user clicks the button/link                link=Your project costs
    Then the user should not see the text in the page  ${valid_pdf}

Academic finances JeS link showing
    [Documentation]    INFUND-2402, INFUND-8347
    [Tags]
    [Setup]    log in as a different user     ${test_mailbox_one}+<EMAIL>    ${correct_password}
    When the user navigates to the academic application finances
    Then the user should not see the element  link=Your funding
    And the user should see correct grant percentage
    When the user clicks the button/link      link=Your project costs
    Then the user can see JeS details

{'fraction_non_alphanumeric': 0.0457267283614589, 'fraction_numerical': 0.011885320268553802, 'mean_word_length': 2.863652295828952, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '266061', 'n_tokens_mistral': 2989, 'n_tokens_neox': 2790, 'n_words': 1423}