Skip to content

Revert "MQE-2158: move proxies function from MagentoWebDriver back in… #731

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 1 commit into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -10,7 +10,6 @@
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler;
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\CredentialStore;
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
use Magento\FunctionalTestingFramework\Exceptions\TestReferenceException;

/**
* Class MagentoActionProxies
Expand All @@ -21,112 +20,5 @@
*/
class MagentoActionProxies extends CodeceptionModule
{
/**
* Create an entity
*
* @param string $key StepKey of the createData action.
* @param string $scope
* @param string $entity Name of xml entity to create.
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
* @param array $overrideFields Array of FieldName => Value of override fields.
* @param string $storeCode
* @return void
* @throws TestReferenceException
*/
public function createEntity(
$key,
$scope,
$entity,
$dependentObjectKeys = [],
$overrideFields = [],
$storeCode = ''
) {
PersistedObjectHandler::getInstance()->createEntity(
$key,
$scope,
$entity,
$dependentObjectKeys,
$overrideFields,
$storeCode
);
}

/**
* Retrieves and updates a previously created entity
*
* @param string $key StepKey of the createData action.
* @param string $scope
* @param string $updateEntity Name of the static XML data to update the entity with.
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
* @return void
*/
public function updateEntity($key, $scope, $updateEntity, $dependentObjectKeys = [])
{
PersistedObjectHandler::getInstance()->updateEntity(
$key,
$scope,
$updateEntity,
$dependentObjectKeys
);
}

/**
* Performs GET on given entity and stores entity for use
*
* @param string $key StepKey of getData action.
* @param string $scope
* @param string $entity Name of XML static data to use.
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
* @param string $storeCode
* @param integer $index
* @return void
*/
public function getEntity($key, $scope, $entity, $dependentObjectKeys = [], $storeCode = '', $index = null)
{
PersistedObjectHandler::getInstance()->getEntity(
$key,
$scope,
$entity,
$dependentObjectKeys,
$storeCode,
$index
);
}

/**
* Retrieves and deletes a previously created entity
*
* @param string $key StepKey of the createData action.
* @param string $scope
* @return void
*/
public function deleteEntity($key, $scope)
{
PersistedObjectHandler::getInstance()->deleteEntity($key, $scope);
}

/**
* Retrieves a field from an entity, according to key and scope given
*
* @param string $stepKey
* @param string $field
* @param string $scope
* @return string
*/
public function retrieveEntityField($stepKey, $field, $scope)
{
return PersistedObjectHandler::getInstance()->retrieveEntityField($stepKey, $field, $scope);
}

/**
* Get encrypted value by key
*
* @param string $key
* @return string|null
* @throws TestFrameworkException
*/
public function getSecret($key)
{
return CredentialStore::getInstance()->getSecret($key);
}
// TODO: placeholder for proxy functions currently in MagentoWebDriver (MQE-1904)
}
115 changes: 115 additions & 0 deletions src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Magento\FunctionalTestingFramework\DataTransport\Protocol\CurlTransport;
use Yandex\Allure\Adapter\Support\AttachmentSupport;
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler;

/**
* MagentoWebDriver module provides common Magento web actions through Selenium WebDriver.
Expand Down Expand Up @@ -952,6 +953,120 @@ public function getOTP()
return OTP::getOTP();
}

/**
* Create an entity
* TODO: move this function to MagentoActionProxies after MQE-1904
*
* @param string $key StepKey of the createData action.
* @param string $scope
* @param string $entity Name of xml entity to create.
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
* @param array $overrideFields Array of FieldName => Value of override fields.
* @param string $storeCode
* @return void
*/
public function createEntity(
$key,
$scope,
$entity,
$dependentObjectKeys = [],
$overrideFields = [],
$storeCode = ''
) {
PersistedObjectHandler::getInstance()->createEntity(
$key,
$scope,
$entity,
$dependentObjectKeys,
$overrideFields,
$storeCode
);
}

/**
* Retrieves and updates a previously created entity
* TODO: move this function to MagentoActionProxies after MQE-1904
*
* @param string $key StepKey of the createData action.
* @param string $scope
* @param string $updateEntity Name of the static XML data to update the entity with.
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
* @return void
*/
public function updateEntity($key, $scope, $updateEntity, $dependentObjectKeys = [])
{
PersistedObjectHandler::getInstance()->updateEntity(
$key,
$scope,
$updateEntity,
$dependentObjectKeys
);
}

/**
* Performs GET on given entity and stores entity for use
* TODO: move this function to MagentoActionProxies after MQE-1904
*
* @param string $key StepKey of getData action.
* @param string $scope
* @param string $entity Name of XML static data to use.
* @param array $dependentObjectKeys StepKeys of other createData actions that are required.
* @param string $storeCode
* @param integer $index
* @return void
*/
public function getEntity($key, $scope, $entity, $dependentObjectKeys = [], $storeCode = '', $index = null)
{
PersistedObjectHandler::getInstance()->getEntity(
$key,
$scope,
$entity,
$dependentObjectKeys,
$storeCode,
$index
);
}

/**
* Retrieves and deletes a previously created entity
* TODO: move this function to MagentoActionProxies after MQE-1904
*
* @param string $key StepKey of the createData action.
* @param string $scope
* @return void
*/
public function deleteEntity($key, $scope)
{
PersistedObjectHandler::getInstance()->deleteEntity($key, $scope);
}

/**
* Retrieves a field from an entity, according to key and scope given
* TODO: move this function to MagentoActionProxies after MQE-1904
*
* @param string $stepKey
* @param string $field
* @param string $scope
* @return string
*/
public function retrieveEntityField($stepKey, $field, $scope)
{
return PersistedObjectHandler::getInstance()->retrieveEntityField($stepKey, $field, $scope);
}

/**
* Get encrypted value by key
* TODO: move this function to MagentoActionProxies after MQE-1904
*
* @param string $key
* @return string|null
* @throws TestFrameworkException
*/
public function getSecret($key)
{
return CredentialStore::getInstance()->getSecret($key);
}

/**
* Waits proper amount of time to perform Cron execution
*
Expand Down