mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Added additional post setting changes to e2e published post update test
refs https://github.com/TryGhost/Team/issues/2371 - tests both the post body and settings in the PSM take effect when saving
This commit is contained in:
parent
e24a67b882
commit
460b031969
1 changed files with 12 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
const {expect, test} = require('@playwright/test');
|
const {expect, test} = require('@playwright/test');
|
||||||
|
const {DateTime} = require('luxon');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a post draft with a filled in title and body. We can consider to move this to utils later.
|
* Start a post draft with a filled in title and body. We can consider to move this to utils later.
|
||||||
|
@ -104,18 +105,26 @@ test.describe('Publishing', () => {
|
||||||
test('Can update a published post', async ({page: adminPage, browser}) => {
|
test('Can update a published post', async ({page: adminPage, browser}) => {
|
||||||
await adminPage.goto('/ghost');
|
await adminPage.goto('/ghost');
|
||||||
|
|
||||||
|
const date = DateTime.now();
|
||||||
|
|
||||||
await createPost(adminPage, {title: 'Testing publish update', body: 'This is the initial published text.'});
|
await createPost(adminPage, {title: 'Testing publish update', body: 'This is the initial published text.'});
|
||||||
const frontendPage = await publishPost(adminPage);
|
const frontendPage = await publishPost(adminPage);
|
||||||
const frontendBody = frontendPage.getByRole('main');
|
const frontendBody = frontendPage.getByRole('main');
|
||||||
|
|
||||||
// check front-end post has the initial body text
|
// check front-end post has the initial body text
|
||||||
await expect(frontendBody).toContainText('This is the initial published text.');
|
await expect(frontendBody).toContainText('This is the initial published text.');
|
||||||
|
await expect(frontendBody).toContainText(date.toFormat('LLL d, yyyy'));
|
||||||
|
|
||||||
// add some extra text to the post
|
// add some extra text to the post
|
||||||
await adminPage.locator('[data-kg="editor"]').click();
|
await adminPage.locator('[data-kg="editor"]').click();
|
||||||
await adminPage.keyboard.press('Enter');
|
await adminPage.keyboard.press('Enter');
|
||||||
await adminPage.keyboard.type('This is some updated text.');
|
await adminPage.keyboard.type('This is some updated text.');
|
||||||
|
|
||||||
|
// change some post settings
|
||||||
|
await adminPage.locator('[data-test-psm-trigger]').click();
|
||||||
|
await adminPage.fill('[data-test-date-time-picker-date-input]', '2022-01-07');
|
||||||
|
await adminPage.fill('[data-test-field="custom-excerpt"]', 'Short description and meta');
|
||||||
|
|
||||||
// save
|
// save
|
||||||
await adminPage.locator('[data-test-button="publish-save"]').click();
|
await adminPage.locator('[data-test-button="publish-save"]').click();
|
||||||
|
|
||||||
|
@ -123,6 +132,9 @@ test.describe('Publishing', () => {
|
||||||
await frontendPage.waitForTimeout(100); // let save go through
|
await frontendPage.waitForTimeout(100); // let save go through
|
||||||
await frontendPage.reload();
|
await frontendPage.reload();
|
||||||
await expect(frontendBody).toContainText('This is some updated text.');
|
await expect(frontendBody).toContainText('This is some updated text.');
|
||||||
|
await expect(frontendBody).toContainText('Jan 7, 2022');
|
||||||
|
const metaDescription = frontendPage.locator('meta[name="description"]');
|
||||||
|
await expect(metaDescription).toHaveAttribute('content', 'Short description and meta');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue