0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00
ghost/apps/admin-x-settings/test/acceptance/growth/tips-and-donations.test.ts
Kevin Ansfield 1bc34f7227 Added Tips & Donations one-off payments
no issue

Give your audience a simple way to support your work with one-time payments, no membership required.

- cleaned up `tipsAndDonations` labs flag
2024-09-03 16:00:48 +01:00

36 lines
1.7 KiB
TypeScript

import {expect, test} from '@playwright/test';
import {globalDataRequests} from '../../utils/acceptance';
import {mockApi, settingsWithStripe} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Tips and donations', () => {
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();
await expect(section.getByTestId('copy-shareable-link')).not.toBeVisible();
await section.getByTestId('donate-url').hover();
await expect(section.getByTestId('preview-shareable-link')).toBeVisible();
await expect(section.getByTestId('copy-shareable-link')).toBeVisible();
});
});