Skip to content

Commit dc324c1

Browse files
authored
Merge pull request #644 from magento/MQE-1964
MQE-1964: MFTF Helper - Implementation
2 parents daae38c + 43d34b7 commit dc324c1

25 files changed

+483
-474
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ language: php
22
php:
33
- 7.2
44
- 7.3
5+
services:
6+
- docker
7+
before_install:
8+
- docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome:3.141.59-zirconium
59
install: composer install --no-interaction --prefer-source
610
env:
711
matrix:
812
- VERIFICATION_TOOL=phpunit-checks
913
- VERIFICATION_TOOL=static-checks
14+
- VERIFICATION_TOOL=functional
1015
script:
1116
- bin/$VERIFICATION_TOOL
1217
after_success:

bin/functional

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright © Magento, Inc. All rights reserved.
2+
# See COPYING.txt for license details.
3+
4+
set -e
5+
6+
echo "==============================="
7+
echo " EXECUTE DevDocsTest "
8+
echo "==============================="
9+
bin/mftf build:project
10+
bin/mftf run:test DevDocsTest -f

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"files": ["src/Magento/FunctionalTestingFramework/_bootstrap.php"],
5454
"psr-4": {
5555
"Magento\\FunctionalTestingFramework\\": "src/Magento/FunctionalTestingFramework",
56-
"MFTF\\": "dev/tests/functional/MFTF"
56+
"MFTF\\": "dev/tests/functional/tests/MFTF"
5757
}
5858
},
5959
"autoload-dev": {

composer.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="HelperActionGroup">
11+
<arguments>
12+
<argument name="test" type="string" />
13+
</arguments>
14+
<comment userInput="Action group to demonstrate helper functionality available from action groups." stepKey="comment" />
15+
<helper class="\MFTF\DevDocs\Helper\CustomHelper" method="goTo" stepKey="customHelper">
16+
<argument name="test">{{contentSection.parametrizedSelector(test)}}</argument>
17+
<argument name="module">['{{test}}', 'Bla']</argument>
18+
<argument name="url">{{test}}</argument>
19+
<argument name="bool">true</argument>
20+
<argument name="float">4.400000000234234</argument>
21+
<argument name="int">42</argument>
22+
</helper>
23+
</actionGroup>
24+
</actionGroups>
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="HelperData">
12+
<data key="entityField">Some kind of data for testing purposes</data>
13+
</entity>
14+
</entities>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace MFTF\DevDocs\Helper;
8+
9+
use Magento\FunctionalTestingFramework\Helper\Helper;
10+
11+
class CustomHelper extends Helper
12+
{
13+
/**
14+
* Custom helper.
15+
*
16+
* @param string $url
17+
* @param mixed $test
18+
* @param bool $bool
19+
* @param int $int
20+
* @param float $float
21+
* @param array $module
22+
* @param null $superBla
23+
* @param mixed $bla
24+
* @param array $arraysomething
25+
* @return void
26+
*/
27+
public function goTo(
28+
string $url,
29+
$test,
30+
bool $bool,
31+
int $int,
32+
float $float,
33+
array $module = [],
34+
$superBla = null,
35+
$bla = 'blaValue',
36+
array $arraysomething = ['key' => 'value', 'test']
37+
) {
38+
print('Hello, this is custom helper which provides an ability to write custom solutions.' . PHP_EOL);
39+
print('string $url = ' . $url . PHP_EOL);
40+
print('$test = ' . $test . PHP_EOL);
41+
print('$bool = ' . $bool . PHP_EOL);
42+
print('$int = ' . $int . PHP_EOL);
43+
print('$float = ' . $float . PHP_EOL);
44+
print('array $module = [' . implode(', ', $module) . ']' . PHP_EOL);
45+
print('$superBla = ' . $superBla . PHP_EOL);
46+
print('$bla = ' . $bla . PHP_EOL);
47+
print('array $arraysomething = [' . implode(', ', $arraysomething) . ']' . PHP_EOL);
48+
}
49+
}

dev/tests/functional/tests/MFTF/DevDocs/Section/ContentSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="contentSection">
1212
<element name="pageIntro" type="text" selector=".page-intro"/>
13+
<element name="parametrizedSelector" type="text" selector=".page-intro > {{justToProofItWorks}}" parameterized="true"/>
1314
<element name="deprecatedPageIntro" type="text" selector=".page-intro-old" deprecated="New element was introduced. Please use 'contentSection.pageIntro'"/>
1415
</section>
1516
</sections>

dev/tests/functional/tests/MFTF/DevDocs/Test/DeprecatedDevDocsTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
<!-- Open MFTF DevDocs Page -->
2323
<amOnPage stepKey="openMFTFDevDocPage" url="{{DeprecatedMFTFDocPage.url}}" />
2424
<see stepKey="verifyPageIntroText" selector="{{DeprecatedContentSection.pageIntro}}" userInput="{{DeprecatedMessageData.message}}" />
25-
<actionGroup ref="DeprecatedCommentActionGroup" stepKey="commentActionGroup" />
25+
<actionGroup ref="DeprecatedCommentActionGroup" stepKey="commentActionGroup"/>
2626
</test>
2727
</tests>

dev/tests/functional/tests/MFTF/DevDocs/Test/DevDocsTest.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,28 @@
2222
<!-- Open MFTF DevDocs Page -->
2323
<amOnPage stepKey="openMFTFDevDocPage" url="{{MFTFDocPage.url}}" />
2424
<see stepKey="verifyPageIntroText" selector="{{contentSection.pageIntro}}" userInput="{{MessageData.message}}" />
25+
<helper class="\MFTF\DevDocs\Helper\CustomHelper" method="goTo" stepKey="customHelper">
26+
<argument name="test">{{contentSection.pageIntro}}</argument>
27+
<argument name="module">['Test', 'Bla']</argument>
28+
<argument name="url">{{MFTFDocPage.url}}</argument>
29+
<argument name="bool">true</argument>
30+
<argument name="float">1.2</argument>
31+
<argument name="int">123</argument>
32+
</helper>
33+
34+
<helper class="\MFTF\DevDocs\Helper\CustomHelper" method="goTo" stepKey="customHelperWithArrayParametrized">
35+
<argument name="test">{{contentSection.pageIntro}}</argument>
36+
<argument name="module">[]</argument>
37+
<argument name="url">{{DeprecatedMFTFDocPage.url}}</argument>
38+
<argument name="superBla">1.2</argument>
39+
<argument name="bla" />
40+
<argument name="bool">false</argument>
41+
<argument name="float">4.223</argument>
42+
<argument name="int">987</argument>
43+
</helper>
44+
45+
<actionGroup ref="HelperActionGroup" stepKey="actionGroupWithCustomHelper">
46+
<argument name="test" value="{{HelperData.entityField}}" />
47+
</actionGroup>
2548
</test>
2649
</tests>

0 commit comments

Comments
 (0)