Ghost/ghost/core/test/e2e-browser/admin/membership-settings.spec.js
Sam Lord 4815aa6e7f
Parallelise browser tests
refs: https://github.com/TryGhost/DevOps/issues/78

Re-introduce parallel browser tests

These were adding in a previous PR, but the difference between local
running tests and using CI introduced failures.

Added additional fixes to ensure the Stripe API key is used in the CLI when running in CI.
2023-10-13 11:42:39 +00:00

29 lines
1.2 KiB
JavaScript

const {expect} = require('@playwright/test');
const test = require('../fixtures/ghost-test');
const {disconnectStripe, setupStripe, generateStripeIntegrationToken, getStripeAccountId} = require('../utils');
test.describe('Membership Settings', () => {
test.describe('Portal settings', () => {
test('Shows free tier toggle when stripe is disconnected', async ({page}) => {
await page.goto('/ghost');
// Disconnect stripe
await disconnectStripe(page);
// Open Portal settings
await page.goto('/ghost');
await page.locator('.gh-nav a[href="#/settings/"]').click();
await page.getByTestId('portal').getByRole('button', {name: 'Customize'}).click();
const modal = page.getByTestId('portal-modal');
// Check free tier toggle is visible
await expect(modal.locator('label').filter({hasText: 'Free'}).first()).toBeVisible();
// Reconnect Stripe for other tests
const stripeAccountId = await getStripeAccountId();
const stripeToken = await generateStripeIntegrationToken(stripeAccountId);
await page.goto('/ghost');
await setupStripe(page, stripeToken);
});
});
});