diff --git a/src/Behat/MinkExtension/Context/MinkDictionary.php b/src/Behat/MinkExtension/Context/MinkDictionary.php index ebde70f..908298a 100644 --- a/src/Behat/MinkExtension/Context/MinkDictionary.php +++ b/src/Behat/MinkExtension/Context/MinkDictionary.php @@ -270,7 +270,10 @@ trait MinkDictionary $field = $this->fixStepArgument($field); if ($this->getMinkParameter('files_path')) { - $path = rtrim($this->getMinkParameter('files_path'), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$path; + $fullPath = rtrim(realpath($this->getMinkParameter('files_path')), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$path; + if (is_file($fullPath)) { + $path = $fullPath; + } } $this->getSession()->getPage()->attachFileToField($field, $path);