Skip to content

Commit b3c5e9a

Browse files
Fix flaky issues
1 parent bf3c4bf commit b3c5e9a

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/lib/Behat/BrowserContext/UserNotificationContext.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public function thereIsNotificationAppearsWithDetails(TableNode $notificationDet
7171
*/
7272
public function iOpenNotificationMenu(string $description): void
7373
{
74-
$this->userNotificationPopup->verifyIsLoaded();
7574
$this->userNotificationPopup->openNotificationMenu($description);
7675
}
7776

src/lib/Behat/Component/UserNotificationPopup.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use Exception;
1212
use Ibexa\Behat\Browser\Component\Component;
13-
use Ibexa\Behat\Browser\Element\Action\MouseOverAndClick;
1413
use Ibexa\Behat\Browser\Element\Condition\ElementExistsCondition;
1514
use Ibexa\Behat\Browser\Element\Condition\ElementNotExistsCondition;
1615
use Ibexa\Behat\Browser\Element\Criterion\ChildElementTextCriterion;
@@ -115,16 +114,26 @@ public function openNotificationMenu(string $expectedDescription): void
115114
$this->getLocator('notificationActionsPopup'),
116115
)
117116
);
117+
118+
$this->getHTMLPage()
119+
->setTimeout(10)
120+
->waitUntilCondition(
121+
new ElementExistsCondition(
122+
$this->getHTMLPage(),
123+
$this->getLocator('notificationMenuItemContent')
124+
)
125+
);
118126
}
119127

120128
public function clickActionButton(string $buttonText): void
121129
{
122-
$buttons = $this->getHTMLPage()
123-
->setTimeout(10)
124-
->findAll($this->getLocator('notificationMenuItemContent'))
125-
->filterBy(new ElementTextCriterion($buttonText));
130+
$button = $this->getActionButton($buttonText);
131+
132+
if ($button === null) {
133+
throw new \Exception(sprintf('Action button "%s" not found.', $buttonText));
134+
}
126135

127-
$buttons->first()->execute(new MouseOverAndClick());
136+
$button->click();
128137

129138
$this->getHTMLPage()
130139
->setTimeout(10)

0 commit comments

Comments
 (0)