Skip to content

Commit 27d5ee6

Browse files
authored
Merge branch 'develop' into MQE-3228
2 parents 4ef9e51 + d8fdaaf commit 27d5ee6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+441
-9
lines changed

dev/tests/unit/Magento/FunctionalTestFramework/Util/TestGeneratorTest.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,66 @@ public function testEntityException(): void
8888
$this->assertArrayHasKey('sampleTest', $testErrors);
8989
}
9090

91+
/**
92+
* Basic test to check unique id is appended to input as prefix
93+
*
94+
* @return void
95+
* @throws Exception
96+
*/
97+
public function testUniqueIdAppendedToInputStringAsPrefix()
98+
{
99+
$actionObject = new ActionObject('fakeAction', 'comment', [
100+
'userInput' => '{{someEntity.entity}}'
101+
]);
102+
103+
$testObject = new TestObject('sampleTest', ['merge123' => $actionObject], [], [], 'filename');
104+
$testGeneratorObject = TestGenerator::getInstance('', ['sampleTest' => $testObject]);
105+
106+
$result = $testGeneratorObject->getUniqueIdForInput('prefix', "foo");
107+
108+
$this->assertMatchesRegularExpression('/[A-Za-z0-9]+foo/', $result);
109+
}
110+
111+
/**
112+
* Basic test to check unique id is appended to input as suffix
113+
*
114+
* @return void
115+
* @throws Exception
116+
*/
117+
public function testUniqueIdAppendedToInputStringAsSuffix()
118+
{
119+
$actionObject = new ActionObject('fakeAction', 'comment', [
120+
'userInput' => '{{someEntity.entity}}'
121+
]);
122+
123+
$testObject = new TestObject('sampleTest', ['merge123' => $actionObject], [], [], 'filename');
124+
$testGeneratorObject = TestGenerator::getInstance('', ['sampleTest' => $testObject]);
125+
126+
$result = $testGeneratorObject->getUniqueIdForInput('suffix', "foo");
127+
128+
$this->assertMatchesRegularExpression('/foo[A-Za-z0-9]+/', $result);
129+
}
130+
131+
/**
132+
* Basic test for wrong output for input
133+
*
134+
* @return void
135+
* @throws Exception
136+
*/
137+
public function testFailedRegexForUniqueAttribute()
138+
{
139+
$actionObject = new ActionObject('fakeAction', 'comment', [
140+
'userInput' => '{{someEntity.entity}}'
141+
]);
142+
143+
$testObject = new TestObject('sampleTest', ['merge123' => $actionObject], [], [], 'filename');
144+
$testGeneratorObject = TestGenerator::getInstance('', ['sampleTest' => $testObject]);
145+
146+
$result = $testGeneratorObject->getUniqueIdForInput('suffix', "foo");
147+
148+
$this->assertDoesNotMatchRegularExpression('/bar[A-Za-z0-9]+/', $result);
149+
}
150+
91151
/**
92152
* Tests that skipped tests do not have a fully generated body.
93153
*

dev/tests/verification/Resources/ActionGroupContainsStepKeyInArgText.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ class ActionGroupContainsStepKeyInArgTextCest
2828
*/
2929
public function _before(AcceptanceTester $I)
3030
{
31+
$I->comment('[START BEFORE HOOK]');
3132
$I->comment("Entering Action Group [actionGroup] actionGroupContainsStepKeyInArgValue");
3233
$I->see("arg1", ".selector"); // stepKey: arg1ActionGroup
3334
$I->comment("Exiting Action Group [actionGroup] actionGroupContainsStepKeyInArgValue");
35+
$I->comment('[END BEFORE HOOK]');
3436
}
3537

