<commit_before>*** Settings ***
Documentation     INFUND-524 As an applicant I want to see the finance summary updated and recalculated as each partner adds their finances.
...
...               INFUND-435 As an applicant and I am on the finance summary, I want to see the partner details listed horizontally so I can see all partner details in the finance summary table
...
...               INFUND-927 As a lead partner i want the system to show me when all questions and sections (partner finances) are complete on the finance summary, so that i know i can submit the application
...
...               INFUND-894 As a lead partner I want to easily see whether or not my partner's finances are marked as complete, so that i can have the right level of confidence in the figures
...
...               INFUND-438: As an applicant and I am filling in the finance details I want a fully working Other funding section
...
...               INFUND-1436 As a lead applicant I want to be able to view the ratio of research participation costs in my consortium so I know my application is within the required range
...
...               INFUND-8397  Permission denied when submitting your finances as a collaborator
...
...               IFS-401 Support team view of detailed finances in application form
...
...               IFS-802 Enable Innovation Lead user profile matching CSS permissions
...
...               IFS-2879: As a Research applicant I MUST accept the grant terms and conditions
...
...               IFS-3609 Extend internal view of application finances to other internal roles
Suite Setup       Custom suite setup
Suite Teardown    Close browser and delete emails
Force Tags        Applicant
Default Tags
Resource          ../../../../resources/defaultResources.robot
Resource          ../../Applicant_Commons.robot
Resource          ../../../10__Project_setup/PS_Common.robot
# For the testing of those Testing cases, the application that has been used is:
# CLOSED_COMPETITION_APPLICATION_NAME that is A new innovative solution
# of the Competition: Connected digital additive manufacturing
# For an Open Competition Application, we have used OPEN_COMPETITION_APPLICATION_2_NAME, which is
# Application:Planetary science Pluto's telltale heart
# from the Competition: Predicting market trends programme

*** Variables ***
${allApplicationsForRTOComp}  ${SERVER}/management/competition/${openCompetitionBusinessRTO}/applications/all

*** Test Cases ***
Calculations for Lead applicant
    [Documentation]    INFUND-524
    [Tags]  HappyPath
    When the user clicks the button/link  link=${CLOSED_COMPETITION_APPLICATION_NAME}
    And the user expands the section      Finances summary
    Then the finance summary calculations should be correct
    And the finance Funding breakdown calculations should be correct

Calculations for the first collaborator
    [Documentation]    INFUND-524
    [Tags]  HappyPath
    [Setup]  log in as a different user   &{collaborator1_credentials}
    When the user clicks the button/link  link=${CLOSED_COMPETITION_APPLICATION_NAME}
    And the user expands the section      Finances summary
    Then the finance summary calculations should be correct
    And the finance Funding breakdown calculations should be correct

Contribution to project and funding sought should not be negative number
    [Documentation]    INFUND-524
    [Tags]  HappyPath
    [Setup]  log in as a different user                       &{lead_applicant_credentials}
    When the user navigates to Your-finances page             ${OPEN_COMPETITION_APPLICATION_2_NAME}
    And the user fills in the project costs                   labour costs  n/a
    And the user enters the project location
    And the user fills in the organisation information        ${OPEN_COMPETITION_APPLICATION_2_NAME}  ${SMALL_ORGANISATION_SIZE}
    And the user checks your funding section for the project  ${OPEN_COMPETITION_APPLICATION_2_NAME}
    Then the contribution to project and funding sought should be 0 and not a negative number

Your Finance includes Finance summary table for lead applicant
    [Documentation]    INFUND-6893
    [Tags]
    [Setup]  log in as a different user            &{lead_applicant_credentials}
    When the user navigates to Your-finances page  ${OPEN_COMPETITION_APPLICATION_2_NAME}
    Then the finance summary table in Your Finances has correct values for lead  £72,611  30%  0  8,000,000  0
    And the user clicks the button/link            link=Return to application overview

Your Finance includes Finance summary table for collaborator
     [Documentation]    INFUND-6893
     [Tags]
     [Setup]  log in as a different user           &{collaborator2_credentials}
    When the user navigates to Your-finances page  ${OPEN_COMPETITION_APPLICATION_2_NAME}
    Then the finance summary table in Your Finances has correct values for collaborator
    And The user clicks the button/link            link=Return to application overview

Red warning should show when the finances are incomplete
    [Documentation]    INFUND-927, INFUND-894, INFUND-446
    [Tags]    HappyPath
    [Setup]  log in as a different user           &{lead_applicant_credentials}
    When the user navigates to the page           ${DASHBOARD_URL}
    And the user clicks the button/link           link=${OPEN_COMPETITION_APPLICATION_2_NAME}
    And the user clicks the button/link           link=Finances overview
    Then the red warning should be visible

