<commit_before>*** Settings ***
Documentation     INFUND-4851 As a project manager I want to be able to submit an uploaded Grant Offer Letter so that Innovate UK can review my signed copy
...
...               INFUND-6059 As the contracts team I want to be able to send a Grant Offer Letter to the partners so that the project can begin
...
...               INFUND-4849 As a partner I want to be able to download a Grant Offer Letter and Appendices
...
...               INFUND-6091 As a partner / lead partner / project manager I want to get access to the GOL section in Project Setup when all other sections
...
...               INFUND-6377 As a member of the Competitions team I want to be able to select when the signed Grant Offer Letter has been approved so that Innovate UK can notify the Project Manager
...
...               INFUND-5998 As the contracts team I need to view, remove and/or re-upload the Grant Offer Letter
...
...               INFUND-6829 GOL uploaded but not submitted by PM shows wrong status
...
...               INFUND-7027 Partners can access the GOL before the internal user hits Send to proj team
...
...               INFUND-7049 Validation missing for PDF file upload in GOL upload page for internal user
...
...               INFUND-6375 As a partner I want to receive a notification when Project Setup has been successfully completed so that I am clear on what steps to take now the project is live
...
...               INFUND-6741 As the service delivery manager I want the service to generate a Grant Offer Letter once both the Spend Profiles and Other documents are approved so that the competitions team can review and publish to the project team
...
...               INFUND-7361 GOL is seen by internal user soon after the external user uploads it
...
...               INFUND-6048 As the contracts team I can have access to a generated Grant Offer Letter so that I can send it to the partners
...
...               INFUND-7170 Approved signed-GOL cannot be seen/downloaded by external users
...
...               INFUND-6780 As a project manager, I have the option to remove an uploaded signed GOL before submitting it, so that an can upload a different file if required
Suite Setup       all the other sections of the project are completed (except spend profile approval)
Suite Teardown    the user closes the browser
Force Tags        Project Setup    Upload
Resource          ../../resources/defaultResources.robot
Resource          PS_Variables.robot

*** Test Cases ***


External user cannot view the GOL section before spend profiles have been approved
    [Documentation]    INFUND-6741
    [Tags]
    [Setup]    log in as a different user    ${PS_GOL_APPLICATION_PM_EMAIL}  ${short_password}
    Given the user navigates to the page             ${server}/project-setup/project/${PS_GOL_APPLICATION_PROJECT}
    When the user should not see the element    jQuery=li.waiting:nth-child(8)
    And the user should not see the element    link=Grant offer letter
    When the user clicks the button/link    link=status of my partners
    Then the user should see the element    jQuery=#table-project-status tr:nth-of-type(2) td.status.na:nth-of-type(7)


GOL not generated before spend profiles have been approved
    [Documentation]    INFUND-6741
    [Tags]    HappyPath
    [Setup]    log in as a different user    &{Comp_admin1_credentials}
    When the user navigates to the page    ${server}/project-setup-management/competition/${PS_GOL_Competition_Id}/status
    Then the user should not see the element    jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(7).status.action
    And the user navigates to the page and gets a custom error message    ${server}/project-setup-management/project/${PS_GOL_APPLICATION_PROJECT}/grant-offer-letter/send    ${403_error_message}
    [Teardown]    proj finance approves the spend profiles



Status updates correctly for internal user's table
    [Documentation]    INFUND-4049 ,INFUND-5543
    [Tags]    Experian
    [Setup]    log in as a different user   &{Comp_admin1_credentials}
    When the user navigates to the page     ${server}/project-setup-management/competition/${PS_GOL_Competition_Id}/status
    Then the user should see the element    jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(1).status.ok       # Project details
    And the user should see the element     jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(2).status.ok       # MO
    And the user should see the element     jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(3).status.ok       # Bank details
    And the user should see the element     jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(4).status.ok       # Finance checks
    And the user should see the element     jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(5).status.ok       # Spend Profile
    And the user should see the element     jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(6).status.ok       # Other Docs
    And the user should see the element     jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(7).status.action   # GOL

Project finance user selects the grant offer letter
    [Documentation]  INFUND-6377, INFUND-6048
    [Tags]  HappyPath
    [Setup]  log in as a different user     &{internal_finance_credentials}
    Given the user navigates to the page    ${server}/project-setup-management/competition/${PS_GOL_Competition_Id}/status
    When the user clicks the button/link    jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(7).status.action a
    Then the user navigates to the page     ${server}/project-setup-management/project/${PS_GOL_APPLICATION_PROJECT}/grant-offer-letter/send
    And the user should see the element     jQuery=h2:contains("Grant offer letter")
    And the user should see the element     link=grant_offer_letter.pdf
    And the user should see the element     jQuery=button:contains("Remove")

