Skip to content

Commit

Permalink
Merge pull request #78 from magento-firedrakes/MAGETWO-31478
Browse files Browse the repository at this point in the history
[Firedrakes] Library Component for the Unified File Format in MTF
  • Loading branch information
Michael Logvin committed Feb 10, 2015
2 parents fd9337c + c43555d commit 0b22d74
Show file tree
Hide file tree
Showing 295 changed files with 6,944 additions and 902 deletions.
2 changes: 1 addition & 1 deletion dev/tests/functional/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"magento/mtf": "1.0.0-rc15",
"magento/mtf": "1.0.0-rc16",
"php": "~5.5.0|~5.6.0",
"phpunit/phpunit": "4.1.0",
"phpunit/phpunit-selenium": ">=1.2",
Expand Down
7 changes: 0 additions & 7 deletions dev/tests/functional/config/application.yml.dist

This file was deleted.

5 changes: 0 additions & 5 deletions dev/tests/functional/config/handler.yml.dist

This file was deleted.

10 changes: 0 additions & 10 deletions dev/tests/functional/config/install_data.yml.dist

This file was deleted.

6 changes: 0 additions & 6 deletions dev/tests/functional/config/isolation.yml.dist

This file was deleted.

11 changes: 0 additions & 11 deletions dev/tests/functional/config/server.yml.dist

This file was deleted.

24 changes: 24 additions & 0 deletions dev/tests/functional/etc/global/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd">
<application>
<reopenBrowser>testCase</reopenBrowser>
<backendLogin>admin</backendLogin>
<backendPassword>123123q</backendPassword>
<appBackendUrl>http://magento.dev/backend/</appBackendUrl>
<backendLoginUrl>admin</backendLoginUrl>
</application>
<install>
<host>127.0.0.1</host>
<user>root</user>
<password>123123q</password>
<dbName>default</dbName>
<baseUrl>http://127.0.0.1/magento2/</baseUrl>
<backendName>backend</backendName>
</install>
</config>
136 changes: 136 additions & 0 deletions dev/tests/functional/etc/global/config.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="config">
<xs:complexType>
<xs:all>
<xs:element name="application" maxOccurs="1" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="reopenBrowser" type="reopenBrowserType"/>
<xs:element name="backendLogin" type="backendLoginType" />
<xs:element name="backendPassword" type="backendPasswordType" />
<xs:element name="backendLoginUrl" type="backendLoginUrlType" />
<xs:element name="appBackendUrl" type="appBackendUrlType" />
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="isolation" maxOccurs="1" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="resetUrlPath" type="notEmptyType"/>
<xs:element name="testSuite" type="isolationModeType" />
<xs:element name="testCase" type="isolationModeType" />
<xs:element name="test" type="isolationModeType" />
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="server" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:choice maxOccurs="unbounded" minOccurs="1">
<xs:element name="item" type="serverItemType"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="install" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element name="host" type="notEmptyType"/>
<xs:element name="user" type="notEmptyType" />
<xs:element name="password" type="notEmptyType" />
<xs:element name="dbName" type="notEmptyType" />
<xs:element name="baseUrl" type="notEmptyType" />
<xs:element name="backendName" type="notEmptyType" />
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
<xs:simpleType name="reopenBrowserType">
<xs:restriction base="xs:string">
<xs:pattern value="testCase|test"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="backendLoginType">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="backendLoginUrlType">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="appBackendUrlType">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="backendPasswordType">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="notEmptyType">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="isolationModeType">
<xs:restriction base="xs:string">
<xs:pattern value="none|before|after|both"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="serverTypeType">
<xs:restriction base="xs:string">
<xs:pattern value="default"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="portType">
<xs:restriction base="xs:int"/>
</xs:simpleType>
<xs:simpleType name="timeoutType">
<xs:restriction base="xs:int">
</xs:restriction>
</xs:simpleType>
<xs:complexType name="serverItemType">
<xs:choice>
<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded" />
</xs:choice>
<xs:attribute name="type" type="serverTypeType" use="optional"/>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="browser" type="notEmptyType"/>
<xs:attribute name="browserName" type="notEmptyType"/>
<xs:attribute name="host" type="notEmptyType"/>
<xs:attribute name="port" type="portType"/>
<xs:attribute name="seleniumServerRequestsTimeout" type="timeoutType" use="optional"/>
<xs:attribute name="sessionStrategy" type="notEmptyType" use="optional"/>
</xs:complexType>
<xs:simpleType name="enableDisableType">
<xs:restriction base="xs:string">
<xs:pattern value="false|true"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="specificModuleType">
<xs:sequence>
<xs:choice>
<xs:element name="module" type="notEmptyType" maxOccurs="unbounded"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="enabled" type="enableDisableType"/>
</xs:complexType>
</xs:schema>
5 changes: 5 additions & 0 deletions dev/tests/functional/etc/global/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<preference for="Magento\Mtf\Util\Generate\Fixture\FieldsProviderInterface" type="Magento\Mtf\Util\Generate\Fixture\FieldsProvider" />
<preference for="Magento\Mtf\Util\Generate\Repository\CollectionProviderInterface" type="Magento\Mtf\Util\Generate\Repository\CollectionProvider" />
<virtualType name="Magento\Mtf\Config\SchemaLocator\Config" type="Magento\Mtf\Config\SchemaLocator">
<arguments>
<argument name="schemaPath" xsi:type="string">etc/global/config.xsd</argument>
</arguments>
</virtualType>
</config>
67 changes: 67 additions & 0 deletions dev/tests/functional/etc/global/variations.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="config">
<xs:annotation>
<xs:documentation>
The root element for configuration data.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="testCase" maxOccurs="unbounded" minOccurs="1">
<xs:annotation>
<xs:documentation>
An element that contains configuration data of a test case.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element name="testCase">
<xs:complexType>
<xs:sequence>
<xs:element ref="variation" maxOccurs="unbounded" minOccurs="1">
<xs:annotation>
<xs:documentation>
An element that contains configuration data of a test case variation.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="name" use="required"/>
</xs:complexType>
</xs:element>

