Skip to content

Improve locator inside openDocumentSettingsSidebar to avoid duplicate Locator failures. #70330

@alejandrogonzalvo

Description

@alejandrogonzalvo

What problem does this address?

Currently, the editor.openDocumentSettingsSidebar() of the @wordpress/e2e-test-utils-playwright uses this Locator to match the Open Settings Icon:

const toggleButton = this.page
		.getByRole( 'region', { name: 'Editor top bar' } )
		.getByRole( 'button', {
			name: 'Settings',
			disabled: false,
		} );

but this fails when the post name includes the word Settings, as shown here:

Image

What is your proposed solution?

This could be resolved by improving the locator as follows:

const toggleButton = this.page
		.getByRole( 'region', { name: 'Editor top bar' } )
		.getByRole( 'button', {
			name: 'Settings',
                        exact: true,
			disabled: false,
		} );

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions