-
Notifications
You must be signed in to change notification settings - Fork 4
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
copy update for update amount SP form (with old min amount) #1352
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { | ||
contributionPaidByCard, | ||
supporterPlus, | ||
supporterPlusMonthlyAllAccessDigital, | ||
supporterPlusMonthlyAllAccessDigitalBeforePriceRise, | ||
} from '../../../../client/fixtures/productBuilder/testProducts'; | ||
import { toMembersDataApiResponse } from '../../../../client/fixtures/mdapiResponse'; | ||
import { signInAndAcceptCookies } from '../../../lib/signInAndAcceptCookies'; | ||
|
@@ -87,7 +88,9 @@ describe('Update contribution amount', () => { | |
it('Updates supporter plus amount', () => { | ||
cy.intercept('GET', '/api/me/mma', { | ||
statusCode: 200, | ||
body: toMembersDataApiResponse(supporterPlus()), | ||
body: toMembersDataApiResponse( | ||
supporterPlusMonthlyAllAccessDigital(), | ||
), | ||
}); | ||
cy.visit('/?withFeature=supporterPlusUpdateAmount'); | ||
|
||
|
@@ -98,6 +101,10 @@ describe('Update contribution amount', () => { | |
|
||
cy.findByText('Change amount').click(); | ||
|
||
cy.contains( | ||
/£\d{2,3} per month is the minimum payment to receive this subscription./, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we fuzzy matching the amount here to account for future config changes? (I.e. so this test doesn't have to be updated each time the config changes?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah I fuzzy matched here to reduce the number of places that you would have to update if/when we do another price rise ... there are still places where you have to do it manually though, so this doesn't solve that 'problem' everywhere, only here. |
||
).should('exist'); | ||
|
||
cy.get( | ||
'[data-cy="supporter-plus-amount-choices"] label:first-of-type', | ||
).click(); | ||
|
@@ -110,4 +117,57 @@ describe('Update contribution amount', () => { | |
'We have successfully updated the amount of your support.', | ||
).should('exist'); | ||
}); | ||
|
||
it('Updates supporter plus amount (for user on old lower min amount)', () => { | ||
cy.intercept('GET', '/api/me/mma', { | ||
statusCode: 200, | ||
body: toMembersDataApiResponse( | ||
supporterPlusMonthlyAllAccessDigitalBeforePriceRise(), | ||
), | ||
}); | ||
cy.visit('/?withFeature=supporterPlusUpdateAmount'); | ||
|
||
setSignInStatus(); | ||
|
||
cy.findByText('Manage subscription').click(); | ||
cy.wait('@cancelled'); | ||
|
||
cy.findByText('Change amount').click(); | ||
|
||
cy.get( | ||
'[data-cy="supporter-plus-amount-choices"] label:last-of-type', | ||
).click(); | ||
|
||
cy.contains('label', 'Other amount (£)').parent().find('input').clear(); | ||
cy.contains('label', 'Other amount (£)') | ||
.parent() | ||
.find('input') | ||
.type('11'); | ||
|
||
cy.contains( | ||
/If you would like to change your monthly amount below £\d{2,3} please call us via the/, | ||
).should('exist'); | ||
|
||
cy.contains( | ||
/£\d{2,3} per month is the new minimum payment to receive this subscription. Please call our customer service team to lower your monthly amount below £\d{2,3} via the Help Centre/, | ||
).should('exist'); | ||
|
||
cy.contains( | ||
/£\d{2,3} per month is the new minimum payment to receive this subscription.$/, | ||
).should('exist'); | ||
|
||
cy.contains('label', 'Other amount (£)').parent().find('input').clear(); | ||
cy.contains('label', 'Other amount (£)') | ||
.parent() | ||
.find('input') | ||
.type('16'); | ||
|
||
cy.findByText('Change amount').click(); | ||
|
||
cy.wait('@supporter_plus_update_amount'); | ||
|
||
cy.contains( | ||
'We have successfully updated the amount of your support.', | ||
).should('exist'); | ||
}); | ||
}); |
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.
Would
change
work in both cases here? Only ask because it would simplify the code a bit!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.
yeah possibly .. I took a steer from the stakeholders re the copy here: