From 22c784e748c77d870dc56f6e22a92939fb2bfcce Mon Sep 17 00:00:00 2001 From: Maud Leray Date: Tue, 3 Dec 2024 10:20:53 +0100 Subject: [PATCH] Remove unrelated changes These can be fixed in another PR --- tests/e2e/tools/lib/editor.js | 12 +++++++----- tests/e2e/tools/lib/post.js | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/e2e/tools/lib/editor.js b/tests/e2e/tools/lib/editor.js index 0fff628ab7..890df2b4f8 100644 --- a/tests/e2e/tools/lib/editor.js +++ b/tests/e2e/tools/lib/editor.js @@ -1,4 +1,4 @@ -import {Locator, Page} from '@playwright/test'; // eslint-disable-line no-unused-vars +import {expect, Locator, Page} from '@playwright/test'; // eslint-disable-line no-unused-vars /** * @param {{Editor}} editor @@ -75,10 +75,12 @@ async function removeAllPostTypes({editor}) { * @return {Promise} - Playwright Locator */ const searchAndInsertBlock = async ({page}, blockName, namespace = '') => { - // We could also use the label "Add block", - // but this one works better when adding several blocks in a row. - await page.getByRole('button', {name: 'Toggle block inserter'}).click(); - await page.getByLabel('Search for blocks and patterns').click(); + const labelText = 'Toggle block inserter'; // Can we also use aria-label="Add block" + const addBlockButton = await page.locator(`button[aria-label="${labelText}"]`); + expect(addBlockButton).toBeVisible(); + await addBlockButton.click(); + + await page.getByPlaceholder('Search').click(); await page.keyboard.type(namespace !== '' ? namespace : blockName); if (namespace !== '') { diff --git a/tests/e2e/tools/lib/post.js b/tests/e2e/tools/lib/post.js index 125a639b3a..b2918bd5d2 100644 --- a/tests/e2e/tools/lib/post.js +++ b/tests/e2e/tools/lib/post.js @@ -65,7 +65,6 @@ async function createPostWithFeaturedImage({admin, editor}, params) { } await imageModal.getByRole('checkbox', {name: 'OCEANS-GP0STOM6C'}).click(); await imageModal.getByRole('button', {name: 'Set featured image'}).click(); - await editor.canvas.waitForSelector('.editor-post-featured-image__preview-image'); return newPost; }