mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Allowed Stripe network access in Playwright tests
no issue Previous test change that blocks network access broke the Playwright tests, that need to access the Stripe checkout page.
This commit is contained in:
parent
6f8dc6b29e
commit
df9df4be80
1 changed files with 9 additions and 0 deletions
|
@ -9,6 +9,7 @@ const {stopGhost} = require('../../utils/e2e-utils');
|
|||
const MailgunClient = require('@tryghost/mailgun-client/lib/mailgun-client');
|
||||
const sinon = require('sinon');
|
||||
const ObjectID = require('bson-objectid').default;
|
||||
const nock = require('nock');
|
||||
|
||||
const startWebhookServer = () => {
|
||||
const command = `stripe listen --forward-to ${config.getSiteUrl()}members/webhooks/stripe/ ${process.env.CI ? `--api-key ${process.env.STRIPE_SECRET_KEY}` : ''}`.trim();
|
||||
|
@ -65,6 +66,11 @@ const stubMailgun = () => {
|
|||
});
|
||||
};
|
||||
|
||||
const allowStripeNetwork = () => {
|
||||
// Allow Stripe
|
||||
nock.enableNetConnect('stripe.com');
|
||||
};
|
||||
|
||||
/**
|
||||
* Setup the environment
|
||||
*/
|
||||
|
@ -86,6 +92,9 @@ const setup = async (playwrightConfig) => {
|
|||
server: true,
|
||||
backend: true
|
||||
});
|
||||
|
||||
// StartGhost automatically disables network, so we need to re-enable it for Stripe
|
||||
allowStripeNetwork();
|
||||
}
|
||||
|
||||
const {baseURL, storageState} = playwrightConfig.projects[0].use;
|
||||
|
|
Loading…
Add table
Reference in a new issue