Revert "Changed request type to fetching iframe content in previews

refs https://ghost.slack.com/archives/C0568LN2CGJ/p1706018058495729
This commit is contained in:
Ronald Langeveld 2024-01-23 14:33:38 +00:00 committed by GitHub
parent 0f24f1efef
commit 94c7d9b21b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 5 additions and 5 deletions

View File

@ -224,7 +224,7 @@ export async function mockSitePreview({page, url, response}: {page: Page, url: s
const lastRequest: {previewHeader?: string} = {};
await page.route(url, async (route) => {
if (route.request().method() !== 'GET') {
if (route.request().method() !== 'POST') {
return route.continue();
}

View File

@ -28,7 +28,7 @@ const AnnouncementBarPreview: React.FC<AnnouncementBarSettings> = ({announcement
}
fetch(url, {
method: 'GET',
method: 'POST',
headers: {
'Content-Type': 'text/html;charset=utf-8',
'x-ghost-preview': getPreviewData(

View File

@ -65,7 +65,7 @@ const ThemePreview: React.FC<ThemePreviewProps> = ({settings,url}) => {
// Fetch theme preview HTML
fetch(url, {
method: 'GET',
method: 'POST',
headers: {
'Content-Type': 'text/html;charset=utf-8',
'x-ghost-preview': previewData,

View File

@ -44,7 +44,7 @@ test.describe('Announcement Bar', async () => {
const iframesHandleHome = await page.$$('[data-testid="announcement-bar-preview-iframe"] > iframe');
const textExistsInHomeIframes = await checkTextInIframes(iframesHandleHome, 'homepage preview');
await expect(textExistsInHomeIframes).toBeTruthy();
expect(textExistsInHomeIframes).toBeTruthy();
const modal = page.getByTestId('announcement-bar-modal');
await modal.getByTestId('design-toolbar').getByRole('tab', {name: 'Post'}).click();

View File

@ -220,7 +220,7 @@ test.describe('Design settings', async () => {
await expect(modal.getByTestId('design-setting-tabs').getByRole('tab', {name: 'Post'})).toBeHidden();
const expectedEncoded = new URLSearchParams([['custom', JSON.stringify({})]]).toString();
await expect(lastPreviewRequest.previewHeader).toMatch(new RegExp(`&${expectedEncoded.replace(/\+/g, '\\+')}`));
expect(lastPreviewRequest.previewHeader).toMatch(new RegExp(`&${expectedEncoded.replace(/\+/g, '\\+')}`));
});
test('Custom theme setting visibility', async ({page}) => {