diff --git a/apps/admin-x-settings/src/components/Sidebar.tsx b/apps/admin-x-settings/src/components/Sidebar.tsx index 46d18a238a..a2f60a4cd7 100644 --- a/apps/admin-x-settings/src/components/Sidebar.tsx +++ b/apps/admin-x-settings/src/components/Sidebar.tsx @@ -186,7 +186,7 @@ const Sidebar: React.FC = () => { {hasStripeEnabled && } - {hasTipsAndDonations && } + {hasTipsAndDonations && hasStripeEnabled && } diff --git a/apps/admin-x-settings/src/components/settings/growth/GrowthSettings.tsx b/apps/admin-x-settings/src/components/settings/growth/GrowthSettings.tsx index 4d74d27237..58a38740ae 100644 --- a/apps/admin-x-settings/src/components/settings/growth/GrowthSettings.tsx +++ b/apps/admin-x-settings/src/components/settings/growth/GrowthSettings.tsx @@ -25,7 +25,7 @@ const GrowthSettings: React.FC = () => { {hasStripeEnabled && } - {hasTipsAndDonations && } + {hasTipsAndDonations && hasStripeEnabled && } ); }; diff --git a/apps/admin-x-settings/test/acceptance/growth/tips-and-donations.test.ts b/apps/admin-x-settings/test/acceptance/growth/tips-and-donations.test.ts index 50337d0695..d637485e80 100644 --- a/apps/admin-x-settings/test/acceptance/growth/tips-and-donations.test.ts +++ b/apps/admin-x-settings/test/acceptance/growth/tips-and-donations.test.ts @@ -1,18 +1,32 @@ import {expect, test} from '@playwright/test'; import {globalDataRequests} from '../../utils/acceptance'; -import {mockApi, toggleLabsFlag} from '@tryghost/admin-x-framework/test/acceptance'; +import {mockApi, settingsWithStripe, toggleLabsFlag} from '@tryghost/admin-x-framework/test/acceptance'; test.describe('Tips and donations', () => { test.beforeEach(async () => { toggleLabsFlag('tipsAndDonations', true); }); - test('Shows suggested amount and shareable link', async ({page}) => { + test('Is not shown when Stripe is disabled', async ({page}) => { await mockApi({page, requests: {...globalDataRequests}}); await page.goto('/'); + await expect(page.locator('[data-setting-nav-item] #tips-and-donations')).not.toBeVisible(); + await expect(page.getByTestId('tips-and-donations')).not.toBeVisible(); + }); + + test('Shows suggested amount and shareable link when Stripe is enabled', async ({page}) => { + await mockApi({page, requests: { + ...globalDataRequests, + browseSettings: {...globalDataRequests.browseSettings, response: settingsWithStripe} + }}); + await page.goto('/'); + const section = page.getByTestId('tips-and-donations'); + await expect(page.locator('[data-setting-nav-item] #tips-and-donations')).toBeVisible(); + await expect(section).toBeVisible(); + await expect(section.getByTestId('suggested-amount')).toHaveText(/\$5/); await expect(section.getByTestId('donate-url')).toHaveText('http://test.com/#/portal/support'); await expect(section.getByTestId('preview-shareable-link')).not.toBeVisible();