Skip to content

Commit 2b00df5

Browse files
committed
Merge branch 'sprint-develop' into MQE-601
2 parents d3a2870 + fcf5efa commit 2b00df5

34 files changed

+523
-159
lines changed

bin/static-checks

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ echo "==============================="
1717
vendor/bin/phpcpd ./src
1818
echo ""
1919

20-
# Uncomment lines as part of MQE-590
21-
# echo "==============================="
22-
# echo " MESS DETECTOR"
23-
# echo "==============================="
24-
# vendor/bin/phpmd ./src text /dev/tests/static/Magento/CodeMessDetector/ruleset.xml --exclude _generated
25-
# echo ""
20+
echo "==============================="
21+
echo " MESS DETECTOR"
22+
echo "==============================="
23+
vendor/bin/phpmd ./src text /dev/tests/static/Magento/CodeMessDetector/ruleset.xml --exclude _generated
24+
echo ""
2625

2726
echo "==============================="
2827
echo " MAGENTO COPYRIGHT CHECK"

bin/static-checks.bat

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ call vendor\bin\phpcs .\dev\tests\verification --standard=.\dev\tests\static\Mag
1010
@echo ===============================COPY PASTE DETECTOR REPORT===============================
1111
call vendor\bin\phpcpd .\src
1212

13-
:: Uncomment lines as part of MQE-590
14-
:: @echo "===============================PHP MESS DETECTOR REPORT===============================
15-
:: vendor\bin\phpmd .\src text \dev\tests\static\Magento\CodeMessDetector\ruleset.xml --exclude _generated
13+
@echo "===============================PHP MESS DETECTOR REPORT===============================
14+
vendor\bin\phpmd .\src text \dev\tests\static\Magento\CodeMessDetector\ruleset.xml --exclude _generated
1615

1716
@echo ===============================MAGENTO COPYRIGHT REPORT===============================
1817
echo msgbox "INFO:Copyright check currently not run as part of .bat implementation" > "%temp%\popup.vbs"

composer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,16 @@
3131
},
3232
"autoload-dev": {
3333
"psr-4": {
34-
"tests\\unit\\Magento\\FunctionalTestingFramework\\": "dev/tests/unit/Magento/FunctionalTestingFramework"
34+
"tests\\unit\\": "dev/tests/unit"
3535
}
3636
},
37+
"scripts": {
38+
"tests": "bin/phpunit-checks",
39+
"static": "bin/static-checks"
40+
},
3741
"extra": {
3842
"hooks": {
39-
"pre-push": "bin/copyright-check"
43+
"pre-push": "bin/all-checks"
4044
}
4145
}
4246
}

dev/tests/static/Magento/CodeMessDetector/ruleset.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@
2626
</rule>
2727

2828
<!-- Unused code rules -->
29-
<rule ref="rulesets/unusedcode.xml" />
29+
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField" />
30+
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
31+
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />
32+
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable" >
33+
<properties>
34+
<property name="allow-unused-foreach-variables" value="true"/>
35+
</properties>
36+
</rule>
3037

