Skip to content

Commit d1a7feb

Browse files
committed
Merge branch 'CD-develop' of github.com:magento/magento2-functional-testing-framework into MFTF-57
# Conflicts: # RoboFile.php # src/Magento/FunctionalTestingFramework/Util/TestGenerator.php
2 parents 12ca5e4 + e01f07e commit d1a7feb

File tree

56 files changed

+597
-111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+597
-111
lines changed

.env.example

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
MAGENTO_BASE_URL=http://devdocs.magento.com/
66

77
#*** Set the Admin Username and Password for your Magento instance ***#
8-
MAGENTO_BACKEND_NAME=
9-
MAGENTO_ADMIN_USERNAME=
10-
MAGENTO_ADMIN_PASSWORD=
8+
MAGENTO_BACKEND_NAME=admin
9+
MAGENTO_ADMIN_USERNAME=admin
10+
MAGENTO_ADMIN_PASSWORD=123123q
1111

1212
#*** Path to CLI entry point and command parameter name. Uncomment and change if folder structure differs from standard Magento installation
1313
#MAGENTO_CLI_COMMAND_PATH=dev/tests/acceptance/utils/command.php
@@ -19,6 +19,9 @@ MAGENTO_ADMIN_PASSWORD=
1919
#SELENIUM_PROTOCOL=http
2020
#SELENIUM_PATH=/wd/hub
2121

22+
#*** Browser for running tests, default chrome. Uncomment and change if you want to run tests on another browser (ex. firefox).
23+
BROWSER=chrome
24+
2225
#*** Uncomment and set host & port if your dev environment needs different value other than MAGENTO_BASE_URL for Rest API Requests ***#
2326
#MAGENTO_RESTAPI_SERVER_HOST=
2427
#MAGENTO_RESTAPI_SERVER_PORT=

RoboFile.php

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function cloneFiles()
3333
*/
3434
function buildProject()
3535
{
36+
$this->writeln("<error>This command will be removed in MFTF v3.0.0. Please use bin/mftf build:project instead.</error>\n");
3637
$this->cloneFiles();
3738
$this->_exec('vendor'. DIRECTORY_SEPARATOR .'bin'. DIRECTORY_SEPARATOR .'codecept build');
3839
}
@@ -52,12 +53,33 @@ function generateTests($opts = ['config' => null, 'force' => true, 'nodes' => nu
5253
$GLOBALS['FORCE_PHP_GENERATE'] = true;
5354
}
5455

55-
require 'dev' . DIRECTORY_SEPARATOR . 'tests'. DIRECTORY_SEPARATOR . 'functional' . DIRECTORY_SEPARATOR . '_bootstrap.php';
56+
require 'dev' . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'functional' . DIRECTORY_SEPARATOR . '_bootstrap.php';
57+
58+
if (!$this->isProjectBuilt()) {
59+
throw new Exception('Please run vendor/bin/robo build:project and configure your environment (.env) first.');
60+
}
61+
5662
\Magento\FunctionalTestingFramework\Util\TestGenerator::getInstance()
5763
->createAllTestFiles($opts['config'], $opts['nodes'], $opts['debug']);
5864
$this->say("Generate Tests Command Run");
5965
}
6066

67+
/**
68+
* Check if MFTF has been properly configured
69+
* @return bool
70+
*/
71+
private function isProjectBuilt()
72+
{
73+
$actorFile = __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Magento' . DIRECTORY_SEPARATOR . 'FunctionalTestingFramework' . DIRECTORY_SEPARATOR . '_generated' . DIRECTORY_SEPARATOR . 'AcceptanceTesterActions.php';
74+
75+
$login = getenv('MAGENTO_ADMIN_USERNAME');
76+
$password = getenv('MAGENTO_ADMIN_PASSWORD');
77+
$baseUrl = getenv('MAGENTO_BASE_URL');
78+
$backendName = getenv('MAGENTO_BACKEND_NAME');
79+
80+
return (file_exists($actorFile) && $login && $password && $baseUrl && $backendName);
81+
}
82+
6183
/**
6284
* Generate a suite based on name(s) passed in as args.
6385
*
@@ -80,13 +102,13 @@ function generateSuite(array $args)
80102
}
81103

82104
/**
83-
* Run all Functional tests.
105+
* Run all MFTF tests.
84106
*
85107
* @return void
86108
*/
87-
function functional()
109+
function mftf()
88110
{
89-
$this->_exec('.' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'codecept run functional --skip-group skip');
111+
$this->_exec('.' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'codecept run MFTF --skip-group skip');
90112
}
91113

