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', () => {
|
2023-10-16 18:32:13 +03:00
|
|
|
test('Shows free tier toggle when stripe is disconnected', async ({sharedPage}) => {
|
|
|
|
await sharedPage.goto('/ghost');
|
2023-01-12 16:59:17 +03:00
|
|
|
// Disconnect stripe
|
2023-10-16 18:32:13 +03:00
|
|
|
await disconnectStripe(sharedPage);
|
2023-01-12 16:59:17 +03:00
|
|
|
|
|
|
|
// Open Portal settings
|
2023-10-16 18:32:13 +03:00
|
|
|
await sharedPage.goto('/ghost');
|
|
|
|
await sharedPage.locator('.gh-nav a[href="#/settings/"]').click();
|
|
|
|
await sharedPage.getByTestId('portal').getByRole('button', {name: 'Customize'}).click();
|
2023-10-09 10:12:46 +03:00
|
|
|
|
2023-10-16 18:32:13 +03:00
|
|
|
const modal = sharedPage.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-10-16 18:32:13 +03:00
|
|
|
await sharedPage.goto('/ghost');
|
|
|
|
await setupStripe(sharedPage, stripeToken);
|
2023-01-12 16:59:17 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|