Skip to content

magento/magento2-functional-testing-framework#61: Validate build:project was run before attempting to generate tests #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,32 @@ function generateTests($opts = ['config' => null, 'force' => true, 'nodes' => nu
$GLOBALS['FORCE_PHP_GENERATE'] = true;
}

require 'dev' . DIRECTORY_SEPARATOR . 'tests'. DIRECTORY_SEPARATOR . 'functional' . DIRECTORY_SEPARATOR . '_bootstrap.php';
require 'dev' . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'functional' . DIRECTORY_SEPARATOR . '_bootstrap.php';

if (!$this->isProjectBuilt()) {
throw new Exception('Please run vendor/bin/robo build:project and configure your environment (.env) first.');
}

\Magento\FunctionalTestingFramework\Util\TestGenerator::getInstance()->createAllTestFiles($opts['config'], $opts['nodes']);
$this->say("Generate Tests Command Run");
}

/**
* Check if MFTF has been properly configured
* @return bool
*/
private function isProjectBuilt()
{
$actorFile = __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Magento' . DIRECTORY_SEPARATOR . 'FunctionalTestingFramework' . DIRECTORY_SEPARATOR . '_generated' . DIRECTORY_SEPARATOR . 'AcceptanceTesterActions.php';

$login = getenv('MAGENTO_ADMIN_USERNAME');
$password = getenv('MAGENTO_ADMIN_PASSWORD');
$baseUrl = getenv('MAGENTO_BASE_URL');
$backendName = getenv('MAGENTO_BACKEND_NAME');

return (file_exists($actorFile) && $login && $password && $baseUrl && $backendName);
}

/**
* Generate a suite based on name(s) passed in as args.
*
Expand Down