diff options
Diffstat (limited to 'tests/acceptance/features/bootstrap/FilesSharingAppContext.php')
-rw-r--r-- | tests/acceptance/features/bootstrap/FilesSharingAppContext.php | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/tests/acceptance/features/bootstrap/FilesSharingAppContext.php b/tests/acceptance/features/bootstrap/FilesSharingAppContext.php index 4b7dd08c83e..4f9dabc60e6 100644 --- a/tests/acceptance/features/bootstrap/FilesSharingAppContext.php +++ b/tests/acceptance/features/bootstrap/FilesSharingAppContext.php @@ -26,6 +26,7 @@ use Behat\Behat\Context\Context; class FilesSharingAppContext implements Context, ActorAwareInterface { use ActorAware; + use FileListAncestorSetter; /** * @return Locator @@ -156,6 +157,8 @@ class FilesSharingAppContext implements Context, ActorAwareInterface { PHPUnit_Framework_Assert::assertEquals( $this->actor->getSharedNotebook()["shared link"], $this->actor->getSession()->getCurrentUrl()); + + $this->setFileListAncestorForActor(null, $this->actor); } /** @@ -182,8 +185,8 @@ class FilesSharingAppContext implements Context, ActorAwareInterface { // Unlike other menus, the Share menu is always present in the DOM, so // the element could be found when it was no made visible yet due to the // command not having been processed by the browser. - if (!$this->waitForElementToBeEventuallyShown( - self::shareMenu(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { + if (!WaitFor::elementToBeEventuallyShown( + $this->actor, self::shareMenu(), $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { PHPUnit_Framework_Assert::fail("The Share menu is not visible yet after $timeout seconds"); } @@ -202,18 +205,4 @@ class FilesSharingAppContext implements Context, ActorAwareInterface { PHPUnit_Framework_Assert::assertContains($text, $this->actor->find(self::textPreview(), 10)->getText()); } - private function waitForElementToBeEventuallyShown($elementLocator, $timeout = 10, $timeoutStep = 1) { - $actor = $this->actor; - - $elementShownCallback = function() use ($actor, $elementLocator) { - try { - return $actor->find($elementLocator)->isVisible(); - } catch (NoSuchElementException $exception) { - return false; - } - }; - - return Utils::waitFor($elementShownCallback, $timeout, $timeoutStep); - } - } |