test(payments): Add test coverage for Checkout - PayPal flows#20710
test(payments): Add test coverage for Checkout - PayPal flows#20710xlisachan wants to merge 2 commits into
Conversation
6507c18 to
35b5fee
Compare
This pull request - Adds unit, integration, and component-level test coverage for PayPal payment method error handling on the subscription management page Closes: PAY-3688
35b5fee to
27f9f43
Compare
| const baseSession = { | ||
| user: { | ||
| id: MOCK_USER_ID, | ||
| email: 'user@example.com', | ||
| metricsEnabled: true, | ||
| }, | ||
| }; | ||
|
|
||
| const basePageContent = { | ||
| accountCreditBalance: { balance: 0, currency: null }, | ||
| defaultPaymentMethod: undefined, | ||
| isStripeCustomer: true, | ||
| subscriptions: [], | ||
| appleIapSubscriptions: [], | ||
| googleIapSubscriptions: [], | ||
| trialSubscriptions: [], | ||
| }; |
There was a problem hiding this comment.
issue: Could these be replaced with a factory in the corresponding library instead of defining them in the test?
| }); | ||
|
|
||
| it('does not render error banner when there is no payment method error', async () => { | ||
| mockGetSubManPageContentAction.mockResolvedValue({ |
There was a problem hiding this comment.
issue: could this use a factory instead, where possible? This also applies to all other similar instances in this test.
| }); | ||
|
|
||
| it('renders error banner with PayPal funding source error content', async () => { | ||
| const paypalFundingSourceError = { |
There was a problem hiding this comment.
issue: could this use a factory instead, where possible? This also applies to all other similar instances in this test.
|
|
||
| const MOCK_USER_ID = 'user-123'; | ||
|
|
||
| const baseSession = { |
There was a problem hiding this comment.
issue: could this use a factory instead?
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
|
||
| const SENTRY_DSN = process.env.SENTRY__CLIENT_DSN; |
There was a problem hiding this comment.
question: is there a library that has all these functions already, that can be reused?
| await checkout.emailInput.fill(credentials.email); | ||
| await checkout.signInContinueButton.click(); |
There was a problem hiding this comment.
question: Will the test fail in Stage, since it's expecting OTP instead of email/password signin?
|
|
||
| test('Stripe checkout success', async ({ | ||
| test.describe('with retries', () => { | ||
| test.describe.configure({ retries: 2 }); |
There was a problem hiding this comment.
question: aren't retries defined globally also set to 2 retries?
There was a problem hiding this comment.
Global retries are set to 1 on CI, and 0 locally.
There was a problem hiding this comment.
question: are the tests excluded from the build?
The tests and imports of those tests should not be included in the final build of payments-next.
This pull request
Note: PayPal checkout success functional tests will only run on stage, as the sandbox is not reachable on local
Issue that this pull request solves
Closes: PAY-3688
Checklist
Put an
xin the boxes that apply