2023-08-16 13:22:30 +02:00
|
|
|
import {expect, test} from '@playwright/test';
|
2023-11-22 13:39:32 +00:00
|
|
|
import {globalDataRequests, mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
|
2023-08-16 13:22:30 +02:00
|
|
|
|
|
|
|
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');
|
2023-10-06 10:06:05 +01:00
|
|
|
|
2023-08-16 13:22:30 +02:00
|
|
|
const unsplashToggle = unsplashModal.getByRole('switch');
|
|
|
|
await unsplashToggle.click();
|
|
|
|
|
|
|
|
expect(lastApiRequests.editSettings?.body).toEqual({
|
|
|
|
settings: [
|
|
|
|
{key: 'unsplash', value: false}
|
|
|
|
]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|