Green check should show when the finances are complete
    [Documentation]    INFUND-927, INFUND-894, INFUND-446
    [Tags]
    When the user navigates to the page   ${DASHBOARD_URL}
    And the user clicks the button/link   link=${OPEN_COMPETITION_APPLICATION_2_NAME}
    When the user clicks the button/link  link=Finances overview
    Then Green check should be visible

Finance overview shows as incomplete
    [Documentation]  IFS-3820
    Given The user clicks the button/link  link=Application overview
    Then the user should see the element   jQuery=li:contains("Finances overview") .task-status-incomplete

Collaborator marks finances as complete
    [Documentation]    INFUND-8397  IFS-2879
    [Tags]  HappyPath
    Given log in as a different user                     &{collaborator1_credentials}
    When the user navigates to Your-finances page  ${OPEN_COMPETITION_APPLICATION_2_NAME}
    Then the user marks the finances as complete        ${OPEN_COMPETITION_APPLICATION_2_NAME}  labour costs  n/a  no

Finances overview shows as complete once all collaborators have marked as complete
    [Documentation]  IFS-3820
    Given the academic user marks finances as complete
    And log in as a different user        &{lead_applicant_credentials}
    When the user clicks the button/link  link=${OPEN_COMPETITION_APPLICATION_2_NAME}
    Then the user should see the element  jQuery=li:contains("Finances overview") .task-status-complete
    [Teardown]  logout as user


Alert shows If the academic research participation is too high
    [Documentation]    INFUND-1436
    [Tags]    Email  HappyPath
    Given Login new application invite academic    ${<EMAIL>_<EMAIL>}+<EMAIL>  Invitation to collaborate in ${openCompetitionBusinessRTO_name}  You will be joining as part of the organisation
    When log in as a different user                ${test_mailbox_one}+<EMAIL>  ${correct_password}
    Then the user navigates to Your-finances page  Academic robot test application
    And The user clicks the button/link            link=Your project costs
    When the user enters text to a text field      css=[name$="incurred_staff"]  1000000
    And log in as a different user                 &{lead_applicant_credentials}<commit_msg>IFS-3820 AT updates<commit_after>*** Settings ***
Documentation     INFUND-524 As an applicant I want to see the finance summary updated and recalculated as each partner adds their finances.
...
...               INFUND-435 As an applicant and I am on the finance summary, I want to see the partner details listed horizontally so I can see all partner details in the finance summary table
...
...               INFUND-927 As a lead partner i want the system to show me when all questions and sections (partner finances) are complete on the finance summary, so that i know i can submit the application
...
...               INFUND-894 As a lead partner I want to easily see whether or not my partner's finances are marked as complete, so that i can have the right level of confidence in the figures
...
...               INFUND-438: As an applicant and I am filling in the finance details I want a fully working Other funding section
...
...               INFUND-1436 As a lead applicant I want to be able to view the ratio of research participation costs in my consortium so I know my application is within the required range
...
...               INFUND-8397  Permission denied when submitting your finances as a collaborator
...
...               IFS-401 Support team view of detailed finances in application form
...
...               IFS-802 Enable Innovation Lead user profile matching CSS permissions
...
...               IFS-2879: As a Research applicant I MUST accept the grant terms and conditions
...
...               IFS-3609 Extend internal view of application finances to other internal roles
Suite Setup       Custom suite setup
Suite Teardown    Close browser and delete emails
Force Tags        Applicant
Default Tags
Resource          ../../../../resources/defaultResources.robot
Resource          ../../Applicant_Commons.robot
Resource          ../../../10__Project_setup/PS_Common.robot
# For the testing of those Testing cases, the application that has been used is:
# CLOSED_COMPETITION_APPLICATION_NAME that is A new innovative solution
# of the Competition: Connected digital additive manufacturing
# For an Open Competition Application, we have used OPEN_COMPETITION_APPLICATION_2_NAME, which is
# Application:Planetary science Pluto's telltale heart
# from the Competition: Predicting market trends programme

*** Variables ***
${allApplicationsForRTOComp}  ${SERVER}/management/competition/${openCompetitionBusinessRTO}/applications/all

*** Test Cases ***
Calculations for Lead applicant
    [Documentation]    INFUND-524
    [Tags]  HappyPath
    When the user clicks the button/link  link=${CLOSED_COMPETITION_APPLICATION_NAME}
    And the user expands the section      Finances summary
    Then the finance summary calculations should be correct
    And the finance Funding breakdown calculations should be correct

