From 17fd818a03e869a7bc8aa5c98b97c0b90f9e0692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Wed, 23 Aug 2023 11:56:13 +0200 Subject: [PATCH] [Behat] Retry entering Richtext value --- src/lib/Behat/Component/Fields/RichText.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib/Behat/Component/Fields/RichText.php b/src/lib/Behat/Component/Fields/RichText.php index e7d0fcad8d..17959cb0c0 100644 --- a/src/lib/Behat/Component/Fields/RichText.php +++ b/src/lib/Behat/Component/Fields/RichText.php @@ -50,9 +50,16 @@ private function focusFieldInput(): void public function setValue(array $parameters): void { - $this->executeCommand('selectAll'); - $this->executeCommand('delete'); - $this->getFieldInput()->setValue($parameters['value']); + $text = $parameters['value']; + $maxIterations = 3; + $counter = 0; + while ($this->getValue()[0] !== $text && $counter < $maxIterations) { + $this->executeCommand('selectAll'); + $this->executeCommand('delete'); + $this->getFieldInput()->setValue($parameters['value']); + usleep(100 * 1000); // 100 ms + ++$counter; + } } public function getValue(): array