3138
<!-- Code design rules -->
3239
<rule ref="rulesets/design.xml/ExitExpression" />
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?php
2+
namespace Magento\AcceptanceTest\_generated\Backend;
3+
4+
use Magento\FunctionalTestingFramework\AcceptanceTester;
5+
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;
6+
use Magento\FunctionalTestingFramework\DataGenerator\Persist\DataPersistenceHandler;
7+
use Magento\FunctionalTestingFramework\DataGenerator\Objects\EntityDataObject;
8+
use \Codeception\Util\Locator;
9+
use Yandex\Allure\Adapter\Annotation\Features;
10+
use Yandex\Allure\Adapter\Annotation\Stories;
11+
use Yandex\Allure\Adapter\Annotation\Title;
12+
use Yandex\Allure\Adapter\Annotation\Description;
13+
use Yandex\Allure\Adapter\Annotation\Parameter;
14+
use Yandex\Allure\Adapter\Annotation\Severity;
15+
use Yandex\Allure\Adapter\Model\SeverityLevel;
16+
use Yandex\Allure\Adapter\Annotation\TestCaseId;
17+
18+
/**
19+
* @Severity(level = SeverityLevel::CRITICAL)
20+
* @Title("Action Group Cest")
21+
* @group functional
22+
* @Features({"Action Group"})
23+
* @Stories({"MQE-496"})
24+
*/
25+
class ActionGroupCest
26+
{
27+
/**
28+
* @Severity(level = SeverityLevel::SEVERE)
29+
* @Title("Action Group With No Argument")
30+
* @Parameter(name = "AcceptanceTester", value="$I")
31+
* @param AcceptanceTester $I
32+
* @return void
33+
*/
34+
public function actionGroupWithNoArguments(AcceptanceTester $I)
35+
{
36+
$I->wait(1);
37+
}
38+
39+
/**
40+
* @Severity(level = SeverityLevel::SEVERE)
41+
* @Title("Action Group With Default Argument Value and Hardcoded Value in Param")
42+
* @Parameter(name = "AcceptanceTester", value="$I")
43+
* @param AcceptanceTester $I
44+
* @return void
45+
*/
46+
public function actionGroupWithDefaultArgumentAndStringSelectorParam(AcceptanceTester $I)
47+
{
48+
$I->see("John", "#element .test1");
49+
}
50+
51+
/**
52+
* @Severity(level = SeverityLevel::SEVERE)
53+
* @Title("Action Group With Passed Argument Value and Hardcoded Value in Param")
54+
* @Parameter(name = "AcceptanceTester", value="$I")
55+
* @param AcceptanceTester $I
56+
* @return void
57+
*/
58+
public function actionGroupWithPassedArgumentAndStringSelectorParam(AcceptanceTester $I)
59+
{
60+
$I->see("John".msq("UniquePerson"), "#element .test1");
61+
}
62+
63+
/**
64+
* @Severity(level = SeverityLevel::SEVERE)
65+
* @Title("Action Group With Default Argument Value and Argument Value in Param")
66+
* @Parameter(name = "AcceptanceTester", value="$I")
67+
* @param AcceptanceTester $I
68+
* @return void
69+
*/
70+
public function actionGroupWithSingleParameterSelectorFromDefaultArgument(AcceptanceTester $I)
71+
{
72+
$I->see("Doe", "#element .John");
73+
}
74+
75+
/**
76+
* @Severity(level = SeverityLevel::SEVERE)
77+
* @Title("Action Group With Passed Argument Value and Argument Value in Param")
78+
* @Parameter(name = "AcceptanceTester", value="$I")
79+
* @param AcceptanceTester $I
80+
* @return void
81+
*/
82+
public function actionGroupWithSingleParameterSelectorFromPassedArgument(AcceptanceTester $I)
83+
{
84+
$I->see("Doe", "#element .John".msq("UniquePerson"));
85+
}
86+
87+
/**
88+
* @Severity(level = SeverityLevel::SEVERE)
89+
* @Title("Action Group With Passed Argument Value and Multiple Argument Values in Param")
90+
* @Parameter(name = "AcceptanceTester", value="$I")
91+
* @param AcceptanceTester $I
92+
* @return void
93+
*/
94+
public function actionGroupWithMultipleParameterSelectorsFromDefaultArgument(AcceptanceTester $I)
95+
{
96+
$I->see("Doe", "#John-Doe .test");
97+
}
98+
99+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
10+
<actionGroup name="actionGroupWithoutArguments">
11+
<wait time="1" stepKey="waitForNothing" />
12+
</actionGroup>
13+
14+
<actionGroup name="actionGroupWithDefaultArgumentAndStringSelectorParam">
15+
<arguments>
16+
<argument name="someArgument" defaultValue="ReplacementPerson" />
17+
</arguments>
18+
19+
<see selector="{{SampleSection.oneParamElement('test1')}}" userInput="{{someArgument.firstname}}" stepKey="seeFirstName" />
20+
</actionGroup>
21+
22+
<actionGroup name="actionGroupWithSingleParameterSelectorFromArgument">
23+
<arguments>
24+
<argument name="someArgument" defaultValue="ReplacementPerson" />
25+
</arguments>
26+
27+
<see selector="{{SampleSection.oneParamElement(someArgument.firstname)}}" userInput="{{someArgument.lastname}}" stepKey="seeLastName" />
28+
</actionGroup>
29+
30+
<actionGroup name="actionGroupWithMultipleParameterSelectorsFromArgument">
31+
<arguments>
32+
<argument name="someArgument" defaultValue="ReplacementPerson" />
33+
</arguments>
34+
35+
<see selector="{{SampleSection.threeParamElement(someArgument.firstname, someArgument.lastname, 'test')}}" userInput="{{someArgument.lastname}}" stepKey="seeLastName" />
36+
</actionGroup>
37+
</config>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
10+
<cest name="ActionGroupCest">
11+
<annotations>
12+
<severity value="CRITICAL"/>
13+
<title value="Action Group Cest"/>
14+
<group value="functional"/>
15+
<features value="Action Group"/>
16+
<stories value="MQE-496"/>
17+
</annotations>
18+
19+
<test name="actionGroupWithNoArguments">
20+
<annotations>
21+
<severity value="SEVERE"/>
22+
<title value="Action Group With No Argument"/>
23+
</annotations>
24+
25+
<actionGroup ref="actionGroupWithoutArguments" stepKey="actionGroup"/>
26+
</test>
27+
28+
<test name="actionGroupWithDefaultArgumentAndStringSelectorParam">
29+
<annotations>
30+
<severity value="SEVERE"/>
31+
<title value="Action Group With Default Argument Value and Hardcoded Value in Param"/>
32+
</annotations>
33+
34+
<actionGroup ref="actionGroupWithDefaultArgumentAndStringSelectorParam" stepKey="actionGroup"/>
35+
</test>
36+
37+
<test name="actionGroupWithPassedArgumentAndStringSelectorParam">
38+
<annotations>
39+
<severity value="SEVERE"/>
40+
<title value="Action Group With Passed Argument Value and Hardcoded Value in Param"/>
41+
</annotations>
42+
43+
<actionGroup ref="actionGroupWithDefaultArgumentAndStringSelectorParam" stepKey="actionGroup">
44+
<argument name="someArgument" value="UniquePerson"/>
45+
</actionGroup>
46+
</test>
47+
48+
<test name="actionGroupWithSingleParameterSelectorFromDefaultArgument">
49+
<annotations>
50+
<severity value="SEVERE"/>
51+
<title value="Action Group With Default Argument Value and Argument Value in Param"/>
52+
</annotations>
53+
54+
<actionGroup ref="actionGroupWithSingleParameterSelectorFromArgument" stepKey="actionGroup"/>
55+
</test>
56+
57+
<test name="actionGroupWithSingleParameterSelectorFromPassedArgument">
58+
<annotations>
59+
<severity value="SEVERE"/>
60+
<title value="Action Group With Passed Argument Value and Argument Value in Param"/>
61+
</annotations>
62+
63+
<actionGroup ref="actionGroupWithSingleParameterSelectorFromArgument" stepKey="actionGroup">
64+
<argument name="someArgument" value="UniquePerson"/>
65+
</actionGroup>
66+
</test>
67+
68+
<test name="actionGroupWithMultipleParameterSelectorsFromDefaultArgument">
69+
<annotations>
70+
<severity value="SEVERE"/>
71+
<title value="Action Group With Passed Argument Value and Multiple Argument Values in Param"/>
72+
</annotations>
73+
74+
<actionGroup ref="actionGroupWithMultipleParameterSelectorsFromArgument" stepKey="actionGroup"/>
75+
</test>
76+
</cest>
77+
</config>

dev/tests/verification/TestModule/Data/ParameterArrayData.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88

99
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
10+
xsi:noNamespaceSchemaLocation="../../../../../src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
1111
<entity name="simpleParamData" type="data">
1212
<data key="name">name</data>
1313
<data key="uniqueNamePre" unique="prefix">prename</data>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace tests\verification\Tests;
7+
8+
use Magento\FunctionalTestingFramework\Test\Handlers\CestObjectHandler;
9+
use Magento\FunctionalTestingFramework\Util\TestGenerator;
10+
use PHPUnit\Framework\TestCase;
11+
12+
class ActionGroupGenerationTest extends TestCase
13+
{
14+
const ACTION_GROUP_CEST = 'ActionGroupCest';
15+
const RESOURCES_PATH = __DIR__ . '/../Resources';
16+
17+
/**
18+
* Tests flat generation of a hardcoded cest file with no external references.
19+
*/
20+
public function testBasicGeneration()
21+
{
22+
$cest = CestObjectHandler::getInstance()->getObject(self::ACTION_GROUP_CEST);
23+
$test = TestGenerator::getInstance(null, [$cest]);
24+
$test->createAllCestFiles();
25+
26+
$this->assertFileEquals(
27+
self::RESOURCES_PATH . DIRECTORY_SEPARATOR . self::ACTION_GROUP_CEST . ".txt",
28+
$test->getExportDir() . DIRECTORY_SEPARATOR . self::ACTION_GROUP_CEST . ".php"
29+
);
30+
}
31+
}

src/Magento/FunctionalTestingFramework/Config/Converter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public function convert($source)
8282
*
8383
* @param \DOMNodeList|array $elements
8484
* @return array
85+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
8586
*/
8687
protected function convertXml($elements)
8788
{

0 commit comments

Comments
 (0)