Project Finance can download GOL
    [Documentation]  INFUND-6377
    [Tags]  HappyPath    Download
    Given the user navigates to the page    ${server}/project-setup-management/project/${PS_GOL_APPLICATION_PROJECT}/grant-offer-letter/send
    Then the user downloads the file        ${internal_finance_credentials["email"]}  ${server}/project-setup-management/project/${PS_GOL_APPLICATION_PROJECT}/grant-offer-letter/grant-offer-letter  ${DOWNLOAD_FOLDER}/grant_offer_letter.pdf
    [Teardown]    remove the file from the operating system    grant_offer_letter.pdf

Lead should not be able to see GOL until it is sent by IUK
    [Documentation]  INFUND-7027
    [Tags]
    [Setup]    log in as a different user            ${PS_GOL_APPLICATION_PM_EMAIL}  ${short_password}
    Given the user navigates to the page             ${server}/project-setup/project/${PS_GOL_APPLICATION_PROJECT}
    And the user should see the element              jQuery=li.waiting:nth-child(8)
    When the user clicks the button/link             link=status of my partners
    Then the user should see the text in the page    Project team status
    And the user should see the element              jQuery=#table-project-status tr:nth-of-type(1) td.status.waiting:nth-of-type(7)
    When the user clicks the button/link             link=Project setup status
    Then the user should not see the element         link=Grant offer letter

Non lead should not be able to see GOL until it is sent by IUK
    [Documentation]  INFUND-7027
    [Tags]
    [Setup]    log in as a different user            ${PS_GOL_APPLICATION_PARTNER_EMAIL}  ${short_password}
    Given the user navigates to the page             ${server}/project-setup/project/${PS_GOL_APPLICATION_PROJECT}
    Then the user should not see the element         jQuery=li.complete:nth-child(8)
    And the user should not see the element          jQuery=li.require-action:nth-child(8)<commit_msg>correcting expected element value in failing AT<commit_after>*** Settings ***
Documentation     INFUND-4851 As a project manager I want to be able to submit an uploaded Grant Offer Letter so that Innovate UK can review my signed copy
...
...               INFUND-6059 As the contracts team I want to be able to send a Grant Offer Letter to the partners so that the project can begin
...
...               INFUND-4849 As a partner I want to be able to download a Grant Offer Letter and Appendices
...
...               INFUND-6091 As a partner / lead partner / project manager I want to get access to the GOL section in Project Setup when all other sections
...
...               INFUND-6377 As a member of the Competitions team I want to be able to select when the signed Grant Offer Letter has been approved so that Innovate UK can notify the Project Manager
...
...               INFUND-5998 As the contracts team I need to view, remove and/or re-upload the Grant Offer Letter
...
...               INFUND-6829 GOL uploaded but not submitted by PM shows wrong status
...
...               INFUND-7027 Partners can access the GOL before the internal user hits Send to proj team
...
...               INFUND-7049 Validation missing for PDF file upload in GOL upload page for internal user
...
...               INFUND-6375 As a partner I want to receive a notification when Project Setup has been successfully completed so that I am clear on what steps to take now the project is live
...
...               INFUND-6741 As the service delivery manager I want the service to generate a Grant Offer Letter once both the Spend Profiles and Other documents are approved so that the competitions team can review and publish to the project team
...
...               INFUND-7361 GOL is seen by internal user soon after the external user uploads it
...
...               INFUND-6048 As the contracts team I can have access to a generated Grant Offer Letter so that I can send it to the partners
...
...               INFUND-7170 Approved signed-GOL cannot be seen/downloaded by external users
...
...               INFUND-6780 As a project manager, I have the option to remove an uploaded signed GOL before submitting it, so that an can upload a different file if required
Suite Setup       all the other sections of the project are completed (except spend profile approval)
Suite Teardown    the user closes the browser
Force Tags        Project Setup    Upload
Resource          ../../resources/defaultResources.robot
Resource          PS_Variables.robot

*** Test Cases ***


External user cannot view the GOL section before spend profiles have been approved
    [Documentation]    INFUND-6741
    [Tags]
    [Setup]    log in as a different user    ${PS_GOL_APPLICATION_PM_EMAIL}  ${short_password}
    Given the user navigates to the page             ${server}/project-setup/project/${PS_GOL_APPLICATION_PROJECT}
    When the user should not see the element    jQuery=li.waiting:nth-child(8)
    And the user should not see the element    link=Grant offer letter
    When the user clicks the button/link    link=status of my partners
    Then the user should see the element    jQuery=#table-project-status tr:nth-of-type(2) td.status.na:nth-of-type(7)


