Skip to content

Commit e83c4f7

Browse files
committed
MQE-352: Review and Update SampleCest.xml for added functionality
1 parent d8d9fca commit e83c4f7

File tree

6 files changed

+141
-2
lines changed

6 files changed

+141
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
5+
<actionGroup name="SampleActionGroup">
6+
<arguments>
7+
<argument name="person" defaultValue="SamplePerson"/>
8+
</arguments>
9+
<fillField selector="#foo" userInput="{{person.foo}}" mergeKey="fillField1"/>
10+
<fillField selector="#bar" userInput="{{person.bar}}" mergeKey="fillField2"/>
11+
</actionGroup>
12+
</config>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
/**
5+
* Copyright © Magento, Inc. All rights reserved.
6+
* See COPYING.txt for license details.
7+
*/
8+
-->
9+
10+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
12+
<cest name="AdvancedSampleCest">
13+
<annotations>
14+
<features value=""/>
15+
<stories value=""/>
16+
<group value="skip"/>
17+
</annotations>
18+
<before>
19+
<createData entity="SamplePerson" mergeKey="beforeData"/>
20+
</before>
21+
<after>
22+
23+
</after>
24+
<test name="OneTest">
25+
<annotations>
26+
<title value=""/>
27+
<description value=""/>
28+
<severity value="CRITICAL"/>
29+
<testCaseId value="#"/>
30+
</annotations>
31+
32+
<!-- Create an entity that depends on another entity -->
33+
<createData entity="_defaultCategory" mergeKey="createCategory"/>
34+
<createData entity="_defaultProduct" mergeKey="createProduct">
35+
<required-entity persistedKey="createCategory"/>
36+
</createData>
37+
38+
<!-- Parameterized url -->
39+
<amOnPage url="{{SamplePage('foo', SamplePerson.bar)}}" mergeKey="amOnPage"/>
40+
41+
<!-- Parameterized selector -->
42+
<grabTextFrom selector="{{SampleSection.twoParamElement(SamplePerson.foo, 'bar')}}" returnVariable="myReturnVar" mergeKey="grabTextFrom"/>
43+
44+
<!-- Element with a timeout -->
45+
<click selector="{{SampleSection.timeoutElement}}" mergeKey="click"/>
46+
47+
<!-- ActionGroup -->
48+
<actionGroup ref="SampleActionGroup" mergeKey="actionGroup">
49+
<argument name="person" value="OverrideDefaultPerson"/>
50+
</actionGroup>
51+
</test>
52+
</cest>
53+
</config>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/SampleTests/Cest/SampleCest.xml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<!-- Test XML Example -->
99
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11-
<cest name="SampleGeneratorCest">
11+
<cest name="SampleCest">
1212
<annotations>
1313
<features value="Test Generator"/>
1414
<stories value="Verify each Codeception command is generated correctly."/>
@@ -247,5 +247,26 @@
247247
<unselectOption selector="#option" variable="randomStuff" mergeKey="unselectOption1"/>
248248
<waitForText variable="randomStuff" time="5" mergeKey="waitForText1"/>
249249
</test>
250+
<test name="AllReplacementTest">
251+
<annotations>
252+
<title value="Exercise reference replacement."/>
253+
<description value="Exercises {{foo}}, $foo$, and $$foo$$ replacement."/>
254+
<severity value="CRITICAL"/>
255+
<testCaseId value="#"/>
256+
</annotations>
257+
<createData entity="CustomerEntity1" mergeKey="testScopeData"/>
258+
<amOnPage url="{{SamplePage.url('success','success2')}}" mergeKey="a0"/>
259+
<amOnPage url="/$testScopeData.firstname$.html" mergeKey="a1"/>
260+
<amOnPage url="/$$createData1.firstname$$.html" mergeKey="a2"/>
261+
<amOnPage url="{{SamplePage.url($testScopeData.firstname$,$testScopeData.lastname$)}}" mergeKey="a3"/>
262+
<amOnPage url="{{SamplePage.url($$createData1.firstname$$,$$createData1.lastname$$)}}" mergeKey="a4"/>
263+
<click selector="{{SampleSection.oneParamElement('success')}}" mergeKey="c1"/>
264+
<click selector="{{SampleSection.twoParamElement('success','success2')}}" mergeKey="c2"/>
265+
<click selector="{{SampleSection.threeParamElement('John', SamplePerson.lastname, $testScopeData.lastname$)}}" mergeKey="c3"/>
266+
<click selector="#$testScopeData.firstname$ .$testScopeData.lastname$" mergeKey="c4"/>
267+
<click selector="#$$createData1.firstname$$ .$$createData1.lastname$$" mergeKey="c5"/>
268+
<fillField selector="#sample" userInput="Hello $testScopeData.firstname$ $testScopeData.lastname$" mergeKey="f1"/>
269+
<fillField selector="#sample" userInput="Hello $$createData1.firstname$$ $$createData1.lastname$$" mergeKey="f2"/>
270+
</test>
250271
</cest>
251-
</config>
272+
</config>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
/**
5+
* Copyright © Magento, Inc. All rights reserved.
6+
* See COPYING.txt for license details.
7+
*/
8+
-->
9+
10+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
12+
<entity name="SamplePerson" type="samplePerson">
13+
<data key="foo">foo</data>
14+
<data key="bar">bar</data>
15+
<data key="lastName">Doe</data>
16+
<data key="email" unique="prefix">.email@gmail.com</data>
17+
</entity>
18+
<entity name="OverrideDefaultPerson" type="samplePerson">
19+
<data key="foo">fizz</data>
20+
<data key="bar">buzz</data>
21+
</entity>
22+
</config>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
11+
<page name="SamplePage" urlPath="/{{var1}}/{{var2}}.html" module="SampleTests" parameterized="true">
12+
<section name="SampleSection"/>
13+
</page>
14+
</config>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="SampleSection">
12+
<element name="oneParamElement" type="button" selector="#element .{{var1}}" parameterized="true"/>
13+
<element name="twoParamElement" type="button" selector="#{{var1}} .{{var2}}" parameterized="true"/>
14+
<element name="threeParamElement" type="button" selector="#{{var1}}-{{var2}} .{{var3}}" parameterized="true"/>
15+
<element name="timeoutElement" type="button" selector="#foo" timeout="30"/>
16+
</section>
17+
</config>

0 commit comments

Comments
 (0)