mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 03:14:03 +03:00
Added Playwright "Post visibility" tests
Refs https://github.com/TryGhost/Team/issues/2371 - Tests whether the post access selection of public, members, or paid-members matches the expected post visibility on the frontend.
This commit is contained in:
parent
460b031969
commit
0ebb3cbefe
@ -5,6 +5,7 @@
|
||||
@optionLabelPath="label"
|
||||
@optionTargetPath="name"
|
||||
@update={{action "updateVisibility"}}
|
||||
@data-test-select="post-visibility"
|
||||
/>
|
||||
{{svg-jar "arrow-down-small"}}
|
||||
</span>
|
@ -172,3 +172,68 @@ test.describe('Publishing', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Updating post access', () => {
|
||||
test.describe('Change post visibility to members-only', () => {
|
||||
test('Only logged-in members (free or paid) can see', async ({page}) => {
|
||||
await page.goto('/ghost');
|
||||
|
||||
// Create a post
|
||||
await createPost(page);
|
||||
|
||||
// Open the Post Settings Menu
|
||||
await page.locator('[data-test-psm-trigger]').click();
|
||||
|
||||
// Change the Post access setting to 'Members only'
|
||||
await page.locator('[data-test-select="post-visibility"]').selectOption('members');
|
||||
|
||||
// Publish the post
|
||||
const frontendPage = await publishPost(page);
|
||||
|
||||
// Check if content gate for members is present on front-end
|
||||
await expect(frontendPage.locator('.gh-post-upgrade-cta-content h2')).toHaveText('This post is for subscribers only');
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Change post visibility to paid-members-only', () => {
|
||||
test('Only logged-in, paid members can see', async ({page}) => {
|
||||
await page.goto('/ghost');
|
||||
|
||||
// Create a post
|
||||
await createPost(page);
|
||||
|
||||
// Open the Post Settings Menu
|
||||
await page.locator('[data-test-psm-trigger]').click();
|
||||
|
||||
// Change the Post access setting to 'Paid-members only'
|
||||
await page.locator('[data-test-select="post-visibility"]').selectOption('paid');
|
||||
|
||||
// Publish the post
|
||||
const frontendPage = await publishPost(page);
|
||||
|
||||
// Check if content gate for paid members is present on front-end
|
||||
await expect(frontendPage.locator('.gh-post-upgrade-cta-content h2')).toHaveText('This post is for paying subscribers only');
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Change post visibility to public', () => {
|
||||
test('Everyone can see', async ({page}) => {
|
||||
await page.goto('/ghost');
|
||||
|
||||
// Create a post
|
||||
await createPost(page);
|
||||
|
||||
// Open the Post Settings Menu
|
||||
await page.locator('[data-test-psm-trigger]').click();
|
||||
|
||||
// Change the Post access setting to 'Public'
|
||||
await page.locator('[data-test-select="post-visibility"]').selectOption('public');
|
||||
|
||||
// Publish the post
|
||||
const frontendPage = await publishPost(page);
|
||||
|
||||
// Check if post content is publicly visible on front-end
|
||||
await expect(frontendPage.locator('.gh-content.gh-canvas > p')).toHaveText('This is my post body.');
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user