Skip to content

Commit c030dcc

Browse files
committed
MQE-812: Tests/Action Groups should infer order based on the top level argument
- updated ActionGroups to work with this - need verification tests still
1 parent ff0fbc2 commit c030dcc

File tree

6 files changed

+34
-7
lines changed

6 files changed

+34
-7
lines changed

src/Magento/FunctionalTestingFramework/Test/Config/ActionGroupDom.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,25 @@ public function initDom($xml, $filename = null, $exceptionCollector = null)
3030
/** @var \DOMElement $actionGroupNode */
3131
$actionGroupNode->setAttribute(self::TEST_META_FILENAME_ATTRIBUTE, $filename);
3232
$this->validateDomStepKeys($actionGroupNode, $filename, 'Action Group', $exceptionCollector);
33+
if ($actionGroupNode->getAttribute(self::TEST_MERGE_POINTER_AFTER) !== "") {
34+
$this->appendMergePointerToActions(
35+
$actionGroupNode,
36+
self::TEST_MERGE_POINTER_AFTER,
37+
$actionGroupNode->getAttribute(self::TEST_MERGE_POINTER_AFTER),
38+
$filename,
39+
$exceptionCollector
40+
);
41+
} elseif ($actionGroupNode->getAttribute(self::TEST_MERGE_POINTER_BEFORE) !== "") {
42+
$this->appendMergePointerToActions(
43+
$actionGroupNode,
44+
self::TEST_MERGE_POINTER_BEFORE,
45+
$actionGroupNode->getAttribute(self::TEST_MERGE_POINTER_BEFORE),
46+
$filename,
47+
$exceptionCollector
48+
);
49+
}
3350
}
3451
}
35-
3652
return $dom;
3753
}
3854
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class Dom extends \Magento\FunctionalTestingFramework\Config\Dom
1717
const TEST_META_FILENAME_ATTRIBUTE = 'filename';
1818
const TEST_META_NAME_ATTRIBUTE = 'name';
1919
const TEST_HOOK_NAMES = ["after", "before"];
20-
const TEST_MERGE_POINTER_BEFORE = "before";
21-
const TEST_MERGE_POINTER_AFTER = "after";
20+
const TEST_MERGE_POINTER_BEFORE = "insertBefore";
21+
const TEST_MERGE_POINTER_AFTER = "insertAfter";
2222

2323
/**
2424
* TestDom constructor.

src/Magento/FunctionalTestingFramework/Test/Util/ActionGroupObjectExtractor.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class ActionGroupObjectExtractor extends BaseObjectExtractor
1818
const DEFAULT_VALUE = 'defaultValue';
1919
const ACTION_GROUP_ARGUMENTS = 'arguments';
2020
const FILENAME = 'filename';
21+
const ACTION_GROUP_INSERT_BEFORE = "insertBefore";
22+
const ACTION_GROUP_INSERT_AFTER = "insertAfter";
2123

2224
/**
2325
* Action Object Extractor for converting actions into objects
@@ -49,7 +51,9 @@ public function extractActionGroup($actionGroupData)
4951
self::NODE_NAME,
5052
self::ACTION_GROUP_ARGUMENTS,
5153
self::NAME,
52-
self::FILENAME
54+
self::FILENAME,
55+
self::ACTION_GROUP_INSERT_BEFORE,
56+
self::ACTION_GROUP_INSERT_AFTER
5357
);
5458

5559
// TODO filename is now available to the ActionGroupObject, integrate this into debug and error statements

src/Magento/FunctionalTestingFramework/Test/Util/TestObjectExtractor.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ class TestObjectExtractor extends BaseObjectExtractor
2323
const TEST_FAILED_HOOK = 'failed';
2424
const TEST_BEFORE_ATTRIBUTE = 'before';
2525
const TEST_AFTER_ATTRIBUTE = 'after';
26+
const TEST_INSERT_BEFORE = 'insertBefore';
27+
const TEST_INSERT_AFTER = 'insertAfter';
28+
const TEST_FILENAME = 'filename';
2629

2730
/**
2831
* Action Object Extractor object
@@ -79,7 +82,9 @@ public function extractTestData($testData)
7982
self::TEST_BEFORE_HOOK,
8083
self::TEST_AFTER_HOOK,
8184
self::TEST_FAILED_HOOK,
82-
'filename'
85+
self::TEST_INSERT_BEFORE,
86+
self::TEST_INSERT_AFTER,
87+
self::TEST_FILENAME
8388
);
8489

8590
if (array_key_exists(self::TEST_ANNOTATIONS, $testData)) {

src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
</xs:choice>
3434
<xs:attribute type="xs:string" name="name" use="required"/>
3535
<xs:attribute type="xs:string" name="filename"/>
36+
<xs:attribute type="xs:string" name="insertBefore"/>
37+
<xs:attribute type="xs:string" name="insertAfter"/>
3638
</xs:complexType>
3739
<xs:simpleType name="dataTypeEnum" final="restriction">
3840
<xs:restriction base="xs:string">

src/Magento/FunctionalTestingFramework/Test/etc/mergedTestSchema.xsd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
<xs:attribute type="xs:string" name="name"/>
7171
<xs:attribute type="xs:boolean" name="remove" default="false"/>
7272
<xs:attribute type="xs:string" name="filename"/>
73-
<xs:attribute type="xs:string" name="before"/>
74-
<xs:attribute type="xs:string" name="after"/>
73+
<xs:attribute type="xs:string" name="insertBefore"/>
74+
<xs:attribute type="xs:string" name="insertAfter"/>
7575
</xs:complexType>
7676
<xs:group name="testTypeTags">
7777
<xs:choice>

0 commit comments

Comments
 (0)