From 99ad27400c215f2d2721196f625763106d57c855 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 26 Oct 2022 07:31:29 +0400 Subject: [PATCH] Re-enable skipped Gallery block e2e test (#45266) * Re-enable skipped Gallery block e2e test * Rafactor to use role selectors --- test/e2e/specs/editor/blocks/gallery.spec.js | 41 +++++++++----------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/test/e2e/specs/editor/blocks/gallery.spec.js b/test/e2e/specs/editor/blocks/gallery.spec.js index e9cfa3c03d99e..936942c9688fa 100644 --- a/test/e2e/specs/editor/blocks/gallery.spec.js +++ b/test/e2e/specs/editor/blocks/gallery.spec.js @@ -196,29 +196,24 @@ test.describe( 'Gallery', () => { ); } ); - // Disable reason: - // This test would be good to enable, but the media modal contains an - // invalid role, which is causing Axe tests to fail: - // https://core.trac.wordpress.org/ticket/50273 - // - // Attempts to add an Axe exception for the media modal haven't proved - // successful: - // https://github.com/WordPress/gutenberg/pull/22719 - test.fixme( - 'when initially added the media library shows the Create Gallery view', - async ( { admin, editor, page } ) => { - await admin.createNewPost(); - await editor.insertBlock( { name: 'core/gallery' } ); - await page.click( 'role=button[name="Media Library"i]' ); - await page.waitForSelector( '.media-frame' ); - expect( await page.innerText( '.media-frame-title h1' ) ).toBe( - 'Create gallery' - ); - expect( - await page.innerText( '.media-toolbar-primary button' ) - ).toBe( 'Create a new gallery' ); - } - ); + test( 'when initially added the media library shows the Create Gallery view', async ( { + admin, + editor, + page, + } ) => { + await admin.createNewPost(); + await editor.insertBlock( { name: 'core/gallery' } ); + await page.click( 'role=button[name="Media Library"i]' ); + + const mediaLibrary = page.locator( + 'role=dialog[name="Create gallery"i]' + ); + + await expect( mediaLibrary ).toBeVisible(); + await expect( + mediaLibrary.locator( 'role=button[name="Create a new gallery"i]' ) + ).toBeVisible(); + } ); } ); class GalleryBlockUtils {