-
Notifications
You must be signed in to change notification settings - Fork 801
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more E2E tests for Jetpack Social (#37046)
* Add more E2E tests for Jetpack Social * Update the wpcom login step to check for the login button visibility * Revert previous change and update wpcom login step --------- Co-authored-by: Paul Bunkham <[email protected]>
- Loading branch information
1 parent
0a8a39f
commit a19e183
Showing
4 changed files
with
79 additions
and
6 deletions.
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