From 6fb5d1f37008866f362026c221f0523e33edcb17 Mon Sep 17 00:00:00 2001 From: ramon Date: Thu, 22 Feb 2024 18:16:34 +1100 Subject: [PATCH] use locator --- test/performance/specs/site-editor.spec.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/performance/specs/site-editor.spec.js b/test/performance/specs/site-editor.spec.js index db7cdffd2c35f..89e8d9d347776 100644 --- a/test/performance/specs/site-editor.spec.js +++ b/test/performance/specs/site-editor.spec.js @@ -241,11 +241,13 @@ test.describe( 'Site Editor Performance', () => { * Once the performance tests are updated to compare compatible versions this code can be removed. */ // eslint-disable-next-line no-restricted-syntax - const actionsButtonElement = await page.$$( - ".edit-site-template-card__actions button[aria-label='Actions']" - ); + const isActionsButtonVisible = await page + .locator( + '.edit-site-template-card__actions button[aria-label="Actions"]' + ) + .isVisible(); - if ( actionsButtonElement.length ) { + if ( isActionsButtonVisible ) { await page .getByRole( 'button', { name: 'Actions', @@ -259,7 +261,7 @@ test.describe( 'Site Editor Performance', () => { const startTime = performance.now(); - if ( actionsButtonElement.length ) { + if ( isActionsButtonVisible ) { await page .getByRole( 'menuitem', { name: 'Replace template' } ) .click();