I have a page with a several options and a button named "Download".
How do I test that this button works - document begin downloading, using Codeception acceptance tests?
I have a page with a several options and a button named "Download".
How do I test that this button works - document begin downloading, using Codeception acceptance tests?
See this previous question about saving to disk How to download any file and save it to the desired location using Selenium Webdriver
I don't think Codeception can control a native "Save as" dialog box. You could probably change the Firefox profile to save without asking, check for file existence in PHP and assert an error if the file does not exist.
If you are using the Cest format you could make a helper like the following in _support/WebHelper.php
.
<?php
namespace Codeception\Module;
// here you can define custom functions for WebGuy
class WebHelper extends \Codeception\Module
{
public function seeFileExists($filename)
{
\PHPUnit_Framework_Assert::assertTrue( file_exists($filename) );
}
}
This should allow you to do $I->seeFileExists('downloadpath/filename.txt');
in your Cest files.
There are a few examples of custom assertions in the documentation http://codeception.com/docs-2.0/03-ModulesAndHelpers