-
-
Notifications
You must be signed in to change notification settings - Fork 12k
Moved core publishing browser tests to e2e
#27004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b6a7cf1
Migrated core publishing e2e tests from browser suite to e2e suite
9larsons c3ba89f
Fixed publishing e2e tests after local validation
9larsons 2c2817b
upd
9larsons 6317992
rm isolation
9larsons 2e03eb0
fix timeout
9larsons 61150b2
Merge branch 'main' into migrate-publishing-e2e-slice-1
9larsons 4cf54af
tmp hook repro
9larsons 6dba235
fix linting
9larsons b9fd05d
upd
9larsons b170f3c
enable mailgun
9larsons File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import {PostEditorPage, PostsPage} from '@/admin-pages'; | ||
| import {expect, test} from '@/helpers/playwright'; | ||
|
|
||
| test.describe('Ghost Admin - Lexical Editor', () => { | ||
| test('renders primary lexical editor', async ({page}) => { | ||
| const postsPage = new PostsPage(page); | ||
| await postsPage.goto(); | ||
| await postsPage.newPostButton.click(); | ||
|
|
||
| const editor = new PostEditorPage(page); | ||
| await editor.createDraft({title: 'Lexical editor test', body: 'This is my post body.'}); | ||
|
|
||
| await expect(editor.lexicalEditor).toBeVisible(); | ||
| }); | ||
|
|
||
| test('renders secondary hidden lexical editor', async ({page}) => { | ||
| const postsPage = new PostsPage(page); | ||
| await postsPage.goto(); | ||
| await postsPage.newPostButton.click(); | ||
|
|
||
| const editor = new PostEditorPage(page); | ||
| await editor.createDraft({title: 'Secondary lexical editor test', body: 'This is my post body.'}); | ||
|
|
||
| await expect(editor.secondaryEditor).toHaveCount(1); | ||
| await expect(editor.secondaryEditor).toBeHidden(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| import {APIRequestContext} from '@playwright/test'; | ||
| import {PostEditorPage, PostsPage} from '@/admin-pages'; | ||
| import {PostPage} from '@/helpers/pages'; | ||
| import {createMemberFactory, generateSlug} from '@/data-factory'; | ||
| import {expect, test} from '@/helpers/playwright'; | ||
|
|
||
| async function getNewsletters(request: APIRequestContext): Promise<string[]> { | ||
| const response = await request.get('/ghost/api/admin/newsletters/?status=active&limit=all'); | ||
| const data = await response.json(); | ||
| return data.newsletters.map((n: {id: string}) => n.id); | ||
| } | ||
|
|
||
| test.describe('Ghost Admin - Publishing', () => { | ||
| test.use({mailgunEnabled: true}); | ||
|
|
||
| test('publish only - post is visible on frontend', async ({page}) => { | ||
| const postData = {title: 'Publish post only', body: 'This is my post body.'}; | ||
|
|
||
| const postsPage = new PostsPage(page); | ||
| await postsPage.goto(); | ||
| await postsPage.newPostButton.click(); | ||
|
|
||
| const editor = new PostEditorPage(page); | ||
| await editor.createDraft(postData); | ||
|
|
||
| await editor.publishFlow.open(); | ||
| await editor.publishFlow.confirm(); | ||
| await editor.publishFlow.close(); | ||
|
|
||
| const postPage = new PostPage(page); | ||
| await postPage.goto(`/${generateSlug(postData.title)}/`); | ||
| await expect(postPage.articleTitle).toHaveText(postData.title); | ||
| await expect(postPage.articleBody).toHaveText(postData.body); | ||
| }); | ||
|
|
||
| test('publish and email - post is visible on frontend', async ({page}) => { | ||
| const postData = {title: 'Publish and email post', body: 'This is my post body.'}; | ||
|
|
||
| const memberFactory = createMemberFactory(page.request); | ||
| const newsletters = await getNewsletters(page.request); | ||
| await memberFactory.create({ | ||
| email: 'publish-email-test@example.com', | ||
| name: 'Publishing member', | ||
| newsletters | ||
| }); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| const postsPage = new PostsPage(page); | ||
| await postsPage.goto(); | ||
| await postsPage.newPostButton.click(); | ||
|
|
||
| const editor = new PostEditorPage(page); | ||
| await editor.createDraft(postData); | ||
|
|
||
| await editor.publishFlow.open(); | ||
| await editor.publishFlow.selectPublishType('publish+send'); | ||
| await editor.publishFlow.confirm(); | ||
|
|
||
| const postPage = new PostPage(page); | ||
| await postPage.goto(`/${generateSlug(postData.title)}/`); | ||
| await expect(postPage.articleTitle).toHaveText(postData.title); | ||
| await expect(postPage.articleBody).toHaveText(postData.body); | ||
| }); | ||
|
|
||
| test('email only - post is not visible on frontend', async ({page}) => { | ||
| const postData = {title: 'Email only post', body: 'This is my post body.'}; | ||
|
|
||
| const memberFactory = createMemberFactory(page.request); | ||
| const newsletters = await getNewsletters(page.request); | ||
| await memberFactory.create({ | ||
| email: 'email-only-test@example.com', | ||
| name: 'Publishing member', | ||
| newsletters | ||
| }); | ||
|
|
||
| const postsPage = new PostsPage(page); | ||
| await postsPage.goto(); | ||
| await postsPage.newPostButton.click(); | ||
|
|
||
| const editor = new PostEditorPage(page); | ||
| await editor.createDraft(postData); | ||
|
|
||
| await editor.publishFlow.open(); | ||
| await editor.publishFlow.selectPublishType('send'); | ||
| await editor.publishFlow.confirm(); | ||
|
|
||
| const slug = generateSlug(postData.title); | ||
| const response = await page.goto(`/${slug}/`); | ||
| expect(response?.status()).toBe(404); | ||
| }); | ||
| }); | ||
|
|
||
| test.describe('Ghost Admin - Deleting Posts', () => { | ||
| test('delete a saved post - redirects to posts list', async ({page}) => { | ||
| const postsPage = new PostsPage(page); | ||
| await postsPage.goto(); | ||
| await postsPage.newPostButton.click(); | ||
|
|
||
| const editor = new PostEditorPage(page); | ||
| await editor.titleInput.fill('Delete a post test'); | ||
| await editor.titleInput.press('Enter'); | ||
| await expect(editor.postStatus).toContainText('Draft - Saved'); | ||
|
|
||
| await editor.settingsToggleButton.click(); | ||
| await editor.settingsMenu.deletePost(); | ||
|
|
||
| await expect(editor.screenTitle).toContainText('Posts'); | ||
| }); | ||
|
|
||
| test('delete a post with unsaved changes - redirects to posts list', async ({page}) => { | ||
| const postsPage = new PostsPage(page); | ||
| await postsPage.goto(); | ||
| await postsPage.newPostButton.click(); | ||
|
|
||
| const editor = new PostEditorPage(page); | ||
| await editor.createDraft({title: 'Delete a post test', body: 'This is the content'}); | ||
|
|
||
| await editor.settingsToggleButton.click(); | ||
| await editor.settingsMenu.deletePost(); | ||
|
|
||
| await expect(editor.screenTitle).toContainText('Posts'); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.