From d8fd7b0d0e9d02d58e23ddd6d17522226a662f1b Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Tue, 28 Jan 2025 14:56:02 +0100 Subject: [PATCH] Adjust tests. --- packages/components/src/font-size-picker/index.tsx | 2 +- test/e2e/specs/site-editor/style-variations.spec.js | 12 +++--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/components/src/font-size-picker/index.tsx b/packages/components/src/font-size-picker/index.tsx index 6824ae3b96ded..9cc577e445121 100644 --- a/packages/components/src/font-size-picker/index.tsx +++ b/packages/components/src/font-size-picker/index.tsx @@ -173,7 +173,7 @@ const UnforwardedFontSizePicker = ( { await page.click( 'role=button[name="Text"i]' ); await expect( - page.locator( 'css=.components-font-size-picker__header__hint' ) - ).toHaveText( 'Medium' ); + page.locator( 'role=radio[name="Medium"i]' ) + ).toHaveAttribute( 'aria-checked', 'true' ); } ); test( 'should apply custom colors and font sizes in a variation', async ( { @@ -132,14 +132,8 @@ test.describe( 'Global styles variations', () => { await page.click( 'role=button[name="Typography"i]' ); await page.click( 'role=button[name="Text"i]' ); - // TODO: to avoid use classnames to locate these elements, - // we could provide accessible attributes to the source code in packages/components/src/font-size-picker/index.js. await expect( - page.locator( 'css=.components-font-size-picker__header__hint' ) - ).toHaveText( 'Custom' ); - - await expect( - page.locator( 'role=spinbutton[name="Custom"i]' ) + page.locator( 'role=spinbutton[name="Custom font size"i]' ) ).toHaveValue( '15' ); } );