3638
/**

dev/tests/verification/Resources/ActionGroupReturningValueTest.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ class ActionGroupReturningValueTestCest
2929
*/
3030
public function _before(AcceptanceTester $I)
3131
{
32+
$I->comment('[START BEFORE HOOK]');
3233
$I->createEntity("createPersonParam", "hook", "ReplacementPerson", [], []); // stepKey: createPersonParam
3334
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
3435
$I->fillField("#foo", "myData1"); // stepKey: fillField1BeforeGroup
3536
$I->fillField("#bar", "myData2"); // stepKey: fillField2BeforeGroup
3637
$I->comment("Exiting Action Group [beforeGroup] FunctionalActionGroup");
38+
$I->comment('[END BEFORE HOOK]');
3739
}
3840

3941
/**
@@ -42,10 +44,12 @@ class ActionGroupReturningValueTestCest
4244
*/
4345
public function _after(AcceptanceTester $I)
4446
{
47+
$I->comment('[START AFTER HOOK]');
4548
$I->comment("Entering Action Group [afterGroup] FunctionalActionGroup");
4649
$I->fillField("#foo", "myData1"); // stepKey: fillField1AfterGroup
4750
$I->fillField("#bar", "myData2"); // stepKey: fillField2AfterGroup
4851
$I->comment("Exiting Action Group [afterGroup] FunctionalActionGroup");
52+
$I->comment('[END AFTER HOOK]');
4953
if ($this->isSuccess) {
5054
unlink(__FILE__);
5155
}

dev/tests/verification/Resources/ActionGroupUsingCreateData.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ class ActionGroupUsingCreateDataCest
2828
*/
2929
public function _before(AcceptanceTester $I)
3030
{
31+
$I->comment('[START BEFORE HOOK]');
3132
$I->comment("Entering Action Group [Key1] actionGroupWithCreateData");
3233
$I->createEntity("createCategoryKey1", "hook", "ApiCategory", [], []); // stepKey: createCategoryKey1
3334
$I->createEntity("createConfigProductKey1", "hook", "ApiConfigurableProduct", ["createCategoryKey1"], []); // stepKey: createConfigProductKey1
3435
$I->comment("Exiting Action Group [Key1] actionGroupWithCreateData");
36+
$I->comment('[END BEFORE HOOK]');
3537
}
3638

3739
/**

dev/tests/verification/Resources/ActionGroupWithDataOverrideTest.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ class ActionGroupWithDataOverrideTestCest
2929
*/
3030
public function _before(AcceptanceTester $I)
3131
{
32+
$I->comment('[START BEFORE HOOK]');
3233
$I->createEntity("createPersonParam", "hook", "ReplacementPerson", [], []); // stepKey: createPersonParam
3334
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
3435
$I->fillField("#foo", "myData1"); // stepKey: fillField1BeforeGroup
3536
$I->fillField("#bar", "myData2"); // stepKey: fillField2BeforeGroup
3637
$I->comment("Exiting Action Group [beforeGroup] FunctionalActionGroup");
38+
$I->comment('[END BEFORE HOOK]');
3739
}
3840

3941
/**
@@ -42,10 +44,12 @@ class ActionGroupWithDataOverrideTestCest
4244
*/
4345
public function _after(AcceptanceTester $I)
4446
{
47+
$I->comment('[START AFTER HOOK]');
4548
$I->comment("Entering Action Group [afterGroup] FunctionalActionGroup");
4649
$I->fillField("#foo", "myData1"); // stepKey: fillField1AfterGroup
4750
$I->fillField("#bar", "myData2"); // stepKey: fillField2AfterGroup
4851
$I->comment("Exiting Action Group [afterGroup] FunctionalActionGroup");
52+
$I->comment('[END AFTER HOOK]');
4953
if ($this->isSuccess) {
5054
unlink(__FILE__);
5155
}

dev/tests/verification/Resources/ActionGroupWithDataTest.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ class ActionGroupWithDataTestCest
2929
*/
3030
public function _before(AcceptanceTester $I)
3131
{
32+
$I->comment('[START BEFORE HOOK]');
3233
$I->createEntity("createPersonParam", "hook", "ReplacementPerson", [], []); // stepKey: createPersonParam
3334
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
3435
$I->fillField("#foo", "myData1"); // stepKey: fillField1BeforeGroup
3536
$I->fillField("#bar", "myData2"); // stepKey: fillField2BeforeGroup
3637
$I->comment("Exiting Action Group [beforeGroup] FunctionalActionGroup");
38+
$I->comment('[END BEFORE HOOK]');
3739
}
3840

3941
/**
@@ -42,10 +44,12 @@ class ActionGroupWithDataTestCest
4244
*/
4345
public function _after(AcceptanceTester $I)
4446
{
47+
$I->comment('[START AFTER HOOK]');
4548
$I->comment("Entering Action Group [afterGroup] FunctionalActionGroup");
4649
$I->fillField("#foo", "myData1"); // stepKey: fillField1AfterGroup
4750
$I->fillField("#bar", "myData2"); // stepKey: fillField2AfterGroup
4851
$I->comment("Exiting Action Group [afterGroup] FunctionalActionGroup");
52+
$I->comment('[END AFTER HOOK]');
4953
if ($this->isSuccess) {
5054
unlink(__FILE__);
5155
}

dev/tests/verification/Resources/ActionGroupWithNoDefaultTest.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ class ActionGroupWithNoDefaultTestCest
2929
*/
3030
public function _before(AcceptanceTester $I)
3131
{
32+
$I->comment('[START BEFORE HOOK]');
3233
$I->createEntity("createPersonParam", "hook", "ReplacementPerson", [], []); // stepKey: createPersonParam
3334
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
3435
$I->fillField("#foo", "myData1"); // stepKey: fillField1BeforeGroup
3536
$I->fillField("#bar", "myData2"); // stepKey: fillField2BeforeGroup
3637
$I->comment("Exiting Action Group [beforeGroup] FunctionalActionGroup");
38+
$I->comment('[END BEFORE HOOK]');
3739
}
3840

3941
/**
@@ -42,10 +44,12 @@ class ActionGroupWithNoDefaultTestCest
4244
*/
4345
public function _after(AcceptanceTester $I)
4446
{
47+
$I->comment('[START AFTER HOOK]');
4548
$I->comment("Entering Action Group [afterGroup] FunctionalActionGroup");
4649
$I->fillField("#foo", "myData1"); // stepKey: fillField1AfterGroup
4750
$I->fillField("#bar", "myData2"); // stepKey: fillField2AfterGroup
4851
$I->comment("Exiting Action Group [afterGroup] FunctionalActionGroup");
52+
$I->comment('[END AFTER HOOK]');
4953
if ($this->isSuccess) {
5054
unlink(__FILE__);
5155
}

dev/tests/verification/Resources/ActionGroupWithPersistedData.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ class ActionGroupWithPersistedDataCest
2929
*/
3030
public function _before(AcceptanceTester $I)
3131
{
32+
$I->comment('[START BEFORE HOOK]');
3233
$I->createEntity("createPersonParam", "hook", "ReplacementPerson", [], []); // stepKey: createPersonParam
3334
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
3435
$I->fillField("#foo", "myData1"); // stepKey: fillField1BeforeGroup
3536
$I->fillField("#bar", "myData2"); // stepKey: fillField2BeforeGroup
3637
$I->comment("Exiting Action Group [beforeGroup] FunctionalActionGroup");
38+
$I->comment('[END BEFORE HOOK]');
3739
}
3840

3941
/**
@@ -42,10 +44,12 @@ class ActionGroupWithPersistedDataCest
4244
*/
4345
public function _after(AcceptanceTester $I)
4446
{
47+
$I->comment('[START AFTER HOOK]');
4548
$I->comment("Entering Action Group [afterGroup] FunctionalActionGroup");
4649
$I->fillField("#foo", "myData1"); // stepKey: fillField1AfterGroup
4750
$I->fillField("#bar", "myData2"); // stepKey: fillField2AfterGroup
4851
$I->comment("Exiting Action Group [afterGroup] FunctionalActionGroup");
52+
$I->comment('[END AFTER HOOK]');
4953
if ($this->isSuccess) {
5054
unlink(__FILE__);
5155
}

dev/tests/verification/Resources/ActionGroupWithTopLevelPersistedData.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ class ActionGroupWithTopLevelPersistedDataCest
2929
*/
3030
public function _before(AcceptanceTester $I)
3131
{
32+
$I->comment('[START BEFORE HOOK]');
3233
$I->createEntity("createPersonParam", "hook", "ReplacementPerson", [], []); // stepKey: createPersonParam
3334
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
3435
$I->fillField("#foo", "myData1"); // stepKey: fillField1BeforeGroup
3536
$I->fillField("#bar", "myData2"); // stepKey: fillField2BeforeGroup
3637
$I->comment("Exiting Action Group [beforeGroup] FunctionalActionGroup");
38+
$I->comment('[END BEFORE HOOK]');
3739
}
3840

3941
/**
@@ -42,10 +44,12 @@ class ActionGroupWithTopLevelPersistedDataCest
4244
*/
4345
public function _after(AcceptanceTester $I)
4446
{
47+
$I->comment('[START AFTER HOOK]');
4548
$I->comment("Entering Action Group [afterGroup] FunctionalActionGroup");
4649
$I->fillField("#foo", "myData1"); // stepKey: fillField1AfterGroup
4750
$I->fillField("#bar", "myData2"); // stepKey: fillField2AfterGroup
4851
$I->comment("Exiting Action Group [afterGroup] FunctionalActionGroup");
52+
$I->comment('[END AFTER HOOK]');
4953
if ($this->isSuccess) {
5054
unlink(__FILE__);
5155
}

dev/tests/verification/Resources/ArgumentWithSameNameAsElement.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ class ArgumentWithSameNameAsElementCest
2929
*/
3030
public function _before(AcceptanceTester $I)
3131
{
32+
$I->comment('[START BEFORE HOOK]');
3233
$I->createEntity("createPersonParam", "hook", "ReplacementPerson", [], []); // stepKey: createPersonParam
3334
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
3435
$I->fillField("#foo", "myData1"); // stepKey: fillField1BeforeGroup
3536
$I->fillField("#bar", "myData2"); // stepKey: fillField2BeforeGroup
3637
$I->comment("Exiting Action Group [beforeGroup] FunctionalActionGroup");
38+
$I->comment('[END BEFORE HOOK]');
3739
}
3840

3941
/**
@@ -42,10 +44,12 @@ class ArgumentWithSameNameAsElementCest
4244
*/
4345
public function _after(AcceptanceTester $I)
4446
{
47+
$I->comment('[START AFTER HOOK]');
4548
$I->comment("Entering Action Group [afterGroup] FunctionalActionGroup");
4649
$I->fillField("#foo", "myData1"); // stepKey: fillField1AfterGroup
4750
$I->fillField("#bar", "myData2"); // stepKey: fillField2AfterGroup
4851
$I->comment("Exiting Action Group [afterGroup] FunctionalActionGroup");
52+
$I->comment('[END AFTER HOOK]');
4953
if ($this->isSuccess) {
5054
unlink(__FILE__);
5155
}

dev/tests/verification/Resources/AssertTest.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ class AssertTestCest
2828
*/
2929
public function _before(AcceptanceTester $I)
3030
{
31+
$I->comment('[START BEFORE HOOK]');
3132
$I->createEntity("createData1", "hook", "ReplacementPerson", [], []); // stepKey: createData1
33+
$I->comment('[END BEFORE HOOK]');
3234
}
3335

3436
/**

dev/tests/verification/Resources/BasicActionGroupTest.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ class BasicActionGroupTestCest
2929
*/
3030
public function _before(AcceptanceTester $I)
3131
{
32+
$I->comment('[START BEFORE HOOK]');
3233
$I->createEntity("createPersonParam", "hook", "ReplacementPerson", [], []); // stepKey: createPersonParam
3334
$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
3435
$I->fillField("#foo", "myData1"); // stepKey: fillField1BeforeGroup
3536
$I->fillField("#bar", "myData2"); // stepKey: fillField2BeforeGroup
3637
$I->comment("Exiting Action Group [beforeGroup] FunctionalActionGroup");
38+
$I->comment('[END BEFORE HOOK]');
3739
}
3840

3941
/**

dev/tests/verification/Resources/BasicFunctionalTest.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ class BasicFunctionalTestCest
3030
*/
3131
public function _before(AcceptanceTester $I)
3232
{
33+
$I->comment('[START BEFORE HOOK]');
3334
$I->amOnPage("/beforeUrl"); // stepKey: beforeAmOnPageKey
35+
$I->comment('[END BEFORE HOOK]');
3436
}
3537

3638
/**
@@ -39,7 +41,9 @@ class BasicFunctionalTestCest
3941
*/
4042
public function _after(AcceptanceTester $I)
4143
{
44+
$I->comment('[START AFTER HOOK]');
4245
$I->amOnPage("/afterUrl"); // stepKey: afterAmOnPageKey
46+
$I->comment('[END AFTER HOOK]');
4347
if ($this->isSuccess) {
4448
unlink(__FILE__);
4549
}

dev/tests/verification/Resources/BasicMergeTest.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ class BasicMergeTestCest
3131
*/
3232
public function _before(AcceptanceTester $I)
3333
{
34+
$I->comment('[START BEFORE HOOK]');
3435
$I->amOnPage("/beforeUrl"); // stepKey: before1
3536
$I->see("#before2"); // stepKey: before2
37+
$I->comment('[END BEFORE HOOK]');
3638
}
3739

3840
/**
@@ -41,7 +43,9 @@ class BasicMergeTestCest
4143
*/
4244
public function _after(AcceptanceTester $I)
4345
{
46+
$I->comment('[START AFTER HOOK]');
4447
$I->amOnPage("/afterUrl1"); // stepKey: after1
48+
$I->comment('[END AFTER HOOK]');
4549
if ($this->isSuccess) {
4650
unlink(__FILE__);
4751
}

dev/tests/verification/Resources/ChildExtendedTestAddHooks.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ class ChildExtendedTestAddHooksCest
3030
*/
3131
public function _before(AcceptanceTester $I)
3232
{
33+
$I->comment('[START BEFORE HOOK]');
3334
$I->amOnPage("/beforeUrl"); // stepKey: beforeAmOnPageKey
35+
$I->comment('[END BEFORE HOOK]');
3436
}
3537

3638
/**
@@ -39,7 +41,9 @@ class ChildExtendedTestAddHooksCest
3941
*/
4042
public function _after(AcceptanceTester $I)
4143
{
44+
$I->comment('[START AFTER HOOK]');
4245
$I->amOnPage("/afterUrl"); // stepKey: afterAmOnPageKey
46+
$I->comment('[END AFTER HOOK]');
4347
if ($this->isSuccess) {
4448
unlink(__FILE__);
4549
}

dev/tests/verification/Resources/ChildExtendedTestMerging.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ class ChildExtendedTestMergingCest
3030
*/
3131
public function _before(AcceptanceTester $I)
3232
{
33+
$I->comment('[START BEFORE HOOK]');
3334
$I->amOnPage("/firstUrl"); // stepKey: firstBeforeAmOnPageKey
3435
$I->amOnPage("/beforeUrl"); // stepKey: beforeAmOnPageKey
3536
$I->amOnPage("/lastUrl"); // stepKey: lastBefore
37+
$I->comment('[END BEFORE HOOK]');
3638
}
3739

3840
/**
@@ -41,7 +43,9 @@ class ChildExtendedTestMergingCest
4143
*/
4244
public function _after(AcceptanceTester $I)
4345
{
46+
$I->comment('[START AFTER HOOK]');
4447
$I->amOnPage("/afterUrl"); // stepKey: afterAmOnPageKey
48+
$I->comment('[END AFTER HOOK]');
4549
if ($this->isSuccess) {
4650
unlink(__FILE__);
4751
}

0 commit comments

Comments
 (0)