From 5ffc82907ca142d47a9b5ef770796bfdd715a5ca Mon Sep 17 00:00:00 2001 From: tischsoic Date: Thu, 31 Aug 2023 19:11:21 +0200 Subject: [PATCH] Adjusting Behat - test 1 --- src/lib/Behat/Component/ContentActionsMenu.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lib/Behat/Component/ContentActionsMenu.php b/src/lib/Behat/Component/ContentActionsMenu.php index 9cd4bc013e..6c0892e543 100644 --- a/src/lib/Behat/Component/ContentActionsMenu.php +++ b/src/lib/Behat/Component/ContentActionsMenu.php @@ -36,6 +36,21 @@ public function clickButton(string $buttonName): void return; } + $contextMenuSplitBtnsTogglers = $this->getHTMLPage() + ->findAll($this->getLocator('menuSplitToggler')); + + foreach($contextMenuSplitBtnsTogglers->getIterator() as $splitBtnToggler) { + $splitBtnToggler->click(); + + $matchingSubButtons = $this->getHTMLPage() + ->findAll($this->getLocator('menuSplitSubmenuButton')) + ->filterBy(new ElementTextCriterion($buttonName)); + + if ($matchingSubButtons->any()) { + $matchingSubButtons->first()->click(); + } + } + $this->getHTMLPage()->find($this->getLocator('moreButton'))->click(); $this->getHTMLPage() @@ -79,6 +94,8 @@ protected function specifyLocators(): array { return [ new VisibleCSSLocator('menuButton', '.ibexa-context-menu .ibexa-btn, .ibexa-context-menu__item .ibexa-popup-menu__item, .ibexa-context-menu .btn'), // TO DO: set one selector after redesign + new VisibleCSSLocator('menuSplitToggler', '.ibexa-context-menu .ibexa-split-btn__toggle-btn'), + new VisibleCSSLocator('menuSplitSubmenuButton', '.ibexa-popup-menu:not(.ibexa-popup-menu--hidden) .ibexa-popup-menu__item-content'), new VisibleCSSLocator('label', '.ibexa-btn__label'), new VisibleCSSLocator('moreButton', '.ibexa-context-menu__item--more'), new VisibleCSSLocator('expandedMenuButton', '.ibexa-context-menu__item .ibexa-popup-menu__item-content'),