-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
87553: fix: close direct deposit form on cancel to prevent white scre…
…en issue (#30768) * 87553: fix: close direct deposit form on cancel to prevent white screen issue * 87553: add test to verify cancel button doesnt break the page
- Loading branch information
Showing
4 changed files
with
135 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...ions/personalization/profile/tests/e2e/direct-deposit/focus-accessibility.cypress.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import directDepositMocks from '@@profile/mocks/endpoints/direct-deposits'; | ||
import DirectDepositPage from './page-objects/DirectDeposit'; | ||
|
||
const directDeposit = new DirectDepositPage(); | ||
|
||
describe('Direct Deposit', () => { | ||
beforeEach(() => { | ||
directDeposit.setup(); | ||
}); | ||
|
||
it('should open the bank account information form and return to the original state on cancel', () => { | ||
const editButton = 'va-button[text="Edit"]'; | ||
const cancelButton = 'va-button[text="Cancel"]'; | ||
// Mock the API response for direct deposits eligibility | ||
cy.intercept( | ||
'GET', | ||
'v0/profile/direct_deposits', | ||
directDepositMocks.isEligible, | ||
); | ||
directDeposit.visitPage(); | ||
cy.injectAxeThenAxeCheck(); | ||
|
||
// Verify initial prompt to add bank information is visible | ||
cy.contains('p', 'Edit your profile to add your bank information.').should( | ||
'be.visible', | ||
); | ||
cy.get(editButton) | ||
.should('exist') | ||
.should('not.be.focused'); | ||
|
||
// Click the Edit button and ensure it is removed from the DOM | ||
cy.get(editButton).click(); | ||
cy.get(editButton).should('not.exist'); | ||
|
||
// Verify the bank account information form appears and is focused | ||
cy.contains( | ||
'p', | ||
'Provide your account type, routing number, and account number.', | ||
).should('be.visible'); | ||
cy.get('#bank-account-information').should('be.focused'); | ||
|
||
// Click the Cancel button to close the form | ||
cy.get(cancelButton) | ||
.should('exist') | ||
.click(); | ||
|
||
// Verify the page returns to the original state and Edit button is focused | ||
cy.findByRole('heading', { name: 'Direct deposit information' }).should( | ||
'exist', | ||
); | ||
cy.get(editButton).should('be.focused'); | ||
}); | ||
}); |