|
26 | 26 | use Magento\FunctionalTestingFramework\DataTransport\Protocol\CurlTransport;
|
27 | 27 | use Yandex\Allure\Adapter\Support\AttachmentSupport;
|
28 | 28 | use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
|
| 29 | +use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler; |
29 | 30 |
|
30 | 31 | /**
|
31 | 32 | * MagentoWebDriver module provides common Magento web actions through Selenium WebDriver.
|
@@ -952,6 +953,120 @@ public function getOTP()
|
952 | 953 | return OTP::getOTP();
|
953 | 954 | }
|
954 | 955 |
|
| 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 | + |
955 | 1070 | /**
|
956 | 1071 | * Waits proper amount of time to perform Cron execution
|
957 | 1072 | *
|
|
0 commit comments