0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00
ghost/apps/admin-x-settings/test/e2e/general/metadata.test.ts
Peter Zimon dbe1c0fa2e
AdminX various UI fixes (#18089)
refs. https://github.com/TryGhost/Product/issues/3349

- some of the UI components' scrollbar was visible where it wasn't necessary
- metadata preview was shown in view mode too
- social accounts value was shown even if it was empty
- user detail modal was missing field descriptions
- it was not possible to reopen the Zapier modal after closing it the "Close" button
- copy had to be updated for analytics export to make it clear what is going to be exported
- invite modal had to be closed after successful invitation
- toggle component was only active on the text itself, instead of the whole row
2023-09-12 16:11:12 +02:00

34 lines
1.3 KiB
TypeScript

import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, updatedSettingsResponse} from '../../utils/e2e';
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'}
]
});
});
});