From 4d4d736bebb383a6370dbb4ad26cc7dcaf038471 Mon Sep 17 00:00:00 2001 From: MaggieCabrera Date: Mon, 13 Feb 2023 12:01:48 +0100 Subject: [PATCH] renaming variables and custom link label --- .../src/request-utils/menus.ts | 10 +++++----- test/e2e/specs/editor/blocks/navigation.spec.js | 13 +++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/e2e-test-utils-playwright/src/request-utils/menus.ts b/packages/e2e-test-utils-playwright/src/request-utils/menus.ts index e0284deafa6355..e5da27e032c797 100644 --- a/packages/e2e-test-utils-playwright/src/request-utils/menus.ts +++ b/packages/e2e-test-utils-playwright/src/request-utils/menus.ts @@ -7,7 +7,7 @@ export interface MenuData { title: string; content: string; } -export interface Menu { +export interface NavigationMenu { id: number; content: string; status: 'publish' | 'future' | 'draft' | 'pending' | 'private'; @@ -22,14 +22,14 @@ export interface Menu { export async function createClassicMenu( this: RequestUtils, name: string ) { const menuItems = [ { - title: 'Home', + title: 'Custom link', url: 'http://localhost:8889/', type: 'custom', menu_order: 1, }, ]; - const menu = await this.rest< Menu >( { + const menu = await this.rest< NavigationMenu >( { method: 'POST', path: `/wp/v2/menus/`, data: { @@ -80,7 +80,7 @@ export async function createNavigationMenu( * */ export async function deleteAllMenus( this: RequestUtils ) { - const navMenus = await this.rest< Menu[] >( { + const navMenus = await this.rest< NavigationMenu[] >( { path: `/wp/v2/navigation/`, } ); @@ -93,7 +93,7 @@ export async function deleteAllMenus( this: RequestUtils ) { ); } - const classicMenus = await this.rest< Menu[] >( { + const classicMenus = await this.rest< NavigationMenu[] >( { path: `/wp/v2/menus/`, } ); diff --git a/test/e2e/specs/editor/blocks/navigation.spec.js b/test/e2e/specs/editor/blocks/navigation.spec.js index d9413525af2a5a..255eca84b55011 100644 --- a/test/e2e/specs/editor/blocks/navigation.spec.js +++ b/test/e2e/specs/editor/blocks/navigation.spec.js @@ -106,17 +106,18 @@ test.describe( await editor.insertBlock( { name: 'core/navigation' } ); // We need to check the canvas after inserting the navigation block to be able to target the block. - const navigationBlock = editor.canvas.locator( - 'role=document[name="Block: Navigation"i]' - ); - await expect( navigationBlock ).toBeVisible(); + await expect.poll( editor.getBlocks ).toMatchObject( [ + { + name: 'core/navigation', + }, + ] ); // Check the block in the canvas. await editor.page.pause(); - await navBlockUtils.selectNavigationItemOnCanvas( 'Home' ); + await navBlockUtils.selectNavigationItemOnCanvas( 'Custom link' ); // Check the block in the frontend. - await navBlockUtils.selectNavigationItemOnFrontend( 'Home' ); + await navBlockUtils.selectNavigationItemOnFrontend( 'Custom link' ); await editor.page.pause(); } ); }