diff options
Diffstat (limited to 'tests')
10 files changed, 82 insertions, 50 deletions
diff --git a/tests/acceptance/features/bootstrap/FilesAppContext.php b/tests/acceptance/features/bootstrap/FilesAppContext.php index bc926fbe52f..e769820c9ee 100644 --- a/tests/acceptance/features/bootstrap/FilesAppContext.php +++ b/tests/acceptance/features/bootstrap/FilesAppContext.php @@ -106,7 +106,11 @@ class FilesAppContext implements Context, ActorAwareInterface { * @return Locator */ public static function shareLinkCheckbox() { - return Locator::forThe()->content("Share link")->descendantOf(self::currentSectionDetailsView())-> + // forThe()->checkbox("Share link") can not be used here; that would + // return the checkbox itself, but the element that the user interacts + // with is the label. + return Locator::forThe()->xpath("//label[normalize-space() = 'Share link']")-> + descendantOf(self::currentSectionDetailsView())-> describedAs("Share link checkbox in the details view in Files app"); } @@ -122,7 +126,11 @@ class FilesAppContext implements Context, ActorAwareInterface { * @return Locator */ public static function passwordProtectCheckbox() { - return Locator::forThe()->content("Password protect")->descendantOf(self::currentSectionDetailsView())-> + // forThe()->checkbox("Password protect") can not be used here; that + // would return the checkbox itself, but the element that the user + // interacts with is the label. + return Locator::forThe()->xpath("//label[normalize-space() = 'Password protect']")-> + descendantOf(self::currentSectionDetailsView())-> describedAs("Password protect checkbox in the details view in Files app"); } @@ -163,7 +171,7 @@ class FilesAppContext implements Context, ActorAwareInterface { * @return Locator */ public static function favoritedStateIconForFile($fileName) { - return Locator::forThe()->content("Favorited")->descendantOf(self::favoriteActionForFile($fileName))-> + return Locator::forThe()->css(".icon-starred")->descendantOf(self::favoriteActionForFile($fileName))-> describedAs("Favorited state icon for file $fileName in Files app"); } @@ -210,7 +218,8 @@ class FilesAppContext implements Context, ActorAwareInterface { * @return Locator */ private static function fileActionsMenuItemFor($itemText) { - return Locator::forThe()->content($itemText)->descendantOf(self::fileActionsMenu())-> + return Locator::forThe()->xpath("//a[normalize-space() = '$itemText']")-> + descendantOf(self::fileActionsMenu())-> describedAs($itemText . " item in file actions menu in Files app"); } diff --git a/tests/acceptance/features/bootstrap/FilesSharingAppContext.php b/tests/acceptance/features/bootstrap/FilesSharingAppContext.php index d9d5eca7359..88c1180c753 100644 --- a/tests/acceptance/features/bootstrap/FilesSharingAppContext.php +++ b/tests/acceptance/features/bootstrap/FilesSharingAppContext.php @@ -47,7 +47,7 @@ class FilesSharingAppContext implements Context, ActorAwareInterface { * @return Locator */ public static function wrongPasswordMessage() { - return Locator::forThe()->content("The password is wrong. Try again.")-> + return Locator::forThe()->xpath("//*[@class = 'warning' and normalize-space() = 'The password is wrong. Try again.']")-> describedAs("Wrong password message in Authenticate page"); } diff --git a/tests/acceptance/features/bootstrap/LoginPageContext.php b/tests/acceptance/features/bootstrap/LoginPageContext.php index 4b0672f652c..61f12f54be6 100644 --- a/tests/acceptance/features/bootstrap/LoginPageContext.php +++ b/tests/acceptance/features/bootstrap/LoginPageContext.php @@ -66,7 +66,7 @@ class LoginPageContext implements Context, ActorAwareInterface { * @return Locator */ public static function wrongPasswordMessage() { - return Locator::forThe()->content("Wrong password. Reset it?")-> + return Locator::forThe()->xpath("//*[@class = 'warning' and normalize-space() = 'Wrong password. Reset it?']")-> describedAs("Wrong password message in Login page"); } diff --git a/tests/acceptance/features/bootstrap/NotificationContext.php b/tests/acceptance/features/bootstrap/NotificationContext.php index f8b784e2465..ac9838562e1 100644 --- a/tests/acceptance/features/bootstrap/NotificationContext.php +++ b/tests/acceptance/features/bootstrap/NotificationContext.php @@ -31,7 +31,8 @@ class NotificationContext implements Context, ActorAwareInterface { * @return Locator */ public static function notificationMessage($message) { - return Locator::forThe()->content($message)->descendantOf(self::notificationContainer())-> + return Locator::forThe()->xpath("//*[@class = 'row' and normalize-space() = '$message']")-> + descendantOf(self::notificationContainer())-> describedAs("$message notification"); } diff --git a/tests/acceptance/features/bootstrap/SettingsMenuContext.php b/tests/acceptance/features/bootstrap/SettingsMenuContext.php index 9ce8df4caef..1ff5d94e98f 100644 --- a/tests/acceptance/features/bootstrap/SettingsMenuContext.php +++ b/tests/acceptance/features/bootstrap/SettingsMenuContext.php @@ -61,7 +61,8 @@ class SettingsMenuContext implements Context, ActorAwareInterface { * @return Locator */ private static function menuItemFor($itemText) { - return Locator::forThe()->content($itemText)->descendantOf(self::settingsMenu())-> + return Locator::forThe()->xpath("//a[normalize-space() = '$itemText']")-> + descendantOf(self::settingsMenu())-> describedAs($itemText . " item in Settings menu"); } diff --git a/tests/acceptance/features/core/Locator.php b/tests/acceptance/features/core/Locator.php index 0ebae9b8fb1..e670a5b8065 100644 --- a/tests/acceptance/features/core/Locator.php +++ b/tests/acceptance/features/core/Locator.php @@ -134,7 +134,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function id($value) { - return $this->customSelector("named", array("id", $value)); + return $this->customSelector("named_exact", array("id", $value)); } /** @@ -142,7 +142,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function idOrName($value) { - return $this->customSelector("named", array("id_or_name", $value)); + return $this->customSelector("named_exact", array("id_or_name", $value)); } /** @@ -150,7 +150,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function link($value) { - return $this->customSelector("named", array("link", $value)); + return $this->customSelector("named_exact", array("link", $value)); } /** @@ -158,7 +158,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function button($value) { - return $this->customSelector("named", array("button", $value)); + return $this->customSelector("named_exact", array("button", $value)); } /** @@ -166,15 +166,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function linkOrButton($value) { - return $this->customSelector("named", array("link_or_button", $value)); - } - - /** - * @param string $value - * @return LocatorBuilderSecondStep - */ - public function content($value) { - return $this->customSelector("named", array("content", $value)); + return $this->customSelector("named_exact", array("link_or_button", $value)); } /** @@ -182,7 +174,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function field($value) { - return $this->customSelector("named", array("field", $value)); + return $this->customSelector("named_exact", array("field", $value)); } /** @@ -190,7 +182,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function selectField($value) { - return $this->customSelector("named", array("select", $value)); + return $this->customSelector("named_exact", array("select", $value)); } /** @@ -198,7 +190,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function checkbox($value) { - return $this->customSelector("named", array("checkbox", $value)); + return $this->customSelector("named_exact", array("checkbox", $value)); } /** @@ -206,7 +198,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function radioButton($value) { - return $this->customSelector("named", array("radio", $value)); + return $this->customSelector("named_exact", array("radio", $value)); } /** @@ -214,7 +206,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function fileInput($value) { - return $this->customSelector("named", array("file", $value)); + return $this->customSelector("named_exact", array("file", $value)); } /** @@ -222,7 +214,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function optionGroup($value) { - return $this->customSelector("named", array("optgroup", $value)); + return $this->customSelector("named_exact", array("optgroup", $value)); } /** @@ -230,7 +222,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function option($value) { - return $this->customSelector("named", array("option", $value)); + return $this->customSelector("named_exact", array("option", $value)); } /** @@ -238,7 +230,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function fieldSet($value) { - return $this->customSelector("named", array("fieldset", $value)); + return $this->customSelector("named_exact", array("fieldset", $value)); } /** @@ -246,7 +238,7 @@ class LocatorBuilder { * @return LocatorBuilderSecondStep */ public function table($value) { - return $this->customSelector("named", array("table", $value)); + return $this->customSelector("named_exact", array("table", $value)); } } diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php index 4a5222fa915..6c0d079a204 100644 --- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php +++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php @@ -72,26 +72,16 @@ EOD; } public function testGetWithFilter() { - $this->config - ->expects($this->at(0)) - ->method('getSystemValue') - ->with('appstoreenabled', true) - ->willReturn(true); - $this->config - ->expects($this->at(1)) - ->method('getSystemValue') - ->with('appstoreenabled', true) - ->willReturn(true); - $this->config - ->expects($this->at(2)) - ->method('getSystemValue') - ->with('version') - ->willReturn('11.0.0.2'); - $this->config - ->expects($this->at(3)) - ->method('getSystemValue') - ->with('version') - ->willReturn('11.0.0.2'); + $this->config->method('getSystemValue') + ->willReturnCallback(function($key, $default) { + if ($key === 'appstoreenabled') { + return true; + } else if ($key === 'version') { + return '11.0.0.2'; + } else { + return $default; + } + }); $file = $this->createMock(ISimpleFile::class); $folder = $this->createMock(ISimpleFolder::class); diff --git a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php index 2d82fa5d68e..353c8d6f58f 100644 --- a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php +++ b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php @@ -79,4 +79,28 @@ class EMailproviderTest extends TestCase { $this->provider->process($entry); } + public function testProcessEmptyAddress() { + $entry = $this->createMock(IEntry::class); + $action = $this->createMock(ILinkAction::class); + $iconUrl = 'https://example.com/img/actions/icon.svg'; + $this->urlGenerator->expects($this->once()) + ->method('imagePath') + ->willReturn('img/actions/icon.svg'); + $this->urlGenerator->expects($this->once()) + ->method('getAbsoluteURL') + ->with('img/actions/icon.svg') + ->willReturn($iconUrl); + $entry->expects($this->once()) + ->method('getEMailAddresses') + ->willReturn([ + '', + ]); + $this->actionFactory->expects($this->never()) + ->method('newEMailAction'); + $entry->expects($this->never()) + ->method('addAction'); + + $this->provider->process($entry); + } + } diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php index 50d46ae932d..f1383b0691b 100644 --- a/tests/lib/Preview/GeneratorTest.php +++ b/tests/lib/Preview/GeneratorTest.php @@ -169,6 +169,7 @@ class GeneratorTest extends \Test\TestCase { $image = $this->createMock(IImage::class); $image->method('width')->willReturn(2048); $image->method('height')->willReturn(2048); + $image->method('valid')->willReturn(true); $this->helper->method('getThumbnail') ->will($this->returnCallback(function ($provider, $file, $x, $y) use ($invalidProvider, $validProvider, $image) { @@ -217,6 +218,7 @@ class GeneratorTest extends \Test\TestCase { ->with(128); $image->method('data') ->willReturn('my resized data'); + $image->method('valid')->willReturn(true); $previewFile->expects($this->once()) ->method('putContent') @@ -379,6 +381,7 @@ class GeneratorTest extends \Test\TestCase { ->willReturn($image); $image->method('height')->willReturn($maxY); $image->method('width')->willReturn($maxX); + $image->method('valid')->willReturn(true); $preview = $this->createMock(ISimpleFile::class); $previewFolder->method('newFile') diff --git a/tests/redis.config.php b/tests/redis.config.php new file mode 100644 index 00000000000..2ff46ec6728 --- /dev/null +++ b/tests/redis.config.php @@ -0,0 +1,12 @@ +<?php + +$CONFIG = [ + 'memcache.local' => '\\OC\\Memcache\\Redis', + 'memcache.distributed' => '\\OC\\Memcache\\Redis', + 'memcache.locking' => '\\OC\\Memcache\\Redis', + 'redis' => [ + 'host' => 'localhost', + 'port' => 6379, + 'timeout' => 0, + ], +]; |