Skip to content

Commit

Permalink
Add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano committed Apr 27, 2024
1 parent b22b479 commit abbaac7
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/e2e/specs/site-editor/site-editor-url-navigation.spec.js
Expand Up @@ -66,4 +66,30 @@ test.describe( 'Site editor url navigation', () => {
'/wp-admin/site-editor.php?postId=emptytheme%2F%2Fdemo&postType=wp_template_part&canvas=edit'
);
} );

test( 'The Patterns page should keep the previously selected template part category', async ( {
admin,
page,
} ) => {
await admin.visitSiteEditor();
const navigation = page.getByRole( 'region', {
name: 'Navigation',
} );
await navigation.getByRole( 'button', { name: 'Patterns' } ).click();
await navigation.getByRole( 'button', { name: 'General' } ).click();
await page
.getByRole( 'region', {
name: 'Patterns content',
} )
.getByLabel( 'header', { exact: true } )
.click();
await expect(
page.getByRole( 'region', { name: 'Editor content' } )
).toBeVisible();
await page.getByRole( 'button', { name: 'Open navigation' } ).click();
await navigation.getByRole( 'button', { name: 'Back' } ).click();
await expect(
navigation.getByRole( 'button', { name: 'General' } )
).toHaveAttribute( 'aria-current', 'true' );
} );
} );

0 comments on commit abbaac7

Please sign in to comment.