-
Notifications
You must be signed in to change notification settings - Fork 15
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
PP-9916 Change test card number in Stripe test accounts #4146
Merged
JFSGDS
merged 4 commits into
master
from
PP-9916-change-test-card-number-in-stripe-test-accounts
Oct 20, 2023
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
fcf8c67
PP-9916 Change test card number in Stripe test accounts
JFSGDS 5a6a9ed
PP-9916 Change test card number in Stripe test accounts
JFSGDS fc2ef7f
PP-9916 Change test card number in Stripe test accounts
JFSGDS 4048451
PP-9916 Change test card number in Stripe test accounts
JFSGDS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
49 changes: 49 additions & 0 deletions
49
test/cypress/integration/demo-payment/mock-cards-stripe.cy.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,49 @@ | ||
'use strict' | ||
|
||
const userStubs = require('../../stubs/user-stubs') | ||
const gatewayAccountStubs = require('../../stubs/gateway-account-stubs') | ||
const stripeAccountSetupStubs = require('../../stubs/stripe-account-setup-stub') | ||
const userExternalId = 'cd0fa54cf3b7408a80ae2f1b93e7c16e' // pragma: allowlist secret | ||
const gatewayAccountId = '42' | ||
const gatewayAccountExternalId = 'a-valid-external-id' | ||
|
||
function setupYourPspStubs (opts = {}) { | ||
const user = userStubs.getUserSuccess({ userExternalId, gatewayAccountId }) | ||
|
||
const gatewayAccountByExternalId = gatewayAccountStubs.getGatewayAccountByExternalIdSuccess({ | ||
gatewayAccountId, | ||
gatewayAccountExternalId, | ||
type: 'test', | ||
paymentProvider: 'stripe', | ||
}) | ||
|
||
const stripeAccountSetup = stripeAccountSetupStubs.getGatewayAccountStripeSetupSuccess({ | ||
gatewayAccountId, | ||
}) | ||
|
||
const stubs = [ | ||
user, | ||
gatewayAccountByExternalId, | ||
stripeAccountSetup, | ||
] | ||
|
||
cy.task('setupStubs', stubs) | ||
} | ||
|
||
describe('Show Mock cards screen for stripe accounts', () => { | ||
beforeEach(() => { | ||
cy.setEncryptedCookies(userExternalId) | ||
}) | ||
|
||
it('should display stripe settings page correctly', () => { | ||
setupYourPspStubs() | ||
cy.visit(`/account/${gatewayAccountExternalId}/settings`) | ||
cy.log('Continue to Make a demo payment page via Dashboard') | ||
cy.get('a').contains('Dashboard').click() | ||
cy.get('a').contains('Make a demo payment').click() | ||
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(/^4000058260000005/) | ||
}) | ||
}) |
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 @@ | ||
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/) | ||
}) | ||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably we can have a version of this test that sets
paymentProvider
tostripe
and checks we output the right card number for Stripe too?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Test to check correct card number is displayed for Stripe accounts now added. Note, unable to land directly on the Dashboard page for a Stripe account as this route returned a ‘403 Forbidden’ status. Landing on the Stripe account’s Settings page and then navigating to the Dashboard pages worked but this probably needs refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it’s fine — the amount of extra code to do the navigation is not huge and it’s not worth investing too much more time into this.