Skip to content

Commit

Permalink
use locator
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Feb 22, 2024
1 parent 0b577a8 commit 6fb5d1f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/performance/specs/site-editor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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();
Expand Down

0 comments on commit 6fb5d1f

Please sign in to comment.