Calculations for the first collaborator
    [Documentation]    INFUND-524
    [Tags]  HappyPath
    [Setup]  log in as a different user   &{collaborator1_credentials}
    When the user clicks the button/link  link=${CLOSED_COMPETITION_APPLICATION_NAME}
    And the user expands the section      Finances summary
    Then the finance summary calculations should be correct
    And the finance Funding breakdown calculations should be correct

Contribution to project and funding sought should not be negative number
    [Documentation]    INFUND-524
    [Tags]  HappyPath
    [Setup]  log in as a different user                       &{lead_applicant_credentials}
    When the user navigates to Your-finances page             ${OPEN_COMPETITION_APPLICATION_2_NAME}
    And the user fills in the project costs                   labour costs  n/a
    And the user enters the project location
    And the user fills in the organisation information        ${OPEN_COMPETITION_APPLICATION_2_NAME}  ${SMALL_ORGANISATION_SIZE}
    And the user checks your funding section for the project  ${OPEN_COMPETITION_APPLICATION_2_NAME}
    Then the contribution to project and funding sought should be 0 and not a negative number

Your Finance includes Finance summary table for lead applicant
    [Documentation]    INFUND-6893
    [Tags]
    [Setup]  log in as a different user            &{lead_applicant_credentials}
    When the user navigates to Your-finances page  ${OPEN_COMPETITION_APPLICATION_2_NAME}
    Then the finance summary table in Your Finances has correct values for lead  £72,611  30%  0  8,000,000  0
    And the user clicks the button/link            link=Return to application overview

Your Finance includes Finance summary table for collaborator
     [Documentation]    INFUND-6893
     [Tags]
     [Setup]  log in as a different user           &{collaborator2_credentials}
    When the user navigates to Your-finances page  ${OPEN_COMPETITION_APPLICATION_2_NAME}
    Then the finance summary table in Your Finances has correct values for collaborator
    And The user clicks the button/link            link=Return to application overview

Red warning should show when the finances are incomplete
    [Documentation]    INFUND-927, INFUND-894, INFUND-446
    [Tags]    HappyPath
    [Setup]  log in as a different user           &{lead_applicant_credentials}
    When the user navigates to the page           ${DASHBOARD_URL}
    And the user clicks the button/link           link=${OPEN_COMPETITION_APPLICATION_2_NAME}
    And the user clicks the button/link           link=Finances overview
    Then the red warning should be visible

Green check should show when the finances are complete
    [Documentation]    INFUND-927, INFUND-894, INFUND-446
    [Tags]
    When the user navigates to the page   ${DASHBOARD_URL}
    And the user clicks the button/link   link=${OPEN_COMPETITION_APPLICATION_2_NAME}
    When the user clicks the button/link  link=Finances overview
    Then Green check should be visible

Finance overview shows as incomplete
    [Documentation]  IFS-3820
    Given The user clicks the button/link  link=Application overview
    Then the user should see the element   jQuery=li:contains("Finances overview") .task-status-incomplete

Collaborator marks finances as complete
    [Documentation]    INFUND-8397  IFS-2879
    [Tags]  HappyPath
    Given log in as a different user                     &{collaborator1_credentials}
    When the user navigates to Your-finances page  ${OPEN_COMPETITION_APPLICATION_2_NAME}
    Then the user marks the finances as complete        ${OPEN_COMPETITION_APPLICATION_2_NAME}  labour costs  n/a  no

Finances overview shows as complete once all collaborators have marked as complete
    [Documentation]  IFS-3820
    Given the academic user marks finances as complete
    And log in as a different user        &{lead_applicant_credentials}
    When the user clicks the button/link  link=${OPEN_COMPETITION_APPLICATION_2_NAME}
    Then the user should see the element  jQuery=li:contains("Finances overview") .task-status-complete
    [Teardown]  logout as user

Alert shows If the academic research participation is too high
    [Documentation]    INFUND-1436
    [Tags]    Email  HappyPath
    Given Login new application invite academic    ${test_mailbox_one}+<EMAIL>  Invitation to collaborate in ${openCompetitionBusinessRTO_name}  You will be joining as part of the organisation
    When log in as a different user                ${test_mailbox_one}+<EMAIL>  ${correct_password}
    Then the user navigates to Your-finances page  Academic robot test application
    And The user clicks the button/link            link=Your project costs
    When the user enters text to a text field      css=[name$="incurred_staff"]  1000000
    And log in as a different user                 &{lead_applicant_credentials}
{'fraction_non_alphanumeric': 0.04941069809610154, 'fraction_numerical': 0.0173552648620645, 'mean_word_length': 3.15469464622007, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2660358', 'n_tokens_mistral': 4227, 'n_tokens_neox': 3880, 'n_words': 1763}