diff --git a/tests/acceptance/features/bootstrap/FilePickerContext.php b/tests/acceptance/features/bootstrap/FilePickerContext.php
index c62a505f7058f11338eea300b3555a8d4301e6c2..d7659dbac8e77e75d64d3c7622d54ab865255d3b 100644
--- a/tests/acceptance/features/bootstrap/FilePickerContext.php
+++ b/tests/acceptance/features/bootstrap/FilePickerContext.php
@@ -48,7 +48,9 @@ class FilePickerContext implements Context, ActorAwareInterface {
 	 * @return Locator
 	 */
 	public static function rowForFile($fileName) {
-		return Locator::forThe()->xpath("//*[@id = 'picker-filestable']//*[contains(concat(' ', normalize-space(@class), ' '), ' filename ') and normalize-space() = '$fileName']/ancestor::tr")->
+		// File names in the file picker are split in two span elements, so
+		// their texts need to be concatenated to get the full file name.
+		return Locator::forThe()->xpath("//*[@id = 'picker-filestable']//*[contains(concat(' ', normalize-space(@class), ' '), ' filename-parts ') and concat(span[1], span[2]) = '$fileName']/ancestor::tr")->
 				descendantOf(self::fileListContainer())->
 				describedAs("Row for file $fileName in the file picker dialog");
 	}