Skip to content

Commit

Permalink
PP-9916 Change test card number in Stripe test accounts
Browse files Browse the repository at this point in the history
Add Cypresss test to check 'Mock card' screen shows correct card number for non Stripe accounts.
  • Loading branch information
JFSGDS committed Oct 19, 2023
1 parent 5a6a9ed commit fc2ef7f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/cypress/integration/demo-payment/mock-cards.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const userStubs = require('../../stubs/user-stubs')
const gatewayAccountStubs = require('../../stubs/gateway-account-stubs')
const transactionStubs = require('../../stubs/transaction-stubs')

const userExternalId = 'cd0fa54cf3b7408a80ae2f1b93e7c16e'
const gatewayAccountId = '42'
const gatewayAccountExternalId = 'a-valid-external-id'

describe('Show Mock cards screen', () => {
beforeEach(() => {
cy.task('setupStubs', [
userStubs.getUserSuccess({ gatewayAccountId, userExternalId }),
gatewayAccountStubs.getGatewayAccountByExternalIdSuccess({
gatewayAccountId,
gatewayAccountExternalId,
paymentProvider: 'sandbox'
}),
transactionStubs.getTransactionsSummarySuccess()
])
})

it('should load the mock cards page and show non stripe card', () => {
cy.setEncryptedCookies(userExternalId)
cy.visit(`/account/${gatewayAccountExternalId}/dashboard`)
cy.get('a').contains('Make a demo payment').click()
cy.get('h1').should('have.text', 'Make a demo payment')

cy.get('#payment-description').contains('An example payment description')
cy.get('#payment-amount').contains('£20.00')

cy.log('Continue to Mock Cards page')
cy.get('a').contains('Continue').click()
cy.get('h1').should('have.text', 'Mock card numbers')
cy.get('p').contains(/^4000056655665556/)
})
})

0 comments on commit fc2ef7f

Please sign in to comment.