Skip to content

MQE-1427 - Support _CREDS in <magentoCLI> action and in Data #368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
66fb4c2
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 11, 2019
55e6421
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 11, 2019
5fc6347
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 13, 2019
052e15d
Merge branch 'develop' into MQE-1427
ivy00johns Jun 13, 2019
d9060d7
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 14, 2019
98480cf
Merge remote-tracking branch 'origin/MQE-1427' into MQE-1427
ivy00johns Jun 14, 2019
6dcd2f4
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 14, 2019
7b8de7e
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 14, 2019
acf87b6
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 14, 2019
ecb5a8a
Merge branch 'develop' into MQE-1427
ivy00johns Jun 14, 2019
b0e821f
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 14, 2019
bffe7d6
Merge remote-tracking branch 'origin/MQE-1427' into MQE-1427
ivy00johns Jun 14, 2019
847e5ff
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 14, 2019
eeb174a
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 17, 2019
352b660
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 17, 2019
0eaaa01
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 17, 2019
f83c893
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 17, 2019
2d5e178
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 18, 2019
7c837c3
Merge branch 'develop' into MQE-1427
ivy00johns Jun 18, 2019
7a1a4e5
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 18, 2019
e4ddde9
Merge remote-tracking branch 'origin/MQE-1427' into MQE-1427
ivy00johns Jun 18, 2019
ad99e96
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 18, 2019
0cd5a47
Merge branch 'develop' into MQE-1427
ivy00johns Jun 18, 2019
d1b3be3
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 18, 2019
6cf6400
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 18, 2019
1e22a8c
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 19, 2019
fd66a0c
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 19, 2019
537b404
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 19, 2019
82a80c6
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 20, 2019
c38ab37
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 20, 2019
a07275f
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 20, 2019
9510135
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 20, 2019
29b37f4
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 20, 2019
9f96927
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 20, 2019
3d2d857
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 20, 2019
8cd1a39
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 21, 2019
9ef7ea7
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 21, 2019
637c3eb
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 21, 2019
32fac0c
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 21, 2019
cd0d237
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 21, 2019
d103842
MQE-1427: Support _CREDS in <magentoCLI> action and in Data
ivy00johns Jun 24, 2019
c5286e6
Merge branch 'develop' into MQE-1427
KevinBKozan Jun 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use AspectMock\Test as AspectMock;
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;
use Magento\FunctionalTestingFramework\DataGenerator\Objects\EntityDataObject;
use Magento\FunctionalTestingFramework\Exceptions\TestReferenceException;
use Magento\FunctionalTestingFramework\Exceptions\XmlException;
use Magento\FunctionalTestingFramework\Test\Objects\ActionObject;
use Magento\FunctionalTestingFramework\Test\Util\ActionMergeUtil;
use Magento\FunctionalTestingFramework\Test\Util\ActionObjectExtractor;
Expand Down Expand Up @@ -100,7 +102,7 @@ public function testResolveActionStepEntityData()
$dataFieldName = 'myfield';
$dataFieldValue = 'myValue';
$userInputKey = "userInput";
$userinputValue = "{{" . "${dataObjectName}.${dataFieldName}}}";
$userInputValue = "{{" . "${dataObjectName}.${dataFieldName}}}";
$actionName = "myAction";
$actionType = "myCustomType";

Expand All @@ -113,10 +115,10 @@ public function testResolveActionStepEntityData()
AspectMock::double(DataObjectHandler::class, ['getInstance' => $mockDOHInstance]);

// Create test object and action object
$actionAttributes = [$userInputKey => $userinputValue];
$actionAttributes = [$userInputKey => $userInputValue];
$actions[$actionName] = new ActionObject($actionName, $actionType, $actionAttributes);

$this->assertEquals($userinputValue, $actions[$actionName]->getCustomActionAttributes()[$userInputKey]);
$this->assertEquals($userInputValue, $actions[$actionName]->getCustomActionAttributes()[$userInputKey]);

$mergeUtil = new ActionMergeUtil("test", "TestCase");
$resolvedActions = $mergeUtil->resolveActionSteps($actions);
Expand All @@ -127,8 +129,14 @@ public function testResolveActionStepEntityData()
/**
* Verify that an XmlException is thrown when an action references a non-existant action.
*
* @throws TestReferenceException
* @throws XmlException
* @return void
*/
/**
* @throws TestReferenceException
* @throws XmlException
*/
public function testNoActionException()
{
$actionObjects = [];
Expand All @@ -151,6 +159,8 @@ public function testNoActionException()
/**
* Verify that a <waitForPageLoad> action is added after actions that have a wait (timeout property).
*
* @throws TestReferenceException
* @throws XmlException
* @return void
*/
public function testInsertWait()
Expand All @@ -173,6 +183,111 @@ public function testInsertWait()
$this->assertEquals($expected, $actual);
}

