Skip to content

Commit 546f165

Browse files
committed
MQE-541: changed to use stepKey for test step sequencing.
1 parent 3649824 commit 546f165

File tree

6 files changed

+51
-6
lines changed

6 files changed

+51
-6
lines changed

dev/tests/verification/Resources/MergeFunctionalCest.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ class MergeFunctionalCest
5454
$I->fillField("#bar", "Dane");
5555
$I->searchAndMultiSelectOption("#foo", ["Jane", "Dane"]);
5656
$I->see("#element .Jane");
57+
$I->click("#step10MergedInResult");
58+
$I->click("#step11MergedInResult");
59+
$I->click("#step12MergedInResult");
5760
}
5861

5962
/**

dev/tests/verification/TestModule/Cest/MergeBaseFunctionalCest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
<fillField stepKey="step3" selector="#username" userInput="step3"/>
2828
<fillField stepKey="step5" selector="#password" userInput="step5"/>
2929
<click stepKey="step6" selector=".step6"/>
30+
<click stepKey="step10" selector="#step10ShouldNotInResult"/>
31+
<click mergeKey="step11" selector="#step11ShouldNotInResult"/>
32+
<click stepKey="step12" selector="#step12ShouldNotInResult"/>
3033
</test>
3134
<test name="MergedReferencesTest">
3235
<fillField stepKey="fillField1" selector="{{SampleSection.mergeElement}}" userInput="{{DefaultPerson.mergedField}}"/>

dev/tests/verification/TestModule/Cest/MergeInFunctionalCest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
<click stepKey="step4" selector="#step4" before="step5"/>
2525
<click stepKey="step6" remove="true"/>
2626
<click stepKey="step6Merge" selector="#step6Merged" after="step5"/>
27+
<click stepKey="step10" selector="#step10MergedInResult"/>
28+
<click mergeKey="step11" selector="#step11MergedInResult"/>
29+
<click mergeKey="step12" selector="#step12MergedInResult"/>
2730
<actionGroup ref="FunctionalActionGroupWithData" stepKey="step8Merge" after="step7Merge"/>
2831
</test>
2932
</cest>

src/Magento/FunctionalTestingFramework/Config/Dom.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
namespace Magento\FunctionalTestingFramework\Config;
88

9+
use Magento\FunctionalTestingFramework\Util\GlobalConstants;
10+
911
/**
1012
* Magento configuration XML DOM utility
1113
*/
@@ -222,6 +224,12 @@ protected function getNodePathByParent(\DOMElement $node, $parentPath)
222224
if ($value = $node->getAttribute($idAttributeValue)) {
223225
$path .= "[@{$idAttributeValue}='{$value}']";
224226
break;
227+
} elseif (empty($value) && $idAttributeValue === GlobalConstants::TEST_ID_ATTRIBUTE) {
228+
$idAttributeValue = GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE;
229+
if ($value = $node->getAttribute($idAttributeValue)) {
230+
$path .= "[@{$idAttributeValue}='{$value}']";
231+
break;
232+
}
225233
}
226234
}
227235
}

src/Magento/FunctionalTestingFramework/Test/Config/Converter/Dom/Flat.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88

99
use Magento\FunctionalTestingFramework\Config\ConverterInterface;
1010
use Magento\FunctionalTestingFramework\Config\Dom\ArrayNodeConfig;
11+
use Magento\FunctionalTestingFramework\Util\GlobalConstants;
1112

1213
/**
1314
* Universal converter of any XML data to an array representation with no data loss
1415
*/
1516
class Flat implements ConverterInterface
1617
{
17-
const UNIQUE_KEY = 'stepKey';
18-
const DEPRECATED_UNIQUE_KEY = 'mergeKey';
19-
2018
/**
2119
* Array node configuration.
2220
*
@@ -88,9 +86,11 @@ public function convertXml(\DOMNode $source, $basePath = '')
8886
}
8987

9088
$nodeData = $this->convertXml($node, $nodePath);
91-
if (!isset($nodeData[self::UNIQUE_KEY]) && isset($nodeData[self::DEPRECATED_UNIQUE_KEY])) {
92-
$nodeData[self::UNIQUE_KEY] = $nodeData[self::DEPRECATED_UNIQUE_KEY];
93-
unset($nodeData[self::DEPRECATED_UNIQUE_KEY]);
89+
if (!isset($nodeData[GlobalConstants::TEST_ID_ATTRIBUTE])
90+
&& isset($nodeData[GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE])) {
91+
$nodeData[GlobalConstants::TEST_ID_ATTRIBUTE] =
92+
$nodeData[GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE];
93+
unset($nodeData[GlobalConstants::DEPRECATED_TEST_ID_ATTRIBUTE]);
9494
}
9595
if ($isArrayNode) {
9696
if ($isNumericArrayNode) {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\FunctionalTestingFramework\Util;
7+
8+
final class GlobalConstants
9+
{
10+
/**
11+
* A new id attribute that needs special handling to maintain backward compatibility.
12+
*/
13+
const TEST_ID_ATTRIBUTE = 'stepKey';
14+
15+
/**
16+
* The old attribute that should still work as an id attribute.
17+
*/
18+
const DEPRECATED_TEST_ID_ATTRIBUTE = 'mergeKey';
19+
20+
/**
21+
* GlobalConstants constructor.
22+
*
23+
* Make this private so it cannot be instantiated.
24+
*/
25+
private function __construct()
26+
{
27+
}
28+
}

0 commit comments

Comments
 (0)