diff --git a/tests/ui/features/bootstrap/FeatureContext.php b/tests/ui/features/bootstrap/FeatureContext.php index f7f8fff6a002..5c190d32ce34 100644 --- a/tests/ui/features/bootstrap/FeatureContext.php +++ b/tests/ui/features/bootstrap/FeatureContext.php @@ -62,7 +62,7 @@ public function notificationsShouldBeDisplayedWithTheText(TableNode $table) { $notifications = $this->owncloudPage->getNotifications(); $tableRows=$table->getRows(); - PHPUnit_Framework_Assert::assertEquals( + PHPUnit_Framework_Assert::assertGreaterThanOrEqual( count($tableRows), count($notifications) ); diff --git a/tests/ui/features/lib/FilesPage.php b/tests/ui/features/lib/FilesPage.php index f9b085dd51e2..789c144d498b 100644 --- a/tests/ui/features/lib/FilesPage.php +++ b/tests/ui/features/lib/FilesPage.php @@ -283,7 +283,7 @@ private function _renameFile($fromFileName, $toFileName, Session $session) if ($inputField === null) { throw new ElementNotFoundException("could not find input field"); } - $inputField->setValue($toFileName); + $this->cleanInputAndSetValue($inputField, $toFileName); $inputField->blur(); $this->waitTillElementIsNull($this->fileBusyIndicatorXpath); } diff --git a/tests/ui/features/lib/OwncloudPage.php b/tests/ui/features/lib/OwncloudPage.php index ca7b3cd79518..cffe6ada1a9e 100644 --- a/tests/ui/features/lib/OwncloudPage.php +++ b/tests/ui/features/lib/OwncloudPage.php @@ -27,6 +27,7 @@ use Behat\Mink\Session; use Behat\Mink\Element\NodeElement; use WebDriver\Exception as WebDriverException; +use WebDriver\Key; class OwncloudPage extends Page { @@ -254,4 +255,27 @@ protected function elementHasCSSValue($element, $property, $value) return $exists; } + + /** + * sends an END key and then BACKSPACEs to delete the current value + * then sends the new value + * checks the set value and sends the Escape key + throws an exception + * if the value is not set correctly + * + * @param NodeElement $inputField + * @param string $value + * @throws \Exception + */ + protected function cleanInputAndSetValue(NodeElement $inputField, $value) { + $resultValue = $inputField->getValue(); + $existingValueLength = strlen($resultValue); + $deleteSequence = Key::END . str_repeat(Key::BACKSPACE, $existingValueLength); + $inputField->setValue($deleteSequence); + $inputField->setValue($value); + $resultValue = $inputField->getValue(); + if ($resultValue !== $value) { + $inputField->keyUp(27); //send escape + throw new \Exception("value of input field is not what we expect"); + } + } } \ No newline at end of file