Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/Controller/OCJSController.php8
-rw-r--r--lib/private/TemplateLayout.php2
-rw-r--r--tests/acceptance/features/bootstrap/FilesAppContext.php37
3 files changed, 37 insertions, 10 deletions
diff --git a/core/Controller/OCJSController.php b/core/Controller/OCJSController.php
index 9c19f0c0adf..dc3071b0e79 100644
--- a/core/Controller/OCJSController.php
+++ b/core/Controller/OCJSController.php
@@ -31,11 +31,11 @@ use OCP\AppFramework\Http\DataDisplayResponse;
use OCP\Defaults;
use OCP\IConfig;
use OCP\IGroupManager;
-use OCP\IL10N;
use OCP\IRequest;
use OCP\ISession;
use OCP\IURLGenerator;
use OCP\IUserSession;
+use OCP\L10N\IFactory;
class OCJSController extends Controller {
@@ -47,7 +47,7 @@ class OCJSController extends Controller {
*
* @param string $appName
* @param IRequest $request
- * @param IL10N $l
+ * @param IFactory $l10nFactory
* @param Defaults $defaults
* @param IAppManager $appManager
* @param ISession $session
@@ -59,7 +59,7 @@ class OCJSController extends Controller {
*/
public function __construct($appName,
IRequest $request,
- IL10N $l,
+ IFactory $l10nFactory,
Defaults $defaults,
IAppManager $appManager,
ISession $session,
@@ -71,7 +71,7 @@ class OCJSController extends Controller {
parent::__construct($appName, $request);
$this->helper = new JSConfigHelper(
- $l,
+ $l10nFactory->get('lib'),
$defaults,
$appManager,
$session,
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php
index dcc0fd3ba67..8a3a8e1e36b 100644
--- a/lib/private/TemplateLayout.php
+++ b/lib/private/TemplateLayout.php
@@ -143,7 +143,7 @@ class TemplateLayout extends \OC_Template {
if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) {
$jsConfigHelper = new JSConfigHelper(
- \OC::$server->getL10N('core'),
+ \OC::$server->getL10N('lib'),
\OC::$server->query(Defaults::class),
\OC::$server->getAppManager(),
\OC::$server->getSession(),
diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php
index 61f6b115ac6..060e958e0e6 100644
--- a/tests/acceptance/features/bootstrap/FilesAppContext.php
+++ b/tests/acceptance/features/bootstrap/FilesAppContext.php
@@ -346,7 +346,16 @@ class FilesAppContext implements Context, ActorAwareInterface {
* @Given I write down the shared link
*/
public function iWriteDownTheSharedLink() {
- $this->actor->getSharedNotebook()["shared link"] = $this->actor->find(self::shareLinkField(), 10)->getValue();
+ // 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(
+ self::shareLinkField(),
+ $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
+ PHPUnit_Framework_Assert::fail("The shared link was not shown yet after $timeout seconds");
+ }
+
+ $this->actor->getSharedNotebook()["shared link"] = $this->actor->find(self::shareLinkField())->getValue();
}
/**
@@ -486,7 +495,9 @@ 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(self::loadingIconForTabInCurrentSectionDetailsViewNamed($tabName), $timeout = 10)) {
+ if (!$this->waitForElementToBeEventuallyNotShown(
+ 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");
}
}
@@ -502,7 +513,9 @@ 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(self::passwordProtectWorkingIcon(), $timeout = 10)) {
+ if (!$this->waitForElementToBeEventuallyNotShown(
+ self::passwordProtectWorkingIcon(),
+ $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) {
PHPUnit_Framework_Assert::fail("The working icon for password protect is still shown after $timeout seconds");
}
}
@@ -517,10 +530,24 @@ 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;
- $elementNotFoundCallback = function() use ($actor, $elementLocator) {
+ $elementNotShownCallback = function() use ($actor, $elementLocator) {
try {
return !$actor->find($elementLocator)->isVisible();
} catch (NoSuchElementException $exception) {
@@ -528,6 +555,6 @@ class FilesAppContext implements Context, ActorAwareInterface {
}
};
- return Utils::waitFor($elementNotFoundCallback, $timeout, $timeoutStep);
+ return Utils::waitFor($elementNotShownCallback, $timeout, $timeoutStep);
}
}