summaryrefslogtreecommitdiffstats
path: root/tests/acceptance/features/bootstrap/FilesAppContext.php
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-02-19 17:38:19 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-03-09 03:37:08 +0100
commit1a2d9a2fdda708fafe08b9d2a19f9e2fdabbe821 (patch)
tree19f8265a14f4c0e15674f144052082fcca0cdffb /tests/acceptance/features/bootstrap/FilesAppContext.php
parentfcd6cf08e0d146f3daf3b6c58a3ad32a5c062659 (diff)
downloadnextcloud-server-1a2d9a2fdda708fafe08b9d2a19f9e2fdabbe821.tar.gz
nextcloud-server-1a2d9a2fdda708fafe08b9d2a19f9e2fdabbe821.zip
Extract common "wait for" functions to a helper class
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests/acceptance/features/bootstrap/FilesAppContext.php')
-rw-r--r--tests/acceptance/features/bootstrap/FilesAppContext.php36
1 files changed, 6 insertions, 30 deletions
diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php
index a9bb8a619e2..42ca284881c 100644
--- a/tests/acceptance/features/bootstrap/FilesAppContext.php
+++ b/tests/acceptance/features/bootstrap/FilesAppContext.php
@@ -279,7 +279,8 @@ class FilesAppContext implements Context, ActorAwareInterface {
// The shared link field always exists in the DOM (once the "Sharing"
// tab is loaded), but its value is the actual shared link only when it
// is visible.
- if (!$this->waitForElementToBeEventuallyShown(
+ if (!WaitFor::elementToBeEventuallyShown(
+ $this->actor,
self::shareLinkField(),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The shared link was not shown yet after $timeout seconds");
@@ -419,7 +420,8 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @When I see that the :tabName tab in the details view is eventually loaded
*/
public function iSeeThatTheTabInTheDetailsViewIsEventuallyLoaded($tabName) {
- if (!$this->waitForElementToBeEventuallyNotShown(
+ if (!WaitFor::elementToBeEventuallyNotShown(
+ $this->actor,
self::loadingIconForTabInCurrentSectionDetailsViewNamed($tabName),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The $tabName tab in the details view has not been loaded after $timeout seconds");
@@ -437,7 +439,8 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @Then I see that the working icon for password protect is eventually not shown
*/
public function iSeeThatTheWorkingIconForPasswordProtectIsEventuallyNotShown() {
- if (!$this->waitForElementToBeEventuallyNotShown(
+ if (!WaitFor::elementToBeEventuallyNotShown(
+ $this->actor,
self::passwordProtectWorkingIcon(),
$timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The working icon for password protect is still shown after $timeout seconds");
@@ -454,31 +457,4 @@ class FilesAppContext implements Context, ActorAwareInterface {
$this->iSeeThatTheWorkingIconForPasswordProtectIsEventuallyNotShown();
}
- 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);
- }
-
- private function waitForElementToBeEventuallyNotShown($elementLocator, $timeout = 10, $timeoutStep = 1) {
- $actor = $this->actor;
-
- $elementNotShownCallback = function() use ($actor, $elementLocator) {
- try {
- return !$actor->find($elementLocator)->isVisible();
- } catch (NoSuchElementException $exception) {
- return true;
- }
- };
-
- return Utils::waitFor($elementNotShownCallback, $timeout, $timeoutStep);
- }
}