/**
* Verify that a <fillField> action is replaced by <fillSecretField> when secret _CREDS are referenced.
*
* @throws TestReferenceException
* @throws XmlException
*/
public function testValidFillFieldSecretFunction()
{
$actionObjectOne = new ActionObject(
'actionKey1',
'fillField',
['userInput' => '{{_CREDS.username}}']
);
$actionObject = [$actionObjectOne];

$actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase');

$result = $actionMergeUtil->resolveActionSteps($actionObject);

$expectedValue = new ActionObject(
'actionKey1',
'fillSecretField',
['userInput' => '{{_CREDS.username}}']
);
$this->assertEquals($expectedValue, $result['actionKey1']);
}

/**
* Verify that a <magentoCLI> action uses <magentoCLI> when secret _CREDS are referenced.
*
* @throws TestReferenceException
* @throws XmlException
*/
public function testValidMagentoCLISecretFunction()
{
$actionObjectOne = new ActionObject(
'actionKey1',
'magentoCLI',
['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}']
);
$actionObject = [$actionObjectOne];

$actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase');

$result = $actionMergeUtil->resolveActionSteps($actionObject);

$expectedValue = new ActionObject(
'actionKey1',
'magentoCLISecret',
['command' => 'config:set cms/wysiwyg/enabled {{_CREDS.payment_authorizenet_login}}']
);
$this->assertEquals($expectedValue, $result['actionKey1']);
}

/**
* Verify that a <field> override in a <createData> action uses <field> when secret _CREDS are referenced.
*
* @throws TestReferenceException
* @throws XmlException
*/
public function testValidCreateDataSecretFunction()
{
$actionObjectOne = new ActionObject(
'actionKey1',
'field',
['value' => '{{_CREDS.payment_authorizenet_login}}']
);
$actionObject = [$actionObjectOne];

$actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase');

$result = $actionMergeUtil->resolveActionSteps($actionObject);

$expectedValue = new ActionObject(
'actionKey1',
'field',
['value' => '{{_CREDS.payment_authorizenet_login}}']
);
$this->assertEquals($expectedValue, $result['actionKey1']);
}

/**
* Verify that a <click> action throws an exception when secret _CREDS are referenced.
*
* @throws TestReferenceException
* @throws XmlException
*/
public function testInvalidSecretFunctions()
{
$this->expectException(TestReferenceException::class);
$this->expectExceptionMessage(
'You cannot reference secret data outside of the fillField, magentoCLI and createData actions'
);

$actionObjectOne = new ActionObject(
'actionKey1',
'click',
['userInput' => '{{_CREDS.username}}']
);
$actionObject = [$actionObjectOne];

$actionMergeUtil = new ActionMergeUtil('actionMergeUtilTest', 'TestCase');
$actionMergeUtil->resolveActionSteps($actionObject);
}

