0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/apps/admin-x-settings/test/e2e/advanced/integrations/unsplash.test.ts
Ronald Langeveld 0da4653f3a
Wired up Unsplash integration to Admin X (#17727)
closes https://github.com/TryGhost/Product/issues/3741
refs https://github.com/TryGhost/Product/issues/3729

- my first commit with some Admin X stuff! 🕺🏻
- Wired up the API to the Unsplash integration modal

---

<!-- Leave the line below if you'd like GitHub Copilot to generate a
summary from your commit -->
<!--
copilot:summary
-->
### <samp>🤖 Generated by Copilot at da09dd4</samp>

This pull request adds a toggle to the Unsplash modal in the advanced
settings to enable or disable the Unsplash integration. It also updates
the settings API hook to include the Unsplash setting in the query.
2023-08-16 13:22:30 +02:00

29 lines
1.1 KiB
TypeScript

import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, updatedSettingsResponse} from '../../../utils/e2e';
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();
expect(lastApiRequests.editSettings?.body).toEqual({
settings: [
{key: 'unsplash', value: false}
]
});
});
});