Skip to content

Commit 5b461c5

Browse files
committed
MQE-2158: move proxies function from MagentoWebDriver back into MagentoActionProxies
1 parent cdc5188 commit 5b461c5

File tree

2 files changed

+109
-116
lines changed

2 files changed

+109
-116
lines changed

src/Magento/FunctionalTestingFramework/Module/MagentoActionProxies.php

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler;
1111
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\CredentialStore;
1212
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
13+
use Magento\FunctionalTestingFramework\Exceptions\TestReferenceException;
1314

1415
/**
1516
* Class MagentoActionProxies
@@ -20,5 +21,112 @@
2021
*/
2122
class MagentoActionProxies extends CodeceptionModule
2223
{
23-
// TODO: placeholder for proxy functions currently in MagentoWebDriver (MQE-1904)
24+
/**
25+
* Create an entity
26+
*
27+
* @param string $key StepKey of the createData action.
28+
* @param string $scope
29+
* @param string $entity Name of xml entity to create.
30+
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
31+
* @param array $overrideFields Array of FieldName => Value of override fields.
32+
* @param string $storeCode
33+
* @return void
34+
* @throws TestReferenceException
35+
*/
36+
public function createEntity(
37+
$key,
38+
$scope,
39+
$entity,
40+
$dependentObjectKeys = [],
41+
$overrideFields = [],
42+
$storeCode = ''
43+
) {
44+
PersistedObjectHandler::getInstance()->createEntity(
45+
$key,
46+
$scope,
47+
$entity,
48+
$dependentObjectKeys,
49+
$overrideFields,
50+
$storeCode
51+
);
52+
}
53+
54+
/**
55+
* Retrieves and updates a previously created entity
56+
*
57+
* @param string $key StepKey of the createData action.
58+
* @param string $scope
59+
* @param string $updateEntity Name of the static XML data to update the entity with.
60+
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
61+
* @return void
62+
*/
63+
public function updateEntity($key, $scope, $updateEntity, $dependentObjectKeys = [])
64+
{
65+
PersistedObjectHandler::getInstance()->updateEntity(
66+
$key,
67+
$scope,
68+
$updateEntity,
69+
$dependentObjectKeys
70+
);
71+
}
72+
73+
/**
74+
* Performs GET on given entity and stores entity for use
75+
*
76+
* @param string $key StepKey of getData action.
77+
* @param string $scope
78+
* @param string $entity Name of XML static data to use.
79+
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
80+
* @param string $storeCode
81+
* @param integer $index
82+
* @return void
83+
*/
84+
public function getEntity($key, $scope, $entity, $dependentObjectKeys = [], $storeCode = '', $index = null)
85+
{
86+
PersistedObjectHandler::getInstance()->getEntity(
87+
$key,
88+
$scope,
89+
$entity,
90+
$dependentObjectKeys,
91+
$storeCode,
92+
$index
93+
);
94+
}
95+
96+
/**
97+
* Retrieves and deletes a previously created entity
98+
*
99+
* @param string $key StepKey of the createData action.
100+
* @param string $scope
101+
* @return void
102+
*/
103+
public function deleteEntity($key, $scope)
104+
{
105+
PersistedObjectHandler::getInstance()->deleteEntity($key, $scope);
106+
}
107+
108+
/**
109+
* Retrieves a field from an entity, according to key and scope given
110+
*
111+
* @param string $stepKey
112+
* @param string $field
113+
* @param string $scope
114+
* @return string
115+
*/
116+
public function retrieveEntityField($stepKey, $field, $scope)
117+
{
118+
return PersistedObjectHandler::getInstance()->retrieveEntityField($stepKey, $field, $scope);
119+
}
120+
121+
/**
122+
* Get encrypted value by key
123+
*
124+
* @param string $key
125+
* @return string|null
126+
* @throws TestFrameworkException
127+
*/
128+
public function getSecret($key)
129+
{
130+
return CredentialStore::getInstance()->getSecret($key);
131+
}
24132
}

src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
use Magento\FunctionalTestingFramework\DataTransport\Protocol\CurlTransport;
2727
use Yandex\Allure\Adapter\Support\AttachmentSupport;
2828
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
29-
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler;
3029

