1010
1111use Exception ;
1212use Ibexa \Behat \Browser \Component \Component ;
13+ use Ibexa \Behat \Browser \Element \Action \MouseOverAndClick ;
1314use Ibexa \Behat \Browser \Element \Condition \ElementExistsCondition ;
1415use Ibexa \Behat \Browser \Element \Condition \ElementNotExistsCondition ;
1516use Ibexa \Behat \Browser \Element \Criterion \ChildElementTextCriterion ;
@@ -114,26 +115,16 @@ public function openNotificationMenu(string $expectedDescription): void
114115 $ this ->getLocator ('notificationActionsPopup ' ),
115116 )
116117 );
117-
118- $ this ->getHTMLPage ()
119- ->setTimeout (10 )
120- ->waitUntilCondition (
121- new ElementExistsCondition (
122- $ this ->getHTMLPage (),
123- $ this ->getLocator ('notificationMenuItemContent ' )
124- )
125- );
126118 }
127119
128120 public function clickActionButton (string $ buttonText ): void
129121 {
130- $ button = $ this ->getActionButton ($ buttonText );
131-
132- if ($ button === null ) {
133- throw new \Exception (sprintf ('Action button "%s" not found. ' , $ buttonText ));
134- }
122+ $ buttons = $ this ->getHTMLPage ()
123+ ->setTimeout (10 )
124+ ->findAll ($ this ->getLocator ('notificationMenuItemContent ' ))
125+ ->filterBy (new ElementTextCriterion ($ buttonText ));
135126
136- $ button -> click ( );
127+ $ buttons -> first ()-> execute ( new MouseOverAndClick () );
137128
138129 $ this ->getHTMLPage ()
139130 ->setTimeout (10 )
@@ -185,6 +176,11 @@ public function clickViewAllNotificationsButton(): void
185176 $ this ->getHTMLPage ()->setTimeout (3 )->find ($ this ->getLocator ('viewAllNotificationsButton ' ))->click ();
186177 }
187178
179+ public function verifyNotificationsCount (int $ expectedCount ): void
180+ {
181+ $ this ->getHTMLPage ()->setTimeout (10 )->find ($ this ->getLocator ('notificationsCount ' ))->assert ()->textEquals ('( ' . $ expectedCount . ') ' );
182+ }
183+
188184 public function verifyIsLoaded (): void
189185 {
190186 $ this ->getHTMLPage ()
@@ -208,6 +204,7 @@ protected function specifyLocators(): array
208204 new VisibleCSSLocator ('viewAllNotificationsButton ' , '.ibexa-notifications-modal__view-all-btn ' ),
209205 new VisibleCSSLocator ('notificationActionsPopup ' , '.ibexa-notification-actions-popup-menu:not(.ibexa-popup-menu--hidden) ' ),
210206 new VisibleCSSLocator ('notificationsEmptyText ' , '.ibexa-notifications-modal__empty-text ' ),
207+ new VisibleCSSLocator ('notificationsCount ' , '.ibexa-notifications-modal__count ' ),
211208 ];
212209 }
213210}
0 commit comments