Ghost/ghost/admin-x-settings/test/e2e/site/design.test.ts
Rishabh Garg b697ca2768
Added basic theme settings design in AdminX (#17000)
refs https://github.com/TryGhost/Team/issues/3432

- adds basic design structure for theme settings/management in adminX

---------

Co-authored-by: Peter Zimon <peter.zimon@gmail.com>
2023-06-13 14:27:29 +05:30

63 lines
2.1 KiB
TypeScript

import {expect, test} from '@playwright/test';
import {mockApi} from '../../utils/e2e';
test.describe('Theme settings', async () => {
test('Editing brand settings', async ({page}) => {
const lastApiRequest = await mockApi({page, responses: {
previewHtml: {
homepage: '<html><head><style></style></head><body><div>homepage preview</div></body></html>'
}
}});
await page.goto('/');
const section = page.getByTestId('design');
await section.getByRole('button', {name: 'Customize'}).click();
const modal = page.getByTestId('design-modal');
await expect(modal.frameLocator('[data-testid="theme-preview"]').getByText('homepage preview')).toHaveCount(1);
await modal.getByLabel('Site description').fill('new description');
await modal.getByRole('button', {name: 'Save'}).click();
await expect(modal).not.toBeVisible();
expect(lastApiRequest.body).toEqual({
settings: [
{key: 'description', value: 'new description'}
]
});
});
test('Editing custom theme settings', async ({page}) => {
const lastApiRequest = await mockApi({page});
await page.goto('/');
const section = page.getByTestId('design');
await section.getByRole('button', {name: 'Customize'}).click();
const modal = page.getByTestId('design-modal');
await modal.getByRole('tab', {name: 'Site wide'}).click();
await modal.getByLabel('Navigation layout').selectOption('Logo in the middle');
await modal.getByRole('button', {name: 'Save'}).click();
await expect(modal).not.toBeVisible();
expect(lastApiRequest.body).toMatchObject({
custom_theme_settings: [
{key: 'navigation_color'},
{key: 'navigation_background_image'},
{key: 'navigation_layout', value: 'Logo in the middle'},
{key: 'show_publication_cover'},
{key: 'email_signup_text'}
]
});
});
});