diff --git a/cypress/support/page/page-actions.ts b/cypress/support/page/page-actions.ts index 6b647bb9..76f3a651 100644 --- a/cypress/support/page/page-actions.ts +++ b/cypress/support/page/page-actions.ts @@ -12,22 +12,30 @@ export function openViewActionsPopoverForPage(pageName: string) { cy.task('log', `Opening view actions popover for page: ${pageName}`); - // Find the page in the sidebar + // Find the page name element + cy.get('[data-testid="page-name"]') + .contains(pageName) + .parent() // Get the parent div that contains the page name + .parent() // Get the div that has the hover handler + .trigger('mouseenter', { force: true }) + .trigger('mouseover', { force: true }); + + // Wait for React to re-render + cy.wait(1000); + + // Now find and click the more actions button cy.get('[data-testid="page-name"]') .contains(pageName) .closest('[data-testid="page-item"]') - .within(() => { - // Hover to show the more actions button - cy.get('[data-testid="page-more-actions"]').invoke('show'); - // Click the more actions button - cy.get('[data-testid="page-more-actions"]').click({ force: true }); - }); + .find('[data-testid="page-more-actions"]') + .should('exist') + .click({ force: true }); // Wait for popover to appear - cy.wait(500); + cy.wait(1000); - // Verify popover is visible - cy.get('[data-testid="view-actions-popover"]').should('be.visible'); + // Verify popover is visible - check for dropdown menu content with our testid + cy.get('[data-testid="view-actions-popover"]', { timeout: 5000 }).should('exist'); cy.task('log', 'View actions popover opened successfully'); } @@ -41,15 +49,30 @@ export function openViewActionsPopoverForPage(pageName: string) { export function deletePageByName(pageName: string) { cy.task('log', `=== Deleting page: ${pageName} ===`); - // Open the actions popover for the page - openViewActionsPopoverForPage(pageName); + // Find and hover over the page to show actions + cy.get('[data-testid="page-name"]') + .contains(pageName) + .parent() + .parent() + .trigger('mouseenter', { force: true }); - // Click delete option - cy.get('[data-testid="view-action-delete"]').click(); + cy.wait(1000); + + // Click the more actions button + cy.get('[data-testid="page-name"]') + .contains(pageName) + .closest('[data-testid="page-item"]') + .find('[data-testid="page-more-actions"]') + .click({ force: true }); + + cy.wait(1000); + + // Click delete option - look in body since it's portalled + cy.get('[data-testid="view-action-delete"]', { timeout: 5000 }).click(); cy.wait(500); // Confirm deletion in the confirmation dialog - cy.get('[data-testid="confirm-delete-button"]').click(); + cy.get('[data-testid="confirm-delete-button"]', { timeout: 5000 }).click(); cy.wait(1000); cy.task('log', `✓ Page "${pageName}" deleted successfully`); diff --git a/src/components/_shared/modal/NormalModal.tsx b/src/components/_shared/modal/NormalModal.tsx index 6730a0b1..30b52245 100644 --- a/src/components/_shared/modal/NormalModal.tsx +++ b/src/components/_shared/modal/NormalModal.tsx @@ -95,6 +95,7 @@ export function NormalModal ({ {modalCancelText}