Skip to content

Commit 5cc6508

Browse files
committed
Merge remote-tracking branch 'origin/sprint-develop' into MQE-494
2 parents 7f3545b + 93e5768 commit 5cc6508

File tree

6 files changed

+45
-4
lines changed

6 files changed

+45
-4
lines changed

dev/tests/verification/Resources/ActionGroupFunctionalCest.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ class ActionGroupFunctionalCest
3535
$ReplacementPerson = DataObjectHandler::getInstance()->getObject("ReplacementPerson");
3636
$this->createPersonParam = new DataPersistenceHandler($ReplacementPerson);
3737
$this->createPersonParam->createEntity();
38+
$I->fillField("#foo", "myData1");
39+
$I->fillField("#bar", "myData2");
40+
}
41+
42+
public function _after(AcceptanceTester $I)
43+
{
44+
$I->fillField("#foo", "myData1");
45+
$I->fillField("#bar", "myData2");
3846
}
3947

4048
/**
@@ -162,4 +170,15 @@ class ActionGroupFunctionalCest
162170
$I->amOnPage("/Jane/Dane.html");
163171
}
164172

173+
/**
174+
* @Parameter(name = "AcceptanceTester", value="$I")
175+
* @param AcceptanceTester $I
176+
* @return void
177+
*/
178+
public function ArgumentWithSameNameAsElement(AcceptanceTester $I)
179+
{
180+
$I->seeElement("#element");
181+
$I->seeElement("#element .John");
182+
}
183+
165184
}

dev/tests/verification/TestModule/ActionGroup/FunctionalActionGroup.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,11 @@
3838
<see selector="{{SampleSection.oneParamElement(myArg.firstname)}}" mergeKey="see1"/>
3939
<amOnPage url="{{SamplePage.url(myArg.firstname,myArg.lastname)}}" mergeKey="amOnPage1"/>
4040
</actionGroup>
41+
<actionGroup name="FunctionalActionGroupWithTrickyArgument">
42+
<arguments>
43+
<argument name="simple" defaultValue="simpleData"/>
44+
</arguments>
45+
<seeElement mergeKey="see1" selector="{{SampleSection.simpleElement}}"/>
46+
<seeElement mergeKey="see2" selector="{{SampleSection.simpleElementOneParam(simple.firstname)}}"/>
47+
</actionGroup>
4148
</config>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
</annotations>
1919
<before>
2020
<createData entity="ReplacementPerson" mergeKey="createPersonParam"/>
21+
<actionGroup ref="FunctionalActionGroup" mergeKey="beforeGroup"/>
2122
</before>
2223
<test name="BasicActionGroupTest">
2324
<amOnPage mergeKey="step1" url="/someUrl"/>
@@ -67,5 +68,11 @@
6768
<argument name="myArg" value="DefaultPerson"/>
6869
</actionGroup>
6970
</test>
71+
<test name="ArgumentWithSameNameAsElement">
72+
<actionGroup ref="FunctionalActionGroupWithTrickyArgument" mergeKey="actionGroup1"/>
73+
</test>
74+
<after>
75+
<actionGroup ref="FunctionalActionGroup" mergeKey="afterGroup"/>
76+
</after>
7077
</cest>
7178
</config>

dev/tests/verification/TestModule/Section/SampleSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1111
<section name="SampleSection">
1212
<element name="simpleElement" type="button" selector="#element"/>
13+
<element name="simpleElementOneParam" type="button" selector="#element .{{var1}}" parameterized="true"/>
1314
<element name="oneParamElement" type="button" selector="#element .{{var1}}" parameterized="true"/>
1415
<element name="twoParamElement" type="button" selector="#{{var1}} .{{var2}}" parameterized="true"/>
1516
<element name="threeParamElement" type="button" selector="#{{var1}}-{{var2}} .{{var3}}" parameterized="true"/>

src/Magento/FunctionalTestingFramework/Test/Objects/ActionGroupObject.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ private function replaceAttributeArgumentInVariable(
217217
);
218218
}
219219

220-
return str_replace($variableName, $arguments[$variableName], $attributeValue);
220+
//replace argument ONLY when there is no letters attached before after (ex. category.name vs categoryTreeButton)
221+
return preg_replace("/(?<![\w]){$variableName}(?![(\w])/", $arguments[$variableName], $attributeValue);
221222
}
222223

223224
/**

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,24 @@
6969
</xs:complexType>
7070
<xs:complexType name="hookType">
7171
<xs:choice minOccurs="0" maxOccurs="unbounded">
72-
<xs:group ref="actionTypeTags"/>
72+
<xs:group ref="testTypeTags"/>
7373
</xs:choice>
7474
</xs:complexType>
7575
<xs:complexType name="testType">
7676
<xs:choice minOccurs="0" maxOccurs="unbounded">
77-
<xs:group ref="actionTypeTags" />
77+
<xs:group ref="testTypeTags" />
7878
<xs:element type="annotationsType" name="annotations" minOccurs="0"/>
79-
<xs:element type="actions" name="actionGroup" minOccurs="0"/>
8079
</xs:choice>
8180
<xs:attribute type="xs:string" name="name"/>
8281
<xs:attribute type="xs:boolean" name="remove" default="false"/>
8382
</xs:complexType>
83+
<xs:group name="testTypeTags">
84+
<xs:choice>
85+
<xs:group ref="actionTypeTags"/>
86+
<xs:element type="actions" name="actionGroup" minOccurs="0"/>
87+
</xs:choice>
88+
</xs:group>
89+
8490
<xs:group name="actionTypeTags">
8591
<xs:choice>
8692
<xs:group ref="dataOperationTags"/>

0 commit comments

Comments
 (0)