a8083960d8
refs https://github.com/TryGhost/Product/issues/4182 Updated framework to include shared test config for easier app setup.
36 lines
1.4 KiB
TypeScript
36 lines
1.4 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('Metadata settings', async () => {
|
|
test('Supports editing metadata', async ({page}) => {
|
|
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'}
|
|
])}
|
|
}});
|
|
|
|
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);
|
|
|
|
expect(lastApiRequests.editSettings?.body).toEqual({
|
|
settings: [
|
|
{key: 'meta_title', value: 'Alternative title'},
|
|
{key: 'meta_description', value: 'Alternative description'}
|
|
]
|
|
});
|
|
});
|
|
});
|