Skip to content

Commit 45ceeda

Browse files
committed
Merge branch 'MQE-659-alex-edition' of github.com:magento/magento2-functional-testing-framework into MQE-1234-alex-edition
2 parents 5a52151 + 9e19969 commit 45ceeda

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/Magento/FunctionalTestingFramework/Allure/Adapter/MagentoAllureAdapter.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ private function sanitizeGroupName($group)
115115
* Override of parent method:
116116
* prevent replacing of . to •
117117
* strips control characters
118+
* inserts stepKey into step name
118119
*
119120
* @param StepEvent $stepEvent
120121
* @return void
@@ -207,7 +208,7 @@ public function testEnd()
207208
$step->setName(str_replace(ActionGroupObject::ACTION_GROUP_CONTEXT_START, '', $step->getName()));
208209
$actionGroupStepContainer = $step;
209210

210-
preg_match('/\[(?<actionGroupStepKey>.*)\]/', $step->getName(), $matches);
211+
preg_match(TestGenerator::ACTION_GROUP_STEP_KEY_REGEX, $step->getName(), $matches);
211212
if (!empty($matches['actionGroupStepKey'])) {
212213
$actionGroupStepKey = ucfirst($matches['actionGroupStepKey']);
213214
}
@@ -266,7 +267,7 @@ private function retrieveStepKey($stepLine)
266267
$this->testFiles[$filePath] = explode(PHP_EOL, file_get_contents($filePath));
267268
}
268269

269-
preg_match("/\/\/ stepKey: (?<stepKey>.*)/", $this->testFiles[$filePath][$stepLine], $matches);
270+
preg_match(TestGenerator::ACTION_STEP_KEY_REGEX, $this->testFiles[$filePath][$stepLine], $matches);
270271
if (!empty($matches['stepKey'])) {
271272
$stepKey = $matches['stepKey'];
272273
}

src/Magento/FunctionalTestingFramework/Codeception/Subscriber/Console.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Codeception\Step\Comment;
1313
use Codeception\Test\Interfaces\ScenarioDriven;
1414
use Magento\FunctionalTestingFramework\Test\Objects\ActionGroupObject;
15+
use Magento\FunctionalTestingFramework\Util\TestGenerator;
1516
use Symfony\Component\Console\Formatter\OutputFormatter;
1617

1718
class Console extends \Codeception\Subscriber\Console
@@ -85,7 +86,7 @@ private function printStepKeys(Step $step)
8586

8687
$isActionGroup = (strpos($step->__toString(), ActionGroupObject::ACTION_GROUP_CONTEXT_START) !== false);
8788
if ($isActionGroup) {
88-
preg_match('/\[(?<actionGroupStepKey>.*)\]/', $step->__toString(), $matches);
89+
preg_match(TestGenerator::ACTION_GROUP_STEP_KEY_REGEX, $step->__toString(), $matches);
8990
if (!empty($matches['actionGroupStepKey'])) {
9091
$this->actionGroupStepKey = ucfirst($matches['actionGroupStepKey']);
9192
}
@@ -152,7 +153,7 @@ private function retrieveStepKey($stepLine)
152153
$this->testFiles[$filePath] = explode(PHP_EOL, file_get_contents($filePath));
153154
}
154155

155-
preg_match("/\/\/ stepKey: (?<stepKey>.*)/", $this->testFiles[$filePath][$stepLine], $matches);
156+
preg_match(TestGenerator::ACTION_STEP_KEY_REGEX, $this->testFiles[$filePath][$stepLine], $matches);
156157
if (!empty($matches['stepKey'])) {
157158
$stepKey = $matches['stepKey'];
158159
}

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
*/
3232
class TestGenerator
3333
{
34+
const ACTION_GROUP_STEP_KEY_REGEX = "/\[(?<actionGroupStepKey>.*)\]/";
35+
const ACTION_STEP_KEY_REGEX = "/\/\/ stepKey: (?<stepKey>.*)/";
3436
const REQUIRED_ENTITY_REFERENCE = 'createDataKey';
3537
const GENERATED_DIR = '_generated';
3638
const DEFAULT_DIR = 'default';

0 commit comments

Comments
 (0)