Skip to content

MQE-1168: magentoCLI action not working properly if URL to magento co… #213

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
Aug 31, 2018
Merged
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
14 changes: 10 additions & 4 deletions src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Magento\FunctionalTestingFramework\Util\Protocol\CurlInterface;
use Magento\FunctionalTestingFramework\Util\ConfigSanitizerUtil;
use Yandex\Allure\Adapter\Support\AttachmentSupport;
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;

/**
* MagentoWebDriver module provides common Magento web actions through Selenium WebDriver.
Expand Down Expand Up @@ -319,6 +320,7 @@ public function searchAndMultiSelectOption($select, array $options, $requireActi
* @param string $selectSearchTextField
* @param string $selectSearchResult
* @param string[] $options
* @throws \Exception
* @return void
*/
public function selectMultipleOptions($selectSearchTextField, $selectSearchResult, array $options)
Expand Down Expand Up @@ -474,14 +476,17 @@ public function scrollToTopOfPage()
* Takes given $command and executes it against exposed MTF CLI entry point. Returns response from server.
* @param string $command
* @param string $arguments
* @throws TestFrameworkException
* @return string
*/
public function magentoCLI($command, $arguments = null)
{
// trim everything after first '/' in URL after (ex http://magento.instance/<index.php>)
preg_match("/.+\/\/[^\/]+\/?/", $this->config['url'], $trimmed);
$trimmedUrl = $trimmed[0];
$apiURL = $trimmedUrl . ltrim(getenv('MAGENTO_CLI_COMMAND_PATH'), '/');
// Remove index.php if it's present in url
$baseUrl = rtrim(
str_replace('index.php', '', rtrim($this->config['url'], '/')),
'/'
);
$apiURL = $baseUrl . '/' . ltrim(getenv('MAGENTO_CLI_COMMAND_PATH'), '/');

$executor = new CurlTransport();
$executor->write(
Expand All @@ -501,6 +506,7 @@ public function magentoCLI($command, $arguments = null)
/**
* Runs DELETE request to delete a Magento entity against the url given.
* @param string $url
* @throws TestFrameworkException
* @return string
*/
public function deleteEntityByUrl($url)
Expand Down