Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(BSR)[PRO] test: add financial management test #13982

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pro/cypress/e2e/features/financialManagement.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@ Feature: Financial Management - messages, links to external help page, reimburse
Then I can see the reimbursement details
# Scenario: I can download accounting receipt as pdf
# Then I can download accounting receipt as pdf

Scenario: Automatic link venue with bank account
Given I am logged in with account 2
And I go to the "Gestion financière" page
And I go to "Informations bancaires" view
When I remove "Lieu avec justificatif à 0€" venue from my bank account
Then no venue should be linked to my account
When I add "Lieu avec justificatif à 0€" venue to my bank account
Then "Lieu avec justificatif à 0€" venue should be linked to my account
54 changes: 54 additions & 0 deletions pro/cypress/e2e/step-definitions/financialManagement.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,45 @@ When('I download reimbursement details', () => {
// })
// })

When('I remove {string} venue from my bank account', (venue: string) => {
cy.findByTestId('reimbursement-bank-account-linked-venues').within(() => {
cy.contains('Lieu(x) rattaché(s) à ce compte bancaire')
cy.contains('Certains de vos lieux ne sont pas rattachés.')
cy.contains(venue)

cy.findByText('Modifier').click()
})

cy.findByRole('dialog').within(() => {
cy.findByLabelText(venue).should('be.checked')
cy.findByLabelText(venue).uncheck()

cy.findByText('Enregistrer').click()
cy.findByText('Confirmer').click()
})
})

When('I add {string} venue to my bank account', (venue: string) => {
cy.findByTestId('reimbursement-bank-account-linked-venues').within(() => {
cy.contains('Aucun lieu n’est rattaché à ce compte bancaire.')

cy.findByText('Rattacher un lieu').click()
})

cy.intercept({ method: 'PATCH', url: 'offerers/*/bank-accounts/*' }).as(
'patchOfferer'
)

cy.findByRole('dialog').within(() => {
cy.findByLabelText(venue).should('not.be.checked')
cy.findByLabelText(venue).check()

cy.findByText('Enregistrer').click()
})

cy.wait('@patchOfferer').its('response.statusCode').should('equal', 204)
})

Then('I can see the reimbursement details', () => {
const filename = `${Cypress.config('downloadsFolder')}/remboursements_pass_culture.csv`

Expand Down Expand Up @@ -109,3 +148,18 @@ Then('No receipt results should be displayed', () => {
'Vous n’avez pas encore de justificatifs de remboursement disponibles'
)
})

Then('no venue should be linked to my account', () => {
cy.findAllByTestId('global-notification-success').should(
'contain',
'Vos modifications ont bien été prises en compte.'
)
})

Then('{string} venue should be linked to my account', (venue: string) => {
cy.findByTestId('reimbursement-bank-account-linked-venues').within(() => {
cy.contains('Lieu(x) rattaché(s) à ce compte bancaire')
cy.contains('Certains de vos lieux ne sont pas rattachés.')
cy.contains(venue)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ export const ReimbursementBankAccount = ({
</ButtonLink>
</div>
) : (
<div className={styles['linked-venues-section']}>
<div
className={styles['linked-venues-section']}
data-testid="reimbursement-bank-account-linked-venues"
>
<div className={styles['linked-venues-section-title']}>
Lieu(x) rattaché(s) à ce compte bancaire
{hasWarning && managedVenues.length > 0 && (
Expand Down
Loading