0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00
ghost/apps/admin-x-settings/test/acceptance/growth/tips-and-donations.test.ts
Daniël van der Winden 171036e640
🎨 Made 5 settings quicker to edit at the top-level in Settings (#21976)
Based on our changes to the _Access_ and _Analytics_ cards in Settings,
we decided to update how we allow edits to a few other settings, too.

These changes allow the following settings to be manipulated at the
top-level in Settings, without having to click 'Edit' first.

- Timezone
- Default recipients for newsletters
- Publication language
- Social accounts
- Tips and donations

fixes
https://linear.app/ghost/issue/DES-1062/updates-to-editsave-method-of-settings-cards
2025-01-08 16:33:54 +00:00

44 lines
1.9 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();
const suggestedAmountInput = section.getByRole('textbox', {name: 'Suggested amount'});
await expect(suggestedAmountInput).toBeVisible();
await expect(suggestedAmountInput).toHaveValue('5');
await expect(section.getByRole('combobox')).toBeVisible();
const donateUrl = section.getByTestId('donate-url');
await expect(donateUrl).toBeVisible();
await expect(donateUrl).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 donateUrl.hover();
await expect(section.getByTestId('preview-shareable-link')).toBeVisible();
await expect(section.getByTestId('copy-shareable-link')).toBeVisible();
});
});