0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/apps/admin-x-settings/test/acceptance/advanced/integrations/unsplash.test.ts
Peter Zimon fca8941740
Updated integration modals buttons (#20502)
DES-27

Updated buttons in integrations from [Cancel] and [Save & close] to
[Close] and [Save] to be consistent with the rest of the Settings UI.
2024-07-01 17:29:53 +02:00

32 lines
1.3 KiB
TypeScript

import {expect, test} from '@playwright/test';
import {globalDataRequests} from '../../../utils/acceptance';
import {mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Unsplash integration', async () => {
test('Supports toggling unsplash integration', async ({page}) => {
const {lastApiRequests} = await mockApi({page, requests: {
...globalDataRequests,
editSettings: {method: 'PUT', path: '/settings/', response: updatedSettingsResponse([
{key: 'unsplash', value: false}
])}
}});
await page.goto('/');
const section = page.getByTestId('integrations');
const unsplashElement = section.getByText('Unsplash').last();
await unsplashElement.hover();
await page.getByRole('button', {name: 'Configure'}).click();
const unsplashModal = page.getByTestId('unsplash-modal');
const unsplashToggle = unsplashModal.getByRole('switch');
await unsplashToggle.click();
await unsplashModal.getByRole('button', {name: 'Save'}).click();
expect(lastApiRequests.editSettings?.body).toEqual({
settings: [
{key: 'unsplash', value: false}
]
});
});
});