Skip to content

Commit

Permalink
Migrate 'Global styles sidebar' test to Playwright (#55045)
Browse files Browse the repository at this point in the history
* Migrate 'Global styles sidebar' test to Playwright
* Remove old test file
  • Loading branch information
Mamaduka authored Oct 4, 2023
1 parent fff4d56 commit f06e1a8
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 45 deletions.
45 changes: 0 additions & 45 deletions packages/e2e-tests/specs/site-editor/global-styles-sidebar.test.js

This file was deleted.

49 changes: 49 additions & 0 deletions test/e2e/specs/site-editor/global-styles-sidebar.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'Global styles sidebar', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'emptytheme' );
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyone' );
} );

test.beforeEach( async ( { admin, editor } ) => {
await admin.visitSiteEditor( {
postId: 'emptytheme//index',
postType: 'wp_template',
} );
await editor.canvas.click( 'body' );
} );

test( 'should filter blocks list results', async ( { page } ) => {
// Navigate to Styles -> Blocks.
await page
.getByRole( 'region', { name: 'Editor top bar' } )
.getByRole( 'button', { name: 'Styles' } )
.click();
await page
.getByRole( 'region', { name: 'Editor settings' } )
.getByRole( 'button', { name: 'Blocks styles' } )
.click();

await page
.getByRole( 'searchbox', { name: 'Search for blocks' } )
.fill( 'heading' );

// Matches both Heading and Table of Contents blocks.
// The latter contains "heading" in its description.
await expect(
page.getByRole( 'button', { name: 'Heading block styles' } )
).toBeVisible();
await expect(
page.getByRole( 'button', {
name: 'Table of Contents block styles',
} )
).toBeVisible();
} );
} );

1 comment on commit f06e1a8

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in f06e1a8.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6409557506
📝 Reported issues:

Please sign in to comment.