GOL not generated before spend profiles have been approved
    [Documentation]    INFUND-6741
    [Tags]    HappyPath
    [Setup]    log in as a different user    &{Comp_admin1_credentials}
    When the user navigates to the page    ${server}/project-setup-management/competition/${PS_GOL_Competition_Id}/status
    Then the user should not see the element    jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(7).status.action
    And the user navigates to the page and gets a custom error message    ${server}/project-setup-management/project/${PS_GOL_APPLICATION_PROJECT}/grant-offer-letter/send    ${403_error_message}
    [Teardown]    proj finance approves the spend profiles



Status updates correctly for internal user's table
    [Documentation]    INFUND-4049 ,INFUND-5543
    [Tags]    Experian
    [Setup]    log in as a different user   &{Comp_admin1_credentials}
    When the user navigates to the page     ${server}/project-setup-management/competition/${PS_GOL_Competition_Id}/status
    Then the user should see the element    jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(1).status.ok       # Project details
    And the user should see the element     jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(2).status.ok       # MO
    And the user should see the element     jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(3).status.ok       # Bank details
    And the user should see the element     jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(4).status.ok       # Finance checks
    And the user should see the element     jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(5).status.ok       # Spend Profile
    And the user should see the element     jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(6).status.ok       # Other Docs
    And the user should see the element     jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(7).status.action   # GOL

Project finance user selects the grant offer letter
    [Documentation]  INFUND-6377, INFUND-6048
    [Tags]  HappyPath
    [Setup]  log in as a different user     &{internal_finance_credentials}
    Given the user navigates to the page    ${server}/project-setup-management/competition/${PS_GOL_Competition_Id}/status
    When the user clicks the button/link    jQuery=#table-project-status tr:nth-of-type(5) td:nth-of-type(7).status.action a
    Then the user navigates to the page     ${server}/project-setup-management/project/${PS_GOL_APPLICATION_PROJECT}/grant-offer-letter/send
    And the user should see the element     jQuery=h2:contains("Grant offer letter")
    And the user should see the element     link=grant_offer_letter.pdf (opens in a new window)
    And the user should see the element     jQuery=button:contains("Remove")

Project Finance can download GOL
    [Documentation]  INFUND-6377
    [Tags]  HappyPath    Download
    Given the user navigates to the page    ${server}/project-setup-management/project/${PS_GOL_APPLICATION_PROJECT}/grant-offer-letter/send
    Then the user downloads the file        ${internal_finance_credentials["email"]}  ${server}/project-setup-management/project/${PS_GOL_APPLICATION_PROJECT}/grant-offer-letter/grant-offer-letter  ${DOWNLOAD_FOLDER}/grant_offer_letter.pdf
    [Teardown]    remove the file from the operating system    grant_offer_letter.pdf

Lead should not be able to see GOL until it is sent by IUK
    [Documentation]  INFUND-7027
    [Tags]
    [Setup]    log in as a different user            ${PS_GOL_APPLICATION_PM_EMAIL}  ${short_password}
    Given the user navigates to the page             ${server}/project-setup/project/${PS_GOL_APPLICATION_PROJECT}
    And the user should see the element              jQuery=li.waiting:nth-child(8)
    When the user clicks the button/link             link=status of my partners
    Then the user should see the text in the page    Project team status
    And the user should see the element              jQuery=#table-project-status tr:nth-of-type(1) td.status.waiting:nth-of-type(7)
    When the user clicks the button/link             link=Project setup status
    Then the user should not see the element         link=Grant offer letter

Non lead should not be able to see GOL until it is sent by IUK
    [Documentation]  INFUND-7027
    [Tags]
    [Setup]    log in as a different user            ${PS_GOL_APPLICATION_PARTNER_EMAIL}  ${short_password}
    Given the user navigates to the page             ${server}/project-setup/project/${PS_GOL_APPLICATION_PROJECT}
    Then the user should not see the element         jQuery=li.complete:nth-child(8)
    And the user should not see the element          jQuery=li.require-action:nth-child(8)
{'fraction_non_alphanumeric': 0.07444137584735125, 'fraction_numerical': 0.016068290233492342, 'mean_word_length': 2.971335992023928, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3407132', 'n_tokens_mistral': 4633, 'n_tokens_neox': 4411, 'n_words': 1744}