From 95e7b305f0e32ba82ab459627766bb65c2e981b0 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Wed, 25 Oct 2023 13:45:18 +0200 Subject: [PATCH] e2e: improve custom command for dropdowns --- apps/datahub-e2e/src/support/commands.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/datahub-e2e/src/support/commands.ts b/apps/datahub-e2e/src/support/commands.ts index 0f1151b769..38595569a8 100644 --- a/apps/datahub-e2e/src/support/commands.ts +++ b/apps/datahub-e2e/src/support/commands.ts @@ -76,7 +76,9 @@ Cypress.Commands.add( { prevSubject: true }, (dropdownElement) => { cy.get('body').click() // first click on the document to close other dropdowns - cy.wrap(dropdownElement).click('right') // click on the right size to avoid the label + const width = dropdownElement.width() + const height = dropdownElement.height() + cy.wrap(dropdownElement).click(width - 10, height / 2) // click on the right size to avoid the label return cy.get('.cdk-overlay-container').find('[role=listbox]') } )