Changed request type to fetching iframe content in previews (#19307)
refs PROD-227 - Swapped out the request type from `POST` to `GET`.
This commit is contained in:
parent
1f0d874ea2
commit
4c09a96a3c
@ -223,7 +223,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() !== 'POST') {
|
||||
if (route.request().method() !== 'GET') {
|
||||
return route.continue();
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ const AnnouncementBarPreview: React.FC<AnnouncementBarSettings> = ({announcement
|
||||
}
|
||||
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'text/html;charset=utf-8',
|
||||
'x-ghost-preview': getPreviewData(
|
||||
|
@ -65,7 +65,7 @@ const ThemePreview: React.FC<ThemePreviewProps> = ({settings,url}) => {
|
||||
|
||||
// Fetch theme preview HTML
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'text/html;charset=utf-8',
|
||||
'x-ghost-preview': previewData,
|
||||
|
@ -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');
|
||||
expect(textExistsInHomeIframes).toBeTruthy();
|
||||
await expect(textExistsInHomeIframes).toBeTruthy();
|
||||
|
||||
const modal = page.getByTestId('announcement-bar-modal');
|
||||
await modal.getByTestId('design-toolbar').getByRole('tab', {name: 'Post'}).click();
|
||||
|
@ -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();
|
||||
expect(lastPreviewRequest.previewHeader).toMatch(new RegExp(`&${expectedEncoded.replace(/\+/g, '\\+')}`));
|
||||
await expect(lastPreviewRequest.previewHeader).toMatch(new RegExp(`&${expectedEncoded.replace(/\+/g, '\\+')}`));
|
||||
});
|
||||
|
||||
test('Custom theme setting visibility', async ({page}) => {
|
||||
|
Loading…
Reference in New Issue
Block a user