Skip to content

Commit a4249b5

Browse files
committed
MQE-812: Tests/Action Groups should infer order based on the top level argument
- Fix to old verification tests, found and fixed a bug with old merging. - final test fixes.
1 parent b350296 commit a4249b5

File tree

4 files changed

+83
-3
lines changed

4 files changed

+83
-3
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
namespace Magento\AcceptanceTest\_default\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+
*/
20+
class ActionGroupMergedViaInsertAfterCest
21+
{
22+
/**
23+
* @Parameter(name = "AcceptanceTester", value="$I")
24+
* @param AcceptanceTester $I
25+
* @return void
26+
* @throws \Exception
27+
*/
28+
public function ActionGroupMergedViaInsertAfter(AcceptanceTester $I)
29+
{
30+
$I->fillField("#foo", "foo");
31+
$I->fillField("#bar", "bar");
32+
$I->click("#mergeOne");
33+
$I->click("#mergeTwo");
34+
$I->click("#mergeThree");
35+
$I->fillField("#baz", "baz");
36+
}
37+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
namespace Magento\AcceptanceTest\_default\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+
*/
20+
class ActionGroupMergedViaInsertBeforeCest
21+
{
22+
/**
23+
* @Parameter(name = "AcceptanceTester", value="$I")
24+
* @param AcceptanceTester $I
25+
* @return void
26+
* @throws \Exception
27+
*/
28+
public function ActionGroupMergedViaInsertBefore(AcceptanceTester $I)
29+
{
30+
$I->fillField("#foo", "foo");
31+
$I->click("#mergeOne");
32+
$I->click("#mergeTwo");
33+
$I->click("#mergeThree");
34+
$I->fillField("#bar", "bar");
35+
$I->fillField("#baz", "baz");
36+
}
37+
}

dev/tests/verification/Resources/MergedActionGroupTest.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ class MergedActionGroupTestCest
7070
*/
7171
public function MergedActionGroupTest(AcceptanceTester $I)
7272
{
73-
$I->see("#element .Jane");
7473
$I->see(".merge .Jane");
75-
$I->click(".merge .Dane");
74+
$I->see("#element .Jane");
7675
$I->amOnPage("/Jane/Dane.html");
76+
$I->click(".merge .Dane");
7777
}
7878
}

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,20 @@ private function getResolvedActionsWithArgs($arguments, $actionReferenceKey)
136136
);
137137
}
138138

139+
// translate 0/1 back to before/after
140+
$orderOffset = ActionObject::MERGE_ACTION_ORDER_BEFORE;
141+
if ($action->getOrderOffset() === 1) {
142+
$orderOffset = ActionObject::MERGE_ACTION_ORDER_AFTER;
143+
}
144+
139145
// we append the action reference key to any linked action and the action's merge key as the user might
140146
// use this action group multiple times in the same test.
141147
$resolvedActions[$action->getStepKey() . ucfirst($actionReferenceKey)] = new ActionObject(
142148
$action->getStepKey() . ucfirst($actionReferenceKey),
143149
$action->getType(),
144150
array_replace_recursive($action->getCustomActionAttributes(), $newActionAttributes),
145151
$action->getLinkedAction() == null ? null : $action->getLinkedAction() . ucfirst($actionReferenceKey),
146-
$action->getOrderOffset(),
152+
$orderOffset,
147153
[self::ACTION_GROUP_ORIGIN_NAME => $this->name,
148154
self::ACTION_GROUP_ORIGIN_TEST_REF => $actionReferenceKey]
149155
);

0 commit comments

Comments
 (0)