92114
/**

bin/mftf

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env php
2+
3+
<?php
4+
/**
5+
* Copyright © Magento, Inc. All rights reserved.
6+
* See COPYING.txt for license details.
7+
*/
8+
9+
if (PHP_SAPI !== 'cli') {
10+
echo 'bin/mftf must be run as a CLI application';
11+
exit(1);
12+
}
13+
14+
try {
15+
require_once __DIR__ . '/../bootstrap.php';
16+
$application = new Symfony\Component\Console\Application();
17+
$application->setName('Magento Functional Testing Framework CLI');
18+
$application->setVersion('1.0.0');
19+
$application->add(new Magento\FunctionalTestingFramework\Console\SetupEnvCommand());
20+
$application->add(new Magento\FunctionalTestingFramework\Console\BuildProjectCommand());
21+
$application->run();
22+
} catch (\Exception $e) {
23+
while ($e) {
24+
echo $e->getMessage();
25+
echo $e->getTraceAsString();
26+
echo "\n\n";
27+
$e = $e->getPrevious();
28+
}
29+
exit(1);
30+
}

bootstrap.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
require_once 'vendor/autoload.php';
8+
define('BP', __DIR__);

dev/tests/functional/MFTF.suite.dist.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ modules:
2020
\Magento\FunctionalTestingFramework\Module\MagentoWebDriver:
2121
url: "%MAGENTO_BASE_URL%"
2222
backend_name: "%MAGENTO_BACKEND_NAME%"
23-
browser: 'chrome'
23+
browser: '%BROWSER%'
2424
window_size: maximize
2525
username: "%MAGENTO_ADMIN_USERNAME%"
2626
password: "%MAGENTO_ADMIN_PASSWORD%"

dev/tests/verification/Resources/ActionGroupWithDataOverrideTest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Magento\AcceptanceTest\_generated\Backend;
2+
namespace Magento\AcceptanceTest\_default\Backend;
33

44
use Magento\FunctionalTestingFramework\AcceptanceTester;
55
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;

dev/tests/verification/Resources/ActionGroupWithDataTest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Magento\AcceptanceTest\_generated\Backend;
2+
namespace Magento\AcceptanceTest\_default\Backend;
33

44
use Magento\FunctionalTestingFramework\AcceptanceTester;
55
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;

dev/tests/verification/Resources/ActionGroupWithDefaultArgumentAndStringSelectorParam.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Magento\AcceptanceTest\_generated\Backend;
2+
namespace Magento\AcceptanceTest\_default\Backend;
33

44
use Magento\FunctionalTestingFramework\AcceptanceTester;
55
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;

dev/tests/verification/Resources/ActionGroupWithMultipleParameterSelectorsFromDefaultArgument.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Magento\AcceptanceTest\_generated\Backend;
2+
namespace Magento\AcceptanceTest\_default\Backend;
33

44
use Magento\FunctionalTestingFramework\AcceptanceTester;
55
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;

dev/tests/verification/Resources/ActionGroupWithNoArguments.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Magento\AcceptanceTest\_generated\Backend;
2+
namespace Magento\AcceptanceTest\_default\Backend;
33

44
use Magento\FunctionalTestingFramework\AcceptanceTester;
55
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;

0 commit comments

Comments
 (0)