-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate
site-editor-inserter
e2e test to Playwright (#44507)
* Add site editor test case * Addressed feedbacks * Addressed feedbacks * Addressed locator feedback * Add role locators intead of class and assert both state * Delete original file
- Loading branch information
1 parent
c3ae088
commit 3ed9aca
Showing
2 changed files
with
42 additions
and
33 deletions.
There are no files selected for viewing
33 changes: 0 additions & 33 deletions
33
packages/e2e-tests/specs/site-editor/site-editor-inserter.test.js
This file was deleted.
Oops, something went wrong.
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,42 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Site Editor Inserter', () => { | ||
test.beforeAll( async ( { requestUtils } ) => { | ||
await Promise.all( [ | ||
requestUtils.activateTheme( 'emptytheme' ), | ||
requestUtils.deleteAllTemplates( 'wp_template' ), | ||
requestUtils.deleteAllTemplates( 'wp_template_part' ), | ||
] ); | ||
} ); | ||
|
||
test.afterAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'twentytwentyone' ); | ||
} ); | ||
|
||
test.beforeEach( async ( { admin } ) => { | ||
await admin.visitSiteEditor(); | ||
} ); | ||
|
||
test( 'inserter toggle button should toggle global inserter', async ( { | ||
page, | ||
} ) => { | ||
await page.click( 'role=button[name="Toggle block inserter"i]' ); | ||
|
||
// Visibility check | ||
await expect( | ||
page.locator( | ||
'role=searchbox[name="Search for blocks and patterns"i]' | ||
) | ||
).toBeVisible(); | ||
await page.click( 'role=button[name="Toggle block inserter"i]' ); | ||
//Hidden State check | ||
await expect( | ||
page.locator( | ||
'role=searchbox[name="Search for blocks and patterns"i]' | ||
) | ||
).toBeHidden(); | ||
} ); | ||
} ); |