diff options
Diffstat (limited to 'tests')
8 files changed, 54 insertions, 16 deletions
diff --git a/tests/acceptance/features/app-files-sharing-link.feature b/tests/acceptance/features/app-files-sharing-link.feature index ac6ff058fec..4fab8391531 100644 --- a/tests/acceptance/features/app-files-sharing-link.feature +++ b/tests/acceptance/features/app-files-sharing-link.feature @@ -119,7 +119,6 @@ Feature: app-files-sharing-link And I create a new folder named "Subfolder" And I see that the file list contains a file named "Subfolder" When I act as John - And I close the details view And I enter in the folder named "Editable shared folder" Then I see that the file list contains a file named "Subfolder" diff --git a/tests/acceptance/features/app-theming.feature b/tests/acceptance/features/app-theming.feature index b6364ae4f44..676b90ab06e 100644 --- a/tests/acceptance/features/app-theming.feature +++ b/tests/acceptance/features/app-theming.feature @@ -9,10 +9,10 @@ Feature: app-theming # The "eventually" part is not really needed here, as the colour is not # being animated at this point, but there is no need to create a specific # step just for this. - And I see that the header color is eventually "#0082C9" + And I see that the background color is eventually "#0082C9" When I set the "Color" parameter in the Theming app to "#C9C9C9" Then I see that the parameters in the Theming app are eventually saved - And I see that the header color is eventually "#C9C9C9" + And I see that the background color is eventually "#C9C9C9" Scenario: resetting the color updates the header color Given I am logged in as the admin @@ -21,7 +21,7 @@ Feature: app-theming And I see that the color selector in the Theming app has loaded And I set the "Color" parameter in the Theming app to "#C9C9C9" And I see that the parameters in the Theming app are eventually saved - And I see that the header color is eventually "#C9C9C9" + And I see that the background color is eventually "#C9C9C9" When I reset the "Color" parameter in the Theming app to its default value Then I see that the parameters in the Theming app are eventually saved - And I see that the header color is eventually "#0082C9" + And I see that the background color is eventually "#0082C9" diff --git a/tests/acceptance/features/bootstrap/ThemingAppContext.php b/tests/acceptance/features/bootstrap/ThemingAppContext.php index d17d9c18109..248d58a1794 100644 --- a/tests/acceptance/features/bootstrap/ThemingAppContext.php +++ b/tests/acceptance/features/bootstrap/ThemingAppContext.php @@ -125,19 +125,19 @@ class ThemingAppContext implements Context, ActorAwareInterface { } /** - * @Then I see that the header color is eventually :color + * @Then I see that the background color is eventually :color */ - public function iSeeThatTheHeaderColorIsEventually($color) { - $headerColorMatchesCallback = function () use ($color) { - $headerColor = $this->actor->getSession()->evaluateScript("return $('#header').css('background-color');"); + public function iSeeThatTheBackgroundColorIsEventually($color) { + $backgroundColorMatchesCallback = function () use ($color) { + $headerColor = $this->actor->getSession()->evaluateScript("return $('body').css('background-color');"); $headerColor = $this->getRGBArray($headerColor); $color = $this->getRGBArray($color); return $headerColor == $color; }; - if (!Utils::waitFor($headerColorMatchesCallback, $timeout = 10 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) { - Assert::fail("The header color is not $color yet after $timeout seconds"); + if (!Utils::waitFor($backgroundColorMatchesCallback, $timeout = 10 * $this->actor->getFindTimeoutMultiplier(), $timeoutStep = 1)) { + Assert::fail("The background color is not $color yet after $timeout seconds"); } } diff --git a/tests/acceptance/features/bootstrap/UsersSettingsContext.php b/tests/acceptance/features/bootstrap/UsersSettingsContext.php index 074a9ff5f1a..4d17b3b5118 100644 --- a/tests/acceptance/features/bootstrap/UsersSettingsContext.php +++ b/tests/acceptance/features/bootstrap/UsersSettingsContext.php @@ -293,8 +293,12 @@ class UsersSettingsContext implements Context, ActorAwareInterface { * @Then I see that the new user form is shown */ public function iSeeThatTheNewUserFormIsShown() { - Assert::assertTrue( - $this->actor->find(self::newUserForm(), 10)->isVisible()); + if (!WaitFor::elementToBeEventuallyShown( + $this->actor, + self::newUserForm(), + $timeout = 10 * $this->actor->getFindTimeoutMultiplier())) { + Assert::fail("The new user form is not shown yet after $timeout seconds"); + } } /** diff --git a/tests/acceptance/features/core/ActorContext.php b/tests/acceptance/features/core/ActorContext.php index b3c8b6f0459..aa538f06069 100644 --- a/tests/acceptance/features/core/ActorContext.php +++ b/tests/acceptance/features/core/ActorContext.php @@ -137,6 +137,8 @@ class ActorContext extends RawMinkContext { $this->getSession()->start(); + $this->getSession()->maximizeWindow(); + $this->actors["default"] = new Actor("default", $this->getSession(), $this->getMinkParameter("base_url"), $this->sharedNotebook); $this->actors["default"]->setFindTimeoutMultiplier($this->actorTimeoutMultiplier); @@ -163,6 +165,8 @@ class ActorContext extends RawMinkContext { if (!array_key_exists($actorName, $this->actors)) { $this->getSession($actorName)->start(); + $this->getSession($actorName)->maximizeWindow(); + $this->actors[$actorName] = new Actor($actorName, $this->getSession($actorName), $this->getMinkParameter("base_url"), $this->sharedNotebook); $this->actors[$actorName]->setFindTimeoutMultiplier($this->actorTimeoutMultiplier); } diff --git a/tests/lib/Collaboration/Collaborators/MailPluginTest.php b/tests/lib/Collaboration/Collaborators/MailPluginTest.php index 702c1d6be6e..3cf76c562a1 100644 --- a/tests/lib/Collaboration/Collaborators/MailPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/MailPluginTest.php @@ -29,7 +29,9 @@ use OC\Federation\CloudIdManager; use OC\KnownUser\KnownUserService; use OCP\Collaboration\Collaborators\SearchResultType; use OCP\Contacts\IManager; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Federation\ICloudIdManager; +use OCP\ICacheFactory; use OCP\IConfig; use OCP\IGroupManager; use OCP\IURLGenerator; @@ -77,7 +79,13 @@ class MailPluginTest extends TestCase { $this->knownUserService = $this->createMock(KnownUserService::class); $this->userSession = $this->createMock(IUserSession::class); $this->mailer = $this->createMock(IMailer::class); - $this->cloudIdManager = new CloudIdManager($this->contactsManager, $this->createMock(IURLGenerator::class), $this->createMock(IUserManager::class)); + $this->cloudIdManager = new CloudIdManager( + $this->contactsManager, + $this->createMock(IURLGenerator::class), + $this->createMock(IUserManager::class), + $this->createMock(ICacheFactory::class), + $this->createMock(IEventDispatcher::class) + ); $this->searchResult = new SearchResult(); } diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php index 4072f3ecde1..22bd6f84be9 100644 --- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php +++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php @@ -28,7 +28,9 @@ use OC\Collaboration\Collaborators\SearchResult; use OC\Federation\CloudIdManager; use OCP\Collaboration\Collaborators\SearchResultType; use OCP\Contacts\IManager; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Federation\ICloudIdManager; +use OCP\ICacheFactory; use OCP\IConfig; use OCP\IURLGenerator; use OCP\IUser; @@ -63,7 +65,13 @@ class RemotePluginTest extends TestCase { $this->userManager = $this->createMock(IUserManager::class); $this->config = $this->createMock(IConfig::class); $this->contactsManager = $this->createMock(IManager::class); - $this->cloudIdManager = new CloudIdManager($this->contactsManager, $this->createMock(IURLGenerator::class), $this->createMock(IUserManager::class)); + $this->cloudIdManager = new CloudIdManager( + $this->contactsManager, + $this->createMock(IURLGenerator::class), + $this->createMock(IUserManager::class), + $this->createMock(ICacheFactory::class), + $this->createMock(IEventDispatcher::class) + ); $this->searchResult = new SearchResult(); } diff --git a/tests/lib/Federation/CloudIdManagerTest.php b/tests/lib/Federation/CloudIdManagerTest.php index 92f8a5fa8dd..0db36b0524a 100644 --- a/tests/lib/Federation/CloudIdManagerTest.php +++ b/tests/lib/Federation/CloudIdManagerTest.php @@ -22,7 +22,10 @@ namespace Test\Federation; use OC\Federation\CloudIdManager; +use OC\Memcache\ArrayCache; use OCP\Contacts\IManager; +use OCP\EventDispatcher\IEventDispatcher; +use OCP\ICacheFactory; use OCP\IURLGenerator; use OCP\IUserManager; use Test\TestCase; @@ -36,6 +39,8 @@ class CloudIdManagerTest extends TestCase { private $userManager; /** @var CloudIdManager */ private $cloudIdManager; + /** @var ICacheFactory|\PHPUnit\Framework\MockObject\MockObject */ + private $cacheFactory; protected function setUp(): void { @@ -45,7 +50,17 @@ class CloudIdManagerTest extends TestCase { $this->urlGenerator = $this->createMock(IURLGenerator::class); $this->userManager = $this->createMock(IUserManager::class); - $this->cloudIdManager = new CloudIdManager($this->contactsManager, $this->urlGenerator, $this->userManager); + $this->cacheFactory = $this->createMock(ICacheFactory::class); + $this->cacheFactory->method('createLocal') + ->willReturn(new ArrayCache('')); + + $this->cloudIdManager = new CloudIdManager( + $this->contactsManager, + $this->urlGenerator, + $this->userManager, + $this->cacheFactory, + $this->createMock(IEventDispatcher::class) + ); } public function cloudIdProvider() { |