Skip to content

Commit

Permalink
LPD-39567 Migrate missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
victorg1991 authored and brianchandotcom committed Oct 24, 2024
1 parent 1725774 commit d695c36
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 106 deletions.
92 changes: 92 additions & 0 deletions modules/test/playwright/tests/fragment-web/fragmentsAdmin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,3 +784,95 @@ test(
).toHaveProperty('fragmentCollectionId', fragmentCollectionId);
}
);

test(
'Can change resource image and propagate',
{tag: '@LPS-152633'},
async ({
apiHelpers,
fragmentEditorPage,
fragmentsPage,
page,
pageEditorPage,
site,
}) => {

// Create a new fragment set and fragment

await fragmentsPage.goto(site.friendlyUrlPath);

const setName = getRandomString();

await fragmentsPage.createFragmentSet(setName);

const fragmentName = getRandomString();

await fragmentsPage.createFragment(setName, fragmentName);

await fragmentEditorPage.addHTML(`
<div class="fragment-name">
Test Fragment
</div>
`);

await fragmentEditorPage.publish();

// Add the fragment to a page

const layout = await apiHelpers.headlessDelivery.createSitePage({
pageDefinition: getPageDefinition([]),
siteId: site.id,
title: getRandomString(),
});

await pageEditorPage.goto(layout, site.friendlyUrlPath);

await pageEditorPage.addFragment(setName, fragmentName);

await expect(page.getByText('Test Fragment')).toBeVisible();

// Edit the fragment but don't publish it

await fragmentsPage.goto(site.friendlyUrlPath);

await fragmentsPage.clickAction('Edit', fragmentName);

await fragmentEditorPage.addHTML(`
<div class="fragment-name">
Test Fragment New
</div>
`);

await fragmentEditorPage.publish();

// Check that the fragment is not updated on the page

await pageEditorPage.goto(layout, site.friendlyUrlPath);

await expect(
page.getByText('Test Fragment', {exact: true})
).toBeVisible();

await fragmentsPage.goto(site.friendlyUrlPath);

// Propagate the changes

await fragmentsPage.clickAction('View Usages', fragmentName);

await page
.getByLabel('Select All Items on the Page')
.check({trial: true});

await page.getByLabel('Select All Items on the Page').check();

await page.getByRole('button', {name: 'Propagate'}).click();

await waitForAlert(page);

// Check that the fragment is updated on the page

await pageEditorPage.goto(layout, site.friendlyUrlPath);

await expect(page.getByText('Test Fragment New')).toBeVisible();
}
);

This file was deleted.

0 comments on commit d695c36

Please sign in to comment.