diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php index 269c3a60a..c515e80ba 100644 --- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php +++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php @@ -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. @@ -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) @@ -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/) - 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( @@ -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)