From e3b750cea76ac24dfbee9a55740a743af0c1ea0d Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Tue, 19 Nov 2024 18:48:43 +0530 Subject: [PATCH] fix: e2e issue nav menu item --- .../hfg/hfg-menu-item-description.spec.ts | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/e2e-tests/specs/customizer/hfg/hfg-menu-item-description.spec.ts b/e2e-tests/specs/customizer/hfg/hfg-menu-item-description.spec.ts index afbf8c701c..ae9514f310 100644 --- a/e2e-tests/specs/customizer/hfg/hfg-menu-item-description.spec.ts +++ b/e2e-tests/specs/customizer/hfg/hfg-menu-item-description.spec.ts @@ -28,11 +28,12 @@ test.describe('Menu item description', function () { await page.getByRole('button', { name: 'Add New Category' }).click(); await page.goto('wp-admin/nav-menus.php'); - await page - .getByRole('heading', { - name: 'Categories Press return or enter to open this section ', - }) - .click(); + await page.waitForSelector('.menu-name'); + await page.locator('.menu-name').fill('My New Menu'); + await page.getByLabel('Primary Menu').check(); + await page.locator('#save_menu_footer ').click(); + + await page.locator('#add-category h3').click(); await page .locator('#taxonomy-category-tabs') .getByRole('link', { name: 'View All' }) @@ -51,6 +52,25 @@ test.describe('Menu item description', function () { await page.keyboard.press('End'); await page.waitForTimeout(500); + await page.locator('#add-post-type-page h3').click(); + await page + .locator('#posttype-page-tabs') + .getByRole('link', { name: 'View All' }) + .click(); + await page.getByLabel('Sample Page').last().check(); + + await Promise.all([ + page.waitForResponse( + (res) => + res.url().includes('wp-admin/admin-ajax.php') && + res.status() === 200 + ), + page.getByRole('button', { name: 'Add to Menu' }).click(), + ]); + + await page.keyboard.press('End'); + await page.waitForTimeout(500); + await expect( page.locator('#menu-to-edit li.menu-item:last-child a.item-edit') ).toBeVisible();