/**
* After class functionality
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ActionGroupUsingCreateDataCest
"hook",
"ApiCategory",
[],
null
[]
);

$I->comment("[createConfigProductKey1] create 'ApiConfigurableProduct' entity");
Expand All @@ -40,7 +40,7 @@ class ActionGroupUsingCreateDataCest
"hook",
"ApiConfigurableProduct",
["createCategoryKey1"],
null
[]
);

$I->comment("Exiting Action Group [Key1] actionGroupWithCreateData");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ActionGroupWithDataOverrideTestCest
"hook",
"ReplacementPerson",
[],
null
[]
);

$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ActionGroupWithDataTestCest
"hook",
"ReplacementPerson",
[],
null
[]
);

$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ActionGroupWithNoDefaultTestCest
"hook",
"ReplacementPerson",
[],
null
[]
);

$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ActionGroupWithPersistedDataCest
"hook",
"ReplacementPerson",
[],
null
[]
);

$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
Expand Down Expand Up @@ -78,7 +78,7 @@ class ActionGroupWithPersistedDataCest
"test",
"DefaultPerson",
[],
null
[]
);

$I->comment("Entering Action Group [actionGroupWithPersistedData1] FunctionalActionGroupWithData");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ActionGroupWithStepKeyReferencesCest
"test",
"simpleData",
[],
null
[]
);

$grabTextDataActionGroup = $I->grabTextFrom(".class"); // stepKey: grabTextDataActionGroup
Expand All @@ -46,7 +46,6 @@ class ActionGroupWithStepKeyReferencesCest
$action3ActionGroup = $I->executeJS($action3ActionGroup); // stepKey: action3ActionGroup
$action4ActionGroup = $I->magentoCLI($action4ActionGroup, "\"stuffHere\""); // stepKey: action4ActionGroup
$I->comment($action4ActionGroup);

$date = new \DateTime();
$date->setTimestamp(strtotime("{$action5}"));
$date->setTimezone(new \DateTimeZone("America/Los_Angeles"));
Expand Down Expand Up @@ -82,7 +81,7 @@ class ActionGroupWithStepKeyReferencesCest
"test",
"{$action10}",
[],
null
[]
);

$action11ActionGroup = $I->grabAttributeFrom($action11ActionGroup, "someInput"); // stepKey: action11ActionGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ActionGroupWithTopLevelPersistedDataCest
"hook",
"ReplacementPerson",
[],
null
[]
);

$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ArgumentWithSameNameAsElementCest
"hook",
"ReplacementPerson",
[],
null
[]
);

$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
Expand Down
4 changes: 2 additions & 2 deletions dev/tests/verification/Resources/AssertTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AssertTestCest
"hook",
"ReplacementPerson",
[],
null
[]
);

}
Expand All @@ -50,7 +50,7 @@ class AssertTestCest
"test",
"UniquePerson",
[],
null
[]
);

$grabTextFrom1 = $I->grabTextFrom(".copyright>span"); // stepKey: grabTextFrom1
Expand Down
2 changes: 1 addition & 1 deletion dev/tests/verification/Resources/BasicActionGroupTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BasicActionGroupTestCest
"hook",
"ReplacementPerson",
[],
null
[]
);

$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
Expand Down
1 change: 0 additions & 1 deletion dev/tests/verification/Resources/BasicFunctionalTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ class BasicFunctionalTestCest
$grabValueFromKey1 = $I->grabValueFrom(".functionalTestSelector"); // stepKey: grabValueFromKey1
$magentoCli1 = $I->magentoCLI("maintenance:enable", "\"stuffHere\""); // stepKey: magentoCli1
$I->comment($magentoCli1);

$I->makeScreenshot("screenShotInput"); // stepKey: makeScreenshotKey1
$I->maximizeWindow(); // stepKey: maximizeWindowKey1
$I->moveBack(); // stepKey: moveBackKey1
Expand Down
4 changes: 2 additions & 2 deletions dev/tests/verification/Resources/DataActionsTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DataActionsTestCest
"hook",
"entity",
[],
null
[]
);

$I->comment("[updateInBefore] update 'createdInBefore' entity to 'entity'");
Expand Down Expand Up @@ -64,7 +64,7 @@ class DataActionsTestCest
"test",
"entity",
[],
null
[]
);

$I->comment("[updateInTest] update 'createdInTest' entity to 'entity'");
Expand Down
1 change: 0 additions & 1 deletion dev/tests/verification/Resources/DataReplacementTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,5 @@ class DataReplacementTestCest
$I->fillField(".selector", "0"); // stepKey: insertZero
$insertCommand = $I->magentoCLI("do something Doe" . msq("uniqueData") . " with uniqueness"); // stepKey: insertCommand
$I->comment($insertCommand);

}
}
2 changes: 1 addition & 1 deletion dev/tests/verification/Resources/ExtendParentDataTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ExtendParentDataTestCest
"test",
"extendParentData",
[],
null
[]
);

$I->searchAndMultiSelectOption("#selector", ["otherName"]); // stepKey: getName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ExtendParentDataTestCest
"test",
"extendParentData",
[],
null
[]
);
$I->searchAndMultiSelectOption("#selector", ["otherName"]);
$I->searchAndMultiSelectOption("#selector", ["extendName"]);
Expand Down
6 changes: 3 additions & 3 deletions dev/tests/verification/Resources/HookActionsTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class HookActionsTestCest
"hook",
"sampleCreatedEntity",
[],
null
[]
);

$I->comment("[sampleDeleteBefore] delete entity 'sampleCreateBefore'");
Expand All @@ -45,7 +45,7 @@ class HookActionsTestCest
"hook",
"sampleCreatedEntity",
[],
null
[]
);

}
Expand All @@ -62,7 +62,7 @@ class HookActionsTestCest
"hook",
"sampleCreatedEntity",
[],
null
[]
);

$I->comment("[sampleDeleteAfter] delete entity 'sampleCreateForAfter'");
Expand Down
2 changes: 1 addition & 1 deletion dev/tests/verification/Resources/LocatorFunctionTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class LocatorFunctionTestCest
"test",
"ReplacementPerson",
[],
null
[]
);

$I->click(Locator::contains("'label'", "'Name'")); // stepKey: SimpleLocator
Expand Down
2 changes: 1 addition & 1 deletion dev/tests/verification/Resources/MergedActionGroupTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class MergedActionGroupTestCest
"hook",
"ReplacementPerson",
[],
null
[]
);

$I->comment("Entering Action Group [beforeGroup] FunctionalActionGroup");
Expand Down
Loading