<xs:element name="variation">
<xs:complexType>
<xs:sequence>
<xs:element ref="data" maxOccurs="unbounded" minOccurs="1">
<xs:annotation>
<xs:documentation>
An element that contains a single configuration data set of a test case variation.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="name" use="required"/>
</xs:complexType>
</xs:element>

<xs:element name="data">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="name" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
20 changes: 0 additions & 20 deletions dev/tests/functional/lib/Magento/Mtf/ObjectManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,6 @@ public function create(array $sharedInstances = [])
return $objectManager;
}

/**
* Create instance of application deployment config
*
* @param \Magento\Framework\App\Filesystem\DirectoryList $directoryList
* @param array $arguments
* @return \Magento\Framework\App\DeploymentConfig
*/
protected function createDeploymentConfig(
\Magento\Framework\App\Filesystem\DirectoryList $directoryList,
array $arguments
) {
$data = isset($arguments[\Magento\Framework\App\Arguments\Loader::PARAM_CUSTOM_FILE])
? $arguments[\Magento\Framework\App\Arguments\Loader::PARAM_CUSTOM_FILE]
: null;
return new \Magento\Framework\App\DeploymentConfig(
new \Magento\Framework\App\DeploymentConfig\Reader($directoryList),
$data
);
}

/**
* Return newly created instance on an argument interpreter, suitable for processing DI arguments
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ protected function collectItems($type)
);
foreach ($dirIterator as $info) {
/** @var $info \SplFileInfo */
$this->_processItem($items, $rewrites, $info->getRealPath(), $location, $path);
$realPath = $info->getPathname();
if (is_link($realPath)) {
$realPath = readlink($realPath);
}
$this->_processItem($items, $rewrites, $realPath, $location, $path);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CollectionProvider implements CollectionProviderInterface
protected $objectManager;

/**
* Magetno resource instance.
* Magento resource instance.
*
* @var \Magento\Framework\App\Resource
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Magento\Mtf\Util\Protocol\CurlTransport;

use Magento\Mtf\System\Config;
use Magento\Mtf\Config;
use Magento\Mtf\Util\Protocol\CurlInterface;
use Magento\Mtf\Util\Protocol\CurlTransport;

Expand Down Expand Up @@ -65,16 +65,18 @@ public function __construct(CurlTransport $transport, Config $configuration)
*/
protected function authorize()
{
$credentials = $this->configuration->getConfigParam('application/backend_user_credentials');
$url = $_ENV['app_backend_url'] . $this->configuration->getConfigParam('application/backend_login_url');
$url = $_ENV['app_backend_url'] .
$this->configuration->getParameter('application/backendLoginUrl');
$data = [
'login[username]' => $credentials['login'],
'login[password]' => $credentials['password'],
'login[username]' => $this->configuration->getParameter('application/backendLogin'),
'login[password]' => $this->configuration->getParameter('application/backendPassword'),
];
$this->transport->write(CurlInterface::POST, $url, '1.0', [], $data);
$response = $this->read();
if (strpos($response, 'page-login')) {
throw new \Exception('Admin user cannot be logged in by curl handler!');
throw new \Exception(
'Admin user cannot be logged in by curl handler!'
);
}
}

Expand Down Expand Up @@ -107,7 +109,7 @@ public function write($method, $url, $httpVer = '1.1', $headers = [], $params =
if ($this->formKey) {
$params['form_key'] = $this->formKey;
} else {
throw new \Exception('Form key is absent! Response: ' . $this->response);
throw new \Exception(sprintf('Form key is absent! Url: "%s" Response: "%s"', $url, $this->response));
}
$this->transport->write($method, $url, $httpVer, $headers, http_build_query($params));
}
Expand Down
5 changes: 0 additions & 5 deletions dev/tests/functional/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
<php>
<env name="app_frontend_url" value="http://localhost/index.php/" />
<env name="app_backend_url" value="http://localhost/index.php/backend/" />
<env name="app_config_path" value="config/application.yml.dist" />
<env name="server_config_path" value="config/server.yml.dist" />
<env name="isolation_config_path" value="config/isolation.yml.dist" />
<env name="handlers_config_path" value="config/handler.yml.dist" />
<env name="install_config_path" value="config/install_data.yml.dist" />
<env name="testsuite_rule" value="basic" />
<env name="testsuite_rule_path" value="Magento/Mtf/TestSuite/InjectableTests" />
<env name="log_directory" value="var/log" />
Expand Down
Loading

0 comments on commit 0b22d74

Please sign in to comment.