I implement the function in FeatureContext, but I do not know how to config in behat.yml
Here is my code
FeatureContext.php
/**
* @Then /^the file ".+" should be downloaded$/
* @param $filename
*
* @throws \Exception
*/
public function assertFileDownloaded($filename) {
if (!file_exists('/download/dir/' . $filename)) {
throw new Exception("Can not download");
}
}
Download.feature
Scenario: Download unlock documents with Success Stories
When I am on "managed-security-services/downloads/"
Then I should be on "/managed-security-services/downloads/"
And I should see "Bühler"
Then I click on the text "Bühler"
And I wait for "1" seconds
And the file ".+" should be downloaded
I do not know how to pass argument to behat.yml Here is code
suites:
default:
paths: &featurePaths
- '%paths.base%/features'
contexts: &contexts
- FeatureContext
When I run my test it shows message error like this:
[Behat\Testwork\Argument\Exception\UnknownParameterValueException] Can not find a matching value for an argument
$filename
of the methodFeatureContext::assertFileDownloaded()
.
As reference in here How to test file download in Behat