-
Notifications
You must be signed in to change notification settings - Fork 801
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
Add more E2E tests for Jetpack Social #37046
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c94241b
Add more E2E tests for Jetpack Social
manzoorwanijk f670105
Update the wpcom login step to check for the login button visibility
pablinos 0a0f40f
Merge remote-tracking branch 'origin/trunk' into add/e2e-tests-for-so…
pablinos 49f6911
Revert previous change and update wpcom login step
pablinos 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 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,4 @@ | ||
Significance: patch | ||
Type: added | ||
|
||
Added more E2E tests |
23 changes: 23 additions & 0 deletions
23
projects/plugins/social/tests/e2e/specs/admin-page.test.js
This file contains 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,23 @@ | ||
import { prerequisitesBuilder } from 'jetpack-e2e-commons/env/prerequisites.js'; | ||
import { expect, test } from 'jetpack-e2e-commons/fixtures/base-test.js'; | ||
import { JetpackSocialPage } from '../pages/index.js'; | ||
import logger from 'jetpack-e2e-commons/logger.js'; | ||
|
||
test.beforeEach( async ( { page } ) => { | ||
await prerequisitesBuilder( page ) | ||
.withCleanEnv() | ||
.withActivePlugins( [ 'social' ] ) | ||
.withLoggedIn( true ) | ||
.build(); | ||
} ); | ||
|
||
test( 'Jetpack Social admin page', async ( { page } ) => { | ||
logger.action( 'Visit the Jetpack Social admin page' ); | ||
await JetpackSocialPage.visit( page ); | ||
|
||
logger.action( 'Checking for heading "Jetpack Social"' ); | ||
await expect( page.getByRole( 'heading', { name: 'Jetpack Social' } ) ).toBeVisible(); | ||
|
||
logger.action( 'Checking for button "Get Started"' ); | ||
await expect( page.getByRole( 'button', { name: 'Get Started' } ) ).toBeVisible(); | ||
} ); |
51 changes: 51 additions & 0 deletions
51
projects/plugins/social/tests/e2e/specs/social-sidebar.test.js
This file contains 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,51 @@ | ||
import { prerequisitesBuilder } from 'jetpack-e2e-commons/env/prerequisites.js'; | ||
import { expect, test } from 'jetpack-e2e-commons/fixtures/base-test.js'; | ||
import logger from 'jetpack-e2e-commons/logger.js'; | ||
import BlockEditorPage from 'jetpack-e2e-commons/pages/wp-admin/block-editor.js'; | ||
import { connect } from '../flows/index.js'; | ||
|
||
test.beforeEach( async ( { page } ) => { | ||
await prerequisitesBuilder( page ) | ||
.withCleanEnv() | ||
.withActivePlugins( [ 'social' ] ) | ||
.withInactivePlugins( [ 'jetpack' ] ) | ||
.withLoggedIn( true ) | ||
.withWpComLoggedIn( true ) | ||
.build(); | ||
} ); | ||
|
||
test( 'Jetpack Social sidebar', async ( { page } ) => { | ||
await test.step( 'Connect wordpress.com account', async () => { | ||
await connect( page ); | ||
} ); | ||
|
||
await test.step( 'Goto post edit page', async () => { | ||
logger.action( 'Hover over "Posts" in admin menu' ); | ||
await page.getByRole( 'link', { name: 'Posts', exact: true } ).hover(); | ||
|
||
logger.action( 'Click on "Add New Post" in admin menu' ); | ||
await page.getByRole( 'link', { name: 'Add New Post' } ).click(); | ||
|
||
/** | ||
* @type {BlockEditorPage} | ||
*/ | ||
const blockEditor = await BlockEditorPage.init( page ); | ||
|
||
await page.waitForURL( '**/post-new.php' ); | ||
await blockEditor.waitForEditor(); | ||
|
||
logger.action( 'Close "Welcome to the block editor" dialog' ); | ||
await blockEditor.resolveWelcomeGuide(); | ||
|
||
await blockEditor.setTitle( 'Jetpack Social test post' ); | ||
} ); | ||
|
||
await test.step( 'Check Social sidebar', async () => { | ||
logger.action( 'Open Jetpack Social sidebar' ); | ||
await page.getByRole( 'button', { name: 'Jetpack Social', exact: true } ).click(); | ||
|
||
logger.action( 'Checking for "Preview" button' ); | ||
const previewButton = page.getByRole( 'button', { name: 'Open Social Previews', exact: true } ); | ||
await expect( previewButton ).toBeVisible(); | ||
} ); | ||
} ); |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason this step is faliing for me. It gets stuck on the confirmation screen after login. It must be something about my environment or other tests would be failing.
Is it still working for you in your dev environment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry meant to attach the screenshot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
What error do you see in the console/terminal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a timeout on this page as it's waiting for the form to be hidden, but that never happens as we need to click on the continue button. Very strange! The GH Action is succeeding too. I've tried cleaning my environment but I get the same problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, many of those workflow utilities are unpredictable and needs more work, which is beyond the scope of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a change in f670105, that looks for the Login button being hidden rather than waiting for the login container to be hidden (which isn't happening sometimes). It works locally for me, but we'll have to see if it works in CI and for everyone else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything changed in that commit you pushed 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah! I've committed the wrong file. 49f6911 should have the right changes.