-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f89aba
commit 041a74f
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
packages/manager/cypress/e2e/core/billing/credit-card-expired-banner.spec.ts
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,36 @@ | ||
import { accountFactory } from 'src/factories'; | ||
import { mockGetAccount } from 'support/intercepts/account'; | ||
import { mockGetUserPreferences } from 'support/intercepts/profile'; | ||
import { ui } from 'support/ui'; | ||
|
||
const creditCardExpiredBannerNotice = | ||
'Your credit card has expired! Please update your payment details.'; | ||
|
||
describe('Credit Card Expired Banner', () => { | ||
beforeEach(() => { | ||
mockGetUserPreferences({ dismissed_notifications: {} }); | ||
}); | ||
|
||
it('appears when the expiration date is in the past', () => { | ||
mockGetAccount( | ||
accountFactory.build({ credit_card: { expiry: '01/2000' } }) | ||
).as('getAccount'); | ||
cy.visitWithLogin('/'); | ||
cy.wait('@getAccount'); | ||
cy.findByText(creditCardExpiredBannerNotice).should('be.visible'); | ||
ui.button.findByTitle('Update Card').should('be.visible').click(); | ||
|
||
// clicking on the link navigates to /account/billing | ||
cy.url().should('endWith', '/account/billing'); | ||
}); | ||
|
||
it('does not appear when the expiration date is in the future', () => { | ||
mockGetAccount( | ||
accountFactory.build({ credit_card: { expiry: '01/2999' } }) | ||
).as('getAccount'); | ||
cy.visitWithLogin('/account/billing'); | ||
cy.wait('@getAccount'); | ||
cy.findByText('Payment Methods').should('be.visible'); | ||
cy.findByText(creditCardExpiredBannerNotice).should('not.exist'); | ||
}); | ||
}); |