3130
/**
3231
* MagentoWebDriver module provides common Magento web actions through Selenium WebDriver.
@@ -953,120 +952,6 @@ public function getOTP()
953952
return OTP::getOTP();
954953
}
955954

956-
/**
957-
* Create an entity
958-
* TODO: move this function to MagentoActionProxies after MQE-1904
959-
*
960-
* @param string $key StepKey of the createData action.
961-
* @param string $scope
962-
* @param string $entity Name of xml entity to create.
963-
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
964-
* @param array $overrideFields Array of FieldName => Value of override fields.
965-
* @param string $storeCode
966-
* @return void
967-
*/
968-
public function createEntity(
969-
$key,
970-
$scope,
971-
$entity,
972-
$dependentObjectKeys = [],
973-
$overrideFields = [],
974-
$storeCode = ''
975-
) {
976-
PersistedObjectHandler::getInstance()->createEntity(
977-
$key,
978-
$scope,
979-
$entity,
980-
$dependentObjectKeys,
981-
$overrideFields,
982-
$storeCode
983-
);
984-
}
985-
986-
/**
987-
* Retrieves and updates a previously created entity
988-
* TODO: move this function to MagentoActionProxies after MQE-1904
989-
*
990-
* @param string $key StepKey of the createData action.
991-
* @param string $scope
992-
* @param string $updateEntity Name of the static XML data to update the entity with.
993-
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
994-
* @return void
995-
*/
996-
public function updateEntity($key, $scope, $updateEntity, $dependentObjectKeys = [])
997-
{
998-
PersistedObjectHandler::getInstance()->updateEntity(
999-
$key,
1000-
$scope,
1001-
$updateEntity,
1002-
$dependentObjectKeys
1003-
);
1004-
}
1005-
1006-
/**
1007-
* Performs GET on given entity and stores entity for use
1008-
* TODO: move this function to MagentoActionProxies after MQE-1904
1009-
*
1010-
* @param string $key StepKey of getData action.
1011-
* @param string $scope
1012-
* @param string $entity Name of XML static data to use.
1013-
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
1014-
* @param string $storeCode
1015-
* @param integer $index
1016-
* @return void
1017-
*/
1018-
public function getEntity($key, $scope, $entity, $dependentObjectKeys = [], $storeCode = '', $index = null)
1019-
{
1020-
PersistedObjectHandler::getInstance()->getEntity(
1021-
$key,
1022-
$scope,
1023-
$entity,
1024-
$dependentObjectKeys,
1025-
$storeCode,
1026-
$index
1027-
);
1028-
}
1029-
1030-
/**
1031-
* Retrieves and deletes a previously created entity
1032-
* TODO: move this function to MagentoActionProxies after MQE-1904
1033-
*
1034-
* @param string $key StepKey of the createData action.
1035-
* @param string $scope
1036-
* @return void
1037-
*/
1038-
public function deleteEntity($key, $scope)
1039-
{
1040-
PersistedObjectHandler::getInstance()->deleteEntity($key, $scope);
1041-
}
1042-
1043-
/**
1044-
* Retrieves a field from an entity, according to key and scope given
1045-
* TODO: move this function to MagentoActionProxies after MQE-1904
1046-
*
1047-
* @param string $stepKey
1048-
* @param string $field
1049-
* @param string $scope
1050-
* @return string
1051-
*/
1052-
public function retrieveEntityField($stepKey, $field, $scope)
1053-
{
1054-
return PersistedObjectHandler::getInstance()->retrieveEntityField($stepKey, $field, $scope);
1055-
}
1056-
1057-
/**
1058-
* Get encrypted value by key
1059-
* TODO: move this function to MagentoActionProxies after MQE-1904
1060-
*
1061-
* @param string $key
1062-
* @return string|null
1063-
* @throws TestFrameworkException
1064-
*/
1065-
public function getSecret($key)
1066-
{
1067-
return CredentialStore::getInstance()->getSecret($key);
1068-
}
1069-
1070955
/**
1071956
* Waits proper amount of time to perform Cron execution
1072957
*

0 commit comments

Comments
 (0)