forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DataViews: Fix filters lost when switching layouts (WordPress#67740)
Co-authored-by: youknowriad <[email protected]> Co-authored-by: ntsekouras <[email protected]>
- Loading branch information
1 parent
6b8e47f
commit 9ae9ec3
Showing
2 changed files
with
104 additions
and
42 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
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,56 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Page List', () => { | ||
test.beforeAll( async ( { requestUtils } ) => { | ||
// Activate a theme with permissions to access the site editor. | ||
await requestUtils.activateTheme( 'emptytheme' ); | ||
await requestUtils.createPage( { | ||
title: 'Privacy Policy', | ||
status: 'publish', | ||
} ); | ||
await requestUtils.createPage( { | ||
title: 'Sample Page', | ||
status: 'publish', | ||
} ); | ||
} ); | ||
|
||
test.afterAll( async ( { requestUtils } ) => { | ||
// Go back to the default theme. | ||
await Promise.all( [ | ||
requestUtils.activateTheme( 'twentytwentyone' ), | ||
requestUtils.deleteAllPages(), | ||
] ); | ||
} ); | ||
|
||
test.beforeEach( async ( { admin, page } ) => { | ||
// Go to the pages page, as it has the list layout enabled by default. | ||
await admin.visitSiteEditor(); | ||
await page.getByRole( 'button', { name: 'Pages' } ).click(); | ||
} ); | ||
|
||
test( 'Persists filter/search when switching layout', async ( { | ||
page, | ||
} ) => { | ||
// Search pages | ||
await page | ||
.getByRole( 'searchbox', { name: 'Search' } ) | ||
.fill( 'Privacy' ); | ||
|
||
// Switch layout | ||
await page.getByRole( 'button', { name: 'Layout' } ).click(); | ||
await page.getByRole( 'menuitemradio', { name: 'Table' } ).click(); | ||
|
||
// Confirm the table is visible | ||
await expect( page.getByRole( 'table' ) ).toContainText( | ||
'Privacy Policy' | ||
); | ||
|
||
// The search should still contain the search term | ||
await expect( | ||
page.getByRole( 'searchbox', { name: 'Search' } ) | ||
).toHaveValue( 'Privacy' ); | ||
} ); | ||
} ); |