diff --git a/src/Behat/MinkExtension/Context/MinkContext.php b/src/Behat/MinkExtension/Context/MinkContext.php index ec7eb99..0850ce3 100644 --- a/src/Behat/MinkExtension/Context/MinkContext.php +++ b/src/Behat/MinkExtension/Context/MinkContext.php @@ -167,7 +167,10 @@ class MinkContext extends RawMinkContext implements TranslatedContextInterface $field = $this->fixStepArgument($field); if ($this->getMinkParameter('files_path')) { - $path = rtrim($this->getMinkParameter('files_path'), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$path; + $fullPath = rtrim($this->getMinkParameter('files_path'), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$path; + if (is_file($fullPath)) { + $path = $fullPath; + } } $this->getSession()->getPage()->attachFileToField($field, $path);