2023-10-13 14:42:39 +03:00
|
|
|
const {expect} = require('@playwright/test');
|
|
|
|
const test = require('../fixtures/ghost-test');
|
|
|
|
const {disconnectStripe, setupStripe, generateStripeIntegrationToken, getStripeAccountId} = require('../utils');
|
2023-01-12 16:59:17 +03:00
|
|
|
|
|
|
|
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();
|
2023-10-09 10:12:46 +03:00
|
|
|
await page.getByTestId('portal').getByRole('button', {name: 'Customize'}).click();
|
|
|
|
|
|
|
|
const modal = page.getByTestId('portal-modal');
|
2023-01-12 16:59:17 +03:00
|
|
|
// Check free tier toggle is visible
|
2023-10-09 10:12:46 +03:00
|
|
|
await expect(modal.locator('label').filter({hasText: 'Free'}).first()).toBeVisible();
|
2023-01-12 16:59:17 +03:00
|
|
|
|
|
|
|
// Reconnect Stripe for other tests
|
2023-10-13 14:42:39 +03:00
|
|
|
const stripeAccountId = await getStripeAccountId();
|
|
|
|
const stripeToken = await generateStripeIntegrationToken(stripeAccountId);
|
2023-01-12 16:59:17 +03:00
|
|
|
await page.goto('/ghost');
|
|
|
|
await setupStripe(page, stripeToken);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|