2023-06-06 06:50:07 +03:00
|
|
|
import {expect, test} from '@playwright/test';
|
2023-11-22 16:39:32 +03:00
|
|
|
import {globalDataRequests, mockApi, updatedSettingsResponse} from '@tryghost/admin-x-framework/test/acceptance';
|
2023-06-06 06:50:07 +03:00
|
|
|
|
|
|
|
test.describe('Metadata settings', async () => {
|
|
|
|
test('Supports editing metadata', async ({page}) => {
|
2023-08-03 11:29:14 +03:00
|
|
|
const {lastApiRequests} = await mockApi({page, requests: {
|
|
|
|
...globalDataRequests,
|
|
|
|
editSettings: {method: 'PUT', path: '/settings/', response: updatedSettingsResponse([
|
|
|
|
{key: 'meta_title', value: 'Alternative title'},
|
|
|
|
{key: 'meta_description', value: 'Alternative description'}
|
|
|
|
])}
|
2023-06-06 06:50:07 +03:00
|
|
|
}});
|
|
|
|
|
|
|
|
await page.goto('/');
|
|
|
|
|
|
|
|
const section = page.getByTestId('metadata');
|
|
|
|
|
|
|
|
await section.getByRole('button', {name: 'Edit'}).click();
|
|
|
|
|
|
|
|
await section.getByLabel('Meta title').fill('Alternative title');
|
|
|
|
await section.getByLabel('Meta description').fill('Alternative description');
|
|
|
|
|
|
|
|
await section.getByRole('button', {name: 'Save'}).click();
|
|
|
|
|
|
|
|
await expect(section.getByLabel('Meta title')).toHaveCount(0);
|
|
|
|
|
2023-08-03 11:29:14 +03:00
|
|
|
expect(lastApiRequests.editSettings?.body).toEqual({
|
2023-06-06 06:50:07 +03:00
|
|
|
settings: [
|
|
|
|
{key: 'meta_title', value: 'Alternative title'},
|
|
|
|
{key: 'meta_description', value: 'Alternative description'}
|
|
|
|
]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|