diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Checkbox.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Checkbox.php index 9b4224271d5818a45ec3df606ea635a18e694c41..ec10318fd59913fcf938c896d4033c601668360b 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Checkbox.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/Checkbox.php @@ -77,17 +77,25 @@ class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra { $values = $this->_getValues(); $value = $row->getData($this->getColumn()->getIndex()); + $checked = ''; if (is_array($values)) { $checked = in_array($value, $values) ? ' checked="checked"' : ''; } else { - $checked = $value === $this->getColumn()->getValue() ? ' checked="checked"' : ''; + $checkedValue = $this->getColumn()->getValue(); + if ($checkedValue !== null) { + $checked = $value === $checkedValue ? ' checked="checked"' : ''; + } } + $disabled = ''; $disabledValues = $this->getColumn()->getDisabledValues(); if (is_array($disabledValues)) { $disabled = in_array($value, $disabledValues) ? ' disabled="disabled"' : ''; } else { - $disabled = $value === $this->getColumn()->getDisabledValue() ? ' disabled="disabled"' : ''; + $disabledValue = $this->getColumn()->getDisabledValue(); + if ($disabledValue !== null) { + $disabled = $value === $disabledValue ? ' disabled="disabled"' : ''; + } } $this->setDisabled($disabled); @@ -108,15 +116,18 @@ class Checkbox extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra */ protected function _getCheckboxHtml($value, $checked) { - $html = '<input type="checkbox" '; + $html = '<label class="data-grid-checkbox-cell-inner" '; + $html .= ' for="id_' . $this->escapeHtml($value) . '">'; + $html .= '<input type="checkbox" '; $html .= 'name="' . $this->getColumn()->getFieldName() . '" '; $html .= 'value="' . $this->escapeHtml($value) . '" '; + $html .= 'id="id_' . $this->escapeHtml($value) . '" '; $html .= 'class="' . ($this->getColumn()->getInlineCss() ? $this->getColumn()->getInlineCss() : 'checkbox') . - ' admin__control-checkbox' . - '"'; + ' admin__control-checkbox' . '"'; $html .= $checked . $this->getDisabled() . '/>'; - $html .= '<label></label>'; + $html .= '<label for="id_' . $this->escapeHtml($value) . '"></label>'; + $html .= '</label>'; /* ToDo UI: add class="admin__field-label" after some refactoring _fields.less */ return $html; } diff --git a/app/code/Magento/Backend/Model/Session/AdminConfig.php b/app/code/Magento/Backend/Model/Session/AdminConfig.php index c3fa55ed8d0ad5b736c150177ba16880c181466a..155a9b09528fc1862222df8e54826edc36dce220 100644 --- a/app/code/Magento/Backend/Model/Session/AdminConfig.php +++ b/app/code/Magento/Backend/Model/Session/AdminConfig.php @@ -30,14 +30,14 @@ class AdminConfig extends Config protected $_frontNameResolver; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var \Magento\Backend\App\BackendAppList */ - protected $_storeManager; + private $backendAppList; /** - * @var \Magento\Backend\App\BackendAppList + * @var \Magento\Backend\Model\UrlFactory */ - private $backendAppList; + private $backendUrlFactory; /** * @param \Magento\Framework\ValidatorFactory $validatorFactory @@ -49,7 +49,7 @@ class AdminConfig extends Config * @param string $scopeType * @param \Magento\Backend\App\BackendAppList $backendAppList * @param FrontNameResolver $frontNameResolver - * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param \Magento\Backend\Model\UrlFactory $backendUrlFactory * @param string $lifetimePath * @param string $sessionName * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -64,7 +64,7 @@ class AdminConfig extends Config $scopeType, \Magento\Backend\App\BackendAppList $backendAppList, FrontNameResolver $frontNameResolver, - \Magento\Store\Model\StoreManagerInterface $storeManager, + \Magento\Backend\Model\UrlFactory $backendUrlFactory, $lifetimePath = self::XML_PATH_COOKIE_LIFETIME, $sessionName = self::SESSION_NAME_ADMIN ) { @@ -79,8 +79,8 @@ class AdminConfig extends Config $lifetimePath ); $this->_frontNameResolver = $frontNameResolver; - $this->_storeManager = $storeManager; $this->backendAppList = $backendAppList; + $this->backendUrlFactory = $backendUrlFactory; $adminPath = $this->extractAdminPath(); $this->setCookiePath($adminPath); $this->setName($sessionName); @@ -95,7 +95,7 @@ class AdminConfig extends Config { $backendApp = $this->backendAppList->getCurrentApp(); $cookiePath = null; - $baseUrl = parse_url($this->_storeManager->getStore()->getBaseUrl(), PHP_URL_PATH); + $baseUrl = parse_url($this->backendUrlFactory->create()->getBaseUrl(), PHP_URL_PATH); if (!$backendApp) { $cookiePath = $baseUrl . $this->_frontNameResolver->getFrontName(); return $cookiePath; diff --git a/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php b/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php index 6b00b71e4c8517532503f064f7aa2009a6c6fbff..24baab2a0298e6e7f3bfdfe01ac4366d823204de 100644 --- a/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php +++ b/app/code/Magento/Backend/Test/Unit/Model/Session/AdminConfigTest.php @@ -29,9 +29,9 @@ class AdminConfigTest extends \PHPUnit_Framework_TestCase private $objectManager; /** - * @var \Magento\Store\Model\StoreManagerInterface | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Backend\Model\UrlFactory | \PHPUnit_Framework_MockObject_MockObject */ - private $storeManagerMock; + private $backendUrlFactory; /** * @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject @@ -56,13 +56,10 @@ class AdminConfigTest extends \PHPUnit_Framework_TestCase $this->validatorFactory = $this->getMockBuilder('Magento\Framework\ValidatorFactory') ->disableOriginalConstructor() ->getMock(); - - $storeMock = $this->getMockBuilder('\Magento\Store\Model\Store') - ->disableOriginalConstructor() - ->getMock(); - $storeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue('/')); - $this->storeManagerMock = $this->getMockForAbstractClass('\Magento\Store\Model\StoreManagerInterface'); - $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock)); + $backendUrl = $this->getMock('\Magento\Backend\Model\Url', [], [], '', false); + $backendUrl->expects($this->once())->method('getBaseUrl')->will($this->returnValue('/')); + $this->backendUrlFactory = $this->getMock('Magento\Backend\Model\UrlFactory', ['create'], [], '', false); + $this->backendUrlFactory->expects($this->any())->method('create')->willReturn($backendUrl); $this->filesystemMock = $this->getMock('\Magento\Framework\Filesystem', [], [], '', false); $dirMock = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\WriteInterface'); @@ -99,7 +96,7 @@ class AdminConfigTest extends \PHPUnit_Framework_TestCase 'validatorFactory' => $this->validatorFactory, 'request' => $this->requestMock, 'frontNameResolver' => $mockFrontNameResolver, - 'storeManager' => $this->storeManagerMock, + 'backendUrlFactory' => $this->backendUrlFactory, 'filesystem' => $this->filesystemMock, ] ); @@ -134,7 +131,7 @@ class AdminConfigTest extends \PHPUnit_Framework_TestCase 'validatorFactory' => $this->validatorFactory, 'request' => $this->requestMock, 'sessionName' => $sessionName, - 'storeManager' => $this->storeManagerMock, + 'backendUrlFactory' => $this->backendUrlFactory, 'filesystem' => $this->filesystemMock, ] ); diff --git a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml index fedec572af962a86661de9308ea78095fff09b64..41f6bf34afc8a9184e5bab7dca4e516e0c2055c4 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml @@ -22,7 +22,7 @@ if (!isset($advancedLabel)) { $advancedLabel = __('Additional Settings'); } -$cssClass = ($isField) ? 'field ' . $element->getClass() : 'fieldset admin__fieldset' . $element->getClass(); +$cssClass = ($isField) ? 'field ' . $element->getClass() : 'fieldset admin__fieldset ' . $element->getClass(); if ($isField) { $count = $element->getCountBasicChildren(); diff --git a/app/code/Magento/Braintree/view/frontend/web/template/payment/cc-form.html b/app/code/Magento/Braintree/view/frontend/web/template/payment/cc-form.html index f28cb33ceb4b1e1b13c85cd7d537fcf95377a434..a120355d9080ac35b377082eda8f1b4bd1076b16 100644 --- a/app/code/Magento/Braintree/view/frontend/web/template/payment/cc-form.html +++ b/app/code/Magento/Braintree/view/frontend/web/template/payment/cc-form.html @@ -80,7 +80,10 @@ <!-- ko if: (isCcDetectionEnabled())--> <ul class="credit-card-types"> <!-- ko foreach: {data: getCcAvailableTypesValues(), as: 'item'} --> - <li class="item" data-bind="css: {_active: $parent.selectedCardType() == item.value} "> + <li class="item" data-bind="css: { + _active: $parent.selectedCardType() == item.value, + _inactive: $parent.selectedCardType() != null && $parent.selectedCardType() != item.value + } "> <!--ko if: $parent.getIcons(item.value) --> <img data-bind="attr: { 'src': $parent.getIcons(item.value).url, diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index 3ab486011b5a660d3a2e28b05de7de8f321b322e..7bd251153314e365e0b9ed8c27de9939ac8f5a8a 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -494,6 +494,11 @@ </argument> </arguments> </type> + <type name="Magento\Catalog\Console\Command\ImagesResizeCommand"> + <arguments> + <argument name="productRepository" xsi:type="object">Magento\Catalog\Api\ProductRepositoryInterface\Proxy</argument> + </arguments> + </type> <type name="Magento\Framework\Config\View"> <arguments> <argument name="xpath" xsi:type="array"> diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml index 9e1c939c542386dea232351f7be694945c4dd984..db9087984db1f0ff501b540055618e949a599cb2 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml @@ -466,7 +466,7 @@ click: function () { (function ($) { $.ajax({ - url: '<?php /* @escapeNotVerified */ echo $block->getMoveUrl() ?>//', + url: '<?php /* @escapeNotVerified */ echo $block->getMoveUrl() ?>', method: 'POST', data: pd.join(""), showLoader: true diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js index 030962f2f06413a56129efbbbc6aa3c6d8b4830a..1b5fbe954b89d8bb5edab7477dc7785c0f4ca6c3 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/composite/configure.js @@ -761,8 +761,5 @@ define([ } }; - jQuery(document).ready(function(){ - productConfigure = new ProductConfigure(); - }); - + productConfigure = new ProductConfigure(); }); \ No newline at end of file diff --git a/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php b/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php index 98aa6bb7e710ab1492fff90a66ae24dd7f5391ea..e692ea59d2d6ef1b97ea0b81a6458c8773907cf4 100644 --- a/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php +++ b/app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php @@ -6,6 +6,7 @@ namespace Magento\CatalogSearch\Model\Adapter\Mysql\Filter; use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\ResourceModel\Eav\Attribute; use Magento\CatalogSearch\Model\Search\TableMapper; use Magento\Eav\Model\Config; use Magento\Framework\App\ResourceConnection; @@ -97,7 +98,7 @@ class Preprocessor implements PreprocessorInterface */ private function processQueryWithField(FilterInterface $filter, $isNegation, $query) { - /** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */ + /** @var Attribute $attribute */ $attribute = $this->config->getAttribute(Product::ENTITY, $filter->getField()); if ($filter->getField() === 'price') { $resultQuery = str_replace( @@ -114,24 +115,16 @@ class Preprocessor implements PreprocessorInterface $this->connection->quoteIdentifier($alias . '.' . $attribute->getAttributeCode()), $query ); - } elseif ($filter->getType() === FilterInterface::TYPE_TERM - && in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true) + } elseif ( + $filter->getType() === FilterInterface::TYPE_TERM && + in_array($attribute->getFrontendInput(), ['select', 'multiselect'], true) ) { - $alias = $this->tableMapper->getMappingAlias($filter); - if (is_array($filter->getValue())) { - $value = sprintf( - '%s IN (%s)', - ($isNegation ? 'NOT' : ''), - implode(',', $filter->getValue()) - ); - } else { - $value = ($isNegation ? '!' : '') . '= ' . $filter->getValue(); - } - $resultQuery = sprintf( - '%1$s.value %2$s', - $alias, - $value - ); + $resultQuery = $this->processTermSelect($filter, $isNegation); + } elseif ( + $filter->getType() === FilterInterface::TYPE_RANGE && + in_array($attribute->getBackendType(), ['decimal', 'int'], true) + ) { + $resultQuery = $this->processRangeNumeric($filter, $query, $attribute); } else { $table = $attribute->getBackendTable(); $select = $this->connection->select(); @@ -161,4 +154,57 @@ class Preprocessor implements PreprocessorInterface return $resultQuery; } + + /** + * @param FilterInterface $filter + * @param string $query + * @param Attribute $attribute + * @return string + */ + private function processRangeNumeric(FilterInterface $filter, $query, $attribute) + { + $tableSuffix = $attribute->getBackendType() === 'decimal' ? '_decimal' : ''; + $table = $this->resource->getTableName("catalog_product_index_eav{$tableSuffix}"); + $select = $this->connection->select(); + + $currentStoreId = $this->scopeResolver->getScope()->getId(); + + $select->from(['main_table' => $table], 'entity_id') + ->columns([$filter->getField() => 'main_table.value']) + ->where('main_table.attribute_id = ?', $attribute->getAttributeId()) + ->where('main_table.store_id = ?', $currentStoreId) + ->having($query); + + $resultQuery = 'search_index.entity_id IN ( + select entity_id from ' . $this->conditionManager->wrapBrackets($select) . ' as filter + )'; + + return $resultQuery; + } + + /** + * @param FilterInterface $filter + * @param bool $isNegation + * @return string + */ + private function processTermSelect(FilterInterface $filter, $isNegation) + { + $alias = $this->tableMapper->getMappingAlias($filter); + if (is_array($filter->getValue())) { + $value = sprintf( + '%s IN (%s)', + ($isNegation ? 'NOT' : ''), + implode(',', $filter->getValue()) + ); + } else { + $value = ($isNegation ? '!' : '') . '= ' . $filter->getValue(); + } + $resultQuery = sprintf( + '%1$s.value %2$s', + $alias, + $value + ); + + return $resultQuery; + } } diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml index 704568283748a660aed1941410b28ebf1e99b622..3f192bc072f9a7f9fa54393cf3eb22d9bc5eaa77 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml @@ -33,6 +33,12 @@ newAttributeSetContainer = $('[data-role=affected-attribute-set-new-name-container]'), existingAttributeSetContainer = $('[data-role=affected-attribute-set-existing-name-container]'); + $form.find('input[type=text]').on('keypress',function(e){ + if(e.keyCode === 13){ + e.preventDefault(); + $form.closest('[data-role=modal]').find('button[data-action=confirm]').click(); + } + }); $('[data-form=edit-product]').append($('<input>', { type: 'hidden', @@ -48,6 +54,9 @@ }, buttons: [{ text: '<?php /* @escapeNotVerified */ echo __('Confirm'); ?>', + attr: { + 'data-action': 'confirm' + }, 'class': 'action-secondary', click: function() { var affectedAttributeSetId = $form.find('input[name=affected-attribute-set]:checked').val(); diff --git a/app/code/Magento/Cookie/composer.json b/app/code/Magento/Cookie/composer.json index 4c1eb56566a7f4c771d7667adcb3a7f79c73faf0..58ab73368af0ccef8200703206e9ec1d919ed57e 100644 --- a/app/code/Magento/Cookie/composer.json +++ b/app/code/Magento/Cookie/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-cookie", "description": "N/A", "require": { - "php": "~5.4.11|~5.5.0|~5.6.0", + "php": "~5.5.0|~5.6.0|~7.0.0", "magento/module-store": "1.0.0-beta", "magento/framework": "1.0.0-beta" }, diff --git a/app/code/Magento/Customer/Console/Command/UpgradeHashAlgorithmCommand.php b/app/code/Magento/Customer/Console/Command/UpgradeHashAlgorithmCommand.php index 275b185492ea51d74e7625af89de766f95cd8a86..92bfb1d5c7fac309014d25396284b5f2aa50b401 100644 --- a/app/code/Magento/Customer/Console/Command/UpgradeHashAlgorithmCommand.php +++ b/app/code/Magento/Customer/Console/Command/UpgradeHashAlgorithmCommand.php @@ -40,7 +40,6 @@ class UpgradeHashAlgorithmCommand extends Command ) { parent::__construct(); $this->customerCollectionFactory = $customerCollectionFactory; - $this->collection = $customerCollectionFactory->create(); $this->encryptor = $encryptor; } @@ -58,6 +57,7 @@ class UpgradeHashAlgorithmCommand extends Command */ protected function execute(InputInterface $input, OutputInterface $output) { + $this->collection = $this->customerCollectionFactory->create(); $this->collection->addAttributeToSelect('*'); $customerCollection = $this->collection->getItems(); /** @var $customer Customer */ diff --git a/app/code/Magento/Deploy/composer.json b/app/code/Magento/Deploy/composer.json index 48b8e7f4ae081385d4623224c53b8fdfeb971a7e..691d71fb387070b5f0447d8c00a97b34fa76fedc 100644 --- a/app/code/Magento/Deploy/composer.json +++ b/app/code/Magento/Deploy/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-deploy", "description": "N/A", "require": { - "php": "~5.5.0|~5.6.0", + "php": "~5.5.0|~5.6.0|~7.0.0", "magento/framework": "1.0.0-beta", "magento/module-developer": "1.0.0-beta", "magento/module-store": "1.0.0-beta", diff --git a/app/code/Magento/DownloadableImportExport/composer.json b/app/code/Magento/DownloadableImportExport/composer.json index 4bfa578ff8b5333214dbd2d0cfa435c0eb4cac6f..c8fccff51ad959d91664ed9eaf314689d8b967a3 100644 --- a/app/code/Magento/DownloadableImportExport/composer.json +++ b/app/code/Magento/DownloadableImportExport/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-downloadable-import-export", "description": "N/A", "require": { - "php": "~5.5.0|~5.6.0", + "php": "~5.5.0|~5.6.0|~7.0.0", "magento/module-catalog": "1.0.0-beta", "magento/module-import-export": "1.0.0-beta", "magento/module-catalog-import-export": "1.0.0-beta", diff --git a/app/code/Magento/EncryptionKey/composer.json b/app/code/Magento/EncryptionKey/composer.json index 590cc443f9032812b8beebe8b4bfb11287c45dc6..9a8aee83c4caec8fbe1996fc94247ef2e8e733c2 100644 --- a/app/code/Magento/EncryptionKey/composer.json +++ b/app/code/Magento/EncryptionKey/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-encryption-key", "description": "N/A", "require": { - "php": "~5.5.0|~5.6.0", + "php": "~5.5.0|~5.6.0|~7.0.0", "magento/module-config": "1.0.0-beta", "magento/module-backend": "1.0.0-beta", "magento/framework": "1.0.0-beta" diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml index 87435ac42e867730101a2752f0cd1c95747d0fb2..e47123ca4322c75030941a8382f9fb8072a703ac 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml @@ -24,11 +24,17 @@ <arguments> <argument name="id" xsi:type="string">grouped_grid_popup</argument> </arguments> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="entity_id"> + <block class="Magento\Backend\Block\Widget\Grid\Column" as="entity_ids"> <arguments> - <argument name="header" xsi:type="string" translate="true">ID</argument> <argument name="type" xsi:type="string">skip-list</argument> <argument name="renderer" xsi:type="string">Magento\Backend\Block\Widget\Grid\Column\Renderer\Checkbox</argument> + <argument name="name" xsi:type="string">entity_ids</argument> + <argument name="index" xsi:type="string">entity_id</argument> + </arguments> + </block> + <block class="Magento\Backend\Block\Widget\Grid\Column" as="entity_id"> + <arguments> + <argument name="header" xsi:type="string" translate="true">ID</argument> <argument name="index" xsi:type="string">entity_id</argument> </arguments> </block> diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js b/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js index b7badba6e79c142c8c1a92e0d60cdb41500507d4..1e497ed7b8231de9c057b986dc1f6c0387aa6aa2 100644 --- a/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js +++ b/app/code/Magento/GroupedProduct/view/adminhtml/web/js/grouped-product.js @@ -132,7 +132,7 @@ define([ if (!target.is('input')) { target.closest('[data-role=row]') - .find('[data-column=entity_id] input') + .find('[data-column=entity_ids] input') .prop('checked', function (element, value) { return !value; }) @@ -142,7 +142,7 @@ define([ popup.on( 'change', - '[data-role=row] [data-column=entity_id] input', + '[data-role=row] [data-column=entity_ids] input', $.proxy(function (event) { var element = $(event.target), product = {}; @@ -175,12 +175,12 @@ define([ return $(element).val(); }).toArray(); ajaxSettings.data.filter = $.extend(ajaxSettings.data.filter || {}, { - 'entity_id': ids + 'entity_ids': ids }); }) .on('gridajax', function (event, ajaxRequest) { ajaxRequest.done(function () { - popup.find('[data-role=row] [data-column=entity_id] input') + popup.find('[data-role=row] [data-column=entity_ids] input') .each(function (index, element) { var $element = $(element); $element.prop('checked', !!selectedProductList[$element.val()]); diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php index 4cd75e3313d2cee2f4185bfe5b734235e6205dfc..6dca0a90a8c32d5dd42af32eaccb3a4dc1d74a38 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Filter.php @@ -120,7 +120,7 @@ class Filter extends \Magento\Backend\Block\Widget\Grid\Extended { $html = '<input type="text" name="' . $this->getFilterElementName( $attribute->getAttributeCode() - ) . '" class="input-text input-text-export-filter"'; + ) . '" class="admin__control-text input-text input-text-export-filter"'; if ($value) { $html .= ' value="' . $this->escapeHtml($value) . '"'; } @@ -190,7 +190,7 @@ class Filter extends \Magento\Backend\Block\Widget\Grid\Extended ':</strong> ' . '<input type="text" name="' . $name . - '[]" class="input-text input-text-range"' . + '[]" class="admin__control-text input-text input-text-range"' . ' value="' . $fromValue . '"/> ' . @@ -200,7 +200,7 @@ class Filter extends \Magento\Backend\Block\Widget\Grid\Extended ) . ':</strong> <input type="text" name="' . $name . - '[]" class="input-text input-text-range" value="' . + '[]" class="admin__control-text input-text input-text-range" value="' . $toValue . '" />'; } @@ -236,7 +236,7 @@ class Filter extends \Magento\Backend\Block\Widget\Grid\Extended $arguments = [ 'name' => $this->getFilterElementName($attribute->getAttributeCode()), 'id' => $this->getFilterElementId($attribute->getAttributeCode()), - 'class' => 'select select-export-filter', + 'class' => 'admin__control-select select select-export-filter', ]; /** @var $selectBlock \Magento\Framework\View\Element\Html\Select */ $selectBlock = $this->_layout->createBlock( diff --git a/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/after.phtml b/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/after.phtml index ace41a768af027afaabce0a4877678e5d10abe8c..929fcf56bb537acede9cc11cf5c57ba57f292b2f 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/after.phtml +++ b/app/code/Magento/ImportExport/view/adminhtml/templates/export/form/after.phtml @@ -6,8 +6,8 @@ // @codingStandardsIgnoreFile ?> -<fieldset class="fieldset" id="export_filter_container" style="display:none;"> - <legend class="legend"> +<fieldset class="admin__fieldset" id="export_filter_container" style="display:none;"> + <legend class="admin__legend"> <span><?php /* @escapeNotVerified */ echo __('Entity Attributes'); ?></span> </legend> <br /> diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Tokens.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Tokens.php index e8654ef4fd3d3eded0d52557415294199801a8aa..f48a5e033b93f3845b7794b4e12d4f8ad2acd5f2 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Tokens.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Tokens.php @@ -37,7 +37,7 @@ class Tokens extends \Magento\Backend\Block\Widget\Form\Generic $fieldset = $form->addFieldset( 'base_fieldset', - ['legend' => __('Integration Tokens for Extensions'), 'class' => 'fieldset-wide'] + ['legend' => __('Integration Tokens for Extensions'), 'class' => ' fieldset-wide'] ); foreach ($this->getFormFields() as $field) { diff --git a/app/code/Magento/Integration/view/adminhtml/templates/integration/activate/permissions/tab/webapi.phtml b/app/code/Magento/Integration/view/adminhtml/templates/integration/activate/permissions/tab/webapi.phtml index 52539a96e184a358ebfab50ff4f22df118ddd8c3..ba9ed08ce44b9a1d6b3a5fb4eb686d0cc05cc1ad 100644 --- a/app/code/Magento/Integration/view/adminhtml/templates/integration/activate/permissions/tab/webapi.phtml +++ b/app/code/Magento/Integration/view/adminhtml/templates/integration/activate/permissions/tab/webapi.phtml @@ -11,7 +11,7 @@ // @codingStandardsIgnoreFile ?> -<fieldset class="fieldset form-inline entry-edit"> +<fieldset class="admin__fieldset form-inline entry-edit"> <?php if ($block->isTreeEmpty()): ?> <p class="empty"><?php /* @escapeNotVerified */ echo __('No permissions requested'); ?></p> <?php else: ?> diff --git a/app/code/Magento/Marketplace/composer.json b/app/code/Magento/Marketplace/composer.json index c472be8a8fdac281ec2864811e986df0f73a4b40..de0198668102e1fa0bf39b3fcca9b1729c3da74f 100644 --- a/app/code/Magento/Marketplace/composer.json +++ b/app/code/Magento/Marketplace/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-marketplace", "description": "N/A", "require": { - "php": "~5.5.0|~5.6.0", + "php": "~5.5.0|~5.6.0|~7.0.0", "magento/framework": "1.0.0-beta", "magento/module-backend": "1.0.0-beta" }, diff --git a/app/code/Magento/NewRelicReporting/composer.json b/app/code/Magento/NewRelicReporting/composer.json index d3336380128e1d464495ca6ac7143b043fe806b9..8e8301f161e9a351a9d23222044980c3d9b19aab 100644 --- a/app/code/Magento/NewRelicReporting/composer.json +++ b/app/code/Magento/NewRelicReporting/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-new-relic-reporting", "description": "N/A", "require": { - "php": "~5.5.0|~5.6.0", + "php": "~5.5.0|~5.6.0|~7.0.0", "magento/module-store": "1.0.0-beta", "magento/module-backend": "1.0.0-beta", "magento/module-customer": "1.0.0-beta", diff --git a/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php b/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php index fd04f1fe4ca2fbe28854f837b0a3323d70164473..d86d8df059161ffdf7b0b04bfde642c328a3a02f 100644 --- a/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php +++ b/app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php @@ -76,6 +76,11 @@ class BuiltinPlugin $this->kernel->process($result); } } else { + json_decode($result->getContent()); + if (json_last_error() == JSON_ERROR_NONE) { + // reset profiler to avoid appending profiling stat to JSON response + \Magento\Framework\Profiler::reset(); + } $this->addDebugHeader($result, 'X-Magento-Cache-Debug', 'HIT', true); } return $result; diff --git a/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/BuiltinPluginTest.php b/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/BuiltinPluginTest.php index 9e4102c889052f63cf2f358577d5059fa7aebc51..ae38b76db495f0e4fefbc1dd3763516ba55d0ef0 100644 --- a/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/BuiltinPluginTest.php +++ b/app/code/Magento/PageCache/Test/Unit/Model/App/FrontController/BuiltinPluginTest.php @@ -200,6 +200,7 @@ class BuiltinPluginTest extends \PHPUnit_Framework_TestCase $this->responseMock->expects($this->never()) ->method('setHeader'); } + $this->responseMock->expects($this->once())->method('getContent'); $this->assertSame( $this->responseMock, $this->plugin->aroundDispatch($this->frontControllerMock, $this->closure, $this->requestMock) diff --git a/app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js b/app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js index 660f3e3c0471f40d168481723d316bfcf792c0ed..2812437f379e491bd301392e3d60afebe3e13dfa 100644 --- a/app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js +++ b/app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js @@ -21,13 +21,34 @@ "use strict"; $.each({ + 'validate-card-type': [ + function (number, item, allowedTypes) { + var cardInfo, + i, + l; + + if (!creditCardNumberValidator(number).isValid) { + return false; + } else { + cardInfo = creditCardNumberValidator(number).card; + + for (i = 0, l = allowedTypes.length; i < l; i++) { + if (cardInfo.title == allowedTypes[i].type) { + return true; + } + } + return false; + } + }, + 'Please enter a valid credit card type number.' + ], 'validate-card-number': [ /** * Validate credit card number based on mod 10 * @param number - credit card number * @return {boolean} */ - function (number) { + function (number) { return creditCardNumberValidator(number).isValid; }, 'Please enter a valid credit card number.' diff --git a/app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html b/app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html index 2df219f3dddf1df4770c7248310c9514682e6f68..7db455786537c37bf09c7a02fe9ca365f887de32 100644 --- a/app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html +++ b/app/code/Magento/Payment/view/frontend/web/template/payment/cc-form.html @@ -50,7 +50,7 @@ id: getCode() + '_cc_number', title: $t('Credit Card Number'), 'data-container': getCode() + '-cc-number', - 'data-validate': JSON.stringify({'required-number':true, 'validate-card-number':'#' + getCode() + '_cc_type', 'validate-cc-type':'#' + getCode() + '_cc_type'})}, + 'data-validate': JSON.stringify({'required-number':true, 'validate-card-type':getCcAvailableTypesValues(), 'validate-card-number':'#' + getCode() + '_cc_type', 'validate-cc-type':'#' + getCode() + '_cc_type'})}, enable: isActive($parents), value: creditCardNumber, valueUpdate: 'keyup' "/> diff --git a/app/code/Magento/ProductVideo/view/adminhtml/web/js/video-modal.js b/app/code/Magento/ProductVideo/view/adminhtml/web/js/video-modal.js index f7e0e72de69c1037285fb71a1f7786614ed3f43d..a6e13f100fee793bea8e7acc11d76f3af11ae21a 100644 --- a/app/code/Magento/ProductVideo/view/adminhtml/web/js/video-modal.js +++ b/app/code/Magento/ProductVideo/view/adminhtml/web/js/video-modal.js @@ -4,56 +4,54 @@ */ define([ 'jquery', + 'productGallery', 'jquery/ui', 'Magento_Ui/js/modal/modal', 'mage/translate', 'mage/backend/tree-suggest', 'mage/backend/validation' -], function ($) { +], function ($, productGallery) { 'use strict'; - $.widget('mage.productGallery', - $.mage.productGallery, - { - - /** - * Fired when windget initialization start - * @private - */ - _create: function () { - this._bind(); - }, - - /** - * Bind events - * @private - */ - _bind: function () { - $(this.element).on('click', this.showModal.bind(this)); - $('.gallery.ui-sortable').on('openDialog', $.proxy(this._onOpenDialog, this)); - }, - - /** - * Open dialog for external video - * @private - */ - _onOpenDialog: function (e, imageData) { - - if (imageData['media_type'] !== 'external-video') { - return; - } - this.showModal(); - }, - - /** - * Fired on trigger "openModal" - */ - showModal: function () { - - $('#new-video').modal('openModal'); + $.widget('mage.productGallery', productGallery, { + + /** + * * Fired when widget initialization start + * @private + */ + _create: function () { + this._bind(); + }, + + /** + * Bind events + * @private + */ + _bind: function () { + $(this.element).on('click', this.showModal.bind(this)); + $('.gallery.ui-sortable').on('openDialog', $.proxy(this._onOpenDialog, this)); + }, + + /** + * Open dialog for external video + * @private + */ + _onOpenDialog: function (e, imageData) { + + if (imageData['media_type'] !== 'external-video') { + return; } + this.showModal(); + }, + + /** + * Fired on trigger "openModal" + */ + showModal: function () { + + $('#new-video').modal('openModal'); } - ); + }); return $.mage.productGallery; }); diff --git a/app/code/Magento/ProductVideo/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/ProductVideo/view/frontend/layout/catalog_product_view.xml index 18417e1619da5d56717ce8602c53bf6359d44ac5..59d2ef3e2cd953c3d86661a6ce93b652701d8362 100644 --- a/app/code/Magento/ProductVideo/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/ProductVideo/view/frontend/layout/catalog_product_view.xml @@ -6,10 +6,6 @@ */ --> <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> - <head> - <link src="Magento_ProductVideo::js/fotorama-add-video-events.js"/> - <link src="Magento_ProductVideo::js/load-player.js"/> - </head> <body> <referenceContainer name="product.info.media"> <block class="Magento\ProductVideo\Block\Product\View\Gallery" name="product.info.media.video" after="product.info.media.image" template="product/view/gallery.phtml"/> diff --git a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js index 90f8b04c5c70b9d4d9fbb88d70e08bd307c83d04..1bde25b44a4fd95346b4cdd3b69e57f6243ec2e8 100644 --- a/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js +++ b/app/code/Magento/Sales/view/adminhtml/web/order/create/scripts.js @@ -64,20 +64,22 @@ define([ }, 10); }; - this.dataArea.onLoad = this.dataArea.onLoad.wrap(function(proceed) { - proceed(); - this._parent.itemsArea.setNode($(this._parent.getAreaId('items'))); - this._parent.itemsArea.onLoad(); - }); + if (jQuery('#' + this.getAreaId('items')).is(':visible')) { + this.dataArea.onLoad = this.dataArea.onLoad.wrap(function(proceed) { + proceed(); + this._parent.itemsArea.setNode($(this._parent.getAreaId('items'))); + this._parent.itemsArea.onLoad(); + }); - this.itemsArea.onLoad = this.itemsArea.onLoad.wrap(function(proceed) { - proceed(); - if ($(searchAreaId) && !$(searchAreaId).visible()) { - this.addControlButton(searchButton); - } - }); - this.areasLoaded(); - this.itemsArea.onLoad(); + this.itemsArea.onLoad = this.itemsArea.onLoad.wrap(function(proceed) { + proceed(); + if ($(searchAreaId) && !$(searchAreaId).visible()) { + this.addControlButton(searchButton); + } + }); + this.areasLoaded(); + this.itemsArea.onLoad(); + } }).bind(this)); jQuery('#edit_form') @@ -85,7 +87,6 @@ define([ jQuery(this).trigger('realOrder'); }) .on('realOrder', this._realSubmit.bind(this)); - }, areasLoaded: function(){ diff --git a/app/code/Magento/Swagger/composer.json b/app/code/Magento/Swagger/composer.json index 878f5c8dfefd02d7623023db544e2c8f52ac8d38..0ba900539c248226038ac89225340001a5e1e8ec 100644 --- a/app/code/Magento/Swagger/composer.json +++ b/app/code/Magento/Swagger/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-swagger", "description": "N/A", "require": { - "php": "~5.5.0|~5.6.0", + "php": "~5.5.0|~5.6.0|~7.0.0", "magento/framework": "1.0.0-beta" }, "type": "magento2-module", diff --git a/app/code/Magento/Ui/view/base/web/js/grid/sticky/sticky.js b/app/code/Magento/Ui/view/base/web/js/grid/sticky/sticky.js index 8daa9999633ac16af713551813a11e9128ecb522..8a1ffe15de04bdabed5d9e3b6f9072abb8057e15 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/sticky/sticky.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/sticky/sticky.js @@ -73,12 +73,6 @@ define([ $.async(this.stickyContainerSelector, this, this.initContainerNode); - $.async(this.stickyElementSelector, - this.listing(), - this.initStickyListingNode); - $.async(this.stickyElementSelector, - this.toolbar(), - this.initStickyToolbarNode); return this; }, @@ -154,6 +148,13 @@ define([ $.async(this.rightDataGridCapSelector, node, this.initRightDataGridCap); + + $.async(this.stickyElementSelector, + this.listing(), + this.initStickyListingNode); + $.async(this.stickyElementSelector, + this.toolbar(), + this.initStickyToolbarNode); }, /** diff --git a/app/code/Magento/Ui/view/base/web/js/lib/core/storage.js b/app/code/Magento/Ui/view/base/web/js/lib/core/storage.js index 62f87dcd432d2ddec9b8ba11b01442cc8a5e92d5..1ffc8c880e485f1859d784bb32eb6aa32f7c94fc 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/core/storage.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/core/storage.js @@ -11,8 +11,72 @@ define([ 'use strict'; var root = 'appData', + localStorage = window.localStorage, + hasSupport, storage; + /** + * Flag which indicates whether localStorage is supported. + */ + hasSupport = (function () { + var key = '_storageSupported'; + + try { + localStorage.setItem(key, 'true'); + + if (localStorage.getItem(key) === 'true') { + localStorage.removeItem(key); + + return true; + } + + return false; + } catch (e) { + return false; + } + })(); + + if (!hasSupport) { + localStorage = { + _data: {}, + + /** + * Sets value of the specified item. + * + * @param {String} key - Key of the property. + * @param {*} value - Properties' value. + */ + setItem: function (key, value) { + this._data[key] = value + ''; + }, + + /** + * Retrieves specfied item. + * + * @param {String} key - Key of the property to be retrieved. + */ + getItem: function (key) { + return this._data[key]; + }, + + /** + * Removes specfied item. + * + * @param {String} key - Key of the property to be removed. + */ + removeItem: function (key) { + delete this._data[key]; + }, + + /** + * Removes all items. + */ + clear: function () { + this._data = {}; + } + }; + } + /** * Extracts and parses data stored in localStorage by the * key specified in 'root' varaible. diff --git a/app/code/Magento/Ui/view/base/web/js/modal/modal.js b/app/code/Magento/Ui/view/base/web/js/modal/modal.js index e99f818068534b4578bdebc4b4f3ef2dc36becc3..b6dd6da1651a64bb521d938291867e90c6a8a1cd 100644 --- a/app/code/Magento/Ui/view/base/web/js/modal/modal.js +++ b/app/code/Magento/Ui/view/base/web/js/modal/modal.js @@ -22,7 +22,7 @@ define([ */ var transitionEvent = (function () { var transition, - elementStyle = document.body.style, + elementStyle = document.createElement('div').style, transitions = { 'transition': 'transitionend', 'OTransition': 'oTransitionEnd', diff --git a/app/code/Magento/Variable/composer.json b/app/code/Magento/Variable/composer.json index c0543d01623a4f261d9db5e34c532b4bb3c106f4..cf3b3e25417384e931f35422d2ba46bd3751a4b4 100644 --- a/app/code/Magento/Variable/composer.json +++ b/app/code/Magento/Variable/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-variable", "description": "N/A", "require": { - "php": "~5.4.11|~5.5.0|~5.6.0", + "php": "~5.5.0|~5.6.0|~7.0.0", "magento/module-backend": "1.0.0-beta", "magento/module-email": "1.0.0-beta", "magento/module-store": "1.0.0-beta", diff --git a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less index 3b4404bc0da1e9336efa2b62783dfb7c48e1bfa0..d9a3ab7292a8a53c423895f1483024a57520645e 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less +++ b/app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/module/_data-grid.less @@ -305,7 +305,7 @@ body._in-resize { width: 7rem; img { border: 1px solid @data-grid-td__border-color; - max-width: 5rem; + width: 5rem; } } .data-grid-multicheck-cell { diff --git a/app/design/adminhtml/Magento/backend/web/css/styles-old.less b/app/design/adminhtml/Magento/backend/web/css/styles-old.less index 7390b3177b8360a5f41fd5cdfe839e1cbf56fa1c..9f624fea87ed90b28856fa0be9b5632e31471ea3 100644 --- a/app/design/adminhtml/Magento/backend/web/css/styles-old.less +++ b/app/design/adminhtml/Magento/backend/web/css/styles-old.less @@ -2640,8 +2640,8 @@ } // -// Configuration -> Design -// -------------------------------------- + // Configuration -> Design + // -------------------------------------- #row_design_theme_ua_regexp .design_theme_ua_regexp { float: left; @@ -2654,6 +2654,16 @@ clear: both; } + // + // Configuration -> Advanced -> System -> Notifications section + // -------------------------------------- + + #row_system_adminnotification_last_update { + .value { + vertical-align: bottom; + } + } + // // CMS -> Banners // -------------------------------------- diff --git a/composer.json b/composer.json index 0fa24640ae43b12e18e5f1a33654b4e88e8bdc0c..a9e71e4b11044065e63828380d9c3203185e9599 100644 --- a/composer.json +++ b/composer.json @@ -69,6 +69,7 @@ "ext-intl": "*", "ext-xsl": "*", "ext-mbstring": "*", + "ext-openssl": "*", "sjparkinson/static-review": "~4.1", "fabpot/php-cs-fixer": "~1.2", "lusitanian/oauth": "~0.3 <=0.7.0" diff --git a/composer.lock b/composer.lock index 30da2611948979b879c9c4272ed8ec235595f617..9da039729694a59f2cb2ed8d294c322ed126c17a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "c4198e8a51c13b0d2c96bb54023cf2c6", - "content-hash": "444606690390cbbc73e906d61746c25d", + "hash": "80867d6202a3ae5d2f4c079e2cfd702f", + "content-hash": "41493176956dcfd2401ac1181d4d4782", "packages": [ { "name": "braintree/braintree_php", @@ -2571,16 +2571,16 @@ }, { "name": "fabpot/php-cs-fixer", - "version": "v1.10", + "version": "v1.10.1", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "8e21b4fb32c4618a425817d9f0daf3d57a9808d1" + "reference": "12dbcd1462f1e3a5a96c6c7398af26b28e092a8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/8e21b4fb32c4618a425817d9f0daf3d57a9808d1", - "reference": "8e21b4fb32c4618a425817d9f0daf3d57a9808d1", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/12dbcd1462f1e3a5a96c6c7398af26b28e092a8a", + "reference": "12dbcd1462f1e3a5a96c6c7398af26b28e092a8a", "shasum": "" }, "require": { @@ -2621,7 +2621,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2015-07-27 20:56:10" + "time": "2015-10-12 20:13:46" }, { "name": "league/climate", @@ -3941,6 +3941,7 @@ "ext-iconv": "*", "ext-intl": "*", "ext-xsl": "*", - "ext-mbstring": "*" + "ext-mbstring": "*", + "ext-openssl": "*" } } diff --git a/dev/tests/functional/composer.json b/dev/tests/functional/composer.json index 5f941b700f5402a510723d4e33ae4bfb570b8467..4e4d5972cd5001c9b7ee3d690a4b4107cb0995c7 100644 --- a/dev/tests/functional/composer.json +++ b/dev/tests/functional/composer.json @@ -1,6 +1,6 @@ { "require": { - "magento/mtf": "1.0.0-rc35", + "magento/mtf": "1.0.0-rc36", "php": "~5.5.0|~5.6.0|~7.0.0", "phpunit/phpunit": "4.1.0", "phpunit/phpunit-selenium": ">=1.2" diff --git a/dev/tests/functional/etc/events.xml b/dev/tests/functional/etc/events.xml index e838968e1c2a20a92b0431055088cf24f249aded..b724c773b6c23b4a932ecdabcc0d8630ddeddba4 100644 --- a/dev/tests/functional/etc/events.xml +++ b/dev/tests/functional/etc/events.xml @@ -8,7 +8,39 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="events.xsd"> <preset name="base"> <observer class="Magento\Mtf\System\Observer\WebapiResponse"> - <tag name="webapi_failed"/> + <tag name="webapi_failed" /> + </observer> + </preset> + <preset name="coverage" extends="base"> + <observer class="Magento\Mtf\System\Observer\PageUrl"> + <tag name="click_after"/> + <tag name="accept_alert_after"/> + <tag name="dismiss_alert_after"/> + <tag name="open_after"/> + <tag name="forward"/> + <tag name="back"/> + </observer> + <observer class="Magento\Mtf\System\Observer\AppState"> + <tag name="app_state_applied"/> + </observer> + <observer class="Magento\Mtf\System\Observer\Log"> + <tag name="exception"/> + <tag name="failure"/> + <tag name="execution" /> + </observer> + <observer class="Magento\Mtf\System\Observer\SourceCode"> + <tag name="exception"/> + <tag name="failure"/> + </observer> + <observer class="Magento\Mtf\System\Observer\Screenshot"> + <tag name="exception"/> + <tag name="failure"/> + </observer> + <observer class="Magento\Mtf\System\Observer\CurlResponse"> + <tag name="curl_failed"/> + </observer> + <observer class="Magento\Mtf\System\Observer\WebapiResponse"> + <tag name="webapi_failed" /> </observer> </preset> </config> diff --git a/dev/tests/functional/lib/Magento/Mtf/Handler/Webapi.php b/dev/tests/functional/lib/Magento/Mtf/Handler/Webapi.php index 443eafd1c256cd8b768da61bfa1589e3dfceb06d..f69225110c81fd0576fd29d431d2b5c807cbf1aa 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Handler/Webapi.php +++ b/dev/tests/functional/lib/Magento/Mtf/Handler/Webapi.php @@ -13,7 +13,7 @@ use Magento\Mtf\Util\Protocol\CurlTransport\WebapiDecorator; /** * Abstract class for webapi handlers. */ -abstract class Webapi implements HandlerInterface +abstract class Webapi extends Curl implements HandlerInterface { /** * Configuration parameters array. diff --git a/dev/tests/functional/lib/Magento/Mtf/Page/BackendPage.php b/dev/tests/functional/lib/Magento/Mtf/Page/BackendPage.php index e5b6c09f905383cb25fd2875245fc6100fd9f87d..26231f9fbef70df83c3585aae3538badcdd6e760 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Page/BackendPage.php +++ b/dev/tests/functional/lib/Magento/Mtf/Page/BackendPage.php @@ -8,7 +8,7 @@ namespace Magento\Mtf\Page; use Magento\Mtf\Factory\Factory; /** - * Class BackendPage + * Admin backend page. * * @SuppressWarnings(PHPMD.NumberOfChildren) */ @@ -19,13 +19,13 @@ class BackendPage extends Page * * @return void */ - protected function _init() + protected function initUrl() { - $this->_url = $_ENV['app_backend_url'] . static::MCA; + $this->url = $_ENV['app_backend_url'] . static::MCA; } /** - * Open backend page and log in if needed + * Open backend page and log in if needed. * * @param array $params * @return $this diff --git a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml index 74541d4f5662e088e0aee224a14701b6ed7c4035..b41addebd2c627244cea76596130015d336c69d3 100644 --- a/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Authorizenet/Test/TestCase/OnePageCheckoutTest.xml @@ -6,12 +6,12 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest"> + <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest" summary="One page check out with Authorize.Net payment method."> <variation name="OnePageCheckoutAuthorizenetTestVariation1" summary="Check Out as a Guest with Authorize.Net and Offline Shipping method" ticketId="MAGETWO-12832"> <data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data> <data name="taxRule" xsi:type="string">us_ca_ny_rule</data> <data name="customer/dataset" xsi:type="string">default</data> - <data name="billingAddress/dataset" xsi:type="string">US_address_1</data> + <data name="shippingAddress/dataset" xsi:type="string">US_address_1</data> <data name="checkoutMethod" xsi:type="string">guest</data> <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> <data name="shipping/shipping_method" xsi:type="string">Fixed</data> diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Cache/Grid.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Cache/Grid.php new file mode 100644 index 0000000000000000000000000000000000000000..686e688a9acf36df25e5c193ab1530cf60759b7c --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Cache/Grid.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Backend\Test\Block\Cache; + +use Magento\Backend\Test\Block\Widget\Grid as ParentGrid; + +/** + * Backend Cache Management grid. + */ +class Grid extends ParentGrid +{ + /** + * Search for item and select it. + * + * @param array $filter + * @return void + * @throws \Exception + */ + public function searchAndSelect(array $filter) + { + $selectItem = $this->getRow($filter, false)->find($this->selectItem); + if ($selectItem->isVisible()) { + $selectItem->click(); + } else { + throw new \Exception('Searched item was not found.'); + } + } +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/FormPageActions.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/FormPageActions.php index 302139354092fc6fdc2cb429056cbadfc1b016b3..1b8a503460cb66420e9bdd96081ec270807a7201 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/FormPageActions.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/FormPageActions.php @@ -49,7 +49,7 @@ class FormPageActions extends PageActions * * @var string */ - protected $deleteButton = '#delete'; + protected $deleteButton = '.delete'; /** * Magento loader diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php index b104c3230510c08d70f30d1d17d49be50cebd18d..c847513f244f25cfe2883f5393a1f7848c52cd46 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/FormTabs.php @@ -17,7 +17,7 @@ use Magento\Mtf\Client\BrowserInterface; use Magento\Mtf\Client\Element\SimpleElement; /** - * Is used to represent any form with tabs on the page + * Is used to represent any form with tabs on the page. * * @SuppressWarnings(PHPMD.NumberOfChildren) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -25,17 +25,26 @@ use Magento\Mtf\Client\Element\SimpleElement; class FormTabs extends Form { /** + * Tabs list. + * * @var array */ protected $tabs = []; /** - * Fields which aren't assigned to any tab + * Fields which aren't assigned to any tab. * * @var array */ protected $unassignedFields = []; + /** + * Page header selector. + * + * @var string + */ + protected $header = 'header'; + /** * @constructor * @param SimpleElement $element @@ -55,7 +64,7 @@ class FormTabs extends Form } /** - * Initialize block + * Initialize block. */ protected function init() { @@ -63,7 +72,7 @@ class FormTabs extends Form } /** - * Fill form with tabs + * Fill form with tabs. * * @param FixtureInterface $fixture * @param SimpleElement|null $element @@ -76,7 +85,7 @@ class FormTabs extends Form } /** - * Fill specified form with tabs + * Fill specified form with tabs. * * @param array $tabs * @param SimpleElement|null $element @@ -91,14 +100,14 @@ class FormTabs extends Form $tab->fillFormTab($tabFields, $context); } if (!empty($this->unassignedFields)) { - $this->fillMissedFields($tabs); + $this->fillMissedFields(); } return $this; } /** - * Fill fields which weren't found on filled tabs + * Fill fields which weren't found on filled tabs. * * @throws \Exception * @SuppressWarnings(PHPMD.UnusedLocalVariable) @@ -130,7 +139,7 @@ class FormTabs extends Form } /** - * Get data of the tabs + * Get data of the tabs. * * @param FixtureInterface|null $fixture * @param SimpleElement|null $element @@ -163,7 +172,7 @@ class FormTabs extends Form } /** - * Update form with tabs + * Update form with tabs. * * @param FixtureInterface $fixture * @return FormTabs @@ -178,7 +187,7 @@ class FormTabs extends Form } /** - * Create data array for filling tabs + * Create data array for filling tabs. * * @param FixtureInterface $fixture * @return array @@ -194,7 +203,7 @@ class FormTabs extends Form } /** - * Create data array for filling tabs (new fixture specification) + * Create data array for filling tabs (new fixture specification). * * @param InjectableFixture $fixture * @return array @@ -217,7 +226,7 @@ class FormTabs extends Form } /** - * Create data array for filling tabs (deprecated fixture specification) + * Create data array for filling tabs (deprecated fixture specification). * * @param FixtureInterface $fixture * @return array @@ -284,6 +293,7 @@ class FormTabs extends Form */ public function openTab($tabName) { + $this->browser->find($this->header)->hover(); $this->getTabElement($tabName)->click(); return $this; } diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Tab.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Tab.php index a4f434313fc12b49c2088d85d8b7e9b33fe1b54a..02afe0f2868972ce84ab7820b37d1aecdd7f4747 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Tab.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Block/Widget/Tab.php @@ -11,8 +11,7 @@ use Magento\Mtf\Client\Element\SimpleElement; use Magento\Mtf\Client\Locator; /** - * Class Tab - * Is used to represent any tab on the page + * Is used to represent any tab on the page. * * @SuppressWarnings(PHPMD.NumberOfChildren) */ @@ -23,24 +22,24 @@ class Tab extends AbstractForm * * @var string */ - protected $mageErrorField = '//*[contains(@class,"field ")][.//*[@class="mage-error"]]'; + protected $mageErrorField = '//fieldset/*[contains(@class,"field ")][.//*[contains(@class,"error")]]'; /** * Fields label with mage error. * * @var string */ - protected $mageErrorLabel = './label'; + protected $mageErrorLabel = './/*[contains(@class,"label")]'; /** * Mage error text. * * @var string */ - protected $mageErrorText = './/*[@class="mage-error"]'; + protected $mageErrorText = './/label[contains(@class,"error")]'; /** - * Fill data to fields on tab + * Fill data to fields on tab. * * @param array $fields * @param SimpleElement|null $element @@ -55,7 +54,7 @@ class Tab extends AbstractForm } /** - * Get data of tab + * Get data of tab. * * @param array|null $fields * @param SimpleElement|null $element @@ -68,10 +67,11 @@ class Tab extends AbstractForm } /** - * Update data to fields on tab + * Update data to fields on tab. * * @param array $fields * @param SimpleElement|null $element + * @return void */ public function updateFormTab(array $fields, SimpleElement $element = null) { diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertCacheIsRefreshableAndInvalidated.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertCacheIsRefreshableAndInvalidated.php new file mode 100644 index 0000000000000000000000000000000000000000..5492c69ef0b27568f4289cab588a9f8894a5d925 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertCacheIsRefreshableAndInvalidated.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Backend\Test\Constraint; + +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Backend\Test\Page\Adminhtml\AdminCache; + +/** + * Assert Cache is Invalidated and Refreshable. + */ +class AssertCacheIsRefreshableAndInvalidated extends AbstractConstraint +{ + /** + * Success message of refreshed cache. + */ + const SUCCESS_MESSAGE = '%d cache type(s) refreshed.'; + + /** + * Assert Cache is Invalidated and Refreshable. + * + * @param AdminCache $adminCache + * @param array $cacheTags + * @return void + */ + public function processAssert(AdminCache $adminCache, $cacheTags) + { + $items = []; + foreach ($cacheTags as $cacheTag) { + $items[] = [ + 'tags' => $cacheTag, + 'status' => 'Invalidated' + ]; + } + + $adminCache->open(); + $adminCache->getGridBlock()->massaction($items, 'Refresh'); + + \PHPUnit_Framework_Assert::assertEquals( + sprintf(self::SUCCESS_MESSAGE, count($items)), + $adminCache->getMessagesBlock()->getSuccessMessages(), + 'Cache is Invalid and refreshable.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Cache is not Invalid or not refreshable.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php index b262b81e09c0ebfdcef2d6ff555e9d756713aa8e..74290a5b8bb717edcaf889f9f16c29ee09710b11 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/AdminAuthLogin.php @@ -43,9 +43,9 @@ class AdminAuthLogin extends Page /** * Constructor. */ - protected function _init() + protected function initUrl() { - $this->_url = $_ENV['app_backend_url'] . self::MCA; + $this->url = $_ENV['app_backend_url'] . self::MCA; } /** @@ -56,7 +56,7 @@ class AdminAuthLogin extends Page public function getLoginBlock() { return Factory::getBlockFactory()->getMagentoBackendAdminLogin( - $this->_browser->find($this->loginBlock, Locator::SELECTOR_CSS) + $this->browser->find($this->loginBlock, Locator::SELECTOR_CSS) ); } @@ -68,7 +68,7 @@ class AdminAuthLogin extends Page public function getHeaderBlock() { return Factory::getBlockFactory()->getMagentoBackendPageHeader( - $this->_browser->find($this->headerBlock, Locator::SELECTOR_CSS) + $this->browser->find($this->headerBlock, Locator::SELECTOR_CSS) ); } @@ -79,7 +79,7 @@ class AdminAuthLogin extends Page */ public function getMessagesBlock() { - return Factory::getBlockFactory()->getMagentoBackendMessages($this->_browser->find($this->messagesBlock)); + return Factory::getBlockFactory()->getMagentoBackendMessages($this->browser->find($this->messagesBlock)); } /** @@ -89,7 +89,7 @@ class AdminAuthLogin extends Page */ public function waitForHeaderBlock() { - $browser = $this->_browser; + $browser = $this->browser; $selector = $this->headerBlock; $browser->waitUntil( function () use ($browser, $selector) { diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.xml index ed129a534adb77e2686f91a5dbd3723e39dbe7a4..3cdc372ff2c646d006e8627ae0cd100bdb1ffd8e 100644 --- a/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.xml +++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Page/Adminhtml/AdminCache.xml @@ -10,6 +10,7 @@ <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator="#messages .messages" strategy="css selector"/> <block name="actionsBlock" class="Magento\Backend\Test\Block\Cache" locator="div.page-actions" strategy="css selector"/> <block name="additionalBlock" class="Magento\Backend\Test\Block\Cache\Additional" locator="div.additional-cache-management" strategy="css selector"/> + <block name="gridBlock" class="Magento\Backend\Test\Block\Cache\Grid" locator="div#cache_grid" strategy="css selector"/> <block name="modalBlock" class="Magento\Ui\Test\Block\Adminhtml\Modal" locator="._show[data-role=modal]" strategy="css selector"/> </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml index 1654b19df2435385286d09db719cb4314f15fdba..530018bf81c4741e9785564800a14f39a3397ac1 100644 --- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/CreateBundleProductEntityTest.xml @@ -129,7 +129,6 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> <constraint name="Magento\Bundle\Test\Constraint\AssertBundleProductPage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> - <constraint name="Magento\Bundle\Test\Constraint\AssertGroupedPriceOnBundleProductPage" /> <constraint name="Magento\Bundle\Test\Constraint\AssertBundleItemsOnProductPage" /> <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceView" /> <constraint name="Magento\Bundle\Test\Constraint\AssertBundlePriceType" /> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.php index 4a1ba08b8565e73dd84123bdd8f363c5b5cd794f..6af0253e217e3f51e47e9a5b4021869037bb00c2 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/CategoryForm.php @@ -7,37 +7,56 @@ namespace Magento\Catalog\Test\Block\Adminhtml\Category\Edit; use Magento\Backend\Test\Block\Widget\FormTabs; -use Magento\Mtf\Factory\Factory; +use Magento\Mtf\Client\Element\SimpleElement; +use Magento\Mtf\Client\Locator; +use Magento\Mtf\Fixture\FixtureInterface; /** - * Class CategoryForm - * Category container block + * Category container block. */ class CategoryForm extends FormTabs { /** - * Save button + * Default sore switcher block locator. * * @var string */ - protected $saveButton = '[data-ui-id=category-edit-form-save-button]'; + protected $storeSwitcherBlock = '.store-switcher'; /** - * Category Products grid + * Dropdown block locator. * * @var string */ - protected $productsGridBlock = '#catalog_category_products'; + protected $dropdownBlock = '.dropdown'; /** - * Get Category edit form + * Selector for confirm. * - * @return \Magento\Catalog\Test\Block\Adminhtml\Category\Tab\ProductGrid + * @var string + */ + protected $confirmModal = '.confirm._show[data-role=modal]'; + + /** + * Fill form with tabs. + * + * @param FixtureInterface $fixture + * @param SimpleElement|null $element + * @return FormTabs */ - public function getCategoryProductsGrid() + public function fill(FixtureInterface $fixture, SimpleElement $element = null) { - return Factory::getBlockFactory()->getMagentoCatalogAdminhtmlCategoryTabProductGrid( - $this->_rootElement->find($this->productsGridBlock) - ); + $tabs = $this->getFieldsByTabs($fixture); + if ($fixture->hasData('store_id')) { + $store = $fixture->getStoreId(); + $storeSwitcherBlock = $this->browser->find($this->storeSwitcherBlock); + $storeSwitcherBlock->find($this->dropdownBlock, Locator::SELECTOR_CSS, 'liselectstore')->setValue($store); + $element = $this->browser->find($this->confirmModal); + /** @var \Magento\Ui\Test\Block\Adminhtml\Modal $modal */ + $modal = $this->blockFactory->create('Magento\Ui\Test\Block\Adminhtml\Modal', ['element' => $element]); + $modal->acceptAlert(); + } + + return $this->fillTabs($tabs, $element); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/PageActions.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/PageActions.php index 4c34c902a1689508e77de4266a8a323c31ba2f13..4389411c00650ec202aa49418c3d2d22f3f85eb6 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/PageActions.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Edit/PageActions.php @@ -9,8 +9,7 @@ namespace Magento\Catalog\Test\Block\Adminhtml\Category\Edit; use Magento\Backend\Test\Block\FormPageActions; /** - * Class PageActions - * Category page actions + * Category page actions. */ class PageActions extends FormPageActions { diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab.php index 8b7671c7d719406d0e7b25c82bab846daa3dcdd2..b86fc8430b45e4610d9413f6c5a537968295e7cb 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab.php @@ -6,16 +6,23 @@ namespace Magento\Catalog\Test\Block\Adminhtml\Product\Edit; +use Magento\Catalog\Test\Block\Adminhtml\Product\Edit\AdvancedPricingTab\OptionTier; use Magento\Mtf\Client\Element\SimpleElement; /** - * Class AdvancedPricingTab - * Product advanced pricing tab + * Product advanced pricing tab. */ class AdvancedPricingTab extends ProductTab { /** - * Class name 'Subform' of the main tab form + * Locator for Tier Price block. + * + * @var string + */ + protected $tierPrice = '#attribute-tier_price-container'; + + /** + * Class name 'Subform' of the main tab form. * * @var array */ @@ -24,7 +31,7 @@ class AdvancedPricingTab extends ProductTab ]; /** - * Fill 'Advanced price' product form on tab + * Fill 'Advanced price' product form on tab. * * @param array $fields * @param SimpleElement|null $element @@ -61,7 +68,7 @@ class AdvancedPricingTab extends ProductTab } /** - * Get data of tab + * Get data of tab. * * @param array|null $fields * @param SimpleElement|null $element @@ -96,4 +103,17 @@ class AdvancedPricingTab extends ProductTab return $formData; } + + /** + * Get Tier Price block. + * + * @return OptionTier + */ + public function getTierPriceForm() + { + return $this->blockFactory->create( + 'Magento\Catalog\Test\Block\Adminhtml\Product\Edit\AdvancedPricingTab\OptionTier', + ['element' => $this->_rootElement->find($this->tierPrice)] + ); + } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab/OptionTier.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab/OptionTier.php index 7dc90c88899bb8f1318dd7141c257c1aafc6eef8..53417ecace24bbd18dbfbe4b34862699f1019407 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab/OptionTier.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/AdvancedPricingTab/OptionTier.php @@ -7,23 +7,31 @@ namespace Magento\Catalog\Test\Block\Adminhtml\Product\Edit\AdvancedPricingTab; use Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\Options\AbstractOptions; +use Magento\Customer\Test\Fixture\CustomerGroup; use Magento\Mtf\Client\Element\SimpleElement; +use Magento\Mtf\Client\Locator; /** - * Class OptionTier - * Form 'Tier prices' on the 'Advanced Pricing' tab + * Form 'Tier prices' on the 'Advanced Pricing' tab. */ class OptionTier extends AbstractOptions { /** - * 'Add Tier' button selector + * 'Add Tier' button selector. * * @var string */ protected $buttonFormLocator = "#tiers_table tfoot button"; /** - * Fill product form 'Tier price' + * Locator for Customer Group element. + * + * @var string + */ + protected $customerGroup = '//*[contains(@name, "[cust_group]")]'; + + /** + * Fill product form 'Tier price'. * * @param array $fields * @param SimpleElement $element @@ -34,4 +42,18 @@ class OptionTier extends AbstractOptions $this->_rootElement->find($this->buttonFormLocator)->click(); return parent::fillOptions($fields, $element); } + + /** + * Check whether Customer Group is visible. + * + * @param CustomerGroup $customerGroup + * @return bool + */ + public function isVisibleCustomerGroup(CustomerGroup $customerGroup) + { + $this->_rootElement->find($this->buttonFormLocator)->click(); + + $options = $this->_rootElement->find($this->customerGroup, Locator::SELECTOR_XPATH)->getText(); + return false !== strpos($options, $customerGroup->getCustomerGroupCode()); + } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Compare/Sidebar.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Compare/Sidebar.php index eec1be1fcf543149fbcc08a034fa02628c4065c2..ea1a27a09e26292c9a81f23f6cb9f7f07e4c407e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Compare/Sidebar.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Compare/Sidebar.php @@ -32,13 +32,6 @@ class Sidebar extends ListCompare */ protected $clearAll = '#compare-clear-all'; - /** - * Selector for alert. - * - * @var string - */ - protected $alertModal = '._show[data-role=modal]'; - /** * Get compare products block content. * @@ -86,9 +79,6 @@ class Sidebar extends ListCompare } ); $this->_rootElement->find($this->clearAll)->click(); - $element = $this->browser->find($this->alertModal); - /** @var \Magento\Ui\Test\Block\Adminhtml\Modal $modal */ - $modal = $this->blockFactory->create('Magento\Ui\Test\Block\Adminhtml\Modal', ['element' => $element]); - $modal->acceptAlert(); + $this->browser->acceptAlert(); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Grouped/AssociatedProducts/Search/Grid.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Grouped/AssociatedProducts/Search/Grid.php index e8dc06003db01756a30cd7a4be1c7565e0be7557..fb9acfa2da5da610ed8b7719255bf4c4b27b04ce 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Grouped/AssociatedProducts/Search/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/Grouped/AssociatedProducts/Search/Grid.php @@ -9,19 +9,26 @@ namespace Magento\Catalog\Test\Block\Product\Grouped\AssociatedProducts\Search; use Magento\Backend\Test\Block\Widget\Grid as GridInterface; /** - * Class Grid + * Associated products grid. */ class Grid extends GridInterface { /** - * 'Add Selected Products' button + * 'Add Selected Products' button. * * @var string */ protected $addProducts = 'button.add'; /** - * Filters array mapping + * An element locator which allows to select entities in grid. + * + * @var string + */ + protected $selectItem = '[data-column=entity_id] input'; + + /** + * Filters array mapping. * * @var array */ @@ -35,18 +42,7 @@ class Grid extends GridInterface ]; /** - * Initialize block elements - * - * @return void - */ - protected function _init() - { - parent::_init(); - $this->selectItem = "[data-column=entity_id] input"; - } - - /** - * Press 'Add Selected Products' button + * Press 'Add Selected Products' button. * * @return void */ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryBreadcrumbs.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryBreadcrumbs.php new file mode 100644 index 0000000000000000000000000000000000000000..f85d76989b0c5d555f791726b7728e127116170f --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryBreadcrumbs.php @@ -0,0 +1,115 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Catalog\Test\Constraint; + +use Magento\Catalog\Test\Fixture\Category; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that displayed breadcrumbs on category page equals to passed from fixture. + */ +class AssertCategoryBreadcrumbs extends AbstractConstraint +{ + /** + * Name of home page. + */ + const HOME_PAGE = 'Home'; + + /** + * Browser instance. + * + * @var BrowserInterface + */ + protected $browser; + + /** + * Assert that displayed breadcrumbs on category page equals to passed from fixture. + * + * @param BrowserInterface $browser + * @param Category $category + * @param CatalogCategoryView $catalogCategoryView + * @return void + */ + public function processAssert( + BrowserInterface $browser, + Category $category, + CatalogCategoryView $catalogCategoryView + ) { + $this->browser = $browser; + $this->openCategory($category); + + $breadcrumbs = $this->getBreadcrumbs($category); + $pageBreadcrumbs = $catalogCategoryView->getBreadcrumbs()->getText(); + \PHPUnit_Framework_Assert::assertEquals( + $breadcrumbs, + $pageBreadcrumbs, + 'Wrong breadcrumbs of category page.' + . "\nExpected: " . $breadcrumbs + . "\nActual: " . $pageBreadcrumbs + ); + } + + /** + * Open category. + * + * @param Category $category + * @return void + */ + protected function openCategory(Category $category) + { + $categoryUrlKey = []; + + while ($category) { + $categoryUrlKey[] = $category->hasData('url_key') + ? strtolower($category->getUrlKey()) + : trim(strtolower(preg_replace('#[^0-9a-z%]+#i', '-', $category->getName())), '-'); + + $category = $category->getDataFieldConfig('parent_id')['source']->getParentCategory(); + if ($category !== null && 1 == $category->getParentId()) { + $category = null; + } + } + $categoryUrlKey = $_ENV['app_frontend_url'] . implode('/', array_reverse($categoryUrlKey)) . '.html'; + + $this->browser->open($categoryUrlKey); + } + + /** + * Prepare and return category breadcrumbs. + * + * @param Category $category + * @return string + */ + protected function getBreadcrumbs(Category $category) + { + $breadcrumbs = []; + + while ($category) { + $breadcrumbs[] = $category->getName(); + + $category = $category->getDataFieldConfig('parent_id')['source']->getParentCategory(); + if ($category !== null && 1 == $category->getParentId()) { + $category = null; + } + } + $breadcrumbs[] = self::HOME_PAGE; + + return implode(' ', array_reverse($breadcrumbs)); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Breadcrumbs on category page equals to passed from fixture.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php index def6490e3bf2734e78252c8fffa7c51181114626..992fdc6c76702b19ca178e4d4b2f67653b9d6d0e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryPage.php @@ -19,7 +19,7 @@ use Magento\Mtf\Fixture\FixtureFactory; class AssertCategoryPage extends AbstractConstraint { /** - * CMS Block display mode + * CMS Block display mode. * * @var array */ @@ -29,14 +29,14 @@ class AssertCategoryPage extends AbstractConstraint ]; /** - * Category view page + * Category view page. * * @var CatalogCategoryView */ protected $categoryViewPage; /** - * Browser instance + * Browser instance. * * @var BrowserInterface */ @@ -68,6 +68,8 @@ class AssertCategoryPage extends AbstractConstraint } /** + * Prepare comparison data. + * * @param FixtureFactory $fixtureFactory * @param Category $category * @param Category $initialCategory @@ -92,21 +94,30 @@ class AssertCategoryPage extends AbstractConstraint } /** - * Get category url to open + * Get category url to open. * * @param Category $category * @return string */ protected function getCategoryUrl(Category $category) { - $categoryUrlKey = $category->hasData('url_key') - ? strtolower($category->getUrlKey()) - : trim(strtolower(preg_replace('#[^0-9a-z%]+#i', '-', $category->getName())), '-'); - return $_ENV['app_frontend_url'] . $categoryUrlKey . '.html'; + $categoryUrlKey = []; + while ($category) { + $categoryUrlKey[] = $category->hasData('url_key') + ? strtolower($category->getUrlKey()) + : trim(strtolower(preg_replace('#[^0-9a-z%]+#i', '-', $category->getName())), '-'); + + $category = $category->getDataFieldConfig('parent_id')['source']->getParentCategory(); + if (1 == $category->getParentId()) { + $category = null; + } + } + + return $_ENV['app_frontend_url'] . implode('/', array_reverse($categoryUrlKey)) . '.html'; } /** - * Assert category general information + * Assert category general information. * * @param Category $category * @param array $categoryData @@ -147,7 +158,7 @@ class AssertCategoryPage extends AbstractConstraint } /** - * Assert category display settings + * Assert category display settings. * * @param Category $category * @param array $categoryData diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryWithCustomStoreOnFrontend.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryWithCustomStoreOnFrontend.php new file mode 100644 index 0000000000000000000000000000000000000000..a448fcaa3f18d9e6fe8e70bb1c71f1ae0ba185a0 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertCategoryWithCustomStoreOnFrontend.php @@ -0,0 +1,66 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Catalog\Test\Constraint; + +use Magento\Catalog\Test\Fixture\Category; +use Magento\Catalog\Test\Page\Category\CatalogCategoryView; +use Magento\Mtf\Client\BrowserInterface; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Cms\Test\Page\CmsIndex; + +/** + * Assert that category name is different on different store view. + */ +class AssertCategoryWithCustomStoreOnFrontend extends AbstractConstraint +{ + /** + * Assert that category name is different on different store view. + * + * @param BrowserInterface $browser + * @param CatalogCategoryView $categoryView + * @param Category $category + * @param Category $initialCategory + * @param CmsIndex $cmsIndex + * @return void + */ + public function processAssert( + BrowserInterface $browser, + CatalogCategoryView $categoryView, + Category $category, + Category $initialCategory, + CmsIndex $cmsIndex + ) { + $cmsIndex->open(); + $cmsIndex->getLinksBlock()->waitWelcomeMessage(); + $browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html'); + \PHPUnit_Framework_Assert::assertEquals( + $initialCategory->getName(), + $categoryView->getTitleBlock()->getTitle(), + 'Wrong category name is displayed for default store.' + ); + + $store = $category->getDataFieldConfig('store_id')['source']->store->getName(); + $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store); + $cmsIndex->getLinksBlock()->waitWelcomeMessage(); + $browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html'); + \PHPUnit_Framework_Assert::assertEquals( + $category->getName(), + $categoryView->getTitleBlock()->getTitle(), + 'Wrong category name is displayed for ' . $store + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Category name is different on different store view.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml index 2c5e23a9099b79bee01f5aee1d92ff8440029b1c..975ae3ed0e70dfaaed4f4fcbd69acbd541c840a5 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category.xml @@ -41,5 +41,6 @@ <field name="landing_page" group="display_setting" source="Magento\Catalog\Test\Fixture\Category\LandingPage" /> <field name="display_mode" group="display_setting" /> <field name="category_products" group="category_products" source="Magento\Catalog\Test\Fixture\Category\CategoryProducts" /> + <field name="store_id" group="null" source="Magento\Catalog\Test\Fixture\Category\StoreId" /> </fixture> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/StoreId.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/StoreId.php new file mode 100644 index 0000000000000000000000000000000000000000..981a7499f5835e004a5981db6c91cc15ffd3df40 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/Category/StoreId.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Catalog\Test\Fixture\Category; + +use Magento\Mtf\Fixture\DataSource; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Store\Test\Fixture\Store; +use Magento\Store\Test\Fixture\StoreGroup; + +/** + * Category store id scope. + */ +class StoreId extends DataSource +{ + /** + * Store fixture. + * + * @var Store + */ + public $store; + + /** + * @constructor + * @param FixtureFactory $fixtureFactory + * @param array $params + * @param array $data [optional] + */ + public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = []) + { + $this->params = $params; + + if (isset($data['dataset'])) { + $store = $fixtureFactory->createByCode('store', $data); + /** @var Store $store */ + if (!$store->getStoreId()) { + $store->persist(); + } + $this->store = $store; + $this->data = $store->getGroupId() . '/' . $store->getName(); + } else { + $this->data = $data; + } + } + + /** + * Return Store fixture. + * + * @return Store + */ + public function getStore() + { + return $this->store; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductAttribute/Curl.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductAttribute/Curl.php index 169eb6805b3d38d984a20863933a6cc3f33d0272..3a2520083bc2077130053e4dd789ebf007b94269 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductAttribute/Curl.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Handler/CatalogProductAttribute/Curl.php @@ -58,6 +58,9 @@ class Curl extends AbstractCurl implements CatalogProductAttributeInterface */ public function persist(FixtureInterface $fixture = null) { + if ($fixture->hasData('attribute_id')) { + return ['attribute_id' => $fixture->getData('attribute_id')]; + } $data = $this->replaceMappingData($fixture->getData()); $data['frontend_label'] = [0 => $data['frontend_label']]; diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategory.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategory.php index d79e8a0823236362443b37c1bec76d6cb4ccb094..ec71bb91ffa152fbb5e2384f3f349a917752c38d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategory.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategory.php @@ -50,10 +50,12 @@ class CatalogCategory extends Page /** * Init page. Set page url. + * + * @return void */ - protected function _init() + protected function initUrl() { - $this->_url = $_ENV['app_backend_url'] . self::MCA; + $this->url = $_ENV['app_backend_url'] . self::MCA; } /** @@ -78,7 +80,7 @@ class CatalogCategory extends Page public function getFormBlock() { return Factory::getBlockFactory()->getMagentoCatalogAdminhtmlCategoryEditCategoryForm( - $this->_browser->find($this->formBlock, Locator::SELECTOR_CSS) + $this->browser->find($this->formBlock, Locator::SELECTOR_CSS) ); } @@ -90,7 +92,7 @@ class CatalogCategory extends Page public function getTreeBlock() { return Factory::getBlockFactory()->getMagentoCatalogAdminhtmlCategoryTree( - $this->_browser->find($this->treeBlock, Locator::SELECTOR_CSS, 'tree'), + $this->browser->find($this->treeBlock, Locator::SELECTOR_CSS, 'tree'), $this->getTemplateBlock() ); } @@ -103,7 +105,7 @@ class CatalogCategory extends Page public function getMessagesBlock() { return Factory::getBlockFactory()->getMagentoBackendMessages( - $this->_browser->find($this->messagesBlock, Locator::SELECTOR_CSS) + $this->browser->find($this->messagesBlock, Locator::SELECTOR_CSS) ); } @@ -115,7 +117,7 @@ class CatalogCategory extends Page public function getTemplateBlock() { return Factory::getBlockFactory()->getMagentoBackendTemplate( - $this->_browser->find($this->templateBlock, Locator::SELECTOR_CSS) + $this->browser->find($this->templateBlock, Locator::SELECTOR_CSS) ); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryEdit.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryEdit.php index 110b175a7d09edbf55d2195cae3799342f59b441..6a2938edc0b96f6840227b90bc7d7927a757bcdf 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryEdit.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryEdit.php @@ -61,9 +61,9 @@ class CatalogCategoryEdit extends Page * * @return void */ - protected function _init() + protected function initUrl() { - $this->_url = $_ENV['app_backend_url'] . self::MCA; + $this->url = $_ENV['app_backend_url'] . self::MCA; } /** @@ -88,7 +88,7 @@ class CatalogCategoryEdit extends Page public function getFormBlock() { return Factory::getBlockFactory()->getMagentoCatalogAdminhtmlCategoryEditCategoryForm( - $this->_browser->find($this->formBlock, Locator::SELECTOR_CSS) + $this->browser->find($this->formBlock, Locator::SELECTOR_CSS) ); } @@ -100,7 +100,7 @@ class CatalogCategoryEdit extends Page public function getTreeBlock() { return Factory::getBlockFactory()->getMagentoCatalogAdminhtmlCategoryTree( - $this->_browser->find($this->treeBlock, Locator::SELECTOR_CSS), + $this->browser->find($this->treeBlock, Locator::SELECTOR_CSS), $this->getTemplateBlock() ); } @@ -113,7 +113,7 @@ class CatalogCategoryEdit extends Page public function getMessagesBlock() { return Factory::getBlockFactory()->getMagentoBackendMessages( - $this->_browser->find($this->messagesBlock, Locator::SELECTOR_CSS) + $this->browser->find($this->messagesBlock, Locator::SELECTOR_CSS) ); } @@ -125,7 +125,7 @@ class CatalogCategoryEdit extends Page public function getTemplateBlock() { return Factory::getBlockFactory()->getMagentoBackendTemplate( - $this->_browser->find($this->templateBlock, Locator::SELECTOR_CSS) + $this->browser->find($this->templateBlock, Locator::SELECTOR_CSS) ); } @@ -137,7 +137,7 @@ class CatalogCategoryEdit extends Page public function getPageActionsBlock() { return Factory::getBlockFactory()->getMagentoBackendFormPageActions( - $this->_browser->find($this->pageActionsBlock) + $this->browser->find($this->pageActionsBlock) ); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml index 45839712e35c673123d36d46d33b1aaa8b869979..730724269f29e3d1135170eff024443d09eb6528 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml @@ -8,6 +8,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd"> <page name="CatalogCategoryView" area="Category" mca="catalog/category/view" module="Magento_Catalog"> <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper h1.page-title .base" strategy="css selector"/> + <block name="breadcrumbs" class="Magento\Theme\Test\Block\Html\Breadcrumbs" locator=".breadcrumbs" strategy="css selector"/> <block name="widgetView" class="Magento\Widget\Test\Block\WidgetView" locator=".widget" strategy="css selector"/> <block name="viewBlock" class="Magento\Catalog\Test\Block\Category\View" locator="#maincontent" strategy="css selector"/> <block name="listProductBlock" class="Magento\Catalog\Test\Block\Product\ListProduct" locator=".products.wrapper.grid" strategy="css selector"/> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute.xml index 9ef0bcfd31196057111439f69587c7f090dc53b0..83a4e691faf571985168d2ae572460d9ae889b13 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute.xml @@ -13,6 +13,46 @@ <field name="is_required" xsi:type="string">No</field> </dataset> + <dataset name="quantity_and_stock_status"> + <field name="attribute_id" xsi:type="number">113</field> + <field name="frontend_label" xsi:type="string">Quantity</field> + <field name="attribute_code" xsi:type="string">quantity_and_stock_status</field> + <field name="frontend_input" xsi:type="string">Dropdown</field> + <field name="is_required" xsi:type="string">No</field> + <field name="options" xsi:type="array"> + <item name="0" xsi:type="array"> + <item name="is_default" xsi:type="string">Yes</item> + <item name="admin" xsi:type="string">In Stock</item> + <item name="view" xsi:type="string">In Stock</item> + </item> + <item name="1" xsi:type="array"> + <item name="is_default" xsi:type="string">No</item> + <item name="admin" xsi:type="string">Out of Stock</item> + <item name="view" xsi:type="string">Out of Stock</item> + </item> + </field> + </dataset> + + <dataset name="tax_class_id"> + <field name="attribute_id" xsi:type="number">172</field> + <field name="frontend_label" xsi:type="string">Tax Class</field> + <field name="attribute_code" xsi:type="string">tax_class_id</field> + <field name="frontend_input" xsi:type="string">Dropdown</field> + <field name="is_required" xsi:type="string">No</field> + <field name="options" xsi:type="array"> + <item name="0" xsi:type="array"> + <item name="is_default" xsi:type="string">No</item> + <item name="admin" xsi:type="string">None</item> + <item name="view" xsi:type="string">None</item> + </item> + <item name="1" xsi:type="array"> + <item name="is_default" xsi:type="string">Yes</item> + <item name="admin" xsi:type="string">Taxable Goods</item> + <item name="view" xsi:type="string">Taxable Goods</item> + </item> + </field> + </dataset> + <dataset name="attribute_type_text_field"> <field name="frontend_label" xsi:type="string">attribute_text%isolation%</field> <field name="attribute_code" xsi:type="string">attribute_text%isolation%</field> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml index 6be4a2275e35365d10655a382d0fdb93b265f618..8a2df347d213ab64af57163d6f9a4bf0c4bec3b0 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml @@ -42,6 +42,7 @@ <field name="name" xsi:type="string">Product \'!@#$%^&*()+:;\\|}{][?=-~` %isolation%</field> <field name="sku" xsi:type="string">sku_simple_product_%isolation%</field> <field name="is_virtual" xsi:type="string">No</field> + <field name="product_has_weight" xsi:type="string">Yes</field> <field name="weight" xsi:type="string">1</field> <field name="quantity_and_stock_status" xsi:type="array"> <item name="qty" xsi:type="string">25</item> @@ -73,6 +74,7 @@ <item name="qty" xsi:type="string">25</item> <item name="is_in_stock" xsi:type="string">In Stock</item> </field> + <field name="product_has_weight" xsi:type="string">Yes</field> <field name="weight" xsi:type="string">1</field> <field name="price" xsi:type="array"> <item name="value" xsi:type="string">560</item> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Category.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Category.xml index f621b1c38c1693e721fdba38a6dd362173ace094..9cdfded386641ff0a5d20d1a9ed50aee4349282d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Category.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/Category.xml @@ -61,5 +61,15 @@ <field name="is_active" xsi:type="string">Yes</field> <field name="include_in_menu" xsi:type="string">Yes</field> </dataset> + + <dataset name="two_nested_category"> + <field name="name" xsi:type="string">Category%isolation%</field> + <field name="url_key" xsi:type="string">category-%isolation%</field> + <field name="parent_id" xsi:type="array"> + <item name="dataset" xsi:type="string">default_subcategory</item> + </field> + <field name="is_active" xsi:type="string">Yes</field> + <field name="include_in_menu" xsi:type="string">Yes</field> + </dataset> </repository> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml index 555443367b77b8e3b043c0c97abc349cb32c9818..0c2a2bf3e4be4f0ea15de4f023817080a0cd3c5c 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/CreateCategoryEntityTest.xml @@ -149,5 +149,17 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForAssignedProducts" /> </variation> + <variation name="CreateCategoryEntityTestVariation10"> + <data name="description" xsi:type="string">Create category with three nesting</data> + <data name="addCategory" xsi:type="string">addSubcategory</data> + <data name="category/data/parent_id/dataset" xsi:type="string">two_nested_category</data> + <data name="category/data/name" xsi:type="string">Category%isolation%</data> + <data name="category/data/url_key" xsi:type="string">Category%isolation%</data> + <data name="category/data/is_active" xsi:type="string">Yes</data> + <data name="category/data/description" xsi:type="string">Category Required</data> + <data name="category/data/available_product_listing_config" xsi:type="string">Yes</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryBreadcrumbs" /> + </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.xml index 2c108c67f39758a85b6b8aaff63250f3ca6b1e8d..a28b5e16ab25d676e779dfc30d46ea93ad2393f2 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/UpdateCategoryEntityTest.xml @@ -46,5 +46,11 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryForm" /> </variation> + <variation name="UpdateCategoryEntityTestVariation4" summary="Update Category with custom Store View."> + <data name="category/data/store_id/dataset" xsi:type="string">custom</data> + <data name="category/data/name" xsi:type="string">Category %isolation%</data> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategorySaveMessage" /> + <constraint name="Magento\Catalog\Test\Constraint\AssertCategoryWithCustomStoreOnFrontend" /> + </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml index f46eff7dac4b8327c03897fbc0a3cbf41d78c166..97aee8c72ce214831cfb85b0cf9364031e8b3060 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest.xml @@ -271,7 +271,6 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductInStock" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" /> </variation> <variation name="CreateSimpleProductEntityTestVariation16"> <data name="description" xsi:type="string">Create product with tax class and check absent special price</data> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.xml index 395b421268e0bf96b0be6b9210fc3522e4e8ce54..dc3aadb36e7f531a80690bd9be70883b2f792d75 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateVirtualProductEntityTest.xml @@ -76,7 +76,6 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductCustomOptionsOnProductPage" /> </variation> <variation name="CreateVirtualProductEntityTestVariation6"> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.xml index 3c3dda5716404d0881365783bb907a9536359bdf..b967e6f87b9f6aef7248b117e07ec8da47d7c4cb 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/UpdateVirtualProductEntityTest.xml @@ -118,7 +118,6 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductVisibleInCategory" /> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> </variation> @@ -210,7 +209,6 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductForm" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSpecialPriceOnProductPage" /> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductTierPriceOnProductPage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductInCategory" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductSearchableBySku" /> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml index 03cf25cfa8abe5a3886f025398dd4427231b3fb6..b945d770fe82d5992ca0a769a3da02da2da2a10d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml @@ -58,6 +58,7 @@ <data name="productAttribute/data/used_for_sort_by" xsi:type="string">Yes</data> <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" /> <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" /> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchProductByAttribute" /> <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUsedInSortOnFrontend" /> <constraint name="Magento\CatalogRule\Test\Constraint\AssertProductAttributeIsUsedPromoRules" /> @@ -69,8 +70,11 @@ <data name="productAttribute/data/is_required" xsi:type="string">Yes</data> <data name="productAttribute/data/attribute_code" xsi:type="string">attr_yesno_%isolation%</data> <data name="productAttribute/data/is_global" xsi:type="string">Global</data> + <data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data> + <data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> <data name="productAttribute/data/default_value_yesno" xsi:type="string">No</data> <data name="productAttribute/data/manage_frontend_label" xsi:type="string">Yes/No_Global</data> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchProductByAttribute" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" /> <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" /> <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" /> @@ -100,6 +104,7 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsComparable" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterable" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsFilterableInSearch" /> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchProductByAttribute" /> <constraint name="Magento\CatalogSearch\Test\Constraint\AssertAttributeSearchableByLabel" /> <constraint name="Magento\Catalog\Test\Constraint\AssertAttributeOptionsOnProductForm" /> </variation> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.php index 8429c349f0cfe3ad3ffd6e16d33ae27cb665fe05..755ff5eb886e3548425a84dec20644430f4b9330 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.php @@ -8,8 +8,10 @@ namespace Magento\Catalog\Test\TestCase\ProductAttribute; use Magento\Catalog\Test\Fixture\CatalogAttributeSet; use Magento\Catalog\Test\Fixture\CatalogProductAttribute; +use Magento\Catalog\Test\Fixture\CatalogProductSimple; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeIndex; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductAttributeNew; +use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\TestCase\Injectable; /** @@ -36,6 +38,24 @@ class UpdateProductAttributeEntityTest extends Injectable const DOMAIN = 'MX'; /* end tags */ + /** + * Factory for fixtures. + * + * @var FixtureFactory + */ + protected $fixtureFactory; + + /** + * Prepare data. + * + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function __prepare(FixtureFactory $fixtureFactory) + { + $this->fixtureFactory = $fixtureFactory; + } + /** * Run UpdateProductAttributeEntity test * @@ -44,14 +64,16 @@ class UpdateProductAttributeEntityTest extends Injectable * @param CatalogAttributeSet $productTemplate * @param CatalogProductAttributeIndex $attributeIndex * @param CatalogProductAttributeNew $attributeNew - * @return void + * @param CatalogProductSimple $productSimple + * @return array */ public function testUpdateProductAttribute( CatalogProductAttribute $productAttributeOriginal, CatalogProductAttribute $attribute, CatalogAttributeSet $productTemplate, CatalogProductAttributeIndex $attributeIndex, - CatalogProductAttributeNew $attributeNew + CatalogProductAttributeNew $attributeNew, + CatalogProductSimple $productSimple ) { //Precondition $productTemplate->persist(); @@ -66,5 +88,42 @@ class UpdateProductAttributeEntityTest extends Injectable $attributeIndex->getGrid()->searchAndOpen($filter); $attributeNew->getAttributeForm()->fill($attribute); $attributeNew->getPageActions()->save(); + $attribute = $this->prepareAttribute($attribute, $productAttributeOriginal); + $productSimple->persist(); + + return ['product' => $this->prepareProduct($productSimple, $attribute, $productTemplate)]; + } + + /** + * Prepare product data. + * + * @param CatalogProductSimple $product + * @param CatalogProductAttribute $attribute + * @param CatalogAttributeSet $productTemplate + * @return CatalogProductSimple + */ + protected function prepareProduct($product, $attribute, $productTemplate) + { + $data = [ + 'attribute_set_id' => ['attribute_set' => $productTemplate], + 'custom_attribute' => $attribute + ]; + $data = array_merge($data, $product->getData()); + + return $this->fixtureFactory->createByCode('catalogProductSimple', ['data' => $data]); + } + + /** + * Prepare attribute data. + * + * @param CatalogProductAttribute $attribute + * @param CatalogProductAttribute $productAttributeOriginal + * @return CatalogProductAttribute + */ + protected function prepareAttribute($attribute, $productAttributeOriginal) + { + $attributeData = array_merge($attribute->getData(), $productAttributeOriginal->getData()); + + return $this->fixtureFactory->createByCode('catalogProductAttribute', ['data' => $attributeData]); } } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml index 11b2cbcd6b5c08205f747562fae7f395e954edc5..63dabf015796e34f589b4ac24a2ac9188da26507 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/UpdateProductAttributeEntityTest.xml @@ -34,6 +34,7 @@ <data name="attribute/data/options/dataset" xsi:type="string">default</data> <data name="attribute/data/is_required" xsi:type="string">Yes</data> <data name="attribute/data/is_global" xsi:type="string">Global</data> + <data name="attribute/data/default_value_text" xsi:type="string">attribute_edited%isolation%</data> <data name="attribute/data/is_unique" xsi:type="string">Yes</data> <data name="attribute/data/is_searchable" xsi:type="string">Yes</data> <data name="attribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> @@ -49,5 +50,16 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeSaveMessage" /> <constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" /> </variation> + <variation name="UpdateProductAttributeEntityTestVariation3"> + <data name="productTemplate/dataset" xsi:type="string">custom_attribute_set</data> + <data name="productAttributeOriginal/dataset" xsi:type="string">tax_class_id</data> + <data name="attribute/data/is_searchable" xsi:type="string">Yes</data> + <data name="attribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data> + <data name="cacheTags" xsi:type="array"> + <item name="0" xsi:type="string">FPC</item> + </data> + <constraint name="Magento\Backend\Test\Constraint\AssertCacheIsRefreshableAndInvalidated" /> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchProductByAttribute" /> + </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/AddAttributeToProductTemplateStep.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/AddAttributeToProductTemplateStep.php index e022906b29b18a8f6bb1d651fa717fff2a88666a..3d5aa19186cec9f6a342ae492fd60df73e1b6f38 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/AddAttributeToProductTemplateStep.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestStep/AddAttributeToProductTemplateStep.php @@ -8,6 +8,8 @@ namespace Magento\Catalog\Test\TestStep; use Magento\Catalog\Test\Fixture\CatalogAttributeSet; use Magento\Catalog\Test\Fixture\CatalogProductAttribute; +use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit; +use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductSetEdit; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductSetIndex; use Magento\Mtf\Fixture\FixtureFactory; @@ -46,6 +48,20 @@ class AddAttributeToProductTemplateStep implements TestStepInterface */ protected $productTemplate; + /** + * Catalog Product Index page. + * + * @var CatalogProductIndex + */ + protected $catalogProductIndex; + + /** + * Catalog Product Edit page. + * + * @var CatalogProductEdit + */ + protected $catalogProductEdit; + /** * @constructor * @param CatalogProductSetIndex $catalogProductSetIndex @@ -53,19 +69,25 @@ class AddAttributeToProductTemplateStep implements TestStepInterface * @param CatalogProductAttribute $attribute * @param CatalogAttributeSet $productTemplate * @param FixtureFactory $fixtureFactory + * @param CatalogProductIndex $catalogProductIndex + * @param CatalogProductEdit $catalogProductEdit */ public function __construct( CatalogProductSetIndex $catalogProductSetIndex, CatalogProductSetEdit $catalogProductSetEdit, CatalogProductAttribute $attribute, CatalogAttributeSet $productTemplate, - FixtureFactory $fixtureFactory + FixtureFactory $fixtureFactory, + CatalogProductIndex $catalogProductIndex, + CatalogProductEdit $catalogProductEdit ) { $this->catalogProductSetIndex = $catalogProductSetIndex; $this->catalogProductSetEdit = $catalogProductSetEdit; $this->attribute = $attribute; $this->productTemplate = $productTemplate; $this->fixtureFactory = $fixtureFactory; + $this->catalogProductIndex = $catalogProductIndex; + $this->catalogProductEdit = $catalogProductEdit; } /** @@ -87,10 +109,14 @@ class AddAttributeToProductTemplateStep implements TestStepInterface 'dataset' => 'product_with_category_with_anchor', 'data' => [ 'attribute_set_id' => ['attribute_set' => $this->productTemplate], + 'custom_attribute' => $this->attribute ], ] ); - $product->persist(); + $this->catalogProductIndex->open()->getGridPageActionBlock()->addProduct('simple'); + $productForm = $this->catalogProductEdit->getProductForm(); + $productForm->fill($product); + $this->catalogProductEdit->getFormPageActions()->save(); return ['product' => $product]; } diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/di.xml index c02f461a875785a48b4312fcd154f2ac302b6e85..92c41c11a06ef9e15ec3f1f2fa85775387f59ee3 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/di.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/etc/di.xml @@ -151,4 +151,9 @@ <argument name="severity" xsi:type="string">high</argument> </arguments> </type> + <type name="Magento\Catalog\Test\Constraint\AssertCategoryWithCustomStoreOnFrontend"> + <arguments> + <argument name="severity" xsi:type="string">low</argument> + </arguments> + </type> </config> diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/PromoForm.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/PromoForm.php index 62b27d30a0738c08ee576c1caae308cc01afade3..2a3f2883b1921f179c3e965da6e76efbf12f4927 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/PromoForm.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/PromoForm.php @@ -8,8 +8,6 @@ namespace Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog\Edit; use Magento\Backend\Test\Block\Widget\FormTabs; use Magento\Mtf\Client\Element\SimpleElement; -use Magento\Mtf\Client\Element; -use Magento\Mtf\Client\Locator; use Magento\Mtf\Fixture\FixtureInterface; /** @@ -17,20 +15,6 @@ use Magento\Mtf\Fixture\FixtureInterface; */ class PromoForm extends FormTabs { - /** - * Add button. - * - * @var string - */ - protected $addButton = '.rule-param-new-child a'; - - /** - * Locator for Customer Segment Conditions. - * - * @var string - */ - protected $conditionFormat = '//*[@id="conditions__1__new_child"]//option[contains(.,"%s")]'; - /** * Fill form with tabs. * @@ -71,19 +55,4 @@ class PromoForm extends FormTabs return $tabs; } - - /** - * Check if attribute is available in conditions. - * - * @param string $name - * @return bool - */ - public function isAttributeInConditions($name) - { - $this->_rootElement->find($this->addButton)->click(); - return $this->_rootElement->find( - sprintf($this->conditionFormat, $name), - Locator::SELECTOR_XPATH - )->isVisible(); - } } diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/PromoForm.xml b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/PromoForm.xml index bf5b8646097f9fdf54a34380908bf83fe1d7ab08..1b940ba5bab4e4f1d33b46c4bdb110b0aa4ec264 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/PromoForm.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/PromoForm.xml @@ -7,7 +7,7 @@ --> <tabs> <rule_information> - <class>\Magento\Backend\Test\Block\Widget\Tab</class> + <class>\Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog\Edit\Tab\RuleInformation</class> <selector>#promo_catalog_edit_tabs_main_section</selector> <strategy>css selector</strategy> <fields> @@ -25,7 +25,7 @@ </fields> </rule_information> <conditions> - <class>\Magento\Backend\Test\Block\Widget\Tab</class> + <class>Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog\Edit\Tab\Conditions</class> <selector>#promo_catalog_edit_tabs_conditions_section</selector> <strategy>css selector</strategy> <fields> diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php index 2ad3ea93baad5a58d2bac8b5abe954c3e26c6046..049cde37bf28979b6a34c01448fe9d70eada3c44 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php @@ -6,42 +6,41 @@ namespace Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog\Edit\Tab; -use Magento\Mtf\Factory\Factory; +use Magento\Catalog\Test\Fixture\CatalogProductAttribute; +use Magento\Mtf\Client\Locator; use Magento\Backend\Test\Block\Widget\Tab; -use Magento\Mtf\Client\Element\SimpleElement; /** - * Class Conditions - * Form Tab for specifying catalog price rule conditions - * + * Form Tab for specifying catalog price rule conditions. */ class Conditions extends Tab { /** - * Rule conditions block selector + * Add button. * * @var string */ - protected $ruleConditions = '#rule_conditions_fieldset'; + protected $addButton = '.rule-param-new-child a'; /** - * Fill condition options + * Locator for specific conditions. * - * @param array $fields - * @param SimpleElement|null $element - * @return void + * @var string */ - public function fillFormTab(array $fields, SimpleElement $element = null) - { - $data = $this->dataMapping($fields); + protected $conditionFormat = '//*[@id="conditions__1__new_child"]//option[contains(.,"%s")]'; - $conditionsBlock = Factory::getBlockFactory()->getMagentoCatalogRuleConditions( - $element->find($this->ruleConditions) - ); - $conditionsBlock->clickAddNew(); - - $conditionsBlock->selectCondition($data['condition_type']['value']); - $conditionsBlock->clickEllipsis(); - $conditionsBlock->selectConditionValue($data['condition_value']['value']); + /** + * Check if attribute is available in conditions. + * + * @param CatalogProductAttribute $attribute + * @return bool + */ + public function isAttributeInConditions(CatalogProductAttribute $attribute) + { + $this->_rootElement->find($this->addButton)->click(); + return $this->_rootElement->find( + sprintf($this->conditionFormat, $attribute->getFrontendLabel()), + Locator::SELECTOR_XPATH + )->isVisible(); } } diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/Tab/RuleInformation.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/Tab/RuleInformation.php new file mode 100644 index 0000000000000000000000000000000000000000..e4beb9105661c5c6c1e8017c7908869e2c1a3b07 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Block/Adminhtml/Promo/Catalog/Edit/Tab/RuleInformation.php @@ -0,0 +1,35 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog\Edit\Tab; + +use Magento\Customer\Test\Fixture\CustomerGroup; +use Magento\Backend\Test\Block\Widget\Tab; + +/** + * Rule Information tab. + */ +class RuleInformation extends Tab +{ + /** + * Locator for Customer Group element. + * + * @var string + */ + protected $customerGroup = '#rule_customer_group_ids'; + + /** + * Check whether Customer Group is visible. + * + * @param CustomerGroup $customerGroup + * @return bool + */ + public function isVisibleCustomerGroup(CustomerGroup $customerGroup) + { + $options = $this->_rootElement->find($this->customerGroup)->getText(); + return false !== strpos($options, $customerGroup->getCustomerGroupCode()); + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php index 7a4e4b605ef4b7c64a09c0ac6d613159167002c2..252a96620ece4f2838e057bd5ec1753d4f6729e1 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleAppliedShoppingCart.php @@ -58,6 +58,7 @@ class AssertCatalogPriceRuleAppliedShoppingCart extends AbstractConstraint . "\nActual: " . $actualPrice . "\n" ); } + $checkoutCartPage->getTotalsBlock()->waitForShippingPriceBlock(); $actualPrices['sub_total'] = $checkoutCartPage->getTotalsBlock()->getSubtotal(); $actualPrices['grand_total'] = $checkoutCartPage->getTotalsBlock()->getGrandTotal(); $expectedPrices['sub_total'] = $cartPrice['sub_total']; diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertProductAttributeIsUsedPromoRules.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertProductAttributeIsUsedPromoRules.php index c0d88eac2804e23a07c77dd111413992d5e1b79b..89b72240318f5d7da2592cd1b2dce55f2ab8baf1 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertProductAttributeIsUsedPromoRules.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertProductAttributeIsUsedPromoRules.php @@ -8,6 +8,7 @@ namespace Magento\CatalogRule\Test\Constraint; use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Catalog\Test\Fixture\CatalogProductAttribute; +use Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog\Edit\Tab\Conditions; use Magento\CatalogRule\Test\Page\Adminhtml\CatalogRuleNew; use Magento\CatalogRule\Test\Page\Adminhtml\CatalogRuleIndex; @@ -33,8 +34,10 @@ class AssertProductAttributeIsUsedPromoRules extends AbstractConstraint $catalogRuleIndex->getGridPageActions()->addNew(); $catalogRuleNew->getEditForm()->openTab('conditions'); + /** @var Conditions $conditionsTab */ + $conditionsTab = $catalogRuleNew->getEditForm()->getTab('conditions'); \PHPUnit_Framework_Assert::assertTrue( - $catalogRuleNew->getEditForm()->isAttributeInConditions($attribute->getFrontendLabel()), + $conditionsTab->isAttributeInConditions($attribute), 'Product attribute can\'t be used on promo rules conditions.' ); } diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestStep/CreateCatalogRuleStep.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestStep/CreateCatalogRuleStep.php index 12412122501f2b81d5105404a0425b707ad14997..8cf299da48d7de0b86f06d397f033bb108ad87a1 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestStep/CreateCatalogRuleStep.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/TestStep/CreateCatalogRuleStep.php @@ -10,19 +10,19 @@ use Magento\Mtf\Fixture\FixtureFactory; use Magento\Mtf\TestStep\TestStepInterface; /** - * Creating catalog rule + * Creating catalog rule. */ class CreateCatalogRuleStep implements TestStepInterface { /** - * Catalog Rule dataset name + * Catalog Rule dataset name. * * @var string */ protected $catalogRule; /** - * Factory for Fixture + * Factory for Fixture. * * @var FixtureFactory */ @@ -36,7 +36,7 @@ class CreateCatalogRuleStep implements TestStepInterface protected $deleteAllCatalogRule; /** - * Preparing step properties + * Preparing step properties. * * @constructor * @param FixtureFactory $fixtureFactory @@ -51,7 +51,7 @@ class CreateCatalogRuleStep implements TestStepInterface } /** - * Create catalog rule + * Create catalog rule. * * @return array */ @@ -76,6 +76,8 @@ class CreateCatalogRuleStep implements TestStepInterface */ public function cleanup() { - $this->deleteAllCatalogRule->run(); + if ($this->catalogRule != '-') { + $this->deleteAllCatalogRule->run(); + } } } diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/CustomAttribute/Date.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/CustomAttribute/Date.php new file mode 100644 index 0000000000000000000000000000000000000000..c4ef4cb26ddea24d7156c0e1a89aff6c153023a5 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/CustomAttribute/Date.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogSearch\Test\Block\Advanced\CustomAttribute; + +use Magento\Mtf\Block\Form as BaseForm; +use Magento\Mtf\Fixture\FixtureInterface; +use Magento\Mtf\Client\Element\SimpleElement; + +/** + * Advanced search form with custom Date attribute. + */ +class Date extends BaseForm +{ + /** + * Selector for date from input. + * + * @var string + */ + protected $dateFromSelector = '[name="%s[from]"]'; + + /** + * Selector for date to input. + * + * @var string + */ + protected $dateToSelector = '[name="%s[to]"]'; + + /** + * Fill the root form. + * + * @param FixtureInterface $fixture + * @param SimpleElement|null $element + * @param array|null $mapping + * @return $this + */ + public function fill(FixtureInterface $fixture, SimpleElement $element = null, array $mapping = null) + { + $data = $fixture->getData(); + + // Mapping + $mapping = $this->dataMapping($data, $mapping); + $attribute = $fixture->getDataFieldConfig('custom_attribute')['source']->getAttribute(); + $mappingDate['custom_attribute']['from'] = $mapping['custom_attribute']; + $mappingDate['custom_attribute']['to'] = $mapping['custom_attribute']; + $attributeCode = $attribute->getAttributeCode(); + $mappingDate['custom_attribute']['from']['selector'] = sprintf($this->dateFromSelector, $attributeCode); + $mappingDate['custom_attribute']['to']['selector'] = sprintf($this->dateToSelector, $attributeCode); + + $this->_fill($mappingDate, $element); + + return $this; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/CustomAttribute/Select.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/CustomAttribute/Select.php new file mode 100644 index 0000000000000000000000000000000000000000..a7aee1dadc90b7917f628475bd02ea4c322cf08e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/CustomAttribute/Select.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogSearch\Test\Block\Advanced\CustomAttribute; + +use Magento\Mtf\Block\Form as BaseForm; +use Magento\Mtf\Fixture\FixtureInterface; +use Magento\Mtf\Client\Element\SimpleElement; + +/** + * Advanced search form with custom Select attribute. + */ +class Select extends BaseForm +{ + /** + * Selector for select. + * + * @var string + */ + protected $selectSelector = '[name="%s"]'; + + /** + * Fill the root form. + * + * @param FixtureInterface $fixture + * @param SimpleElement|null $element + * @param array|null $mapping + * @return $this + */ + public function fill(FixtureInterface $fixture, SimpleElement $element = null, array $mapping = null) + { + $attribute = $fixture->getDataFieldConfig('custom_attribute')['source']->getAttribute(); + $mapping['custom_attribute']['selector'] = sprintf($this->selectSelector, $attribute->getAttributeCode()); + $mapping['custom_attribute']['input'] = 'select'; + $this->_fill($mapping, $element); + + return $this; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/CustomAttribute/Text.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/CustomAttribute/Text.php new file mode 100644 index 0000000000000000000000000000000000000000..5beb76c1d06badf33366477fbbe0cec69c963c21 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/CustomAttribute/Text.php @@ -0,0 +1,41 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogSearch\Test\Block\Advanced\CustomAttribute; + +use Magento\Mtf\Block\Form as BaseForm; +use Magento\Mtf\Fixture\FixtureInterface; +use Magento\Mtf\Client\Element\SimpleElement; + +/** + * Advanced search form with custom Text attribute. + */ +class Text extends BaseForm +{ + /** + * Selector for text input. + * + * @var string + */ + protected $inputSelector = '[name="%s"]'; + + /** + * Fill the root form. + * + * @param FixtureInterface $fixture + * @param SimpleElement|null $element + * @param array|null $mapping + * @return $this + */ + public function fill(FixtureInterface $fixture, SimpleElement $element = null, array $mapping = null) + { + $attribute = $fixture->getDataFieldConfig('custom_attribute')['source']->getAttribute(); + $mapping['custom_attribute']['selector'] = sprintf($this->inputSelector, $attribute->getAttributeCode()); + $this->_fill($mapping, $element); + + return $this; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/Form.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/Form.php index 0f2a69ae8e95e038f909b74375a5e9683df2c26a..f70152800ba752b3b2703d31b957108399784646 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/Form.php +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/Form.php @@ -6,6 +6,7 @@ namespace Magento\CatalogSearch\Test\Block\Advanced; +use Magento\Catalog\Test\Fixture\CatalogProductAttribute; use Magento\Mtf\Block\Form as ParentForm; use Magento\Mtf\Client\Element; use Magento\Mtf\Client\Locator; @@ -45,6 +46,13 @@ class Form extends ParentForm */ protected $labelSelector = 'label'; + /** + * Selector for custom attribute. + * + * @var string + */ + protected $customAttributeSelector = 'div[class*="%s"]'; + /** * Submit search form. * @@ -73,27 +81,24 @@ class Form extends ParentForm // Mapping $mapping = $this->dataMapping($data); - $this->_fill($mapping, $element); + $attributeType = $attributeCode = ''; + if ($fixture->hasData('custom_attribute')) { + /** @var CatalogProductAttribute $attribute */ + $attribute = $fixture->getDataFieldConfig('custom_attribute')['source']->getAttribute(); + $attributeType = $attribute->getFrontendInput(); + $attributeCode = $attribute->getAttributeCode(); + } + if ($this->hasRender($attributeType)) { + $element = $this->_rootElement->find(sprintf($this->customAttributeSelector, $attributeCode)); + $arguments = ['fixture' => $fixture, 'element' => $element, 'mapping' => $mapping]; + $this->callRender($attributeType, 'fill', $arguments); + } else { + $this->_fill($mapping, $element); + } return $this; } - /** - * Fill form with custom fields. - * (for End To End Tests) - * - * @param FixtureInterface $fixture - * @param array $fields - * @param SimpleElement $element - */ - public function fillCustom(FixtureInterface $fixture, array $fields, SimpleElement $element = null) - { - $data = $fixture->getData('fields'); - $dataForMapping = array_intersect_key($data, array_flip($fields)); - $mapping = $this->dataMapping($dataForMapping); - $this->_fill($mapping, $element); - } - /** * Get form fields. * diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/Form.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/Form.xml index ee3886f04ef7e47c77bd78cb75eaa6798979e58f..01642bfd697ae5cd268b5b603e47029fb344e9ca 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/Form.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Block/Advanced/Form.xml @@ -25,9 +25,5 @@ <price_to> <selector>#price_to</selector> </price_to> - <tax_class_id> - <selector>#tax_class_id</selector> - <input>select</input> - </tax_class_id> </fields> -</mapping> \ No newline at end of file +</mapping> diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchNoResult.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchNoResult.php new file mode 100644 index 0000000000000000000000000000000000000000..caf6de9b9e87d24e486cf5bd2bfbf3dfd80c2722 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchNoResult.php @@ -0,0 +1,45 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogSearch\Test\Constraint; + +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\CatalogSearch\Test\Page\AdvancedResult; + +/** + * Advanced Search without results. + */ +class AssertAdvancedSearchNoResult extends AbstractConstraint +{ + /** + * Text for error messages. + */ + const ERROR_MESSAGE = 'We can\'t find any items matching these search criteria. Modify your search'; + + /** + * Assert that Advanced Search without results. + * + * @param AdvancedResult $resultPage + * @return void + */ + public function processAssert(AdvancedResult $resultPage) + { + \PHPUnit_Framework_Assert::assertTrue( + $resultPage->getSearchResultBlock()->isVisibleMessages(self::ERROR_MESSAGE), + "The error message '" . self::ERROR_MESSAGE . "' is not visible." + ); + } + + /** + * Returns a string representation of successful assertion. + * + * @return string + */ + public function toString() + { + return 'Error message is visible.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchProductByAttribute.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchProductByAttribute.php new file mode 100644 index 0000000000000000000000000000000000000000..17686b94f919df0a8ba6a7c67ce0da19628efc8a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Constraint/AssertAdvancedSearchProductByAttribute.php @@ -0,0 +1,86 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\CatalogSearch\Test\Constraint; + +use Magento\Catalog\Test\Fixture\CatalogProductSimple; +use Magento\CatalogSearch\Test\Page\AdvancedSearch; +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Mtf\Fixture\FixtureFactory; +use Magento\Mtf\Fixture\InjectableFixture; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\CatalogSearch\Test\Page\CatalogsearchResult; + +/** + * Assert that product attribute is searchable on Frontend. + */ +class AssertAdvancedSearchProductByAttribute extends AbstractConstraint +{ + /** + * Factory for fixtures. + * + * @var FixtureFactory + */ + protected $fixtureFactory; + + /** + * Assert that product attribute is searchable on Frontend. + * + * @param CmsIndex $cmsIndex + * @param InjectableFixture $product + * @param AdvancedSearch $searchPage + * @param CatalogsearchResult $catalogSearchResult + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function processAssert( + CmsIndex $cmsIndex, + InjectableFixture $product, + AdvancedSearch $searchPage, + CatalogsearchResult $catalogSearchResult, + FixtureFactory $fixtureFactory + ) { + $this->fixtureFactory = $fixtureFactory; + $cmsIndex->open(); + $cmsIndex->getFooterBlock()->openAdvancedSearch(); + $searchForm = $searchPage->getForm(); + $productSearch = $this->prepareFixture($product); + + $searchForm->fill($productSearch); + $searchForm->submit(); + $isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible(); + while (!$isVisible && $catalogSearchResult->getBottomToolbar()->nextPage()) { + $isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible(); + } + + \PHPUnit_Framework_Assert::assertTrue($isVisible, 'Product attribute is not searchable on Frontend.'); + } + + /** + * Preparation of fixture data before comparing. + * + * @param InjectableFixture $productSearch + * @return CatalogProductSimple + */ + protected function prepareFixture(InjectableFixture $productSearch) + { + $customAttribute = $productSearch->getDataFieldConfig('custom_attribute')['source']->getAttribute(); + return $this->fixtureFactory->createByCode( + 'catalogProductSimple', + ['data' => ['custom_attribute' => $customAttribute]] + ); + } + + /** + * Returns string representation of object. + * + * @return string + */ + public function toString() + { + return 'Product attribute is searchable on Frontend.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.xml index f4e3ce23e3e9525c76ffa97d3e6531a29d377fe1..0ad76850c06151772b8a516d3c0e1f67e7c1f2ac 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.xml @@ -6,8 +6,14 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="AdvancedSearch" mca="catalogsearch/advanced" module="Magento_CatalogSearch"> - <block name="form" class="Magento\CatalogSearch\Test\Block\Advanced\Form" locator=".form.search.advanced" strategy="css selector"/> - <block name="widgetView" class="Magento\Widget\Test\Block\WidgetView" locator=".widget" strategy="css selector"/> - </page> + <page name="AdvancedSearch" mca="catalogsearch/advanced" module="Magento_CatalogSearch"> + <block name="form" class="Magento\CatalogSearch\Test\Block\Advanced\Form" locator=".form.search.advanced" strategy="css selector"> + <render name="Date" class="Magento\CatalogSearch\Test\Block\Advanced\CustomAttribute\Date" /> + <render name="Multiple Select" class="Magento\CatalogSearch\Test\Block\Advanced\CustomAttribute\Select" /> + <render name="Yes/No" class="Magento\CatalogSearch\Test\Block\Advanced\CustomAttribute\Select" /> + <render name="Text Field" class="Magento\CatalogSearch\Test\Block\Advanced\CustomAttribute\Text" /> + <render name="Dropdown" class="Magento\CatalogSearch\Test\Block\Advanced\CustomAttribute\Select" /> + </block> + <block name="widgetView" class="Magento\Widget\Test\Block\WidgetView" locator=".widget" strategy="css selector" /> + </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.xml index 06d89946b5e1fcefc4c8c7e5f2bd5a19ee8f53d5..d36c3f5eb51fe785d7c947ba986a5917c97b4bd7 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.xml @@ -111,5 +111,10 @@ <data name="productSearch/data/price/value/price_to" xsi:type="string">50</data> <constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchProductsResult" /> </variation> + <variation name="AdvancedSearchEntityTestVariation14"> + <data name="description" xsi:type="string">Negative product search</data> + <data name="productSearch/data/name" xsi:type="string">Negative_product_search</data> + <constraint name="Magento\CatalogSearch\Test\Constraint\AssertAdvancedSearchNoResult" /> + </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Totals.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Totals.php index 663a88d34b66cc410e3106a693340fdb4e1af367..738bb89e949b6476bf67fbb1407b2be3e06ae192 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Totals.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Totals.php @@ -10,83 +10,82 @@ use Magento\Mtf\Block\Block; use Magento\Mtf\Client\Locator; /** - * Class Totals - * Cart totals block + * Cart totals block. */ class Totals extends Block { /** - * Grand total search mask + * Grand total search mask. * * @var string */ protected $grandTotal = '.grand.totals .price'; /** - * Grand total search mask + * Grand total search mask. * * @var string */ protected $grandTotalExclTax = '.totals.grand.excl span'; /** - * Grand total search mask + * Grand total search mask. * * @var string */ protected $grandTotalInclTax = '.totals.grand.incl span'; /** - * Subtotal search mask + * Subtotal search mask. * * @var string */ protected $subtotal = '.totals.sub .price'; /** - * Subtotal search mask + * Subtotal search mask. * * @var string */ protected $subtotalExclTax = '.totals.sub.excl .price'; /** - * Subtotal search mask + * Subtotal search mask. * * @var string */ protected $subtotalInclTax = '.totals.sub.incl .price'; /** - * Tax search mask + * Tax search mask. * * @var string */ protected $tax = '.totals-tax span'; /** - * Get shipping price selector + * Get shipping price selector. * * @var string */ protected $shippingPriceSelector = '.shipping.excl .price'; /** - * Get discount + * Get discount. * * @var string */ protected $discount = '[class=totals] .amount .price'; /** - * Get shipping price including tax selector + * Get shipping price including tax selector. * * @var string */ protected $shippingPriceInclTaxSelector = '.shipping.incl .price'; /** - * Get shipping price block selector + * Get shipping price block selector. * * @var string */ @@ -97,10 +96,10 @@ class Totals extends Block * * @var string */ - protected $blockWaitElement = '._block-content-loading'; + protected $blockWaitElement = '.loading-mask'; /** - * Get Grand Total Text + * Get Grand Total Text. * * @return string */ @@ -111,7 +110,7 @@ class Totals extends Block } /** - * Get Grand Total Text + * Get Grand Total Text. * * @return string|null */ @@ -122,7 +121,7 @@ class Totals extends Block } /** - * Get Grand Total Text + * Get Grand Total Text. * * @return string|null */ @@ -133,7 +132,7 @@ class Totals extends Block } /** - * Get Tax text from Order Totals + * Get Tax text from Order Totals. * * @return string|null */ @@ -144,7 +143,7 @@ class Totals extends Block } /** - * Check that Tax is visible + * Check that Tax is visible. * * @return bool */ @@ -154,7 +153,7 @@ class Totals extends Block } /** - * Get Subtotal text + * Get Subtotal text. * * @return string */ @@ -165,7 +164,7 @@ class Totals extends Block } /** - * Get Subtotal text + * Get Subtotal text. * * @return string|null */ @@ -176,7 +175,7 @@ class Totals extends Block } /** - * Get Subtotal text + * Get Subtotal text. * * @return string|null */ @@ -187,7 +186,7 @@ class Totals extends Block } /** - * Method that escapes currency symbols + * Method that escapes currency symbols. * * @param string $price * @return string|null @@ -199,7 +198,7 @@ class Totals extends Block } /** - * Get discount + * Get discount. * * @return string|null */ @@ -210,7 +209,7 @@ class Totals extends Block } /** - * Get shipping price + * Get shipping price. * * @return string|null */ @@ -221,7 +220,7 @@ class Totals extends Block } /** - * Get shipping price + * Get shipping price. * * @return string|null */ @@ -232,7 +231,7 @@ class Totals extends Block } /** - * Is visible shipping price block + * Is visible shipping price block. * * @return bool */ @@ -252,4 +251,14 @@ class Totals extends Block sleep(1); $this->waitForElementNotVisible($this->blockWaitElement); } + + /** + * Wait for shipping block to appear + * + * @return bool|null + */ + public function waitForShippingPriceBlock() + { + $this->waitForElementVisible($this->shippingPriceBlockSelector, Locator::SELECTOR_CSS); + } } diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method/Billing.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method/Billing.php index ffa5b1d91cb77912933faa89da83dc0e26bf332d..a90e1f3e4ce99e9b33d7acfa60a102839af38635 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method/Billing.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method/Billing.php @@ -20,7 +20,7 @@ class Billing extends Form * * @var string */ - protected $updateButtonSelector = '.action-toolbar .action-update'; + protected $updateButtonSelector = '.action.action-update'; /** * Wait element. diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method/Billing.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method/Billing.xml index a00c55ccbc2e9f437c950ffd5b1a83b9c631afb6..b86b6378e26f8d58935df71f5bddef99141cedf0 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method/Billing.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Payment/Method/Billing.xml @@ -9,22 +9,40 @@ <wrapper>billingAddress</wrapper> <fields> <email> - <selector>[name='customerDetails[email]']</selector> + <selector>./ancestor::*[contains(@class, 'checkout-payment-method')]//input[contains(@name, 'username')]</selector> + <strategy>xpath</strategy> </email> - <firstname /> - <lastname /> - <company /> + <firstname> + <selector>input[name*=firstname]</selector> + </firstname> + <lastname> + <selector>input[name*=lastname]</selector> + </lastname> + <company> + <selector>input[name*=company]</selector> + </company> <street> - <selector>[name='billingAddress[street][0]']</selector> + <selector>input[name*='street[0]']</selector> </street> - <city /> + <city> + <selector>input[name*=city]</selector> + </city> <region_id> + <selector>select[name*=region_id]</selector> <input>select</input> </region_id> - <postcode /> + <region> + <selector>input[name*=region]</selector> + </region> + <postcode> + <selector>input[name*=postcode]</selector> + </postcode> <country_id> + <selector>select[name*=country_id]</selector> <input>select</input> </country_id> - <telephone /> + <telephone> + <selector>input[name*=telephone]</selector> + </telephone> </fields> </mapping> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEstimateShippingAndTax.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEstimateShippingAndTax.php index 66a4f25834be097f80142a8d4f12c9a516c2d0f8..b55f6fb7edcd995945847c36d2dc7aeabe9b5f2d 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEstimateShippingAndTax.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Constraint/AssertEstimateShippingAndTax.php @@ -10,6 +10,7 @@ use Magento\Checkout\Test\Fixture\Cart; use Magento\Checkout\Test\Page\CheckoutCart; use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Mtf\ObjectManager; +use Magento\Mtf\System\Event\EventManagerInterface; /** * Assert that grand total is equal to expected. @@ -54,6 +55,7 @@ class AssertEstimateShippingAndTax extends AbstractConstraint /** * @constructor * @param ObjectManager $objectManager + * @param EventManagerInterface $eventManager * @param AssertSubtotalInShoppingCart $assertSubtotalInShoppingCart * @param AssertGrandTotalInShoppingCart $assertGrandTotalInShoppingCart * @param AssertTaxInShoppingCart $assertTaxInShoppingCart @@ -61,12 +63,13 @@ class AssertEstimateShippingAndTax extends AbstractConstraint */ public function __construct( ObjectManager $objectManager, + EventManagerInterface $eventManager, AssertSubtotalInShoppingCart $assertSubtotalInShoppingCart, AssertGrandTotalInShoppingCart $assertGrandTotalInShoppingCart, AssertTaxInShoppingCart $assertTaxInShoppingCart, AssertShippingInShoppingCart $assertShippingInShoppingCart ) { - parent::__construct($objectManager); + parent::__construct($objectManager, $eventManager); $this->assertSubtotalInShoppingCart = $assertSubtotalInShoppingCart; $this->assertGrandTotalInShoppingCart = $assertGrandTotalInShoppingCart; $this->assertTaxInShoppingCart = $assertTaxInShoppingCart; diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml index 397bd616ea313f806aa447e3daa210da2285ba10..fadf354d75dfb624e34fa1de1a7da9152330222f 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Page/CheckoutOnepage.xml @@ -6,11 +6,12 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd"> - <page name="CheckoutOnepage" mca="checkout" module="Magento_Checkout"> - <block name="loginBlock" class="Magento\Checkout\Test\Block\Onepage\Login" locator="[data-role='email-with-possible-login']" strategy="css selector"/> - <block name="shippingBlock" class="Magento\Checkout\Test\Block\Onepage\Shipping" locator="#checkout-step-shipping" strategy="css selector"/> - <block name="shippingMethodBlock" class="Magento\Checkout\Test\Block\Onepage\Shipping\Method" locator="#checkout-step-shipping_method" strategy="css selector"/> - <block name="paymentBlock" class="Magento\Checkout\Test\Block\Onepage\Payment" locator="#checkout-step-payment" strategy="css selector"/> - <block name="reviewBlock" class="Magento\Checkout\Test\Block\Onepage\Review" locator=".opc-block-summary" strategy="css selector"/> - </page> + <page name="CheckoutOnepage" mca="checkout" module="Magento_Checkout"> + <block name="loginBlock" class="Magento\Checkout\Test\Block\Onepage\Login" locator="[data-role='email-with-possible-login']" strategy="css selector" /> + <block name="shippingBlock" class="Magento\Checkout\Test\Block\Onepage\Shipping" locator="#checkout-step-shipping" strategy="css selector" /> + <block name="shippingMethodBlock" class="Magento\Checkout\Test\Block\Onepage\Shipping\Method" locator="#checkout-step-shipping_method" strategy="css selector" /> + <block name="paymentBlock" class="Magento\Checkout\Test\Block\Onepage\Payment" locator="#checkout-step-payment" strategy="css selector" /> + <block name="reviewBlock" class="Magento\Checkout\Test\Block\Onepage\Review" locator=".opc-block-summary" strategy="css selector" /> + <block name="messagesBlock" class="Magento\Backend\Test\Block\Messages" locator=".page.messages" strategy="css selector" /> + </page> </config> diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php index 6d9516684512359904181b06d7899f8af8f7021e..7fdc478b1da5e32eef412b7f7ab961cf6b1fcbb7 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.php @@ -42,7 +42,6 @@ class OnePageCheckoutTest extends Scenario const MVP = 'yes'; const DOMAIN = 'CS'; const TEST_TYPE = 'acceptance_test, 3rd_party_test'; - const TO_MAINTAIN = 'yes'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml index 696bf1324beea2c303bda0496702588f2b70be3a..0b86f927eef12cf2d40a17024d4b7bf17fdb29da 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/OnePageCheckoutTest.xml @@ -9,16 +9,15 @@ <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest" summary="OnePageCheckout within Offline Payment Methods" ticketId="MAGETWO-27485"> <variation name="OnePageCheckoutTestVariation1" summary="Checkout as UK guest with virtual product using coupon for not logged in customers"> <data name="products" xsi:type="string">catalogProductVirtual::default</data> - <data name="salesRule" xsi:type="string">active_sales_rule_with_percent_price_discount_coupon</data> - <data name="customer/dataset" xsi:type="string">default</data> - <data name="billingAddress/dataset" xsi:type="string">UK_address</data> - <data name="checkoutMethod" xsi:type="string">guest</data> + <data name="salesRule" xsi:type="string">active_sales_rule_for_all_groups</data> + <data name="customer/dataset" xsi:type="string">customer_UK_1_default_billing_address</data> + <data name="checkoutMethod" xsi:type="string">login</data> <data name="prices" xsi:type="array"> <item name="grandTotal" xsi:type="string">5.00</item> </data> <data name="payment/method" xsi:type="string">checkmo</data> <data name="status" xsi:type="string">Pending</data> - <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Notification, Hold, Invoice, Edit</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Cancel, Hold, Invoice, Edit</data> <data name="configData" xsi:type="string">checkmo_specificcountry_gb</data> <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> @@ -29,8 +28,8 @@ <data name="products" xsi:type="string">catalogProductSimple::default</data> <data name="salesRule" xsi:type="string">active_sales_rule_for_all_groups</data> <data name="customer/dataset" xsi:type="string">default</data> - <data name="billingAddress/dataset" xsi:type="string">US_address_1</data> <data name="checkoutMethod" xsi:type="string">guest</data> + <data name="shippingAddress/dataset" xsi:type="string">US_address_1</data> <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="prices" xsi:type="array"> @@ -38,24 +37,26 @@ </data> <data name="payment/method" xsi:type="string">banktransfer</data> <data name="status" xsi:type="string">Pending</data> - <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Notification, Hold, Reorder, Invoice, Edit</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Cancel, Hold, Ship, Invoice, Edit</data> <data name="configData" xsi:type="string">banktransfer</data> <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" /> </variation> - <variation name="OnePageCheckoutTestVariation3" summary="Checkout as UK guest with virtual product"> - <data name="products" xsi:type="string">catalogProductVirtual::default</data> + <variation name="OnePageCheckoutTestVariation3" summary="Checkout as UK guest with simple product"> + <data name="products" xsi:type="string">catalogProductSimple::default</data> <data name="customer/dataset" xsi:type="string">default</data> - <data name="billingAddress/dataset" xsi:type="string">UK_address</data> <data name="checkoutMethod" xsi:type="string">guest</data> + <data name="shippingAddress/dataset" xsi:type="string">UK_address</data> + <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> + <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="prices" xsi:type="array"> - <item name="grandTotal" xsi:type="string">10.00</item> + <item name="grandTotal" xsi:type="string">565.00</item> </data> <data name="payment/method" xsi:type="string">banktransfer</data> <data name="status" xsi:type="string">Pending</data> - <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Notification, Hold, Invoice, Edit</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Send Email, Cancel, Hold, Ship, Invoice, Edit</data> <data name="configData" xsi:type="string">banktransfer_specificcountry_gb</data> <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> @@ -65,8 +66,8 @@ <variation name="OnePageCheckoutTestVariation4" summary="One Page Checkout Products with Special Prices" ticketId="MAGETWO-12429"> <data name="products" xsi:type="string">catalogProductSimple::product_with_special_price, configurableProduct::product_with_special_price</data> <data name="customer/dataset" xsi:type="string">default</data> - <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data> <data name="checkoutMethod" xsi:type="string">login</data> + <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data> <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data> <data name="shipping/shipping_method" xsi:type="string">Fixed</data> <data name="prices" xsi:type="array"> @@ -85,8 +86,8 @@ <variation name="OnePageCheckoutTestVariation5" summary="Guest Checkout using Check/Money Order and Free Shipping with Prices/Taxes Verifications" ticketId="MAGETWO-12412"> <data name="products" xsi:type="string">catalogProductSimple::product_10_dollar, configurableProduct::with_one_option, bundleProduct::bundle_fixed_100_dollar_product</data> <data name="taxRule" xsi:type="string">us_ca_ny_rule</data> - <data name="shippingAddress/dataset" xsi:type="string">US_address_1</data> <data name="checkoutMethod" xsi:type="string">guest</data> + <data name="shippingAddress/dataset" xsi:type="string">US_address_1</data> <data name="shipping/shipping_service" xsi:type="string">Free Shipping</data> <data name="shipping/shipping_method" xsi:type="string">Free</data> <data name="prices" xsi:type="array"> diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/Tab/Content.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/Tab/Content.php index a07445f3eee83cf3d6d3b542c04921c4880f8f8e..24b1999344084474cf3954fb4aeed7b712283f44 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/Tab/Content.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Block/Adminhtml/Page/Edit/Tab/Content.php @@ -62,11 +62,13 @@ class Content extends Tab /** * Clicking in content tab 'Insert Variable' button. * + * @param SimpleElement $element [optional] * @return void */ - public function clickInsertVariable() + public function clickInsertVariable(SimpleElement $element = null) { - $addVariableButton = $this->_rootElement->find($this->addVariableButton); + $context = $element === null ? $this->_rootElement : $element; + $addVariableButton = $context->find($this->addVariableButton); if ($addVariableButton->isVisible()) { $addVariableButton->click(); } @@ -75,11 +77,13 @@ class Content extends Tab /** * Clicking in content tab 'Insert Widget' button. * + * @param SimpleElement $element [optional] * @return void */ - public function clickInsertWidget() + public function clickInsertWidget(SimpleElement $element = null) { - $addWidgetButton = $this->_rootElement->find($this->addWidgetButton); + $context = $element === null ? $this->_rootElement : $element; + $addWidgetButton = $context->find($this->addWidgetButton); if ($addWidgetButton->isVisible()) { $addWidgetButton->click(); } diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage/Content.php b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage/Content.php index 0ce3f511d5732c8cae18a3f24fc59f156a751587..31a9d22a1530389c41b257a990ae67e8e57c228e 100644 --- a/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage/Content.php +++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Fixture/CmsPage/Content.php @@ -25,14 +25,19 @@ class Content extends DataSource */ protected $fixtureFactory; + /** + * Repository factory. + * + * @var RepositoryFactory + */ + protected $repositoryFactory; + /** * @constructor * @param RepositoryFactory $repositoryFactory * @param FixtureFactory $fixtureFactory * @param array $params * @param array $data - * - * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function __construct( RepositoryFactory $repositoryFactory, @@ -41,37 +46,62 @@ class Content extends DataSource array $data = [] ) { $this->fixtureFactory = $fixtureFactory; + $this->repositoryFactory = $repositoryFactory; $this->params = $params; $this->data = $data; - if (isset($data['widget']['dataset']) && isset($this->params['repository'])) { - $this->data['widget']['dataset'] = $repositoryFactory->get($this->params['repository'])->get( - $data['widget']['dataset'] + $this->prepareSourceData(); + } + + /** + * Prepare source data. + * + * @return void + */ + protected function prepareSourceData() + { + if (isset($this->data['widget']['dataset']) && isset($this->params['repository'])) { + $this->data['widget']['dataset'] = $this->repositoryFactory->get($this->params['repository'])->get( + $this->data['widget']['dataset'] ); - foreach ($this->data['widget']['dataset'] as $key => $widget) { - if (isset($widget['chosen_option']['category_path']) - && !isset($widget['chosen_option']['filter_sku']) - ) { - $category = $this->createCategory($widget); - $categoryName = $category->getData('name'); - $this->data['widget']['dataset'][$key]['chosen_option']['category_path'] = $categoryName; - } - if (isset($widget['chosen_option']['category_path']) && isset($widget['chosen_option']['filter_sku'])) { - $product = $this->createProduct($widget); - $categoryName = $product->getCategoryIds()[0]['name']; - $productSku = $product->getData('sku'); - $this->data['widget']['dataset'][$key]['chosen_option']['category_path'] = $categoryName; - $this->data['widget']['dataset'][$key]['chosen_option']['filter_sku'] = $productSku; - } - if ($widget['widget_type'] == 'Catalog New Products List') { - $this->createProduct(); - } - if ($widget['widget_type'] == 'CMS Static Block') { - $block = $this->createBlock($widget); - $blockIdentifier = $block->getIdentifier(); - $this->data['widget']['dataset'][$key]['chosen_option']['filter_identifier'] = $blockIdentifier; - } + $this->data = array_merge($this->data, $this->prepareWidgetData($this->data['widget'])); + } + } + + /** + * Prepare widget data for the source. + * + * @param array $widgets + * @return array + */ + protected function prepareWidgetData(array $widgets) + { + $data = []; + foreach ($widgets['dataset'] as $key => $widget) { + if (isset($widget['chosen_option']['category_path']) + && !isset($widget['chosen_option']['filter_sku']) + ) { + $category = $this->createCategory($widget); + $categoryName = $category->getData('name'); + $data['widget']['dataset'][$key]['chosen_option']['category_path'] = $categoryName; + } + if (isset($widget['chosen_option']['category_path']) && isset($widget['chosen_option']['filter_sku'])) { + $product = $this->createProduct($widget); + $categoryName = $product->getCategoryIds()[0]['name']; + $productSku = $product->getData('sku'); + $data['widget']['dataset'][$key]['chosen_option']['category_path'] = $categoryName; + $data['widget']['dataset'][$key]['chosen_option']['filter_sku'] = $productSku; + } + if ($widget['widget_type'] == 'Catalog New Products List') { + $this->createProduct(); + } + if ($widget['widget_type'] == 'CMS Static Block') { + $block = $this->createBlock($widget); + $blockIdentifier = $block->getIdentifier(); + $data['widget']['dataset'][$key]['chosen_option']['filter_identifier'] = $blockIdentifier; } } + + return $data; } /** diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml index 2fd3b20f3769c10a79c4b97290b34470f712cc82..25540646b7181e36757d4daa927c40038f00dd1f 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct.xml @@ -38,6 +38,37 @@ </field> </dataset> + <dataset name="configurable_with_qty_1"> + <field name="name" xsi:type="string">Test configurable product %isolation%</field> + <field name="sku" xsi:type="string">sku_test_configurable_product_%isolation%</field> + <field name="price" xsi:type="array"> + <item name="value" xsi:type="string">40</item> + </field> + <field name="weight" xsi:type="string">30</field> + <field name="product_has_weight" xsi:type="string">Yes</field> + <field name="status" xsi:type="string">Product online</field> + <field name="visibility" xsi:type="string">Catalog, Search</field> + <field name="tax_class_id" xsi:type="array"> + <item name="dataset" xsi:type="string">taxable_goods</item> + </field> + <field name="url_key" xsi:type="string">configurable-product-%isolation%</field> + <field name="configurable_attributes_data" xsi:type="array"> + <item name="dataset" xsi:type="string">default</item> + </field> + <field name="quantity_and_stock_status" xsi:type="array"> + <item name="is_in_stock" xsi:type="string">In Stock</item> + </field> + <field name="website_ids" xsi:type="array"> + <item name="0" xsi:type="string">Main Website</item> + </field> + <field name="attribute_set_id" xsi:type="array"> + <item name="dataset" xsi:type="string">default</item> + </field> + <field name="checkout_data" xsi:type="array"> + <item name="dataset" xsi:type="string">configurable_options_with_qty_1</item> + </field> + </dataset> + <dataset name="product_with_special_price"> <field name="name" xsi:type="string">Test configurable product %isolation%</field> <field name="sku" xsi:type="string">sku_test_configurable_product_%isolation%</field> diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/CheckoutData.xml b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/CheckoutData.xml index 4f058ad0611c0f5eff12d181acb7607d920361a5..5b7d919c0f3566d90f76cde53355e902f0184a44 100644 --- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/CheckoutData.xml +++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Repository/ConfigurableProduct/CheckoutData.xml @@ -28,6 +28,27 @@ </field> </dataset> + <dataset name="configurable_options_with_qty_1"> + <field name="options" xsi:type="array"> + <item name="configurable_options" xsi:type="array"> + <item name="0" xsi:type="array"> + <item name="title" xsi:type="string">attribute_key_0</item> + <item name="value" xsi:type="string">option_key_0</item> + </item> + <item name="1" xsi:type="array"> + <item name="title" xsi:type="string">attribute_key_1</item> + <item name="value" xsi:type="string">option_key_1</item> + </item> + </item> + </field> + <field name="qty" xsi:type="string">1</field> + <field name="cartItem" xsi:type="array"> + <item name="price" xsi:type="string">40</item> + <item name="qty" xsi:type="string">1</item> + <item name="subtotal" xsi:type="string">40</item> + </field> + </dataset> + <dataset name="configurable_update_mini_shopping_cart"> <field name="options" xsi:type="array"> <item name="configurable_options" xsi:type="array"> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/CustomerForm.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/CustomerForm.php index 2a33378d7c701fb7d2552175647a2df47297beeb..30f762335acbaefda343c9219849a89656ab1e96 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/CustomerForm.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Adminhtml/Edit/CustomerForm.php @@ -141,4 +141,21 @@ class CustomerForm extends FormTabs return $this; } + + /** + * Get array of label => js error text. + * + * @return array + */ + public function getJsErrors() + { + $tabs = ['account_information', 'addresses']; + $jsErrors = []; + foreach ($tabs as $tabName) { + $tab = $this->getTab($tabName); + $this->openTab($tabName); + $jsErrors = array_merge($jsErrors, $tab->getJsErrors()); + } + return $jsErrors; + } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerBackendBackButton.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerBackendBackButton.php new file mode 100644 index 0000000000000000000000000000000000000000..6d372387341161713199d9814ad18e23ad35fb31 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerBackendBackButton.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Customer\Test\Constraint; + +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\Customer\Test\Page\Adminhtml\CustomerIndex; +use Magento\Customer\Test\Page\Adminhtml\CustomerIndexEdit; + +/** + * Asserts that "Back" button works on customer edit page. + */ +class AssertCustomerBackendBackButton extends AbstractConstraint +{ + /** + * Asserts that "Back" button works on customer edit page (returns to customers grid). + * + * @param CustomerIndexEdit $customerEditPage + * @param CustomerIndex $customerGridPage + * @return void + */ + public function processAssert(CustomerIndexEdit $customerEditPage, CustomerIndex $customerGridPage) + { + $customerEditPage->getPageActionsBlock()->back(); + \PHPUnit_Framework_Assert::assertTrue( + $customerGridPage->getCustomerGridBlock()->isVisible(), + 'Clicking on "Back" button does not redirect to customers grid.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return '"Back" button on customer edit page redirects to customers grid.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerBackendDuplicateErrorMessage.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerBackendDuplicateErrorMessage.php new file mode 100644 index 0000000000000000000000000000000000000000..27394f8e074ecc7fc0238a58285d8d4ed364fd16 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerBackendDuplicateErrorMessage.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Customer\Test\Constraint; + +use Magento\Customer\Test\Page\Adminhtml\CustomerIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Asserts duplicate error message on saving backend customer. + */ +class AssertCustomerBackendDuplicateErrorMessage extends AbstractConstraint +{ + /** + * Error save message text. + */ + const ERROR_SAVE_MESSAGE = 'A customer with the same email already exists in an associated website.'; + + /** + * Asserts that error message is displayed while creating customer with the same email. + * + * @param CustomerIndex $customerIndexPage + * @return void + */ + public function processAssert(CustomerIndex $customerIndexPage) + { + $actualMessage = $customerIndexPage->getMessagesBlock()->getErrorMessages(); + \PHPUnit_Framework_Assert::assertEquals( + self::ERROR_SAVE_MESSAGE, + $actualMessage, + 'Wrong error message is displayed.' + . "\nExpected: " . self::ERROR_SAVE_MESSAGE + . "\nActual: " . $actualMessage + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return 'Assert that error duplicated message is displayed.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerBackendRequiredFields.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerBackendRequiredFields.php new file mode 100644 index 0000000000000000000000000000000000000000..802b24652594a21440d6f4cc747a5677322d1e9a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerBackendRequiredFields.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Customer\Test\Constraint; + +use Magento\Customer\Test\Page\Adminhtml\CustomerIndexNew; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert required fields on customer form. + */ +class AssertCustomerBackendRequiredFields extends AbstractConstraint +{ + /** + * Expected message. + */ + const REQUIRE_MESSAGE = 'This is a required field.'; + + /** + * Assert required fields on customer form. + * + * @param CustomerIndexNew $customerNewPage + * @param array $expectedRequiredFields + * @return void + */ + public function processAssert(CustomerIndexNew $customerNewPage, array $expectedRequiredFields) + { + $actualRequiredFields = $customerNewPage->getCustomerForm()->getJsErrors(); + foreach ($expectedRequiredFields as $field) { + \PHPUnit_Framework_Assert::assertTrue( + isset($actualRequiredFields[$field]), + "Field '$field' is not highlighted with an JS error." + ); + \PHPUnit_Framework_Assert::assertEquals( + self::REQUIRE_MESSAGE, + $actualRequiredFields[$field], + "Field '$field' is not highlighted as required." + ); + } + } + + /** + * Return string representation of object. + * + * @return string + */ + public function toString() + { + return 'All required fields on customer form are highlighted.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupOnCartPriceRuleForm.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupOnCartPriceRuleForm.php new file mode 100644 index 0000000000000000000000000000000000000000..5f49cbee1e5a45870804c7d99b704a9916c3c97a --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupOnCartPriceRuleForm.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Customer\Test\Constraint; + +use Magento\Customer\Test\Fixture\CustomerGroup; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\SalesRule\Test\Block\Adminhtml\Promo\Quote\Edit\Tab\RuleInformation; +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteIndex; +use Magento\SalesRule\Test\Page\Adminhtml\PromoQuoteNew; + +/** + * Assert that customer group find on cart price rule page. + */ +class AssertCustomerGroupOnCartPriceRuleForm extends AbstractConstraint +{ + /** + * Assert that customer group find on cart price rule page. + * + * @param PromoQuoteIndex $promoQuoteIndex + * @param PromoQuoteNew $promoQuoteNew + * @param CustomerGroup $customerGroup + * @return void + */ + public function processAssert( + PromoQuoteIndex $promoQuoteIndex, + PromoQuoteNew $promoQuoteNew, + CustomerGroup $customerGroup + ) { + $promoQuoteIndex->open(); + $promoQuoteIndex->getGridPageActions()->addNew(); + $promoQuoteNew->getSalesRuleForm()->openTab('rule_information'); + + /** @var RuleInformation $ruleInformationTab */ + $ruleInformationTab = $promoQuoteNew->getSalesRuleForm()->getTab('rule_information'); + \PHPUnit_Framework_Assert::assertTrue( + $ruleInformationTab->isVisibleCustomerGroup($customerGroup), + "Customer group {$customerGroup->getCustomerGroupCode()} not in cart price rule page." + ); + } + + /** + * Success assert of customer group find on cart price rule page. + * + * @return string + */ + public function toString() + { + return 'Customer group find on cart price rule page.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupOnCatalogPriceRuleForm.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupOnCatalogPriceRuleForm.php new file mode 100644 index 0000000000000000000000000000000000000000..15fac430dc6855fd60efe6d53e38f54d32bd58e3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupOnCatalogPriceRuleForm.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Customer\Test\Constraint; + +use Magento\CatalogRule\Test\Page\Adminhtml\CatalogRuleIndex; +use Magento\CatalogRule\Test\Page\Adminhtml\CatalogRuleNew; +use Magento\Customer\Test\Fixture\CustomerGroup; +use Magento\Mtf\Constraint\AbstractConstraint; +use Magento\CatalogRule\Test\Block\Adminhtml\Promo\Catalog\Edit\Tab\RuleInformation; + +/** + * Assert that customer group find on catalog price rule page. + */ +class AssertCustomerGroupOnCatalogPriceRuleForm extends AbstractConstraint +{ + /** + * Assert that customer group find on catalog price rule page. + * + * @param CatalogRuleIndex $catalogRuleIndex + * @param CatalogRuleNew $catalogRuleNew + * @param CustomerGroup $customerGroup + * @return void + */ + public function processAssert( + CatalogRuleIndex $catalogRuleIndex, + CatalogRuleNew $catalogRuleNew, + CustomerGroup $customerGroup + ) { + $catalogRuleIndex->open(); + $catalogRuleIndex->getGridPageActions()->addNew(); + $catalogRuleNew->getEditForm()->openTab('rule_information'); + + /** @var RuleInformation $ruleInformationTab */ + $ruleInformationTab = $catalogRuleNew->getEditForm()->getTab('rule_information'); + \PHPUnit_Framework_Assert::assertTrue( + $ruleInformationTab->isVisibleCustomerGroup($customerGroup), + "Customer group {$customerGroup->getCustomerGroupCode()} not in catalog price rule page." + ); + } + + /** + * Success assert of customer group find on catalog price rule page. + * + * @return string + */ + public function toString() + { + return 'Customer group find on catalog price rule page.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupOnCustomerForm.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupOnCustomerForm.php index d0f38165dea70abbc733a66ba53d78a752e7e214..0ab32aa443c909c663ff4b1363b9cf34cf48a79b 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupOnCustomerForm.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupOnCustomerForm.php @@ -14,12 +14,12 @@ use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Mtf\Fixture\FixtureFactory; /** - * Class AssertCustomerGroupOnCustomerForm + * Assert that customer group find on account information page. */ class AssertCustomerGroupOnCustomerForm extends AbstractConstraint { /** - * Assert that customer group find on account information page + * Assert that customer group find on account information page. * * @param FixtureFactory $fixtureFactory * @param CustomerGroup $customerGroup @@ -53,12 +53,12 @@ class AssertCustomerGroupOnCustomerForm extends AbstractConstraint \PHPUnit_Framework_Assert::assertTrue( empty($diff), - "Customer group {$customerGroup->getCustomerGroupCode()} not in customer form." + "Customer group {$customerGroup->getCustomerGroupCode()} not in account information page." ); } /** - * Success assert of customer group find on account information page + * Success assert of customer group find on account information page. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupOnProductForm.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupOnProductForm.php new file mode 100644 index 0000000000000000000000000000000000000000..f783c4b4ea6254eb3f458490bb9b0f28c5960172 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerGroupOnProductForm.php @@ -0,0 +1,54 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Customer\Test\Constraint; + +use Magento\Catalog\Test\Block\Adminhtml\Product\Edit\AdvancedPricingTab; +use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; +use Magento\Catalog\Test\Page\Adminhtml\CatalogProductNew; +use Magento\Customer\Test\Fixture\CustomerGroup; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that customer group find on product page. + */ +class AssertCustomerGroupOnProductForm extends AbstractConstraint +{ + /** + * Assert that customer group find on product page. + * + * @param CatalogProductIndex $catalogProductIndex + * @param CatalogProductNew $catalogProductNew + * @param CustomerGroup $customerGroup + * @return void + */ + public function processAssert( + CatalogProductIndex $catalogProductIndex, + CatalogProductNew $catalogProductNew, + CustomerGroup $customerGroup + ) { + $catalogProductIndex->open(); + $catalogProductIndex->getGridPageActionBlock()->addProduct(); + $catalogProductNew->getProductForm()->openTab('advanced-pricing'); + + /** @var AdvancedPricingTab $advancedPricingTab */ + $advancedPricingTab = $catalogProductNew->getProductForm()->getTab('advanced-pricing'); + \PHPUnit_Framework_Assert::assertTrue( + $advancedPricingTab->getTierPriceForm()->isVisibleCustomerGroup($customerGroup), + "Customer group {$customerGroup->getCustomerGroupCode()} not in tier price form on product page." + ); + } + + /** + * Success assert of customer group find on product page. + * + * @return string + */ + public function toString() + { + return 'Customer group find on product page.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerLogout.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerLogout.php new file mode 100644 index 0000000000000000000000000000000000000000..0db06b1df1ab5e5972511d25410fcf91ab7bbd3d --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerLogout.php @@ -0,0 +1,59 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Customer\Test\Constraint; + +use Magento\Cms\Test\Page\CmsIndex; +use Magento\Customer\Test\Page\CustomerAccountIndex; +use Magento\Mtf\Constraint\AbstractConstraint; + +/** + * Assert that customer success log out. + */ +class AssertCustomerLogout extends AbstractConstraint +{ + /** + * Logout page title. + */ + const LOGOUT_PAGE_TITLE = 'You are signed out'; + + /** + * Home page title. + */ + const HOME_PAGE_TITLE = 'Home Page'; + + /** + * Assert that customer success log out. + * + * @param CustomerAccountIndex $customerAccountIndex + * @param CmsIndex $cmsIndex + * @return void + */ + public function processAssert(CustomerAccountIndex $customerAccountIndex, CmsIndex $cmsIndex) + { + $customerAccountIndex->open(); + $cmsIndex->getCmsPageBlock()->waitPageInit(); + + $cmsIndex->getLinksBlock()->openLink('Sign Out'); + $cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible(self::LOGOUT_PAGE_TITLE); + $cmsIndex->getCmsPageBlock()->waitUntilTextIsVisible(self::HOME_PAGE_TITLE); + $cmsIndex->getCmsPageBlock()->waitPageInit(); + \PHPUnit_Framework_Assert::assertTrue( + $cmsIndex->getLinksBlock()->isLinkVisible('Sign In'), + "Customer wasn't logged out." + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return "Customer is successfully log out."; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerSuccessRegisterMessage.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerSuccessRegisterMessage.php index 13d0cdae0112ff60c9f15ef7ae8665e5174340b2..bf70b9806347fbe9f410a2dba27ce1d283114b2f 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerSuccessRegisterMessage.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Constraint/AssertCustomerSuccessRegisterMessage.php @@ -10,15 +10,14 @@ use Magento\Customer\Test\Page\CustomerAccountCreate; use Magento\Mtf\Constraint\AbstractConstraint; /** - * Class AssertCustomerSuccessRegisterMessage - * + * Assert that success message is displayed after customer registered on frontend. */ class AssertCustomerSuccessRegisterMessage extends AbstractConstraint { const SUCCESS_MESSAGE = 'Thank you for registering with Main Website Store.'; /** - * Assert that success message is displayed after customer registered on frontend + * Assert that success message is displayed after customer registered on frontend. * * @param CustomerAccountCreate $registerPage * @return void @@ -36,7 +35,7 @@ class AssertCustomerSuccessRegisterMessage extends AbstractConstraint } /** - * Text of success register message is displayed + * Text of success register message is displayed. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Webapi.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Webapi.php index 1934bc456d92061105b2faae79919f69de35293f..44485d16264c614c31992ed1bb9061346ac30c5d 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Webapi.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Handler/Customer/Webapi.php @@ -26,6 +26,11 @@ class Webapi extends AbstractWebapi implements CustomerInterface * @var array */ protected $mappingData = [ + 'gender' => [ + 'Male' => 1, + 'Female' => 2, + 'Not Specified' => 3 + ], 'country_id' => [ 'United States' => 'US', 'United Kingdom' => 'GB' @@ -70,7 +75,7 @@ class Webapi extends AbstractWebapi implements CustomerInterface */ protected function prepareData(Customer $customer) { - $data['customer'] = $customer->getData(); + $data['customer'] = $this->replaceMappingData($customer->getData()); $data['customer']['group_id'] = $this->getCustomerGroup($customer); $data['password'] = $data['customer']['password']; unset($data['customer']['password']); @@ -105,7 +110,6 @@ class Webapi extends AbstractWebapi implements CustomerInterface return $data; } foreach ($data['customer']['address'] as $key => $addressData) { - $addressData['country_id'] = $this->mappingData['country_id'][$addressData['country_id']]; $addressData = $this->prepareRegionData($addressData); $addressData = $this->prepareStreetData($addressData); $addressData = $this->prepareDefaultAddressData($addressData); @@ -132,7 +136,7 @@ class Webapi extends AbstractWebapi implements CustomerInterface } if (isset($addressData['region_id'])) { $addressData['region'] = [ - 'region_id' => $this->mappingData['region_id'][$addressData['region_id']] + 'region_id' => $addressData['region_id'] ]; unset($addressData['region_id']); } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php index 90b432c8d47acde1326078a623e26c5389675c07..249e0e30184e91df88fa7e02c9232f96479d8825 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/Address/DefaultAddress.php @@ -11,32 +11,31 @@ use Magento\Mtf\Factory\Factory; use Magento\Mtf\Page\Page; /** - * Class DefaultAddress - * Default address page + * Default address page. */ class DefaultAddress extends Page { /** - * URL for customer Dashboard + * URL for customer Dashboard. */ const MCA = 'customer/address/index'; /** - * Selector for default address block + * Selector for default address block. * * @var string */ protected $defaultAddressesSelector = '.block-addresses-default'; /** - * Get default addresses block + * Get default addresses block. * * @return \Magento\Customer\Test\Block\Account\AddressesDefault */ public function getDefaultAddresses() { return Factory::getBlockFactory()->getMagentoCustomerAccountAddressesDefault( - $this->_browser->find($this->defaultAddressesSelector, Locator::SELECTOR_CSS) + $this->browser->find($this->defaultAddressesSelector, Locator::SELECTOR_CSS) ); } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountForgotPassword.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountForgotPassword.php index ff129b94eb17217dfd85f29dadac635191f7e87c..0d0364d8238196fe030849dc82aa9fff50539894 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountForgotPassword.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountForgotPassword.php @@ -11,36 +11,41 @@ use Magento\Mtf\Factory\Factory; use Magento\Mtf\Page\Page; /** + * Customer forgot password page. */ class CustomerAccountForgotPassword extends Page { /** - * URL for reset customer password + * URL for reset customer password. */ const MCA = 'customer/account/forgotpassword'; /** + * Forgot password form. + * * @var string */ protected $forgotPasswordForm = '#form-validate'; /** - * Custom constructor + * Init page. Set page url. + * + * @return void */ - protected function _init() + protected function initUrl() { - $this->_url = $_ENV['app_frontend_url'] . self::MCA; + $this->url = $_ENV['app_frontend_url'] . self::MCA; } /** - * Get Customer Forgot Password form + * Get Customer Forgot Password form. * * @return \Magento\Customer\Test\Block\Form\ForgotPassword */ public function getForgotPasswordForm() { return Factory::getBlockFactory()->getMagentoCustomerFormForgotPassword( - $this->_browser->find( + $this->browser->find( $this->forgotPasswordForm, Locator::SELECTOR_CSS ) diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountLogout.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountLogout.php index 2f73386919242c92c8d1e2a30ea557d5ab4f7625..e9584762883d0088d6174b97d7933dc0f729f841 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountLogout.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAccountLogout.php @@ -9,22 +9,22 @@ namespace Magento\Customer\Test\Page; use Magento\Mtf\Page\Page; /** - * Class CustomerAccountLogout * Customer frontend logout page. - * */ class CustomerAccountLogout extends Page { /** - * URL for customer logout + * URL for customer logout. */ const MCA = 'customer/account/logout'; /** - * Custom constructor + * Init page. Set page url. + * + * @return void */ - protected function _init() + protected function initUrl() { - $this->_url = $_ENV['app_frontend_url'] . self::MCA; + $this->url = $_ENV['app_frontend_url'] . self::MCA; } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAddressEdit.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAddressEdit.php index f217c900d0b65c267bc633b91272f5d9e7a3e983..53a2867b16ac7648df018152ae87531276a818a9 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAddressEdit.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAddressEdit.php @@ -12,39 +12,40 @@ use Magento\Mtf\Page\Page; /** * Customer Address Edit page. - * */ class CustomerAddressEdit extends Page { /** - * URL for Customer Address Edit page + * URL for Customer Address Edit page. */ const MCA = 'customer/address/edit'; /** - * Customer Address Edit form + * Customer Address Edit form. * * @var string */ protected $editForm = '#form-validate'; /** - * Custom constructor + * Init page. Set page url. + * + * @return void */ - protected function _init() + protected function initUrl() { - $this->_url = $_ENV['app_frontend_url'] . self::MCA; + $this->url = $_ENV['app_frontend_url'] . self::MCA; } /** - * Get Customer Address Edit form + * Get Customer Address Edit form. * * @return \Magento\Customer\Test\Block\Address\Edit */ public function getEditForm() { return Factory::getBlockFactory()->getMagentoCustomerAddressEdit( - $this->_browser->find($this->editForm, Locator::SELECTOR_CSS) + $this->browser->find($this->editForm, Locator::SELECTOR_CSS) ); } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml index bca31130341c1d56f8ea3d42274b079abc5c0cf0..1acc4414058840ebade67dc21edf491933ff3175 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Repository/Address.xml @@ -159,7 +159,6 @@ <field name="country_id" xsi:type="string">United Kingdom</field> <field name="region" xsi:type="string">London</field> <field name="telephone" xsi:type="string">444-44-444-44</field> - <field name="fax" xsi:type="string">444-44-444-44</field> <field name="default_billing" xsi:type="string">Yes</field> <field name="default_shipping" xsi:type="string">Yes</field> </dataset> @@ -175,7 +174,6 @@ <field name="country_id" xsi:type="string">United Kingdom</field> <field name="region" xsi:type="string">London</field> <field name="telephone" xsi:type="string">444-44-444-44</field> - <field name="fax" xsi:type="string">444-44-444-44</field> </dataset> <dataset name="UK_address_without_email"> @@ -188,7 +186,6 @@ <field name="country_id" xsi:type="string">United Kingdom</field> <field name="region" xsi:type="string">London</field> <field name="telephone" xsi:type="string">444-44-444-44</field> - <field name="fax" xsi:type="string">444-44-444-44</field> </dataset> <dataset name="UK_address_with_VAT"> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.xml index 4ee4ba83044c39be4d3827259e827b47bf3069f4..1b89235517ffefd6e2d11dcd2c9922290949ebfd 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerBackendEntityTest.xml @@ -96,5 +96,44 @@ <constraint name="Magento\Customer\Test\Constraint\AssertCustomerSuccessSaveMessage" /> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerBackendFormTitle" /> </variation> + <variation name="CreateCustomerBackendEntityTestVariation7" summary="Create customer with custom customer group"> + <data name="customerAction" xsi:type="string">saveAndContinue</data> + <data name="customer/data/website_id" xsi:type="string">Main Website</data> + <data name="customer/data/group_id/dataset" xsi:type="string">customer_group_retail_customer</data> + <data name="customer/data/firstname" xsi:type="string">John%isolation%</data> + <data name="customer/data/lastname" xsi:type="string">Doe%isolation%</data> + <data name="customer/data/email" xsi:type="string">JohnDoe%isolation%@example.com</data> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerSuccessSaveMessage" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerBackendBackButton" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerForm" /> + </variation> + <variation name="CreateCustomerBackendEntityTestVariation8" summary="Verify required fields on Account Information tab."> + <data name="customerAction" xsi:type="string">save</data> + <data name="customer/data/website_id" xsi:type="string">Main Website</data> + <data name="customer/data/group_id/dataset" xsi:type="string">General</data> + <data name="expectedRequiredFields" xsi:type="array"> + <item name="0" xsi:type="string">First Name</item> + <item name="1" xsi:type="string">Last Name</item> + <item name="2" xsi:type="string">Email</item> + </data> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerBackendRequiredFields" /> + </variation> + <variation name="CreateCustomerBackendEntityTestVariation9" summary="Verify required fields on Addresses tab."> + <data name="customerAction" xsi:type="string">save</data> + <data name="customer/data/website_id" xsi:type="string">Main Website</data> + <data name="customer/data/group_id/dataset" xsi:type="string">General</data> + <data name="customer/data/firstname" xsi:type="string">John%isolation%</data> + <data name="customer/data/lastname" xsi:type="string">Doe%isolation%</data> + <data name="customer/data/email" xsi:type="string">JohnDoe%isolation%@example.com</data> + <data name="address/data/company" xsi:type="string">Magento</data> + <data name="expectedRequiredFields" xsi:type="array"> + <item name="2" xsi:type="string">Street Address</item> + <item name="3" xsi:type="string">City</item> + <item name="4" xsi:type="string">Country</item> + <item name="5" xsi:type="string">Zip/Postal Code</item> + <item name="6" xsi:type="string">Phone Number</item> + </data> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerBackendRequiredFields" /> + </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.xml index b50e80215cceb426cf2b75d621c69cfdb375b450..1294aafbdc2812bbb723e374b17d3cb81303b65c 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateCustomerGroupEntityTest.xml @@ -13,6 +13,9 @@ <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupSuccessSaveMessage" /> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupInGrid" /> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupOnCustomerForm" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupOnProductForm" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupOnCatalogPriceRuleForm" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerGroupOnCartPriceRuleForm" /> </variation> <variation name="CreateCustomerGroupEntityTestVariation2"> <data name="customerGroup/data/tax_class_id/dataset" xsi:type="string">retail_customer</data> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerBackendEntity.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerBackendEntity.php new file mode 100644 index 0000000000000000000000000000000000000000..f3721ef7b36598fdc7bb3eed2cc10d0f11c1f4b8 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerBackendEntity.php @@ -0,0 +1,81 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Customer\Test\TestCase; + +use Magento\Mtf\TestCase\Injectable; +use Magento\Customer\Test\Fixture\Customer; +use Magento\Customer\Test\Page\Adminhtml\CustomerIndex; +use Magento\Customer\Test\Page\Adminhtml\CustomerIndexNew; + +/** + * Precondition: + * 1. Customer is created. + * + * Steps: + * 1. Log in as default admin user. + * 2. Go to Customers > All Customers. + * 3. Press "Add New Customer" button. + * 4. Fill form with data from previously created customer. + * 5. Click "Save Customer" button. + * 6. Perform all assertions. + * + * @ZephyrId MAGETWO-43685 + */ +class CreateExistingCustomerBackendEntity extends Injectable +{ + /* tags */ + const MVP = 'yes'; + const DOMAIN = 'CS'; + /* end tags */ + + /** + * Customer index page. + * + * @var CustomerIndex + */ + protected $pageCustomerIndex; + + /** + * New customer page. + * + * @var CustomerIndexNew + */ + protected $pageCustomerIndexNew; + + /** + * Inject customer pages. + * + * @param CustomerIndex $pageCustomerIndex + * @param CustomerIndexNew $pageCustomerIndexNew + * @return void + */ + public function __inject( + CustomerIndex $pageCustomerIndex, + CustomerIndexNew $pageCustomerIndexNew + ) { + $this->pageCustomerIndex = $pageCustomerIndex; + $this->pageCustomerIndexNew = $pageCustomerIndexNew; + } + + /** + * Create customer on backend. + * + * @param Customer $customer + * @return void + */ + public function test(Customer $customer) + { + // Precondition + $customer->persist(); + + // Steps + $this->pageCustomerIndex->open(); + $this->pageCustomerIndex->getPageActionsBlock()->addNew(); + $this->pageCustomerIndexNew->getCustomerForm()->fillCustomer($customer); + $this->pageCustomerIndexNew->getPageActionsBlock()->save(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerBackendEntity.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerBackendEntity.xml new file mode 100644 index 0000000000000000000000000000000000000000..2c711d79991b719385af229a2dad11e8726aebbb --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/CreateExistingCustomerBackendEntity.xml @@ -0,0 +1,15 @@ +<?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="../../../../../../vendor/magento/mtf/etc/variations.xsd"> + <testCase name="Magento\Customer\Test\TestCase\CreateExistingCustomerBackendEntity" summary="Create Existing Customer from Backend" ticketId="MAGETWO-43685"> + <variation name="CreateExistingCustomerBackendEntity1" summary="Create existing customer on Backend."> + <data name="customer/dataset" xsi:type="string">default</data> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerBackendDuplicateErrorMessage" /> + </variation> + </testCase> +</config> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.php index 8d89091816aa5a217f385b50ce31bbd0fb205ac7..a5ac5b76883196e9fc41c9cb496a84e4228654a9 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.php @@ -9,7 +9,7 @@ namespace Magento\Customer\Test\TestCase; use Magento\Customer\Test\Fixture\Customer; use Magento\Customer\Test\Page\CustomerAccountCreate; use Magento\Cms\Test\Page\CmsIndex; -use Magento\Customer\Test\Page\CustomerAccountLogout; +use Magento\Customer\Test\TestStep\LogoutCustomerOnFrontendStep; use Magento\Mtf\TestCase\Injectable; /** @@ -32,40 +32,49 @@ class RegisterCustomerFrontendEntityTest extends Injectable /* end tags */ /** + * Customer registry page. + * * @var CustomerAccountCreate */ protected $customerAccountCreate; /** - * @var CustomerAccountLogout + * Cms page. + * + * @var CmsIndex $cmsIndex */ - protected $customerAccountLogout; + protected $cmsIndex; /** - * @var CmsIndex $cmsIndex + * Customer log out step. + * + * @var LogoutCustomerOnFrontendStep */ - protected $cmsIndex; + protected $logoutCustomerOnFrontendStep; /** + * Inject data. + * * @param CustomerAccountCreate $customerAccountCreate - * @param CustomerAccountLogout $customerAccountLogout * @param CmsIndex $cmsIndex + * @param LogoutCustomerOnFrontendStep $logoutCustomerOnFrontendStep + * @return void */ public function __inject( CustomerAccountCreate $customerAccountCreate, - CustomerAccountLogout $customerAccountLogout, - CmsIndex $cmsIndex + CmsIndex $cmsIndex, + LogoutCustomerOnFrontendStep $logoutCustomerOnFrontendStep ) { - $this->customerAccountLogout = $customerAccountLogout; $this->customerAccountCreate = $customerAccountCreate; $this->cmsIndex = $cmsIndex; - $this->customerAccountLogout->open(); + $this->logoutCustomerOnFrontendStep = $logoutCustomerOnFrontendStep; } /** * Create Customer account on Storefront. * * @param Customer $customer + * @return void */ public function test(Customer $customer) { @@ -76,12 +85,12 @@ class RegisterCustomerFrontendEntityTest extends Injectable } /** - * Logout customer from frontend account + * Logout customer from frontend account. * - * return void + * @return void */ public function tearDown() { - $this->customerAccountLogout->open(); + $this->logoutCustomerOnFrontendStep->run(); } } diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.xml index ba55d1feb8d4fb7bd959d6b0f3a04af9a8f1b142..f9db269ee2b0f190d8455158a01de6bc730d9bf7 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestCase/RegisterCustomerFrontendEntityTest.xml @@ -7,8 +7,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> <testCase name="Magento\Customer\Test\TestCase\RegisterCustomerFrontendEntityTest" summary="Register New Customer" ticketId="MAGETWO-23546"> - <variation name="RegisterCustomerFrontendEntityTestVariation1"> - <data name="description" xsi:type="string">Register new customer</data> + <variation name="RegisterCustomerFrontendEntityTestVariation1" summary="Register new customer"> <data name="customer/data/firstname" xsi:type="string">john</data> <data name="customer/data/lastname" xsi:type="string">doe</data> <data name="customer/data/email" xsi:type="string">johndoe%isolation%@example.com</data> @@ -17,9 +16,9 @@ <data name="customer/data/password_confirmation" xsi:type="string">123123q</data> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerSuccessRegisterMessage" /> <constraint name="Magento\Customer\Test\Constraint\AssertCustomerInGrid" /> + <constraint name="Magento\Customer\Test\Constraint\AssertCustomerLogout" /> </variation> - <variation name="RegisterCustomerFrontendEntityTestVariation2"> - <data name="description" xsi:type="string">Register new customer with subscribing</data> + <variation name="RegisterCustomerFrontendEntityTestVariation2" summary="Register new customer with subscribing"> <data name="customer/data/firstname" xsi:type="string">john</data> <data name="customer/data/lastname" xsi:type="string">doe</data> <data name="customer/data/email" xsi:type="string">johndoe%isolation%@example.com</data> diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php index 63399666bbc44a8ccd21371b6df5c5813bb2cf3e..4c536396af65adc8783011519df7a187f79ac8b3 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/TestStep/LogoutCustomerOnFrontendStep.php @@ -15,11 +15,6 @@ use Magento\Customer\Test\Page\CustomerAccountIndex; */ class LogoutCustomerOnFrontendStep implements TestStepInterface { - /** - * Logout page title. - */ - const LOGOUT_PAGE_TITLE = 'You are signed out.'; - /** * Cms index page. * diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Customer/Test/etc/di.xml index f314e6315e00d2c643046da954f22f16fc76719f..dcee2b9bd421f90a6fc72de9d14308a9bcc53b4e 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/etc/di.xml +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/etc/di.xml @@ -41,4 +41,19 @@ <argument name="severity" xsi:type="string">high</argument> </arguments> </type> + <type name="Magento\Customer\Test\Constraint\AssertCustomerBackendBackButton"> + <arguments> + <argument name="severity" xsi:type="string">middle</argument> + </arguments> + </type> + <type name="Magento\Customer\Test\Constraint\AssertCustomerBackendDuplicateErrorMessage"> + <arguments> + <argument name="severity" xsi:type="string">middle</argument> + </arguments> + </type> + <type name="Magento\Customer\Test\Constraint\AssertCustomerBackendRequiredFields"> + <arguments> + <argument name="severity" xsi:type="string">middle</argument> + </arguments> + </type> </config> diff --git a/dev/tests/functional/tests/app/Magento/Dhl/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Dhl/Test/TestCase/OnePageCheckoutTest.xml index a9e54ed517058c2711cdc2096426944a0a04be6f..5b8bedaf9b977de4d992588095a8625f1d5ca0ed 100644 --- a/dev/tests/functional/tests/app/Magento/Dhl/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Dhl/Test/TestCase/OnePageCheckoutTest.xml @@ -6,22 +6,22 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest"> + <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest" summary="OnePageCheckout within Offline Payment Method and DHL shipping method"> <variation name="OnePageCheckoutDhlTestVariation1" summary="Use DHL International (EU) Online Shipping Carrier on Checkout as a Registered Customer" ticketId="MAGETWO-12850"> <data name="products" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> <data name="checkoutMethod" xsi:type="string">login</data> <data name="customer/dataset" xsi:type="string">customer_DE</data> <data name="address/dataset" xsi:type="string">DE_address</data> - <data name="billingAddress/dataset" xsi:type="string">customer_DE</data> + <data name="shippingAddress/dataset" xsi:type="string">customer_DE</data> <data name="shipping/shipping_service" xsi:type="string">DHL</data> <data name="shipping/shipping_method" xsi:type="string">Express worldwide</data> <data name="cart/data/shipping_method" xsi:type="string">Express worldwide</data> <data name="payment/method" xsi:type="string">checkmo</data> <data name="configData" xsi:type="string">checkmo, dhl_eu, shipping_origin_CH, config_base_currency_ch</data> <data name="tag" xsi:type="string">test_type:3rd_party_test</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> - <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" /> </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml index 5c8e12cbb0e1a2ed8bb50c24311a3af37987acb0..89234e4b9a12c71824d2c7017e485202f061a813 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/TestCase/CreateDownloadableProductEntityTest.xml @@ -276,7 +276,6 @@ <constraint name="Magento\Catalog\Test\Constraint\AssertProductInGrid" /> <constraint name="Magento\Downloadable\Test\Constraint\AssertDownloadableProductForm" /> <constraint name="Magento\Catalog\Test\Constraint\AssertProductPage" /> - <constraint name="Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage" /> </variation> <variation name="CreateDownloadableProductEntityTestVariation15"> <data name="description" xsi:type="string">Create product with tier price</data> diff --git a/dev/tests/functional/tests/app/Magento/Fedex/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Fedex/Test/TestCase/OnePageCheckoutTest.xml index d53852fef4800cd19fa6adbf896c89cf29c983c6..580de1cac6f912292b16b8973f23376f4aad5282 100644 --- a/dev/tests/functional/tests/app/Magento/Fedex/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Fedex/Test/TestCase/OnePageCheckoutTest.xml @@ -6,37 +6,38 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest"> + <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest" summary="OnePageCheckout within Offline Payment Method and Fedex shipping method"> <variation name="OnePageCheckoutFedexTestVariation1" summary="Check Out as Guest using FedEx with US shipping origin and UK customer"> <data name="products" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> <data name="checkoutMethod" xsi:type="string">guest</data> <data name="customer/dataset" xsi:type="string">default</data> <data name="address/dataset" xsi:type="string">UK_address</data> - <data name="billingAddress/dataset" xsi:type="string">UK_address</data> + <data name="shippingAddress/dataset" xsi:type="string">UK_address</data> <data name="shipping/shipping_service" xsi:type="string">Federal Express</data> <data name="shipping/shipping_method" xsi:type="string">International Economy</data> <data name="cart/data/shipping_method" xsi:type="string">International Economy</data> <data name="payment/method" xsi:type="string">checkmo</data> <data name="configData" xsi:type="string">checkmo, fedex, shipping_origin_US_CA</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> - <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> + <data name="tag" xsi:type="string">test_type:3rd_party_test</data> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" /> </variation> <variation name="OnePageCheckoutFedexTestVariation2" summary="Use FedEx Online Shipping Carrier on Checkout as a Registered Customer" ticketId="MAGETWO-12849"> <data name="products" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> <data name="checkoutMethod" xsi:type="string">login</data> <data name="customer/dataset" xsi:type="string">customer_DE</data> <data name="address/dataset" xsi:type="string">DE_address</data> - <data name="billingAddress/dataset" xsi:type="string">customer_DE</data> + <data name="shippingAddress/dataset" xsi:type="string">customer_DE</data> <data name="shipping/shipping_service" xsi:type="string">Federal Express</data> <data name="shipping/shipping_method" xsi:type="string">Ground</data> <data name="cart/data/shipping_method" xsi:type="string">Ground</data> <data name="payment/method" xsi:type="string">checkmo</data> <data name="configData" xsi:type="string">checkmo, fedex, shipping_origin_US_CA</data> <data name="tag" xsi:type="string">test_type:3rd_party_test</data> - <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> - <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid"/> - <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> + <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" /> + <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" /> + <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty" /> </variation> </testCase> </config> diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Adminhtml/Product/Grouped/AssociatedProducts/Search/Grid.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Adminhtml/Product/Grouped/AssociatedProducts/Search/Grid.php index 55b341dc6d3b72224065b2c9b41e3bc05264834a..caa07b91ce7efd9d88bc031c324ca400c69d1d7c 100644 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Adminhtml/Product/Grouped/AssociatedProducts/Search/Grid.php +++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Block/Adminhtml/Product/Grouped/AssociatedProducts/Search/Grid.php @@ -37,7 +37,7 @@ class Grid extends GridInterface * * @var string */ - protected $selectItem = '[data-column=entity_id] input'; + protected $selectItem = '[data-column=entity_ids] input'; /** * Press 'Add Selected Products' button diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedPriceOnGroupedProductPage.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedPriceOnGroupedProductPage.php deleted file mode 100644 index e3c8e2bd1dbd4dc687469b7fe8a005419c5c0bd9..0000000000000000000000000000000000000000 --- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedPriceOnGroupedProductPage.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\GroupedProduct\Test\Constraint; - -use Magento\Catalog\Test\Constraint\AssertProductGroupedPriceOnProductPage; -use Magento\Catalog\Test\Page\Product\CatalogProductView; -use Magento\GroupedProduct\Test\Fixture\GroupedProduct; -use Magento\Mtf\Client\BrowserInterface; - -/** - * Class AssertGroupedPriceOnGroupedProductPage - * Assert that displayed grouped price on grouped product page equals passed from fixture - */ -class AssertGroupedPriceOnGroupedProductPage extends AbstractAssertPriceOnGroupedProductPage -{ - /** - * Format error message - * - * @var string - */ - protected $errorMessage = 'This "%s" product\'s grouped price on product page NOT equals passed from fixture.'; - - /** - * Successful message - * - * @var string - */ - protected $successfulMessage = 'Displayed grouped price on grouped product page equals to passed from a fixture.'; - - /** - * Assert that displayed grouped price on grouped product page equals passed from fixture - * - * @param CatalogProductView $catalogProductView - * @param GroupedProduct $product - * @param AssertProductGroupedPriceOnProductPage $groupedPrice - * @param BrowserInterface $browser - * @return void - */ - public function processAssert( - CatalogProductView $catalogProductView, - GroupedProduct $product, - AssertProductGroupedPriceOnProductPage $groupedPrice, - BrowserInterface $browser - ) { - $this->processAssertPrice($product, $catalogProductView, $groupedPrice, $browser); - } -} diff --git a/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutAddressNewShipping.php b/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutAddressNewShipping.php index 37d0cda809996a05b6edb2791d3941b4d3df95c8..746296b32c10871d07722f73ee411aed0539d936 100644 --- a/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutAddressNewShipping.php +++ b/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutAddressNewShipping.php @@ -11,41 +11,41 @@ use Magento\Mtf\Factory\Factory; use Magento\Mtf\Page\Page; /** - * class MultishippingCheckoutAddressNewShipping - * Create Shipping Address page - * + * Create Shipping Address page. */ class MultishippingCheckoutAddressNewShipping extends Page { /** - * URL for new shipping address page + * URL for new shipping address page. */ const MCA = 'multishipping/checkout_address/newShipping'; /** - * Form for edit customer address + * Form for edit customer address. * * @var string */ protected $editBlock = '#form-validate'; /** - * Custom constructor + * Init page. Set page url. + * + * @return void */ - protected function _init() + protected function initUrl() { - $this->_url = $_ENV['app_frontend_url'] . self::MCA; + $this->url = $_ENV['app_frontend_url'] . self::MCA; } /** - * Get form for edit customer address + * Get form for edit customer address. * * @return \Magento\Customer\Test\Block\Address\Edit */ public function getEditBlock() { return Factory::getBlockFactory()->getMagentoCustomerAddressEdit( - $this->_browser->find($this->editBlock, Locator::SELECTOR_CSS) + $this->browser->find($this->editBlock, Locator::SELECTOR_CSS) ); } } diff --git a/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutCart.php b/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutCart.php index acbd1375dbbbbf5f9af4b52828c061878c17a245..3a3e1981636a3987f778815f8db5e2a1f5faa730 100644 --- a/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutCart.php +++ b/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutCart.php @@ -11,32 +11,31 @@ use Magento\Mtf\Factory\Factory; use Magento\Mtf\Page\Page; /** - * class MultishippingCheckoutCart - * + * Multishipping checkout cart page. */ class MultishippingCheckoutCart extends Page { /** - * URL for multishipping checkout cart page + * URL for multishipping checkout cart page. */ const MCA = 'multishipping/checkout/cart'; /** - * Multishipping cart link block + * Multishipping cart link block. * * @var string */ protected $multishippingLinkBlock = '.action.multicheckout'; /** - * Get multishipping cart link block + * Get multishipping cart link block. * * @return \Magento\Multishipping\Test\Block\Checkout\Link */ public function getMultishippingLinkBlock() { return Factory::getBlockFactory()->getMagentoMultishippingCheckoutLink( - $this->_browser->find($this->multishippingLinkBlock, Locator::SELECTOR_CSS) + $this->browser->find($this->multishippingLinkBlock, Locator::SELECTOR_CSS) ); } } diff --git a/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutLogin.php b/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutLogin.php index cb233ab410587cadaee367a117261a67347c9eef..8c0a07f7dfb717059f76efb1cc774b2126586d57 100644 --- a/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutLogin.php +++ b/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutLogin.php @@ -11,39 +11,41 @@ use Magento\Mtf\Factory\Factory; use Magento\Mtf\Page\Page; /** - * Multishipping login page + * Multishipping login page. */ class MultishippingCheckoutLogin extends Page { /** - * URL for multishipping login page + * URL for multishipping login page. */ const MCA = 'multishipping/checkout/login'; /** - * Form for customer login + * Form for customer login. * * @var string */ protected $loginBlock = '.login-container'; /** - * Custom constructor + * Init page. Set page url. + * + * @return void */ - protected function _init() + protected function initUrl() { - $this->_url = $_ENV['app_frontend_url'] . self::MCA; + $this->url = $_ENV['app_frontend_url'] . self::MCA; } /** - * Get form for customer login + * Get form for customer login. * * @return \Magento\Customer\Test\Block\Form\Login */ public function getLoginBlock() { return Factory::getBlockFactory()->getMagentoCustomerFormLogin( - $this->_browser->find($this->loginBlock, Locator::SELECTOR_CSS) + $this->browser->find($this->loginBlock, Locator::SELECTOR_CSS) ); } } diff --git a/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutRegister.php b/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutRegister.php index 4b858c8514a5f7452d2461b476ff13687e5999c4..757848308d76ea2de1442885f84de76d251b4e9e 100644 --- a/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutRegister.php +++ b/dev/tests/functional/tests/app/Magento/Multishipping/Test/Page/MultishippingCheckoutRegister.php @@ -11,41 +11,41 @@ use Magento\Mtf\Factory\Factory; use Magento\Mtf\Page\Page; /** - * class MultishippingCheckoutRegister - * Register new customer while performing multishipping addresses checkout - * + * Register new customer while performing multishipping addresses checkout. */ class MultishippingCheckoutRegister extends Page { /** - * URL for register customer page + * URL for register customer page. */ const MCA = 'multishipping/checkout/register'; /** - * Customer register block form + * Customer register block form. * * @var string */ protected $registerBlock = '#form-validate'; /** - * Custom constructor + * Init page. Set page url. + * + * @return void */ - protected function _init() + protected function initUrl() { - $this->_url = $_ENV['app_frontend_url'] . self::MCA; + $this->url = $_ENV['app_frontend_url'] . self::MCA; } /** - * Get customer register block form + * Get customer register block form. * * @return \Magento\Customer\Test\Block\Form\Register */ public function getRegisterBlock() { return Factory::getBlockFactory()->getMagentoCustomerFormRegister( - $this->_browser->find($this->registerBlock, Locator::SELECTOR_CSS) + $this->browser->find($this->registerBlock, Locator::SELECTOR_CSS) ); } } diff --git a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Subscriber/Grid.php b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Subscriber/Grid.php index 093740233986417f69c4572734a2adf739c17bdc..9c2f66542e902a7198c8014073ee1f70f88596f1 100644 --- a/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Subscriber/Grid.php +++ b/dev/tests/functional/tests/app/Magento/Newsletter/Test/Block/Adminhtml/Subscriber/Grid.php @@ -7,13 +7,12 @@ namespace Magento\Newsletter\Test\Block\Adminhtml\Subscriber; /** - * Newsletter subscribers grid - * + * Newsletter subscribers grid. */ -class Grid extends \Magento\Ui\Test\Block\Adminhtml\DataGrid +class Grid extends \Magento\Backend\Test\Block\Widget\Grid { /** - * Filters array mapping + * Filters array mapping. * * @var array */ diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AbstractAssertInvoiceReportResult.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AbstractAssertInvoiceReportResult.php index df6e3fb9662d455e69f22dbe3b8238b743c143eb..0bf83c62bc8a22e1a9d4c797632e680857921a66 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AbstractAssertInvoiceReportResult.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AbstractAssertInvoiceReportResult.php @@ -10,22 +10,22 @@ use Magento\Reports\Test\Page\Adminhtml\SalesInvoiceReport; use Magento\Sales\Test\Fixture\OrderInjectable; use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Mtf\ObjectManager; +use Magento\Mtf\System\Event\EventManagerInterface; /** - * Class AbstractAssertInvoiceReportResult - * Abstract assert for search in invoice report grid + * Abstract assert for search in invoice report grid. */ abstract class AbstractAssertInvoiceReportResult extends AbstractConstraint { /** - * Invoice report page + * Invoice report page. * * @var SalesInvoiceReport */ protected $salesInvoiceReport; /** - * Order + * Order. * * @var OrderInjectable */ @@ -34,16 +34,20 @@ abstract class AbstractAssertInvoiceReportResult extends AbstractConstraint /** * @constructor * @param ObjectManager $objectManager + * @param EventManagerInterface $eventManager * @param SalesInvoiceReport $salesInvoiceReport */ - public function __construct(ObjectManager $objectManager, SalesInvoiceReport $salesInvoiceReport) - { - parent::__construct($objectManager); + public function __construct( + ObjectManager $objectManager, + EventManagerInterface $eventManager, + SalesInvoiceReport $salesInvoiceReport + ) { + parent::__construct($objectManager, $eventManager); $this->salesInvoiceReport = $salesInvoiceReport; } /** - * Search in invoice report grid + * Search in invoice report grid. * * @param array $invoiceReport * @return void @@ -57,7 +61,7 @@ abstract class AbstractAssertInvoiceReportResult extends AbstractConstraint } /** - * Prepare expected result + * Prepare expected result. * * @param array $expectedInvoiceData * @return array diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php index 2a1942e9f7254b0ff6bfba751f5f17f073e160ca..f034bbb2c52b7b34ed7e061a882a71d78a8e67fa 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php @@ -10,108 +10,107 @@ use Magento\Mtf\Block\Block; use Magento\Mtf\Client\Locator; /** - * Class Actions - * Order actions block + * Order actions block. */ class Actions extends Block { /** - * 'Back' button + * 'Back' button. * * @var string */ protected $back = '#back'; /** - * 'Edit' button + * 'Edit' button. * * @var string */ protected $edit = '#order_edit'; /** - * 'Cancel' button + * 'Cancel' button. * * @var string */ - protected $cancel = '#order_cancel'; + protected $cancel = '[id$=cancel-button]'; /** - * 'Send Email' button + * 'Send Email' button. * * @var string */ protected $sendEmail = '#send_notification'; /** - * 'Void' button + * 'Void' button. * * @var string */ protected $void = '#void_payment'; /** - * 'Hold' button + * 'Hold' button. * * @var string */ - protected $hold = '#order_hold'; + protected $hold = '[id$=hold-button]'; /** - * 'Invoice' button + * 'Invoice' button. * * @var string */ protected $invoice = '#order_invoice'; /** - * 'Reorder' button + * 'Reorder' button. * * @var string */ protected $reorder = '#order_reorder'; /** - * 'Ship' button + * 'Ship' button. * * @var string */ protected $ship = '#order_ship'; /** - * 'Credit Memo' button on the order page + * 'Credit Memo' button on the order page. * * @var string */ protected $orderCreditMemo = '#order_creditmemo'; /** - * 'Credit Memo' button on the order invoice page + * 'Credit Memo' button on the order invoice page. * * @var string */ protected $orderInvoiceCreditMemo = '#capture'; /** - * 'Refund' button + * 'Refund' button. * * @var string */ protected $refund = '.submit-button.refund'; /** - * 'Refund Offline' button + * 'Refund Offline' button. * * @var string */ protected $refundOffline = '.submit-button'; /** - * General button selector + * General button selector. * * @var string */ - protected $button = 'button[data-ui-id$="%s-button"]'; + protected $button = '//button[@title="%s"]'; /** * Selector for confirm. @@ -121,7 +120,7 @@ class Actions extends Block protected $confirmModal = '.confirm._show[data-role=modal]'; /** - * Ship order + * Ship order. * * @return void */ @@ -131,7 +130,7 @@ class Actions extends Block } /** - * Invoice order + * Invoice order. * * @return void */ @@ -141,7 +140,7 @@ class Actions extends Block } /** - * Reorder order + * Reorder order. * * @return void */ @@ -151,7 +150,7 @@ class Actions extends Block } /** - * Go back + * Go back. * * @return void */ @@ -161,7 +160,7 @@ class Actions extends Block } /** - * Edit order + * Edit order. * * @return void */ @@ -171,7 +170,7 @@ class Actions extends Block } /** - * Cancel order + * Cancel order. * * @return void */ @@ -185,7 +184,7 @@ class Actions extends Block } /** - * Send email + * Send email. * * @return void */ @@ -195,7 +194,7 @@ class Actions extends Block } /** - * Void order + * Void order. * * @return void */ @@ -205,7 +204,7 @@ class Actions extends Block } /** - * Hold order + * Hold order. * * @return void */ @@ -215,7 +214,7 @@ class Actions extends Block } /** - * Order credit memo + * Order credit memo. * * @return void */ @@ -225,7 +224,7 @@ class Actions extends Block } /** - * Order invoice credit memo + * Order invoice credit memo. * * @return void */ @@ -235,7 +234,7 @@ class Actions extends Block } /** - * Refund order + * Refund order. * * @return void */ @@ -245,7 +244,7 @@ class Actions extends Block } /** - * Refund offline order + * Refund offline order. * * @return void */ @@ -255,14 +254,13 @@ class Actions extends Block } /** - * Check if action button is visible + * Check if action button is visible. * * @param string $buttonName * @return bool */ public function isActionButtonVisible($buttonName) { - $buttonName = str_replace(' ', '-', strtolower($buttonName)); - return $this->_rootElement->find(sprintf($this->button, $buttonName))->isVisible(); + return $this->_rootElement->find(sprintf($this->button, $buttonName), Locator::SELECTOR_XPATH)->isVisible(); } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AbstractAssertOrderOnFrontend.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AbstractAssertOrderOnFrontend.php index 9ba84f6a064de3ee1cedc9d86ed6c3fc49d3b0f5..0c8fecdff10e4cbeb2c419bf1aa76997529a8287 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AbstractAssertOrderOnFrontend.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AbstractAssertOrderOnFrontend.php @@ -11,22 +11,22 @@ use Magento\Cms\Test\Page\CmsIndex; use Magento\Customer\Test\Fixture\Customer; use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Mtf\ObjectManager; +use Magento\Mtf\System\Event\EventManagerInterface; /** - * Abstract Class AbstractAssertOrderOnFrontend - * Abstract class for frontend asserts + * Abstract class for frontend asserts. */ abstract class AbstractAssertOrderOnFrontend extends AbstractConstraint { /** - * Cms index page + * Cms index page. * * @var CmsIndex */ protected $cmsIndex; /** - * Customer account index page + * Customer account index page. * * @var CustomerAccountIndex */ @@ -35,21 +35,23 @@ abstract class AbstractAssertOrderOnFrontend extends AbstractConstraint /** * @constructor * @param ObjectManager $objectManager + * @param EventManagerInterface $eventManager * @param CmsIndex $cmsIndex * @param CustomerAccountIndex $customerAccountIndex */ public function __construct( ObjectManager $objectManager, + EventManagerInterface $eventManager, CmsIndex $cmsIndex, CustomerAccountIndex $customerAccountIndex ) { - parent::__construct($objectManager); + parent::__construct($objectManager, $eventManager); $this->cmsIndex = $cmsIndex; $this->customerAccountIndex = $customerAccountIndex; } /** - * Login customer and open Order page + * Login customer and open Order page. * * @param Customer $customer * @return void diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCreditMemoButton.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCreditMemoButton.php index 6baff36cc94ebc9f8a23103474da4070105190b5..4ce59a74583bfef397c8756bb0b1bc4bbe0797cd 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCreditMemoButton.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCreditMemoButton.php @@ -29,7 +29,7 @@ class AssertCreditMemoButton extends AbstractConstraint $orderIndex->open(); $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]); \PHPUnit_Framework_Assert::assertTrue( - $salesOrderView->getPageActions()->isActionButtonVisible('CreditMemo'), + $salesOrderView->getPageActions()->isActionButtonVisible('Credit Memo'), 'Credit memo button is absent on order view page.' ); } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertNoCreditMemoButton.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertNoCreditMemoButton.php index ed8806f44c61642cfd56bdf2fd9644d5ac2c8b7b..d9e935600ba18bea3a6040b9977d214ee112a9b3 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertNoCreditMemoButton.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertNoCreditMemoButton.php @@ -29,7 +29,7 @@ class AssertNoCreditMemoButton extends AbstractConstraint $orderIndex->open(); $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]); \PHPUnit_Framework_Assert::assertFalse( - $salesOrderView->getPageActions()->isActionButtonVisible('CreditMemo'), + $salesOrderView->getPageActions()->isActionButtonVisible('Credit Memo'), 'Credit memo button is present on order view page.' ); } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/SalesOrderShipmentNew.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/SalesOrderShipmentNew.php index 352f752784045a12c0f3549332fbf48832a82844..28f2387011d6256f58065389ec272026f197f417 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/SalesOrderShipmentNew.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/SalesOrderShipmentNew.php @@ -11,41 +11,41 @@ use Magento\Mtf\Factory\Factory; use Magento\Mtf\Page\Page; /** - * Class SalesOrder - * Manage orders page - * + * Manage orders page. */ class SalesOrderShipmentNew extends Page { /** - * URL for manage orders page + * URL for manage orders page. */ const MCA = 'sales/order/shipment/new'; /** - * Shipment totals block + * Shipment totals block. * * @var string */ protected $totalsBlock = '.order-totals'; /** - * Custom constructor + * Init page. Set page url. + * + * @return void */ - protected function _init() + protected function initUrl() { - $this->_url = $this->_url = $_ENV['app_backend_url'] . self::MCA; + $this->url = $_ENV['app_backend_url'] . self::MCA; } /** - * Get shipment totals + * Get shipment totals. * * @return \Magento\Sales\Test\Block\Adminhtml\Order\Shipment\Totals */ public function getTotalsBlock() { return Factory::getBlockFactory()->getMagentoSalesAdminhtmlOrderShipmentTotals( - $this->_browser->find($this->totalsBlock, Locator::SELECTOR_CSS) + $this->browser->find($this->totalsBlock, Locator::SELECTOR_CSS) ); } } diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml index c6a9fa03bb5c07a546cb0d2981de62a76cf5bda0..a073396e9136d11a91dacbce00ed0f8c9e4c77ca 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendTest.xml @@ -20,7 +20,7 @@ </data> <data name="payment/method" xsi:type="string">cashondelivery</data> <data name="status" xsi:type="string">Pending</data> - <data name="orderButtonsAvailable" xsi:type="string">Back, Reorder, Cancel, Send Notification, Hold, Invoice, Ship, Edit</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Reorder, Cancel, Send Email, Hold, Invoice, Ship, Edit</data> <data name="configData" xsi:type="string">cashondelivery</data> <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> @@ -39,7 +39,7 @@ </data> <data name="payment/method" xsi:type="string">checkmo</data> <data name="status" xsi:type="string">Pending</data> - <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Notification, Hold, Invoice, Edit</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Invoice, Edit</data> <data name="configData" xsi:type="string">checkmo_specificcountry_gb</data> <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> @@ -60,7 +60,7 @@ </data> <data name="payment/method" xsi:type="string">banktransfer</data> <data name="status" xsi:type="string">Pending</data> - <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Notification, Hold, Reorder, Invoice, Edit</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Reorder, Invoice, Edit</data> <data name="configData" xsi:type="string">banktransfer</data> <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> @@ -80,7 +80,7 @@ </data> <data name="payment/method" xsi:type="string">banktransfer</data> <data name="status" xsi:type="string">Pending</data> - <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Notification, Hold, Invoice, Edit</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Invoice, Edit</data> <data name="configData" xsi:type="string">freeshipping_specificcountry_gb, banktransfer</data> <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> @@ -102,7 +102,7 @@ <data name="payment/method" xsi:type="string">purchaseorder</data> <data name="payment/po_number" xsi:type="string">123456</data> <data name="status" xsi:type="string">Pending</data> - <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Notification, Hold, Invoice, Reorder, Edit</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Invoice, Reorder, Edit</data> <data name="configData" xsi:type="string">purchaseorder</data> <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" /> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.xml index facb72b9d308636e7e0c994bbb40fe0b940cff35..1ad7453a1253f2f7a835e71ad21c95921c6341d2 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveLastOrderedProductsOnOrderPageTest.xml @@ -14,7 +14,7 @@ </variation> <variation name="MoveLastOrderedProductsOnOrderPageTestVariation2"> <data name="order/dataset" xsi:type="string">default</data> - <data name="order/data/entity_id/products" xsi:type="string">configurableProduct::default</data> + <data name="order/data/entity_id/products" xsi:type="string">configurableProduct::configurable_with_qty_1</data> <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInItemsOrderedGrid" /> </variation> </testCase> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.xml index fd66961ecdb5743c649d4290b8a017fc381fe911..ef57ce932a9ca91222ac849df7637c0caf7fd2b9 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveProductsInComparedOnOrderPageTest.xml @@ -12,7 +12,7 @@ <constraint name="Magento\Sales\Test\Constraint\AssertProductInItemsOrderedGrid" /> </variation> <variation name="MoveProductsInComparedOnOrderPageTestVariation2"> - <data name="products" xsi:type="string">configurableProduct::default,configurableProduct::default</data> + <data name="products" xsi:type="string">configurableProduct::configurable_with_qty_1,configurableProduct::configurable_with_qty_1</data> <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInItemsOrderedGrid" /> </variation> </testCase> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.xml index b37eb5a0a491dae3d6ece0e53a1e1cbde5362ba1..1ffaa89fc60462eefe40dbd9207279888df31e63 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveRecentlyComparedProductsOnOrderPageTest.xml @@ -11,8 +11,8 @@ <data name="products" xsi:type="string">catalogProductSimple::default,catalogProductSimple::default</data> <constraint name="Magento\Sales\Test\Constraint\AssertProductInItemsOrderedGrid" /> </variation> - <variation name="MoveRecentlyComparedProductsOnOrderPageTestVariation2" firstConstraint="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInItemsOrderedGrid" method="test"> - <data name="products" xsi:type="string">configurableProduct::default,configurableProduct::default</data> + <variation name="MoveRecentlyComparedProductsOnOrderPageTestVariation2"> + <data name="products" xsi:type="string">configurableProduct::configurable_with_qty_1,configurableProduct::configurable_with_qty_1</data> <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInItemsOrderedGrid" /> </variation> </testCase> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.xml index c82da591595d335f0985ef72ed9e73f6fee22d41..d03339663c03c8967d6091669e7cf47ea8ca1f84 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/MoveShoppingCartProductsOnOrderPageTest.xml @@ -12,7 +12,7 @@ <constraint name="Magento\Sales\Test\Constraint\AssertProductInItemsOrderedGrid" /> </variation> <variation name="MoveShoppingCartProductsOnOrderPageTestVariation2" firstConstraint="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInItemsOrderedGrid" method="test"> - <data name="product" xsi:type="string">configurableProduct::default</data> + <data name="product" xsi:type="string">configurableProduct::configurable_with_qty_1</data> <constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInItemsOrderedGrid" /> </variation> </testCase> diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.xml index fb43e4a85b4c9e8fc672be041ab7f7ce9ad220da..6d9ff785a5df99181f1103e1a091c906ca6851ce 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/ReorderOrderEntityTest.xml @@ -21,7 +21,7 @@ <data name="payment/method" xsi:type="string">checkmo</data> <data name="previousOrderStatus" xsi:type="string">Pending</data> <data name="status" xsi:type="string">Pending</data> - <data name="orderButtonsAvailable" xsi:type="string">Back, Reorder, Cancel, Send Notification, Hold, Invoice, Ship, Edit</data> + <data name="orderButtonsAvailable" xsi:type="string">Back, Reorder, Cancel, Send Email, Hold, Invoice, Ship, Edit</data> <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" /> <constraint name="Magento\Sales\Test\Constraint\AssertReorderStatusIsCorrect" /> diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/Tab/RuleInformation.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/Tab/RuleInformation.php index 4c4b9a024af41424445ce09d25fab26e43787919..22168f005697e3c4ce86068ac9b1ae9ed25d6b18 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/Tab/RuleInformation.php +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/Block/Adminhtml/Promo/Quote/Edit/Tab/RuleInformation.php @@ -7,6 +7,7 @@ namespace Magento\SalesRule\Test\Block\Adminhtml\Promo\Quote\Edit\Tab; use Magento\Backend\Test\Block\Widget\Tab; +use Magento\Customer\Test\Fixture\CustomerGroup; use Magento\Mtf\Client\Element\SimpleElement; /** @@ -14,6 +15,13 @@ use Magento\Mtf\Client\Element\SimpleElement; */ class RuleInformation extends Tab { + /** + * Locator for Customer Group element. + * + * @var string + */ + protected $customerGroup = '#rule_customer_group_ids'; + /** * Get data of tab. * @@ -31,4 +39,16 @@ class RuleInformation extends Tab } return $this->_getData($data, $element); } + + /** + * Check whether Customer Group is visible. + * + * @param CustomerGroup $customerGroup + * @return bool + */ + public function isVisibleCustomerGroup(CustomerGroup $customerGroup) + { + $options = $this->_rootElement->find($this->customerGroup)->getText(); + return false !== strpos($options, $customerGroup->getCustomerGroupCode()); + } } diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnFrontendStep.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnFrontendStep.php index 49fedf0d5d16dd7b214105d42fb4cab24e55aaa8..3e21afe5ef91b67f6f992fce191a9ab3783b97c5 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnFrontendStep.php +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/ApplySalesRuleOnFrontendStep.php @@ -49,6 +49,7 @@ class ApplySalesRuleOnFrontendStep implements TestStepInterface { if ($this->salesRule !== null) { $this->checkoutCart->getDiscountCodesBlock()->applyCouponCode($this->salesRule->getCouponCode()); + $this->checkoutCart->getTotalsBlock()->waitForUpdatedTotals(); } } } diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/CreateSalesRuleStep.php b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/CreateSalesRuleStep.php index 56db436ccb68d969073310fe69e0278936c1ef75..ad0d2fbe86454c8c0e19a63dc46057125ceef5ec 100644 --- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/CreateSalesRuleStep.php +++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestStep/CreateSalesRuleStep.php @@ -77,6 +77,8 @@ class CreateSalesRuleStep implements TestStepInterface */ public function cleanup() { - $this->deleteAllSalesRule->run(); + if ($this->salesRule !== null) { + $this->deleteAllSalesRule->run(); + } } } diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertShipmentItems.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertShipmentItems.php index e85ce0c7b0e2eb4813224bf75d487f741717b29e..1b915560f211f3a033d1dbb7e750bf1a0c69638e 100644 --- a/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertShipmentItems.php +++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertShipmentItems.php @@ -11,15 +11,15 @@ use Magento\Sales\Test\Fixture\OrderInjectable; use Magento\Shipping\Test\Page\Adminhtml\SalesShipmentView; use Magento\Shipping\Test\Page\Adminhtml\ShipmentIndex; use Magento\Mtf\ObjectManager; +use Magento\Mtf\System\Event\EventManagerInterface; /** - * Class AssertShipmentItems - * Assert shipment items on shipment view page + * Assert shipment items on shipment view page. */ class AssertShipmentItems extends AbstractAssertItems { /** - * Shipment index page + * Shipment index page. * * @var ShipmentIndex */ @@ -28,16 +28,20 @@ class AssertShipmentItems extends AbstractAssertItems /** * @constructor * @param ObjectManager $objectManager + * @param EventManagerInterface $eventManager * @param ShipmentIndex $shipmentIndex */ - public function __construct(ObjectManager $objectManager, ShipmentIndex $shipmentIndex) - { - parent::__construct($objectManager); + public function __construct( + ObjectManager $objectManager, + EventManagerInterface $eventManager, + ShipmentIndex $shipmentIndex + ) { + parent::__construct($objectManager, $eventManager); $this->shipmentPage = $shipmentIndex; } /** - * Assert shipped products are represented on shipment view page + * Assert shipped products are represented on shipment view page. * * @param SalesShipmentView $orderShipmentView * @param OrderInjectable $order @@ -56,7 +60,7 @@ class AssertShipmentItems extends AbstractAssertItems } /** - * Process assert + * Process assert. * * @param OrderInjectable $order * @param array $ids @@ -85,7 +89,7 @@ class AssertShipmentItems extends AbstractAssertItems } /** - * Returns a string representation of the object + * Returns a string representation of the object. * * @return string */ diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/TaxRate.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/TaxRate.php index 30ee53017146c24b9afebd9546848862a80fa03b..4c06dede0433d327fc106acfc7cb45fa4f3b55c2 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/TaxRate.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Block/Adminhtml/Rule/Edit/TaxRate.php @@ -9,20 +9,19 @@ namespace Magento\Tax\Test\Block\Adminhtml\Rule\Edit; use Magento\Mtf\Block\Form as FormInterface; /** - * Class TaxRate - * Tax rate block + * Tax rate block. */ class TaxRate extends FormInterface { /** - * 'Save' button on dialog window for creating new tax rate + * 'Save' button on dialog window for creating new tax rate. * * @var string */ - protected $saveTaxRate = '#tax-rule-edit-apply-button'; + protected $saveTaxRate = '.action-save'; /** - * Clicking 'Save' button on dialog window for creating new tax rate + * Clicking 'Save' button on dialog window for creating new tax rate. * * @return void */ diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php index 51caa4822fa60fd38b18c1df6c132bfa8ec876e0..e66cdb00918e84cfe6d415ca30a4284220203c54 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/Constraint/AssertTaxRuleApplying.php @@ -17,65 +17,65 @@ use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Mtf\Fixture\FixtureFactory; /** - * Abstract class for implementing assert applying + * Abstract class for implementing assert applying. */ abstract class AssertTaxRuleApplying extends AbstractConstraint { /** - * Initial tax rule + * Initial tax rule. * * @var TaxRule */ protected $initialTaxRule; /** - * Tax rule + * Tax rule. * * @var TaxRule */ protected $taxRule; /** - * Product simple + * Product simple. * * @var CatalogProductSimple */ protected $productSimple; /** - * Checkout cart page + * Checkout cart page. * * @var CheckoutCart */ protected $checkoutCart; /** - * Shipping carrier and method + * Shipping carrier and method. * * @var array */ protected $shipping; /** - * Tax Rule name + * Tax Rule name. * * @var string */ protected $taxRuleCode; /** - * Implementation assert + * Implementation assert. * * @return void */ abstract protected function assert(); /** - * 1. Creating product simple with custom tax product class - * 2. Log In as customer - * 3. Add product to shopping cart - * 4. Estimate Shipping and Tax - * 5. Implementation assert + * 1. Creating product simple with custom tax product class. + * 2. Log In as customer. + * 3. Add product to shopping cart. + * 4. Estimate Shipping and Tax. + * 5. Implementation assert. * * @param FixtureFactory $fixtureFactory * @param TaxRule $taxRule @@ -136,9 +136,7 @@ abstract class AssertTaxRuleApplying extends AbstractConstraint $catalogProductView->getMessagesBlock()->waitSuccessMessage(); // Estimate Shipping and Tax $checkoutCart->open(); - $checkoutCart->getShippingBlock()->openEstimateShippingAndTax(); - $checkoutCart->getShippingBlock()->fill($address); - $checkoutCart->getShippingBlock()->clickGetQuote(); + $checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($address); $checkoutCart->getShippingBlock()->selectShippingMethod($shipping); $this->assert(); } diff --git a/dev/tests/functional/tests/app/Magento/Tax/Test/TestStep/CreateTaxRuleStep.php b/dev/tests/functional/tests/app/Magento/Tax/Test/TestStep/CreateTaxRuleStep.php index a587216002ed8a933341ddf30fa10d8f24af1a1a..f2e786edf23583abad54fbd5b48569da77a8104b 100644 --- a/dev/tests/functional/tests/app/Magento/Tax/Test/TestStep/CreateTaxRuleStep.php +++ b/dev/tests/functional/tests/app/Magento/Tax/Test/TestStep/CreateTaxRuleStep.php @@ -80,6 +80,8 @@ class CreateTaxRuleStep implements TestStepInterface */ public function cleanup() { - $this->deleteAllTaxRule->run(); + if ($this->taxRule !== null) { + $this->deleteAllTaxRule->run(); + } } } diff --git a/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Breadcrumbs.php b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Breadcrumbs.php new file mode 100644 index 0000000000000000000000000000000000000000..a5ef31b35849452127662a99594506d909e1bf4e --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Html/Breadcrumbs.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Theme\Test\Block\Html; + +use Magento\Mtf\Block\Block; + +/** + * Page breadcrumbs block. + */ +class Breadcrumbs extends Block +{ + /** + * Get breadcrumbs content of current page. + * + * @return string + */ + public function getText() + { + return $this->_rootElement->getText(); + } +} diff --git a/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Links.php b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Links.php index 3375541068cb1264e5054958cc449dc7871bc8b9..31f1a6fd97bacaafcffca6775ef6f637b9650129 100644 --- a/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Links.php +++ b/dev/tests/functional/tests/app/Magento/Theme/Test/Block/Links.php @@ -75,8 +75,11 @@ class Links extends Block */ public function isLinkVisible($linkTitle) { - $this->expandCustomerMenu(); - return $this->_rootElement->find(sprintf($this->link, $linkTitle), Locator::SELECTOR_XPATH)->isVisible(); + $link = $this->_rootElement->find(sprintf($this->link, $linkTitle), Locator::SELECTOR_XPATH); + if (!$link->isVisible()) { + $this->expandCustomerMenu(); + } + return $link->isVisible(); } /** diff --git a/dev/tests/functional/tests/app/Magento/Ups/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Ups/Test/TestCase/OnePageCheckoutTest.xml index 6c3a76c5c99865bdc9bede513bd8ea350dd469b7..d739d5bae2626b28189928338119d49e0c37972b 100644 --- a/dev/tests/functional/tests/app/Magento/Ups/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Ups/Test/TestCase/OnePageCheckoutTest.xml @@ -6,12 +6,12 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest"> + <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest" summary="OnePageCheckout within Offline Payment Methods and UPS shipping method."> <variation name="OnePageCheckoutUpsTestVariation1" summary="Use UPS Online Shipping Carrier on Checkout as a Registered Customer" ticketId="MAGETWO-12848"> <data name="products" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> <data name="checkoutMethod" xsi:type="string">login</data> <data name="customer/dataset" xsi:type="string">default</data> - <data name="billingAddress/dataset" xsi:type="string">US_address_1</data> + <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data> <data name="shipping/shipping_service" xsi:type="string">United Parcel Service</data> <data name="shipping/shipping_method" xsi:type="string">UPS Ground</data> <data name="cart/data/shipping_method" xsi:type="string">UPS Ground</data> @@ -27,12 +27,13 @@ <data name="checkoutMethod" xsi:type="string">guest</data> <data name="customer/dataset" xsi:type="string">default</data> <data name="address/dataset" xsi:type="string">UK_address</data> - <data name="billingAddress/dataset" xsi:type="string">UK_address</data> + <data name="shippingAddress/dataset" xsi:type="string">UK_address</data> <data name="shipping/shipping_service" xsi:type="string">United Parcel Service</data> <data name="shipping/shipping_method" xsi:type="string">UPS Worldwide Expedited</data> <data name="cart/data/shipping_method" xsi:type="string">UPS Worldwide Expedited</data> <data name="payment/method" xsi:type="string">checkmo</data> <data name="configData" xsi:type="string">checkmo, ups, shipping_origin_US_CA</data> + <data name="tag" xsi:type="string">test_type:3rd_party_test</data> <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid"/> <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> diff --git a/dev/tests/functional/tests/app/Magento/Usps/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Usps/Test/TestCase/OnePageCheckoutTest.xml index 7f049503781c6dd1ed7d4a5dee78fb57d79ad746..cf2ad50688a9e7c1535cb5cdffb191fa1b8154b6 100644 --- a/dev/tests/functional/tests/app/Magento/Usps/Test/TestCase/OnePageCheckoutTest.xml +++ b/dev/tests/functional/tests/app/Magento/Usps/Test/TestCase/OnePageCheckoutTest.xml @@ -6,12 +6,12 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd"> - <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest"> + <testCase name="Magento\Checkout\Test\TestCase\OnePageCheckoutTest" summary="OnePageCheckout within Offline Payment Methods and USPS shipping method."> <variation name="OnePageCheckoutUspsTestVariation1" summary="Use USPS Online Shipping Carrier on Checkout as a Registered Customer" ticketId="MAGETWO-12444"> <data name="products" xsi:type="string">catalogProductSimple::default, configurableProduct::default, bundleProduct::bundle_fixed_product</data> <data name="checkoutMethod" xsi:type="string">login</data> <data name="customer/dataset" xsi:type="string">default</data> - <data name="billingAddress/dataset" xsi:type="string">US_address_1</data> + <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data> <data name="shipping/shipping_service" xsi:type="string">United States Postal Service</data> <data name="shipping/shipping_method" xsi:type="string">Priority Mail 1-Day</data> <data name="cart/data/shipping_method" xsi:type="string">Priority Mail 1-Day</data> @@ -27,12 +27,13 @@ <data name="checkoutMethod" xsi:type="string">guest</data> <data name="customer/dataset" xsi:type="string">default</data> <data name="address/dataset" xsi:type="string">UK_address</data> - <data name="billingAddress/dataset" xsi:type="string">UK_address</data> + <data name="shippingAddress/dataset" xsi:type="string">UK_address</data> <data name="shipping/shipping_service" xsi:type="string">United States Postal Service</data> <data name="shipping/shipping_method" xsi:type="string">Priority Mail International</data> <data name="cart/data/shipping_method" xsi:type="string">Priority Mail International</data> <data name="payment/method" xsi:type="string">checkmo</data> <data name="configData" xsi:type="string">checkmo, usps, shipping_origin_US_CA</data> + <data name="tag" xsi:type="string">test_type:3rd_party_test</data> <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage"/> <constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid"/> <constraint name="Magento\Checkout\Test\Constraint\AssertCartIsEmpty"/> diff --git a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/_files/composer3.json b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/_files/composer3.json index 436ee0afe3eb6e42dae48d57e59774fced9ac23e..d8c398fe8f3b096e0c6e2f3648d57dba2da96fc6 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/_files/composer3.json +++ b/dev/tests/integration/testsuite/Magento/Setup/Module/Dependency/_files/composer3.json @@ -2,7 +2,7 @@ "name": "magento/module-module1", "description": "N/A", "require": { - "php": "~5.5.0|~5.6.0" + "php": "~5.5.0|~5.6.0|~7.0.0" }, "type": "magento2-module", "version": "0.1.0-alpha103" diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php index 530d99c68dcdfbfa1feeaaee620ba570a10deb2e..215df89727a1decb4e2587f2ddf31c7d5e2a6308 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php @@ -154,6 +154,7 @@ class ComposerTest extends \PHPUnit_Framework_TestCase $xml = simplexml_load_file("$dir/etc/module.xml"); $this->assertConsistentModuleName($xml, $json->name); $this->assertDependsOnPhp($json->require); + $this->assertPhpVersionInSync($json->name, $json->require->php); $this->assertDependsOnFramework($json->require); $this->assertRequireInSync($json); $this->assertAutoload($json); @@ -166,12 +167,14 @@ class ComposerTest extends \PHPUnit_Framework_TestCase case 'magento2-theme': $this->assertRegExp('/^magento\/theme-(?:adminhtml|frontend)(\-[a-z0-9_]+)+$/', $json->name); $this->assertDependsOnPhp($json->require); + $this->assertPhpVersionInSync($json->name, $json->require->php); $this->assertDependsOnFramework($json->require); $this->assertRequireInSync($json); break; case 'magento2-library': $this->assertDependsOnPhp($json->require); $this->assertRegExp('/^magento\/framework*/', $json->name); + $this->assertPhpVersionInSync($json->name, $json->require->php); $this->assertRequireInSync($json); $this->assertAutoload($json); break; @@ -277,6 +280,22 @@ class ComposerTest extends \PHPUnit_Framework_TestCase ); } + /** + * Assert that PHP versions in root composer.json and Magento component's composer.json are not out of sync + * + * @param string $name + * @param string $phpVersion + */ + private function assertPhpVersionInSync($name, $phpVersion) + { + $this->assertEquals( + self::$rootJson['require']['php'], + $phpVersion, + "PHP version {$phpVersion} in component {$name} is inconsistent with version " + . self::$rootJson['require']['php'] . ' in root composer.json' + ); + } + /** * Make sure requirements of components are reflected in root composer.json * diff --git a/dev/tests/static/testsuite/Magento/Test/Js/_files/jscs/.jscsrc b/dev/tests/static/testsuite/Magento/Test/Js/_files/jscs/.jscsrc index b8071503882e23246959a4b515edeb435a1f325c..0a4404817de4742085a59692e1a321fbb23cef13 100644 --- a/dev/tests/static/testsuite/Magento/Test/Js/_files/jscs/.jscsrc +++ b/dev/tests/static/testsuite/Magento/Test/Js/_files/jscs/.jscsrc @@ -75,6 +75,7 @@ "disallowTrailingComma": true, "disallowTrailingWhitespace": true, "disallowYodaConditions": true, + "maxErrors": null, "requireBlocksOnNewline": true, "requireDotNotation": "except_snake_case", "requireCamelCaseOrUpperCaseIdentifiers": true, diff --git a/lib/internal/Magento/Framework/App/ErrorHandler.php b/lib/internal/Magento/Framework/App/ErrorHandler.php index 59119102e6955a742beb3398588d305b663b7ab8..99eaab78f51b8a9194d6ae18d3a26754b86fffa9 100644 --- a/lib/internal/Magento/Framework/App/ErrorHandler.php +++ b/lib/internal/Magento/Framework/App/ErrorHandler.php @@ -51,17 +51,11 @@ class ErrorHandler return false; } - if (strpos($errorStr, 'Automatically populating $HTTP_RAW_POST_DATA is deprecated') !== false) { - // this warning should be suppressed as it is a known bug in php 5.6.0 https://bugs.php.net/bug.php?id=66763 - // and workaround suggested here (http://php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data) - // is not compatible with HHVM - return false; - } - $errorNo = $errorNo & error_reporting(); if ($errorNo == 0) { return false; } + $msg = isset($this->errorPhrases[$errorNo]) ? $this->errorPhrases[$errorNo] : "Unknown error ({$errorNo})"; $msg .= ": {$errorStr} in {$errorFile} on line {$errorLine}"; throw new \Exception($msg); diff --git a/lib/internal/Magento/Framework/App/Http.php b/lib/internal/Magento/Framework/App/Http.php index 897985cc0982b52298fed8665e9ba7ac518b347e..f87e64ea889377b1dcedd146ca96092bdc025faf 100644 --- a/lib/internal/Magento/Framework/App/Http.php +++ b/lib/internal/Magento/Framework/App/Http.php @@ -184,9 +184,12 @@ class Http implements \Magento\Framework\AppInterface $this->_response->setRedirect($setupInfo->getUrl()); $this->_response->sendHeaders(); } else { - $newMessage = $exception->getMessage() . "\nNOTE: web setup wizard is not accessible.\n" - . 'In order to install, use Magento Setup CLI or configure web access to the following directory: ' - . $setupInfo->getDir($projectRoot); + $newMessage = $exception->getMessage() . "\nNOTE: You cannot install Magento using the Setup Wizard " + . "because the Magento setup directory cannot be accessed. \n" + . 'You can install Magento using either the command line or you must restore access ' + . 'to the following directory: ' . $setupInfo->getDir($projectRoot) . "\n"; + $newMessage .= 'If you are using the sample nginx configuration, please go to ' + . $this->_request->getScheme(). '://' . $this->_request->getHttpHost() . $setupInfo->getUrl(); throw new \Exception($newMessage, 0, $exception); } } diff --git a/lib/internal/Magento/Framework/Component/ComponentRegistrar.php b/lib/internal/Magento/Framework/Component/ComponentRegistrar.php index c2c928b2376efe8589e86741e5fa8d3df1c4966b..44258c7f135ce0e122f3a63d6f0fe1fd26737fe4 100644 --- a/lib/internal/Magento/Framework/Component/ComponentRegistrar.php +++ b/lib/internal/Magento/Framework/Component/ComponentRegistrar.php @@ -48,7 +48,7 @@ class ComponentRegistrar implements ComponentRegistrarInterface if (isset(self::$paths[$type][$componentName])) { throw new \LogicException('\'' . $componentName . '\' component already exists'); } else { - self::$paths[$type][$componentName] = $path; + self::$paths[$type][$componentName] = str_replace('\\', '/', $path); } } diff --git a/lib/internal/Magento/Framework/Config/ConfigOptionsListConstants.php b/lib/internal/Magento/Framework/Config/ConfigOptionsListConstants.php index 5bb8e80888b6b6e2be74875430165d6e7c0e6169..4fbeaecc85d18ad7c22f386ecfd00d838d5b904d 100644 --- a/lib/internal/Magento/Framework/Config/ConfigOptionsListConstants.php +++ b/lib/internal/Magento/Framework/Config/ConfigOptionsListConstants.php @@ -97,4 +97,9 @@ class ConfigOptionsListConstants * Key for modules */ const KEY_MODULES = 'modules'; + + /** + * Size of random string generated for store's encryption key + */ + const STORE_KEY_RANDOM_STRING_SIZE = 32; } diff --git a/lib/internal/Magento/Framework/Controller/Result/Json.php b/lib/internal/Magento/Framework/Controller/Result/Json.php index f1d480efec72e9ec8b610e4209bb581cbf1cb773..bc3855448ccc264e16b34f061518a3e0507998cd 100644 --- a/lib/internal/Magento/Framework/Controller/Result/Json.php +++ b/lib/internal/Magento/Framework/Controller/Result/Json.php @@ -63,6 +63,8 @@ class Json extends AbstractResult */ protected function render(ResponseInterface $response) { + // reset profiler to avoid appending profiling stat to JSON response + \Magento\Framework\Profiler::reset(); $this->translateInline->processResponseBody($this->json, true); $response->representJson($this->json); return $this; diff --git a/lib/internal/Magento/Framework/DB/Ddl/Table.php b/lib/internal/Magento/Framework/DB/Ddl/Table.php index a623ba4c0fb3398a107d72140fe711adfa19b946..0b168e4c94a50cddc3ebbf59ef9c796f1d652c73 100644 --- a/lib/internal/Magento/Framework/DB/Ddl/Table.php +++ b/lib/internal/Magento/Framework/DB/Ddl/Table.php @@ -310,8 +310,8 @@ class Table case self::TYPE_DECIMAL: case self::TYPE_NUMERIC: $match = []; - $scale = 10; - $precision = 0; + $scale = 0; + $precision = 10; // parse size value if (is_array($size)) { if (count($size) == 2) { diff --git a/lib/internal/Magento/Framework/Math/Random.php b/lib/internal/Magento/Framework/Math/Random.php index 03c0727efd26e5938e3b3f2c74bcab7131777050..8ed28cb6021a976337e2e8b9cd6da0c5a98d724c 100644 --- a/lib/internal/Magento/Framework/Math/Random.php +++ b/lib/internal/Magento/Framework/Math/Random.php @@ -24,9 +24,10 @@ class Random /** * Get random string * - * @param int $length + * @param int $length * @param null|string $chars * @return string + * @throws \Magento\Framework\Exception\LocalizedException */ public function getRandomString($length, $chars = null) { @@ -53,12 +54,9 @@ class Random } fclose($fp); } else { - // fallback to mt_rand() if all else fails - mt_srand(10000000 * (double)microtime()); - for ($i = 0, $lc = strlen($chars) - 1; $i < $length; $i++) { - $rand = mt_rand(0, $lc); // random integer from 0 to $lc - $str .= $chars[$rand]; // random character in $chars - } + throw new \Magento\Framework\Exception\LocalizedException( + new \Magento\Framework\Phrase("Please make sure you have 'openssl' extension installed") + ); } return $str; @@ -70,6 +68,7 @@ class Random * @param $min [optional] * @param $max [optional] * @return int A random integer value between min (or 0) and max + * @throws \Magento\Framework\Exception\LocalizedException */ public static function getRandomNumber($min = 0, $max = null) { @@ -91,9 +90,9 @@ class Random $offset = abs(hexdec($hex) % $range); // random integer from 0 to $range fclose($fp); } else { - // fallback to mt_rand() if all else fails - mt_srand(mt_rand() + (100000000 * microtime()) % PHP_INT_MAX); - return mt_rand($min, $max); // random integer from $min to $max + throw new \Magento\Framework\Exception\LocalizedException( + new \Magento\Framework\Phrase("Please make sure you have 'openssl' extension installed") + ); } return $min + $offset; // random integer from $min to $max diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index 061a0f9c765c68772f18406aa59a0f1bb77a6eb8..3e39db19a43cf4ace7b87d7d46ad2970be4add27 100644 --- a/lib/internal/Magento/Framework/composer.json +++ b/lib/internal/Magento/Framework/composer.json @@ -17,6 +17,7 @@ "ext-curl": "*", "ext-iconv": "*", "ext-gd": "*", + "ext-openssl": "*", "lib-libxml": "*", "ext-xsl": "*" }, diff --git a/lib/web/fotorama/fotorama.min.js b/lib/web/fotorama/fotorama.min.js new file mode 100644 index 0000000000000000000000000000000000000000..dbce341e32242af7a80a4fb2d659857b8e5eb692 --- /dev/null +++ b/lib/web/fotorama/fotorama.min.js @@ -0,0 +1,5 @@ +/*! + * Fotorama 4.6.4 | http://fotorama.io/license/ + */ +fotoramaVersion="4.6.4",function(t,e,n,o,i){"use strict";function r(t){var e="bez_"+o.makeArray(arguments).join("_").replace(".","p");if("function"!=typeof o.easing[e]){var n=function(t,e){var n=[null,null],o=[null,null],i=[null,null],r=function(r,a){return i[a]=3*t[a],o[a]=3*(e[a]-t[a])-i[a],n[a]=1-i[a]-o[a],r*(i[a]+r*(o[a]+r*n[a]))},a=function(t){return i[0]+t*(2*o[0]+3*n[0]*t)},s=function(t){for(var e,n=t,o=0;++o<14&&(e=r(n,0)-t,!(Math.abs(e)<.001));)n-=e/a(n);return n};return function(t){return r(s(t),1)}};o.easing[e]=function(e,o,i,r,a){return r*n([t[0],t[1]],[t[2],t[3]])(o/a)+i}}return e}function a(){}function s(t,e,n){return Math.max(isNaN(e)?-1/0:e,Math.min(isNaN(n)?1/0:n,t))}function u(t,e){return t.match(/ma/)&&t.match(/-?\d+(?!d)/g)[t.match(/3d/)?"vertical"===e?13:12:"vertical"===e?5:4]}function l(t,e){return On?+u(t.css("transform"),e):+t.css("vertical"===e?"top":"left").replace("px","")}function c(t,e){var n={};if(On)switch(e){case"vertical":n.transform="translate3d(0, "+t+"px,0)";break;case"list":break;default:n.transform="translate3d("+t+"px,0,0)"}else"vertical"===e?n.top=t:n.left=t;return n}function d(t){return{"transition-duration":t+"ms"}}function f(t,e){return isNaN(t)?e:t}function h(t,e){return f(+String(t).replace(e||"px",""))}function m(t){return/%$/.test(t)?h(t,"%"):i}function p(t,e){return f(m(t)/100*e,h(t))}function v(t){return(!isNaN(h(t))||!isNaN(h(t,"%")))&&t}function g(t,e,n,o){return(t-(o||0))*(e+(n||0))}function w(t,e,n,o){return-Math.round(t/(e+(n||0))-(o||0))}function y(t){var e=t.data();if(!e.tEnd){var n=t[0],o={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",msTransition:"MSTransitionEnd",transition:"transitionend"};V(n,o[Tn.prefixed("transition")],function(t){e.tProp&&t.propertyName.match(e.tProp)&&e.onEndFn()}),e.tEnd=!0}}function b(t,e,n,o){var i,r=t.data();r&&(r.onEndFn=function(){i||(i=!0,clearTimeout(r.tT),n())},r.tProp=e,clearTimeout(r.tT),r.tT=setTimeout(function(){r.onEndFn()},1.5*o),y(t))}function x(t,e){var n=t.navdir||"horizontal";if(t.length){var o=t.data();On?(t.css(d(0)),o.onEndFn=a,clearTimeout(o.tT)):t.stop();var i=_(e,function(){return l(t,n)});return t.css(c(i,n)),i}}function _(){for(var t,e=0,n=arguments.length;n>e&&(t=e?arguments[e]():arguments[e],"number"!=typeof t);e++);return t}function C(t,e){return Math.round(t+(e-t)/1.5)}function k(){return k.p=k.p||("https:"===n.protocol?"https://":"http://"),k.p}function T(t){var n=e.createElement("a");return n.href=t,n}function P(t,e){if("string"!=typeof t)return t;t=T(t);var n,o;if(t.host.match(/youtube\.com/)&&t.search){if(n=t.search.split("v=")[1]){var i=n.indexOf("&");-1!==i&&(n=n.substring(0,i)),o="youtube"}}else t.host.match(/youtube\.com|youtu\.be/)?(n=t.pathname.replace(/^\/(embed\/|v\/)?/,"").replace(/\/.*/,""),o="youtube"):t.host.match(/vimeo\.com/)&&(o="vimeo",n=t.pathname.replace(/^\/(video\/)?/,"").replace(/\/.*/,""));return n&&o||!e||(n=t.href,o="custom"),n?{id:n,type:o,s:t.search.replace(/^\?/,""),p:k()}:!1}function S(t,e,n){var i,r,a=t.video;return"youtube"===a.type?(r=k()+"img.youtube.com/vi/"+a.id+"/default.jpg",i=r.replace(/\/default.jpg$/,"/hqdefault.jpg"),t.thumbsReady=!0):"vimeo"===a.type?o.ajax({url:k()+"vimeo.com/api/v2/video/"+a.id+".json",dataType:"jsonp",success:function(o){t.thumbsReady=!0,M(e,{img:o[0].thumbnail_large,thumb:o[0].thumbnail_small},t.i,n)}}):t.thumbsReady=!0,{img:i,thumb:r}}function M(t,e,n,i){for(var r=0,a=t.length;a>r;r++){var s=t[r];if(s.i===n&&s.thumbsReady){var u={videoReady:!0};u[to]=u[no]=u[eo]=!1,i.splice(r,1,o.extend({},s,u,e));break}}}function E(t){function e(t,e,i){var r=t.children("img").eq(0),a=t.attr("href"),s=t.attr("src"),u=r.attr("src"),l=e.video,c=i?P(a,l===!0):!1;c?a=!1:c=l,n(t,r,o.extend(e,{video:c,img:e.img||a||s||u,thumb:e.thumb||u||s||a}))}function n(t,e,n){var i=n.thumb&&n.img!==n.thumb,r=h(n.width||t.attr("width")),a=h(n.height||t.attr("height"));o.extend(n,{width:r,height:a,thumbratio:K(n.thumbratio||h(n.thumbwidth||e&&e.attr("width")||i||r)/h(n.thumbheight||e&&e.attr("height")||i||a))})}var i=[];return t.children().each(function(){var t=o(this),r=H(o.extend(t.data(),{id:t.attr("id")}));if(t.is("a, img"))e(t,r,!0);else{if(t.is(":empty"))return;n(t,null,o.extend(r,{html:this,_html:t.html()}))}i.push(r)}),i}function F(t){return 0===t.offsetWidth&&0===t.offsetHeight}function j(t){return!o.contains(e.documentElement,t)}function z(t,e,n,o){return z.i||(z.i=1,z.ii=[!0]),o=o||z.i,"undefined"==typeof z.ii[o]&&(z.ii[o]=!0),t()?e():z.ii[o]&&setTimeout(function(){z.ii[o]&&z(t,e,n,o)},n||100),z.i++}function N(t,e){var n=t.data(),o=n.measures;if(o&&(!n.l||n.l.W!==o.width||n.l.H!==o.height||n.l.r!==o.ratio||n.l.w!==e.w||n.l.h!==e.h)){var i=s(e.h,0,o.height),r=i*o.ratio;po.setRatio(t,r,i),n.l={W:o.width,H:o.height,r:o.ratio,w:e.w,h:e.h}}return!0}function $(t,e){var n=t[0];n.styleSheet?n.styleSheet.cssText=e:t.html(e)}function q(t,e,n,o){return e===n?!1:"vertical"===o?e>=t?"top":t>=n?"bottom":"top bottom":e>=t?"left":t>=n?"right":"left right"}function L(t,e,n){n=n||{},t.each(function(){var t,i=o(this),r=i.data();r.clickOn||(r.clickOn=!0,o.extend(oe(i,{onStart:function(e){t=e,(n.onStart||a).call(this,e)},onMove:n.onMove||a,onTouchEnd:n.onTouchEnd||a,onEnd:function(n){n.moved||e.call(this,t)}}),{noMove:!0}))})}function A(t,e){return'<div class="'+t+'">'+(e||"")+"</div>"}function I(t){return"."+t}function O(t){var e='<iframe src="'+t.p+t.type+".com/embed/"+t.id+'" frameborder="0" allowfullscreen></iframe>';return e}function D(t){for(var e=t.length;e;){var n=Math.floor(Math.random()*e--),o=t[e];t[e]=t[n],t[n]=o}return t}function R(t){return"[object Array]"==Object.prototype.toString.call(t)&&o.map(t,function(t){return o.extend({},t)})}function W(t,e,n){t.scrollLeft(e||0).scrollTop(n||0)}function H(t){if(t){var e={};return o.each(t,function(t,n){e[t.toLowerCase()]=n}),e}}function K(t){if(t){var e=+t;return isNaN(e)?(e=t.split("/"),+e[0]/+e[1]||i):e}}function V(t,e,n,o){e&&(t.addEventListener?t.addEventListener(e,n,!!o):t.attachEvent("on"+e,n))}function B(t,e){return t>e.max?t=e.max:t<e.min&&(t=e.min),t}function Q(t,e,n,o,i,r,a){var s,u,l;return"horizontal"===a?(u=t.thumbwidth,l=r.width()):(u=t.thumbheight,l=r.height()),s=(u+t.margin)*(n+1)>=l-o?"horizontal"===a?-i.position().left:-i.position().top:(u+t.margin)*n<=Math.abs(o)?"horizontal"===a?-i.position().left+l-(u+t.margin):-i.position().top+l-(u+t.margin):o,s=B(s,e),s||0}function X(t){return!!t.getAttribute("disabled")}function U(t){return{tabindex:-1*t+"",disabled:t}}function Y(t,e){V(t,"keyup",function(n){X(t)||13==n.keyCode&&e.call(t,n)})}function G(t,e){V(t,"focus",t.onfocusin=function(n){e.call(t,n)},!0)}function J(t,e){t.preventDefault?t.preventDefault():t.returnValue=!1,e&&t.stopPropagation&&t.stopPropagation()}function Z(t){return t?">":"<"}function te(t,e){var n=t.data(),i=Math.round(e.pos),r=function(){n&&n.sliding&&(n.sliding=!1),(e.onEnd||a)()};"undefined"!=typeof e.overPos&&e.overPos!==e.pos&&(i=e.overPos);var s=o.extend(c(i,e.direction),e.width&&{width:e.width},e.height&&{height:e.height});n&&n.sliding&&(n.sliding=!0),On?(t.css(o.extend(d(e.time),s)),e.time>10?b(t,"transform",r,e.time):r()):t.stop().animate(s,e.time,io,r)}function ee(t,e,n,i,r,s){var u="undefined"!=typeof s;if(u||(r.push(arguments),Array.prototype.push.call(arguments,r.length),!(r.length>1))){t=t||o(t),e=e||o(e);var l=t[0],c=e[0],d="crossfade"===i.method,f=function(){if(!f.done){f.done=!0;var t=(u||r.shift())&&r.shift();t&&ee.apply(this,t),(i.onEnd||a)(!!t)}},h=i.time/(s||1);n.removeClass(Ke+" "+He),t.stop().addClass(Ke),e.stop().addClass(He),d&&c&&t.fadeTo(0,0),t.fadeTo(d?h:0,1,d&&f),e.fadeTo(h,0,f),l&&d||c||f()}}function ne(t){var e=(t.touches||[])[0]||t;t._x=e.pageX,t._y=e.clientY,t._now=o.now()}function oe(t,n){function i(t){return f=o(t.target),b.checked=p=v=w=!1,c||b.flow||t.touches&&t.touches.length>1||t.which>1||lo&&lo.type!==t.type&&fo||(p=n.select&&f.is(n.select,y))?p:(m="touchstart"===t.type,v=f.is("a, a *",y),h=b.control,g=b.noMove||b.noSwipe||h?16:b.snap?0:4,ne(t),d=lo=t,co=t.type.replace(/down|start/,"move").replace(/Down/,"Move"),(n.onStart||a).call(y,t,{control:h,$target:f}),c=b.flow=!0,void((!m||b.go)&&J(t)))}function r(t){if(t.touches&&t.touches.length>1||Kn&&!t.isPrimary||co!==t.type||!c)return c&&s(),void(n.onTouchEnd||a)();ne(t);var e=Math.abs(t._x-d._x),o=Math.abs(t._y-d._y),i=e-o,r=(b.go||b.x||i>=0)&&!b.noSwipe,u=0>i;m&&!b.checked?(c=r)&&J(t):(J(t),(n.onMove||a).call(y,t,{touch:m})),!w&&Math.sqrt(Math.pow(e,2)+Math.pow(o,2))>g&&(w=!0),b.checked=b.checked||r||u}function s(t){(n.onTouchEnd||a)();var e=c;b.control=c=!1,e&&(b.flow=!1),!e||v&&!b.checked||(t&&J(t),fo=!0,clearTimeout(ho),ho=setTimeout(function(){fo=!1},1e3),(n.onEnd||a).call(y,{moved:w,$target:f,control:h,touch:m,startEvent:d,aborted:!t||"MSPointerCancel"===t.type}))}function u(){b.flow||setTimeout(function(){b.flow=!0},10)}function l(){b.flow&&setTimeout(function(){b.flow=!1},Bn)}var c,d,f,h,m,p,v,g,w,y=t[0],b={};return Kn?(V(y,"MSPointerDown",i),V(e,"MSPointerMove",r),V(e,"MSPointerCancel",s),V(e,"MSPointerUp",s)):(V(y,"touchstart",i),V(y,"touchmove",r),V(y,"touchend",s),V(e,"touchstart",u),V(e,"touchend",l),V(e,"touchcancel",l),qn.on("scroll",l),t.on("mousedown",i),Ln.on("mousemove",r).on("mouseup",s)),mo=Tn.touch?"a":"div",t.on("click",mo,function(t){b.checked&&J(t)}),b}function ie(t,e){function n(n,o){S=!0,l=d="vertical"===_?n._y:n._x,v=n._now,p=[[v,l]],f=h=F.noMove||o?0:x(t,(e.getPos||a)()),(e.onStart||a).call(M,n)}function i(e,o){w=F.min,y=F.max,b=F.snap,_=F.direction||"horizontal",t.navdir=_,k=e.altKey,S=P=!1,T=o.control,T||E.sliding||n(e)}function r(o,i){F.noSwipe||(S||n(o),d="vertical"===_?o._y:o._x,p.push([o._now,d]),h=f-(l-d),m=q(h,w,y,_),w>=h?h=C(h,w):h>=y&&(h=C(h,y)),F.noMove||(t.css(c(h,_)),P||(P=!0,i.touch||Kn||t.addClass(un)),(e.onMove||a).call(M,o,{pos:h,edge:m})))}function u(i){if(!F.noSwipe||!i.moved){S||n(i.startEvent,!0),i.touch||Kn||t.removeClass(un),g=o.now();for(var r,u,l,c,m,v,x,C,T,P=g-Bn,E=null,j=Qn,z=e.friction,N=p.length-1;N>=0;N--){if(r=p[N][0],u=Math.abs(r-P),null===E||l>u)E=r,c=p[N][1];else if(E===P||u>l)break;l=u}x=s(h,w,y);var $=c-d,q=$>=0,L=g-E,A=L>Bn,I=!A&&h!==f&&x===h;b&&(x=s(Math[I?q?"floor":"ceil":"round"](h/b)*b,w,y),w=y=x),I&&(b||x===h)&&(T=-($/L),j*=s(Math.abs(T),e.timeLow,e.timeHigh),m=Math.round(h+T*j/z),b||(x=m),(!q&&m>y||q&&w>m)&&(v=q?w:y,C=m-v,b||(x=v),C=s(x+.03*C,v-50,v+50),j=Math.abs((h-C)/(T/z)))),j*=k?10:1,(e.onEnd||a).call(M,o.extend(i,{moved:i.moved||A&&b,pos:h,newPos:x,overPos:C,time:j,dir:_}))}}var l,d,f,h,m,p,v,g,w,y,b,_,k,T,P,S,M=t[0],E=t.data(),F={};return F=o.extend(oe(e.$wrap,o.extend({},e,{onStart:i,onMove:r,onEnd:u})),F)}function re(t,e){var n,i,r,s=t[0],u={prevent:{}};return V(s,Vn,function(t){var s=t.wheelDeltaY||-1*t.deltaY||0,l=t.wheelDeltaX||-1*t.deltaX||0,c=Math.abs(l)&&!Math.abs(s),d=Z(0>l),f=i===d,h=o.now(),m=Bn>h-r;i=d,r=h,c&&u.ok&&(!u.prevent[d]||n)&&(J(t,!0),n&&f&&m||(e.shift&&(n=!0,clearTimeout(u.t),u.t=setTimeout(function(){n=!1},Xn)),(e.onEnd||a)(t,e.shift?d:l)))}),u}function ae(){o.each(o.Fotorama.instances,function(t,e){e.index=t})}function se(t){o.Fotorama.instances.push(t),ae()}function ue(t){o.Fotorama.instances.splice(t.index,1),ae()}var le="fotorama",ce="fotorama__fullscreen",de=le+"__wrap",fe=de+"--css2",he=de+"--css3",me=de+"--video",pe=de+"--fade",ve=de+"--slide",ge=de+"--no-controls",we=de+"--no-shadows",ye=de+"--pan-y",be=de+"--rtl",xe=de+"--no-captions",_e=de+"--toggle-arrows",Ce=le+"__stage",ke=Ce+"__frame",Te=ke+"--video",Pe=Ce+"__shaft",Se=le+"__grab",Me=le+"__pointer",Ee=le+"__arr",Fe=Ee+"--disabled",je=Ee+"--prev",ze=Ee+"--next",Ne=le+"__nav",$e=Ne+"-wrap",qe=Ne+"__shaft",Le=$e+"--vertical",Ae=$e+"--list",Ie=$e+"--horizontal",Oe=Ne+"--dots",De=Ne+"--thumbs",Re=Ne+"__frame",We=le+"__fade",He=We+"-front",Ke=We+"-rear",Ve=le+"__shadow",Be=Ve+"s",Qe=Be+"--left",Xe=Be+"--right",Ue=Be+"--top",Ye=Be+"--bottom",Ge=le+"__active",Je=le+"__select",Ze=le+"--hidden",tn=le+"--fullscreen",en=le+"__fullscreen-icon",nn=le+"__error",on=le+"__loading",rn=le+"__loaded",an=rn+"--full",sn=rn+"--img",un=le+"__grabbing",ln=le+"__img",cn=ln+"--full",dn=le+"__thumb",fn=dn+"__arr--left",hn=dn+"__arr--right",mn=dn+"-border",pn=le+"__html",vn=le+"-video-container",gn=le+"__video",wn=gn+"-play",yn=gn+"-close",bn=le+"__spinner",xn=le+"_horizontal_ratio",_n=le+"_vertical_ratio",Cn=o&&o.fn.jquery.split(".");if(!Cn||Cn[0]<1||1==Cn[0]&&Cn[1]<8)throw"Fotorama requires jQuery 1.8 or later and will not run without it.";var kn={},Tn=function(t,e,n){function o(t){g.cssText=t}function i(t,e){return typeof t===e}function r(t,e){return!!~(""+t).indexOf(e)}function a(t,e){for(var o in t){var i=t[o];if(!r(i,"-")&&g[i]!==n)return"pfx"==e?i:!0}return!1}function s(t,e,o){for(var r in t){var a=e[t[r]];if(a!==n)return o===!1?t[r]:i(a,"function")?a.bind(o||e):a}return!1}function u(t,e,n){var o=t.charAt(0).toUpperCase()+t.slice(1),r=(t+" "+b.join(o+" ")+o).split(" ");return i(e,"string")||i(e,"undefined")?a(r,e):(r=(t+" "+x.join(o+" ")+o).split(" "),s(r,e,n))}var l,c,d,f="2.8.3",h={},m=e.documentElement,p="modernizr",v=e.createElement(p),g=v.style,w=({}.toString," -webkit- -moz- -o- -ms- ".split(" ")),y="Webkit Moz O ms",b=y.split(" "),x=y.toLowerCase().split(" "),_={},C=[],k=C.slice,T=function(t,n,o,i){var r,a,s,u,l=e.createElement("div"),c=e.body,d=c||e.createElement("body");if(parseInt(o,10))for(;o--;)s=e.createElement("div"),s.id=i?i[o]:p+(o+1),l.appendChild(s);return r=["­",'<style id="s',p,'">',t,"</style>"].join(""),l.id=p,(c?l:d).innerHTML+=r,d.appendChild(l),c||(d.style.background="",d.style.overflow="hidden",u=m.style.overflow,m.style.overflow="hidden",m.appendChild(d)),a=n(l,t),c?l.parentNode.removeChild(l):(d.parentNode.removeChild(d),m.style.overflow=u),!!a},P={}.hasOwnProperty;d=i(P,"undefined")||i(P.call,"undefined")?function(t,e){return e in t&&i(t.constructor.prototype[e],"undefined")}:function(t,e){return P.call(t,e)},Function.prototype.bind||(Function.prototype.bind=function(t){var e=this;if("function"!=typeof e)throw new TypeError;var n=k.call(arguments,1),o=function(){if(this instanceof o){var i=function(){};i.prototype=e.prototype;var r=new i,a=e.apply(r,n.concat(k.call(arguments)));return Object(a)===a?a:r}return e.apply(t,n.concat(k.call(arguments)))};return o}),_.touch=function(){var n;return"ontouchstart"in t||t.DocumentTouch&&e instanceof DocumentTouch?n=!0:T(["@media (",w.join("touch-enabled),("),p,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(t){n=9===t.offsetTop}),n},_.csstransforms3d=function(){var t=!!u("perspective");return t&&"webkitPerspective"in m.style&&T("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(e){t=9===e.offsetLeft&&3===e.offsetHeight}),t},_.csstransitions=function(){return u("transition")};for(var S in _)d(_,S)&&(c=S.toLowerCase(),h[c]=_[S](),C.push((h[c]?"":"no-")+c));return h.addTest=function(t,e){if("object"==typeof t)for(var o in t)d(t,o)&&h.addTest(o,t[o]);else{if(t=t.toLowerCase(),h[t]!==n)return h;e="function"==typeof e?e():e,"undefined"!=typeof enableClasses&&enableClasses&&(m.className+=" "+(e?"":"no-")+t),h[t]=e}return h},o(""),v=l=null,h._version=f,h._prefixes=w,h._domPrefixes=x,h._cssomPrefixes=b,h.testProp=function(t){return a([t])},h.testAllProps=u,h.testStyles=T,h.prefixed=function(t,e,n){return e?u(t,e,n):u(t,"pfx")},h}(t,e),Pn={ok:!1,is:function(){return!1},request:function(){},cancel:function(){},event:"",prefix:""},Sn="webkit moz o ms khtml".split(" ");if("undefined"!=typeof e.cancelFullScreen)Pn.ok=!0;else for(var Mn=0,En=Sn.length;En>Mn;Mn++)if(Pn.prefix=Sn[Mn],"undefined"!=typeof e[Pn.prefix+"CancelFullScreen"]){Pn.ok=!0;break}Pn.ok&&(Pn.event=Pn.prefix+"fullscreenchange",Pn.is=function(){switch(this.prefix){case"":return e.fullScreen;case"webkit":return e.webkitIsFullScreen;default:return e[this.prefix+"FullScreen"]}},Pn.request=function(t){return""===this.prefix?t.requestFullScreen():t[this.prefix+"RequestFullScreen"]()},Pn.cancel=function(){return""===this.prefix?e.cancelFullScreen():e[this.prefix+"CancelFullScreen"]()});var Fn,jn={lines:12,length:5,width:2,radius:7,corners:1,rotate:15,color:"rgba(128, 128, 128, .75)",hwaccel:!0},zn={top:"auto",left:"auto",className:""};!function(t,e){Fn=e()}(this,function(){function t(t,n){var o,i=e.createElement(t||"div");for(o in n)i[o]=n[o];return i}function n(t){for(var e=1,n=arguments.length;n>e;e++)t.appendChild(arguments[e]);return t}function o(t,e,n,o){var i=["opacity",e,~~(100*t),n,o].join("-"),r=.01+n/o*100,a=Math.max(1-(1-t)/e*(100-r),t),s=f.substring(0,f.indexOf("Animation")).toLowerCase(),u=s&&"-"+s+"-"||"";return m[i]||(p.insertRule("@"+u+"keyframes "+i+"{0%{opacity:"+a+"}"+r+"%{opacity:"+t+"}"+(r+.01)+"%{opacity:1}"+(r+e)%100+"%{opacity:"+t+"}100%{opacity:"+a+"}}",p.cssRules.length),m[i]=1),i}function r(t,e){var n,o,r=t.style;for(e=e.charAt(0).toUpperCase()+e.slice(1),o=0;o<h.length;o++)if(n=h[o]+e,r[n]!==i)return n;return r[e]!==i?e:void 0}function a(t,e){for(var n in e)t.style[r(t,n)||n]=e[n];return t}function s(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)t[o]===i&&(t[o]=n[o])}return t}function u(t){for(var e={x:t.offsetLeft,y:t.offsetTop};t=t.offsetParent;)e.x+=t.offsetLeft,e.y+=t.offsetTop;return e}function l(t,e){return"string"==typeof t?t:t[e%t.length]}function c(t){return"undefined"==typeof this?new c(t):void(this.opts=s(t||{},c.defaults,v))}function d(){function e(e,n){return t("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',n)}p.addRule(".spin-vml","behavior:url(#default#VML)"),c.prototype.lines=function(t,o){function i(){return a(e("group",{coordsize:c+" "+c,coordorigin:-u+" "+-u}),{width:c,height:c})}function r(t,r,s){n(f,n(a(i(),{rotation:360/o.lines*t+"deg",left:~~r}),n(a(e("roundrect",{arcsize:o.corners}),{width:u,height:o.width,left:o.radius,top:-o.width>>1,filter:s}),e("fill",{color:l(o.color,t),opacity:o.opacity}),e("stroke",{opacity:0}))))}var s,u=o.length+o.width,c=2*u,d=2*-(o.width+o.length)+"px",f=a(i(),{position:"absolute",top:d,left:d});if(o.shadow)for(s=1;s<=o.lines;s++)r(s,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(s=1;s<=o.lines;s++)r(s);return n(t,f)},c.prototype.opacity=function(t,e,n,o){var i=t.firstChild;o=o.shadow&&o.lines||0,i&&e+o<i.childNodes.length&&(i=i.childNodes[e+o],i=i&&i.firstChild,i=i&&i.firstChild,i&&(i.opacity=n))}}var f,h=["webkit","Moz","ms","O"],m={},p=function(){var o=t("style",{type:"text/css"});return n(e.getElementsByTagName("head")[0],o),o.sheet||o.styleSheet}(),v={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};c.defaults={},s(c.prototype,{spin:function(e){this.stop();var n,o,i=this,r=i.opts,s=i.el=a(t(0,{className:r.className}),{position:r.position,width:0,zIndex:r.zIndex}),l=r.radius+r.length+r.width;if(e&&(e.insertBefore(s,e.firstChild||null),o=u(e),n=u(s),a(s,{left:("auto"==r.left?o.x-n.x+(e.offsetWidth>>1):parseInt(r.left,10)+l)+"px",top:("auto"==r.top?o.y-n.y+(e.offsetHeight>>1):parseInt(r.top,10)+l)+"px"})),s.setAttribute("role","progressbar"),i.lines(s,i.opts),!f){var c,d=0,h=(r.lines-1)*(1-r.direction)/2,m=r.fps,p=m/r.speed,v=(1-r.opacity)/(p*r.trail/100),g=p/r.lines;!function w(){d++;for(var t=0;t<r.lines;t++)c=Math.max(1-(d+(r.lines-t)*g)%p*v,r.opacity),i.opacity(s,t*r.direction+h,c,r);i.timeout=i.el&&setTimeout(w,~~(1e3/m))}()}return i},stop:function(){var t=this.el;return t&&(clearTimeout(this.timeout),t.parentNode&&t.parentNode.removeChild(t),this.el=i),this},lines:function(e,i){function r(e,n){return a(t(),{position:"absolute",width:i.length+i.width+"px",height:i.width+"px",background:e,boxShadow:n,transformOrigin:"left",transform:"rotate("+~~(360/i.lines*u+i.rotate)+"deg) translate("+i.radius+"px,0)",borderRadius:(i.corners*i.width>>1)+"px"})}for(var s,u=0,c=(i.lines-1)*(1-i.direction)/2;u<i.lines;u++)s=a(t(),{position:"absolute",top:1+~(i.width/2)+"px",transform:i.hwaccel?"translate3d(0,0,0)":"",opacity:i.opacity,animation:f&&o(i.opacity,i.trail,c+u*i.direction,i.lines)+" "+1/i.speed+"s linear infinite"}),i.shadow&&n(s,a(r("#000","0 0 4px #000"),{top:"2px"})),n(e,n(s,r(l(i.color,u),"0 0 1px rgba(0,0,0,.1)")));return e},opacity:function(t,e,n){e<t.childNodes.length&&(t.childNodes[e].style.opacity=n)}});var g=a(t("group"),{behavior:"url(#default#VML)"});return!r(g,"transform")&&g.adj?d():f=r(g,"animation"),c});var Nn,$n,qn=o(t),Ln=o(e),An="quirks"===n.hash.replace("#",""),In=Tn.csstransforms3d,On=In&&!An,Dn=In||"CSS1Compat"===e.compatMode,Rn=Pn.ok,Wn=navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone/i),Hn=!On||Wn,Kn=navigator.msPointerEnabled,Vn="onwheel"in e.createElement("div")?"wheel":e.onmousewheel!==i?"mousewheel":"DOMMouseScroll",Bn=250,Qn=300,Xn=1400,Un=5e3,Yn=2,Gn=64,Jn=500,Zn=333,to="$stageFrame",eo="$navDotFrame",no="$navThumbFrame",oo="auto",io=r([.1,0,.25,1]),ro=1200,ao=1,so={width:null,minwidth:null,maxwidth:"100%",height:null,minheight:null,maxheight:null,ratio:null,margin:Yn,nav:"dots",navposition:"bottom",navwidth:null,thumbwidth:Gn,thumbheight:Gn,thumbmargin:Yn,thumbborderwidth:Yn,allowfullscreen:!1,transition:"slide",clicktransition:null,transitionduration:Qn,captions:!0,startindex:0,loop:!1,autoplay:!1,stopautoplayontouch:!0,keyboard:!1,arrows:!0,click:!0,swipe:!1,trackpad:!1,shuffle:!1,direction:"ltr",shadows:!0,spinner:null,showcaption:!0,navdir:"horizontal",navarrows:!0,navtype:"thumbs"},uo={left:!0,right:!0,down:!1,up:!1,space:!1,home:!1,end:!1};z.stop=function(t){z.ii[t]=!1};var lo,co,fo,ho,mo,po=function(){function t(t,e,n){var o=e/n;1>=o?(t.parent().removeClass(xn),t.parent().addClass(_n)):(t.parent().removeClass(_n),t.parent().addClass(xn))}function e(t,e,n){var r=n;t.attr(r)||t.attr(r)===i||t.attr(r,e),t.find("["+r+"]").length&&t.find("["+r+"]").each(function(){o(this).attr(r,e)})}function n(t,e,n){var o,i=!1;return o=t.showCaption===n||t.showCaption===!0?!0:!1,e?(t.caption&&o&&(i=!0),i):!1}return{setRatio:t,setThumbAttr:e,isExpectedCaption:n}}(po||{},jQuery);jQuery.Fotorama=function(n,r){function a(){o.each(Ro,function(t,e){if(!e.i){e.i=Ei++;var n=P(e.video,!0);if(n){var o={};e.video=n,e.img||e.thumb?e.thumbsReady=!0:o=S(e,Ro,Ti),M(Ro,{img:o.img,thumb:o.thumb},e.i,Ti)}}})}function u(t){return mi[t]||Ti.fullScreen}function f(){if($i!==i)if("vertical"==r.navdir){var t=r.thumbwidth+r.thumbmargin;$i.css("left",t),Ii.css("right",t),Xi.css("right",t),Ni.css("width",Ni.css("width")+t),qi.css("max-width",Ni.width()-t)}else $i.css("left",""),Ii.css("right",""),Xi.css("right",""),Ni.css("width",Ni.css("width")+t),qi.css("max-width","")}function m(t){var e,n="keydown."+le,o=le+Pi,i="keydown."+o,a="keyup."+o,s="resize."+o+" orientationchange."+o;t?(Ln.on(i,function(t){var n,o;Vo&&27===t.keyCode?(n=!0,Eo(Vo,!0,!0)):(Ti.fullScreen||r.keyboard&&!Ti.index)&&(27===t.keyCode?(n=!0,Ti.cancelFullScreen()):t.shiftKey&&32===t.keyCode&&u("space")||37===t.keyCode&&u("left")||38===t.keyCode&&u("up")?(Ti.longPress.progress(),o="<"):32===t.keyCode&&u("space")||39===t.keyCode&&u("right")||40===t.keyCode&&u("down")?(Ti.longPress.progress(),o=">"):36===t.keyCode&&u("home")?(Ti.longPress.progress(),o="<<"):35===t.keyCode&&u("end")&&(Ti.longPress.progress(),o=">>")),(n||o)&&J(t),e={index:o,slow:t.altKey,user:!0},o&&(Ti.longPress.inProgress?Ti.showWhileLongPress(e):Ti.show(e))}),t&&Ln.on(a,function(){Ti.longPress.inProgress&&Ti.showEndLongPress({user:!0}),Ti.longPress.reset()}),Ti.index||Ln.off(n).on(n,"textarea, input, select",function(t){!$n.hasClass(ce)&&t.stopPropagation()}),qn.on(s,Ti.resize)):(Ln.off(i),qn.off(s))}function y(t){t!==y.f&&(t?(n.addClass(le+" "+Si).before(zi).before(ji),se(Ti)):(zi.detach(),ji.detach(),n.html(Fi.urtext).removeClass(Si),ue(Ti)),m(t),y.f=t)}function b(){Ro=Ti.data=Ro||R(r.data)||E(n),Wo=Ti.size=Ro.length,Do.ok&&r.shuffle&&D(Ro),a(),tr=oe(tr),Wo&&y(!0)}function C(){var t=2>Wo||Vo;or.noMove=t||si,or.noSwipe=t||!r.swipe,!di&&qi.toggleClass(Se,!r.click&&!or.noMove&&!or.noSwipe),Kn&&Ni.toggleClass(ye,!or.noSwipe)}function k(t){t===!0&&(t=""),r.autoplay=Math.max(+t||Un,1.5*ci)}function T(t){t.navarrows&&"thumbs"===t.nav?(Bi.show(),Qi.show()):(Bi.hide(),Qi.hide())}function F(t,e){return Math.floor(Ni.width()/(e.thumbwidth+e.thumbmargin))}function X(){function t(t,n){e[t?"add":"remove"].push(n)}r.nav&&"dots"!==r.nav||(r.navdir="horizontal"),Ti.options=r=H(r),ao=F(Ni,r),si="crossfade"===r.transition||"dissolve"===r.transition,ei=r.loop&&(Wo>2||si&&(!di||"slide"!==di)),ci=+r.transitionduration||Qn,hi="rtl"===r.direction,mi=o.extend({},r.keyboard&&uo,r.keyboard),T(r);var e={add:[],remove:[]};Wo>1?(ni=r.nav,ii="top"===r.navposition,e.remove.push(Je),Oi.toggle(r.arrows)):(ni=!1,Oi.hide()),Cn(),Ko=new Fn(o.extend(jn,r.spinner,zn,{direction:hi?-1:1})),Yn(),so(),io(),r.autoplay&&k(r.autoplay),ui=h(r.thumbwidth)||Gn,li=h(r.thumbheight)||Gn,ir.ok=ar.ok=r.trackpad&&!Hn,C(),wo(r,[nr]),oi="thumbs"===ni,Di.filter(":hidden")&&ni&&Di.show(),oi?(Mn(Wo,"navThumb"),Ho=Ki,ki=no,$(ji,o.Fotorama.jst.style({w:ui,h:li,b:r.thumbborderwidth,m:r.thumbmargin,s:Pi,q:!Dn})),Ri.addClass(De).removeClass(Oe)):"dots"===ni?(Mn(Wo,"navDot"),Ho=Hi,ki=eo,Ri.addClass(Oe).removeClass(De)):(Di.hide(),ni=!1,Ri.removeClass(De+" "+Oe)),ni&&(ii?Di.insertBefore($i):Di.insertAfter($i),Wn.nav=!1,Wn(Ho,Wi,"nav")),ri=r.allowfullscreen,ri?(Xi.prependTo($i),ai=Rn&&"native"===ri):(Xi.detach(),ai=!1),t(si,pe),t(!si,ve),t(!r.captions,xe),t(hi,be),t("always"!==r.arrows,_e),fi=r.shadows&&!Hn,t(!fi,we),Ni.addClass(e.add.join(" ")).removeClass(e.remove.join(" ")),er=o.extend({},r),f()}function ne(t){return 0>t?(Wo+t%Wo)%Wo:t>=Wo?t%Wo:t}function oe(t){return s(t,0,Wo-1)}function ae(t){return ei?ne(t):oe(t)}function We(t){return t>0||ei?t-1:!1}function He(t){return Wo-1>t||ei?t+1:!1}function Ke(){or.min=ei?-1/0:-g(Wo-1,nr.w,r.margin,Xo),or.max=ei?1/0:-g(0,nr.w,r.margin,Xo),or.snap=nr.w+r.margin}function Ve(){var t="vertical"===r.navdir,e=t?Wi.height():Wi.width(),n=t?nr.h:nr.nw;rr.min=Math.min(0,n-e),rr.max=0,rr.direction=r.navdir,Wi.toggleClass(Se,!(rr.noMove=rr.min===rr.max))}function un(t,e,n){if("number"==typeof t){t=new Array(t);var i=!0}return o.each(t,function(t,o){if(i&&(o=t),"number"==typeof o){var r=Ro[ne(o)];if(r){var a="$"+e+"Frame",s=r[a];n.call(this,t,o,r,s,a,s&&s.data())}}})}function dn(t,e,n,o){(!pi||"*"===pi&&o===ti)&&(t=v(r.width)||v(t)||Jn,e=v(r.height)||v(e)||Zn,Ti.resize({width:t,ratio:r.ratio||n||t/e},0,o!==ti&&"*"))}function xn(t,e,n,i){un(t,e,function(t,a,s,u,l,c){function d(t){var e=ne(a);yo(t,{index:e,src:b,frame:Ro[e]})}function f(){g.remove(),o.Fotorama.cache[b]="error",s.html&&"stage"===e||!x||x===b?(!b||s.html||p?"stage"===e&&(u.trigger("f:load").removeClass(on+" "+nn).addClass(rn),d("load"),dn()):(u.trigger("f:error").removeClass(on).addClass(nn),d("error")),c.state="error",!(Wo>1&&Ro[a]===s)||s.html||s.deleted||s.video||p||(s.deleted=!0,Ti.splice(a,1))):(s[y]=b=x,xn([a],e,n,!0))}function h(){o.Fotorama.measures[b]=w.measures=o.Fotorama.measures[b]||{width:v.width,height:v.height,ratio:v.width/v.height},dn(w.measures.width,w.measures.height,w.measures.ratio,a),g.off("load error").addClass(ln+(p?" "+cn:"")).prependTo(u),u.hasClass(ke)&&!u.hasClass(vn)&&u.attr("href",g.attr("src")),N(g,(o.isFunction(n)?n():n)||nr),o.Fotorama.cache[b]=c.state="loaded",setTimeout(function(){u.trigger("f:load").removeClass(on+" "+nn).addClass(rn+" "+(p?an:sn)),"stage"===e?d("load"):(s.thumbratio===oo||!s.thumbratio&&r.thumbratio===oo)&&(s.thumbratio=w.measures.ratio,Io())},0)}function m(){var t=10;z(function(){return!_i||!t--&&!Hn},function(){h()})}if(u){var p=Ti.fullScreen&&s.full&&s.full!==s.img&&!c.$full&&"stage"===e;if(!c.$img||i||p){var v=new Image,g=o(v),w=g.data();c[p?"$full":"$img"]=g;var y="stage"===e?p?"full":"img":"thumb",b=s[y],x=p?null:s["stage"===e?"thumb":"img"];if("navThumb"===e&&(u=c.$wrap),!b)return void f();o.Fotorama.cache[b]?!function _(){"error"===o.Fotorama.cache[b]?f():"loaded"===o.Fotorama.cache[b]?setTimeout(m,0):setTimeout(_,100)}():(o.Fotorama.cache[b]="*",g.on("load",m).on("error",f)),c.state="",v.src=b,c.data.caption&&(v.alt=c.data.caption||""),po.isExpectedCaption(s,r.showcaption)&&o(v).attr("aria-labelledby",s.labelledby)}}})}function _n(t){Zi.append(Ko.spin().el).appendTo(t)}function Cn(){Zi.detach(),Ko&&Ko.stop()}function kn(){var t=Bo[to];t&&!t.data().state&&(_n(t),t.on("f:load f:error",function(){t.off("f:load f:error"),Cn()}))}function Sn(t){Y(t,qo),G(t,function(){setTimeout(function(){W(Ri)},0),fo({time:ci,guessIndex:o(this).data().eq,minMax:rr})})}function Mn(t,e){un(t,e,function(t,n,i,a,s,u){if(!a){a=i[s]=Ni[s].clone(),u=a.data(),u.data=i;var l=a[0],c="labelledby"+o.now();"stage"===e?(i.html&&o('<div class="'+pn+'"></div>').append(i._html?o(i.html).removeAttr("id").html(i._html):i.html).appendTo(a),i.id&&(c=i.id||c),i.labelledby=c,po.isExpectedCaption(i,r.showcaption)&&o(o.Fotorama.jst.frameCaption({caption:i.caption,labelledby:c})).appendTo(a),i.video&&a.addClass(Te).append(Yi.clone()),G(l,function(){setTimeout(function(){W($i)},0),zo({index:u.eq,user:!0})}),Li=Li.add(a)):"navDot"===e?(Sn(l),Hi=Hi.add(a)):"navThumb"===e&&(Sn(l),u.$wrap=a.children(":first"),Ki=Ki.add(a),i.video&&u.$wrap.append(Yi.clone()))}})}function En(t,e){return t&&t.length&&N(t,e)}function An(t){un(t,"stage",function(t,e,n,i,a,s){if(i){var u=ne(e);s.eq=u,ur[to][u]=i.css(o.extend({left:si?0:g(e,nr.w,r.margin,Xo)},si&&d(0))),j(i[0])&&(i.appendTo(qi),Eo(n.$video)),En(s.$img,nr),En(s.$full,nr),!i.hasClass(ke)||"false"===i.attr("aria-hidden")&&i.hasClass(Ge)||i.attr("aria-hidden","true")}})}function In(t,e){var n,i;"thumbs"!==ni||isNaN(t)||(n=-t,i=-t+nr.nw,"vertical"===r.navdir&&(t-=r.thumbheight,i=-t+nr.h),Ki.each(function(){var t=o(this),a=t.data(),s=a.eq,u=function(){return{h:li,w:a.w}},l=u(),c="vertical"===r.navdir?a.t>i:a.l>i;l.w=a.w,a.l+a.w<n||c||En(a.$img,l)||e&&xn([s],"navThumb",u)}))}function Wn(t,e,n){if(!Wn[n]){var i="nav"===n&&oi,a=0,s=0;e.append(t.filter(function(){for(var t,e=o(this),n=e.data(),i=0,r=Ro.length;r>i;i++)if(n.data===Ro[i]){t=!0,n.eq=i;break}return t||e.remove()&&!1}).sort(function(t,e){return o(t).data().eq-o(e).data().eq}).each(function(){var t=o(this),e=t.data();po.setThumbAttr(t,e.data.caption,"aria-label")}).each(function(){if(i){var t=o(this),e=t.data(),n=Math.round(li*e.data.thumbratio)||ui,u=Math.round(ui/e.data.thumbratio)||li;e.t=s,e.h=u,e.l=a,e.w=n,t.css({width:n}),s+=u+r.thumbmargin,a+=n+r.thumbmargin}})),Wn[n]=!0}}function Vn(t){return t-lr>nr.w/3}function Xn(t){return!(ei||tr+t&&tr-Wo+t||Vo)}function Yn(){var t=Xn(0),e=Xn(1);Ai.toggleClass(Fe,t).attr(U(t)),Ii.toggleClass(Fe,e).attr(U(e))}function io(){var t=!1,e=!1;if("thumbs"!==r.navtype||r.loop||(t=0==tr?!0:!1,e=tr==r.data.length-1?!0:!1),"slides"===r.navtype){var n=l(Wi,r.navdir);t=n>=rr.max?!0:!1,e=n<=rr.min?!0:!1}Bi.toggleClass(Fe,t).attr(U(t)),Qi.toggleClass(Fe,e).attr(U(e))}function so(){ir.ok&&(ir.prevent={"<":Xn(0),">":Xn(1)})}function lo(t){var e,n,o,i,a=t.data();oi?(e=a.l,n=a.t,o=a.w,i=a.h):(e=t.position().left,o=t.width());var s={c:e+o/2,min:-e+10*r.thumbmargin,max:-e+nr.w-o-10*r.thumbmargin},u={c:n+i/2,min:-n+10*r.thumbmargin,max:-n+nr.h-i-10*r.thumbmargin};return"vertical"===r.navdir?u:s}function co(t){var e=Bo[ki].data();te(Vi,{time:1.2*t,pos:"vertical"===r.navdir?e.t:e.l,width:e.w,height:e.h,direction:r.navdir})}function fo(t){var e,n,o,i,a,u,c,d,f=Ro[t.guessIndex][ki],h=r.navtype;f&&("thumbs"===h?(e=rr.min!==rr.max,o=t.minMax||e&&lo(Bo[ki]),i=e&&(t.keep&&fo.t?fo.l:s((t.coo||nr.nw/2)-lo(f).c,o.min,o.max)),a=e&&(t.keep&&fo.l?fo.l:s((t.coo||nr.nw/2)-lo(f).c,o.min,o.max)),u="vertical"===r.navdir?i:a,c=e&&s(u,rr.min,rr.max)||0,n=1.1*t.time,te(Wi,{time:n,pos:c,direction:r.navdir,onEnd:function(){In(c,!0),io()}}),Mo(Ri,q(c,rr.min,rr.max,r.navdir)),fo.l=u):(d=l(Wi,r.navdir),n=1.11*t.time,c=Q(r,rr,t.guessIndex,d,f,Di,r.navdir),te(Wi,{time:n,pos:c,direction:r.navdir,onEnd:function(){In(c,!0),io() +}}),Mo(Ri,q(c,rr.min,rr.max,r.navdir))))}function ho(){mo(ki),sr[ki].push(Bo[ki].addClass(Ge).attr("data-active",!0))}function mo(t){for(var e=sr[t];e.length;)e.shift().removeClass(Ge).attr("data-active",!1)}function vo(t){var e=ur[t];o.each(Qo,function(t,n){delete e[ne(n)]}),o.each(e,function(t,n){delete e[t],n.detach()})}function go(t){Xo=Uo=tr;var e=Bo[to];e&&(mo(to),sr[to].push(e.addClass(Ge).attr("data-active",!0)),e.hasClass(ke)&&e.attr("aria-hidden","false"),t||Ti.showStage.onEnd(!0),x(qi,0,!0),vo(to),An(Qo),Ke(),Ve(),Y(qi[0],function(){n.hasClass(tn)||(Ti.requestFullScreen(),o(Ui).trigger("focus"))}))}function wo(t,e){t&&o.each(e,function(e,n){n&&o.extend(n,{width:t.width||n.width,height:t.height,minwidth:t.minwidth,maxwidth:t.maxwidth,minheight:t.minheight,maxheight:t.maxheight,ratio:K(t.ratio)})})}function yo(t,e){n.trigger(le+":"+t,[Ti,e])}function bo(){clearTimeout(xo.t),_i=1,r.stopautoplayontouch?Ti.stopAutoplay():yi=!0}function xo(){_i&&(r.stopautoplayontouch||(_o(),Co()),xo.t=setTimeout(function(){_i=0},Qn+Bn))}function _o(){yi=!(!Vo&&!bi)}function Co(){if(clearTimeout(Co.t),z.stop(Co.w),!r.autoplay||yi)return void(Ti.autoplay&&(Ti.autoplay=!1,yo("stopautoplay")));Ti.autoplay||(Ti.autoplay=!0,yo("startautoplay"));var t=tr,e=Bo[to].data();Co.w=z(function(){return e.state||t!==tr},function(){Co.t=setTimeout(function(){if(!yi&&t===tr){var e=Zo,n=Ro[e][to].data();Co.w=z(function(){return n.state||e!==Zo},function(){yi||e!==Zo||Ti.show(ei?Z(!hi):Zo)})}},r.autoplay)})}function ko(t){var e;return"object"!=typeof t?(e=t,t={}):e=t.index,e=">"===e?Uo+1:"<"===e?Uo-1:"<<"===e?0:">>"===e?Wo-1:e,e=isNaN(e)?i:e,e="undefined"==typeof e?tr||0:e}function To(t){Ti.activeIndex=tr=ae(t),Go=We(tr),Jo=He(tr),Zo=ne(tr+(hi?-1:1)),Qo=[tr,Go,Jo],Uo=ei?t:tr}function Po(t){var e=Math.abs(Yo-Uo),n=_(t.time,function(){return Math.min(ci*(1+(e-1)/12),2*ci)});return t.slow&&(n*=10),n}function So(){Ti.fullScreen&&(Ti.fullScreen=!1,Rn&&Pn.cancel(Mi),$n.removeClass(ce),Nn.removeClass(ce),n.removeClass(tn).insertAfter(zi),nr=o.extend({},xi),Eo(Vo,!0,!0),$o("x",!1),Ti.resize(),xn(Qo,"stage"),W(qn,gi,vi),yo("fullscreenexit"))}function Mo(t,e){fi&&(t.removeClass(Qe+" "+Xe),t.removeClass(Ue+" "+Ye),e&&!Vo&&t.addClass(e.replace(/^|\s/g," "+Be+"--")))}function Eo(t,e,n){e&&(Ni.removeClass(me),Vo=!1,C()),t&&t!==Vo&&(t.remove(),yo("unloadvideo")),n&&(_o(),Co())}function Fo(t){Ni.toggleClass(ge,t)}function jo(t){if(!or.flow){var e=t?t.pageX:jo.x,n=e&&!Xn(Vn(e))&&r.click;jo.p!==n&&$i.toggleClass(Me,n)&&(jo.p=n,jo.x=e)}}function zo(t){clearTimeout(zo.t),r.clicktransition&&r.clicktransition!==r.transition?setTimeout(function(){var e=r.transition;Ti.setOptions({transition:r.clicktransition}),di=e,zo.t=setTimeout(function(){Ti.show(t)},10)},0):Ti.show(t)}function No(t,e){var n=t.target,i=o(n);i.hasClass(wn)?Ti.playVideo():n===Ui?Ti.toggleFullScreen():Vo?n===Ji&&Eo(Vo,!0,!0):e?Fo():r.click&&zo({index:t.shiftKey||Z(Vn(t._x)),slow:t.altKey,user:!0})}function $o(t,e){or[t]=rr[t]=e}function qo(t){var e=o(this).data().eq;zo("thumbs"===r.navtype?{index:e,slow:t.altKey,user:!0,coo:t._x-Ri.offset().left}:{index:e,slow:t.altKey,user:!0})}function Lo(t){zo({index:Oi.index(this)?">":"<",slow:t.altKey,user:!0})}function Ao(t){G(t,function(){setTimeout(function(){W($i)},0),Fo(!1)})}function Io(){if(b(),X(),!Io.i){Io.i=!0;var t=r.startindex;tr=Xo=Uo=Yo=ti=ae(t)||0}if(Wo){if(Oo())return;Vo&&Eo(Vo,!0),Qo=[],vo(to),Io.ok=!0,Ti.show({index:tr,time:0}),Ti.resize()}else Ti.destroy()}function Oo(){return!Oo.f===hi?(Oo.f=hi,tr=Wo-1-tr,Ti.reverse(),!0):void 0}function Do(){Do.ok&&(Do.ok=!1,yo("ready"))}Nn=o("html"),$n=o("body");var Ro,Wo,Ho,Ko,Vo,Bo,Qo,Xo,Uo,Yo,Go,Jo,Zo,ti,ei,ni,oi,ii,ri,ai,si,ui,li,ci,di,fi,hi,mi,pi,vi,gi,wi,yi,bi,xi,_i,Ci,ki,Ti=this,Pi=o.now(),Si=le+Pi,Mi=n[0],Ei=1,Fi=n.data(),ji=o("<style></style>"),zi=o(A(Ze)),Ni=n.find(I(de)),$i=Ni.find(I(Ce)),qi=($i[0],n.find(I(Pe))),Li=o(),Ai=n.find(I(je)),Ii=n.find(I(ze)),Oi=n.find(I(Ee)),Di=n.find(I($e)),Ri=Di.find(I(Ne)),Wi=Ri.find(I(qe)),Hi=o(),Ki=o(),Vi=(qi.data(),Wi.data(),n.find(I(mn))),Bi=n.find(I(fn)),Qi=n.find(I(hn)),Xi=n.find(I(en)),Ui=Xi[0],Yi=o(A(wn)),Gi=n.find(I(yn)),Ji=Gi[0],Zi=o(A(bn)),tr=!1,er={},nr={},or={},ir={},rr={},ar={},sr={},ur={},lr=0,cr=[];Ni[to]=o(Tn.touch?'<a class="'+ke+'" target="_blank"></a>':'<div class="'+ke+'"></div>'),Ni[no]=o(o.Fotorama.jst.thumb()),Ni[eo]=o(o.Fotorama.jst.dots()),sr[to]=[],sr[no]=[],sr[eo]=[],ur[to]={},Ni.addClass(On?he:fe),Fi.fotorama=this,Ti.startAutoplay=function(t){return Ti.autoplay?this:(yi=bi=!1,k(t||r.autoplay),Co(),this)},Ti.stopAutoplay=function(){return Ti.autoplay&&(yi=bi=!0,Co()),this},Ti.showSlide=function(t){var e,n=l(Wi,r.navdir),o=550,i="horizontal"===r.navdir?r.thumbwidth:r.thumbheight,a=function(){io()};"next"===t&&(e=n-(i+r.margin)*ao),"prev"===t&&(e=n+(i+r.margin)*ao),e=B(e,rr),In(e,!0),te(Wi,{time:o,pos:e,direction:r.navdir,onEnd:a})},Ti.showWhileLongPress=function(t){if(!Ti.longPress.singlePressInProgress){var e=ko(t);To(e);var n=Po(t)/50,o=Bo;Ti.activeFrame=Bo=Ro[tr];var i=o===Bo&&!t.user;return Ti.showNav(i,t,n),this}},Ti.showEndLongPress=function(t){if(!Ti.longPress.singlePressInProgress){var e=ko(t);To(e);var n=Po(t)/50,o=Bo;Ti.activeFrame=Bo=Ro[tr];var i=o===Bo&&!t.user;return Ti.showStage(i,t,n),wi="undefined"!=typeof Yo&&Yo!==tr,Yo=tr,this}},Ti.showStage=function(t,e,n){Eo(Vo,Bo.i!==Ro[ne(Xo)].i),Mn(Qo,"stage"),An(Hn?[Uo]:[Uo,We(Uo),He(Uo)]),$o("go",!0),t||yo("show",{user:e.user,time:n}),yi=!0;var o=e.overPos,i=Ti.showStage.onEnd=function(n){if(!i.ok){if(i.ok=!0,n||go(!0),t||yo("showend",{user:e.user}),!n&&di&&di!==r.transition)return Ti.setOptions({transition:di}),void(di=!1);kn(),xn(Qo,"stage"),$o("go",!1),so(),jo(),_o(),Co()}};if(si){var a=Bo[to],s=Ro[Yo]&&tr!==Yo?Ro[Yo][to]:null;ee(a,s,Li,{time:n,method:r.transition,onEnd:i},cr)}else te(qi,{pos:-g(Uo,nr.w,r.margin,Xo),overPos:o,time:n,onEnd:i});Yn()},Ti.showNav=function(t,e,n){if(io(),ni){ho();var o=oe(tr+s(Uo-Yo,-1,1));fo({time:n,coo:o!==tr&&e.coo,guessIndex:"undefined"!=typeof e.coo?o:tr,keep:t}),oi&&co(n)}},Ti.show=function(t){Ti.longPress.singlePressInProgress=!0;var e=ko(t);To(e);var n=Po(t),o=Bo;Ti.activeFrame=Bo=Ro[tr];var i=o===Bo&&!t.user;return Ti.showStage(i,t,n),Ti.showNav(i,t,n),wi="undefined"!=typeof Yo&&Yo!==tr,Yo=tr,Ti.longPress.singlePressInProgress=!1,this},Ti.requestFullScreen=function(){return ri&&!Ti.fullScreen&&(vi=qn.scrollTop(),gi=qn.scrollLeft(),W(qn),$o("x",!0),xi=o.extend({},nr),n.addClass(tn).appendTo($n.addClass(ce)),Nn.addClass(ce),Eo(Vo,!0,!0),Ti.fullScreen=!0,ai&&Pn.request(Mi),Ti.resize(),xn(Qo,"stage"),kn(),yo("fullscreenenter")),this},Ti.cancelFullScreen=function(){return ai&&Pn.is()?Pn.cancel(e):So(),this},Ti.toggleFullScreen=function(){return Ti[(Ti.fullScreen?"cancel":"request")+"FullScreen"]()},V(e,Pn.event,function(){!Ro||Pn.is()||Vo||So()}),Ti.resize=function(e){if(!Ro)return this;var n=arguments[1]||0,i=arguments[2];ao=F(Ni,r),wo(Ti.fullScreen?{width:o(t).width(),maxwidth:null,minwidth:null,height:o(t).height(),maxheight:null,minheight:null}:H(e),[nr,i||Ti.fullScreen||r]);var a=nr.width,u=nr.height,l=nr.ratio,c=qn.height()-(ni?Ri.height():0);if(v(a)&&(Ni.css({width:""}),Ni.css({height:""}),$i.css({width:""}),$i.css({height:""}),$i.css({"line-height":""}),qi.css({width:""}),qi.css({height:""}),Ri.css({width:""}),Ri.css({height:""}),Ni.css({minWidth:nr.minwidth||0,maxWidth:nr.maxwidth||ro}),a=nr.W=nr.w=Ni.width(),nr.nw=ni&&p(r.navwidth,a)||a,qi.css({width:nr.w,marginLeft:(nr.W-nr.w)/2}),u=p(u,c),u=u||l&&a/l)){if(a=Math.round(a),u=nr.h=Math.round(s(u,p(nr.minheight,c),p(nr.maxheight,c))),$i.css({width:a,height:u,"line-height":u+"px"}),"vertical"!==r.navdir||Ti.fullscreen||Ri.width(r.thumbwidth+2*r.thumbmargin),"horizontal"!==r.navdir||Ti.fullscreen||Ri.height(r.thumbheight+2*r.thumbmargin),"vertical"===r.navdir&&Ti.fullScreen&&$i.css("height",o(t).height()),"horizontal"===r.navdir&&Ti.fullScreen&&$i.css("height",o(t).height()-(r.thumbheight+2*r.thumbmargin)),ni){switch(r.navdir){case"vertical":Di.removeClass(Ie),Di.removeClass(Ae),Di.addClass(Le),Ri.stop().animate({height:nr.h,width:r.thumbwidth},n);break;case"list":Di.removeClass(Le),Di.removeClass(Ie),Di.addClass(Ae);break;default:Di.removeClass(Le),Di.removeClass(Ae),Di.addClass(Ie),Ri.stop().animate({width:nr.nw},n)}go(),fo({guessIndex:tr,time:n,keep:!0}),oi&&Wn.nav&&co(n)}pi=i||!0,Do.ok=!0,Do()}return lr=$i.offset().left,f(),this},Ti.setOptions=function(t){return o.extend(r,t),Io(),this},Ti.shuffle=function(){return Ro&&D(Ro)&&Io(),this},Ti.longPress={threshold:1,count:0,thumbSlideTime:20,progress:function(){this.inProgress||(this.count++,this.inProgress=this.count>this.threshold)},end:function(){this.inProgress&&(this.isEnded=!0)},reset:function(){this.count=0,this.inProgress=!1,this.isEnded=!1}},Ti.destroy=function(){return Ti.cancelFullScreen(),Ti.stopAutoplay(),Ro=Ti.data=null,y(),Qo=[],vo(to),Io.ok=!1,this},Ti.playVideo=function(){var t=Bo,e=t.video,n=tr;return"object"==typeof e&&t.videoReady&&(ai&&Ti.fullScreen&&Ti.cancelFullScreen(),z(function(){return!Pn.is()||n!==tr},function(){n===tr&&(t.$video=t.$video||o(A(gn)).append(O(e)),t.$video.appendTo(t[to]),Ni.addClass(me),Vo=t.$video,C(),Oi.blur(),Xi.blur(),yo("loadvideo"))})),this},Ti.stopVideo=function(){return Eo(Vo,!0,!0),this},$i.on("mousemove",jo),or=ie(qi,{onStart:bo,onMove:function(t,e){Mo($i,e.edge)},onTouchEnd:xo,onEnd:function(t){Mo($i);var e=(Kn&&!Ci||t.touch)&&r.arrows&&"always"!==r.arrows;if(t.moved||e&&t.pos!==t.newPos&&!t.control){var n=w(t.newPos,nr.w,r.margin,Xo);Ti.show({index:n,time:si?ci:t.time,overPos:t.overPos,user:!0})}else t.aborted||t.control||No(t.startEvent,e)},timeLow:1,timeHigh:1,friction:2,select:"."+Je+", ."+Je+" *",$wrap:$i,direction:"horizontal"}),rr=ie(Wi,{onStart:bo,onMove:function(t,e){Mo(Ri,e.edge)},onTouchEnd:xo,onEnd:function(t){function e(){fo.l=t.newPos,_o(),Co(),In(t.newPos,!0),io()}if(t.moved)t.pos!==t.newPos?(yi=!0,te(Wi,{time:t.time,pos:t.newPos,overPos:t.overPos,direction:r.navdir,onEnd:e}),In(t.newPos),fi&&Mo(Ri,q(t.newPos,rr.min,rr.max,t.dir))):e();else{var n=t.$target.closest("."+Re,Wi)[0];n&&qo.call(n,t.startEvent)}},timeLow:.5,timeHigh:2,friction:5,$wrap:Ri,direction:r.navdir}),ir=re($i,{shift:!0,onEnd:function(t,e){bo(),xo(),Ti.show({index:e,slow:t.altKey})}}),ar=re(Ri,{onEnd:function(t,e){bo(),xo();var n=x(Wi)+.25*e;Wi.css(c(s(n,rr.min,rr.max),r.navdir)),fi&&Mo(Ri,q(n,rr.min,rr.max,r.navdir)),ar.prevent={"<":n>=rr.max,">":n<=rr.min},clearTimeout(ar.t),ar.t=setTimeout(function(){fo.l=n,In(n,!0)},Bn),In(n)}}),Ni.hover(function(){setTimeout(function(){_i||Fo(!(Ci=!0))},0)},function(){Ci&&Fo(!(Ci=!1))}),L(Oi,function(t){J(t),Lo.call(this,t)},{onStart:function(){bo(),or.control=!0},onTouchEnd:xo}),L(Bi,function(t){J(t),"thumbs"===r.navtype?Ti.show("<"):Ti.showSlide("prev")}),L(Qi,function(t){J(t),"thumbs"===r.navtype?Ti.show(">"):Ti.showSlide("next")}),Oi.each(function(){Y(this,function(t){Lo.call(this,t)}),Ao(this)}),Y(Ui,function(){Ti.toggleFullScreen(),o(Ui).trigger("focus")}),Ao(Ui),o.each("load push pop shift unshift reverse sort splice".split(" "),function(t,e){Ti[e]=function(){return Ro=Ro||[],"load"!==e?Array.prototype[e].apply(Ro,arguments):arguments[0]&&"object"==typeof arguments[0]&&arguments[0].length&&(Ro=R(arguments[0])),Io(),Ti}}),Io()},o.fn.fotorama=function(e){return this.each(function(){var n=this,i=o(this),r=i.data(),a=r.fotorama;a?a.setOptions(e,!0):z(function(){return!F(n)},function(){r.urtext=i.html(),new o.Fotorama(i,o.extend({},so,t.fotoramaDefaults,e,r))})})},o.Fotorama.instances=[],o.Fotorama.cache={},o.Fotorama.measures={},o=o||{},o.Fotorama=o.Fotorama||{},o.Fotorama.jst=o.Fotorama.jst||{},o.Fotorama.jst.dots=function(){{var t="";kn.escape}return t+='<div class="fotorama__nav__frame fotorama__nav__frame--dot" tabindex="0" role="button" data-gallery-role="nav-frame" data-nav-type="thumb" aria-label>\r\n <div class="fotorama__dot"></div>\r\n</div>'},o.Fotorama.jst.frameCaption=function(t){{var e,n="";kn.escape}return n+='<div class="fotorama__caption" aria-hidden="true">\r\n <div class="fotorama__caption__wrap" id="'+(null==(e=t.labelledby)?"":e)+'">'+(null==(e=t.caption)?"":e)+"</div>\r\n</div>\r\n"},o.Fotorama.jst.style=function(t){{var e,n="";kn.escape}return n+=".fotorama"+(null==(e=t.s)?"":e)+" .fotorama__nav--thumbs .fotorama__nav__frame{\r\npadding:"+(null==(e=t.m)?"":e)+"px;\r\nheight:"+(null==(e=t.h)?"":e)+"px}\r\n.fotorama"+(null==(e=t.s)?"":e)+" .fotorama__thumb-border{\r\nheight:"+(null==(e=t.h)?"":e)+"px;\r\nborder-width:"+(null==(e=t.b)?"":e)+"px;\r\nmargin-top:"+(null==(e=t.m)?"":e)+"px}"},o.Fotorama.jst.thumb=function(){{var t="";kn.escape}return t+='<div class="fotorama__nav__frame fotorama__nav__frame--thumb" tabindex="0" role="button" data-gallery-role="nav-frame" data-nav-type="thumb" aria-label>\r\n <div class="fotorama__thumb">\r\n </div>\r\n</div>'}}(window,document,location,"undefined"!=typeof jQuery&&jQuery); \ No newline at end of file diff --git a/lib/web/mage/validation/url.js b/lib/web/mage/validation/url.js index 5361d9522787650bd470d9941153527b192ff781..40fe32c9a5bc9d08207fe8bd3a969b35ff4eb164 100644 --- a/lib/web/mage/validation/url.js +++ b/lib/web/mage/validation/url.js @@ -35,6 +35,8 @@ define([], function () { path.indexOf('vbscript:') !== -1) { return false; } + + return true; }, /** @@ -44,7 +46,7 @@ define([], function () { * @returns {String} */ sanitize: function (path) { - return path.Replace('[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]', ''); + return path.replace('[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]', ''); } }; }); diff --git a/nginx.conf.sample b/nginx.conf.sample index 137ef8205deda016379d2b4a2abd4f103f8f9882..d1fae8af249431a258df786406c23f9be30a17a6 100644 --- a/nginx.conf.sample +++ b/nginx.conf.sample @@ -36,7 +36,7 @@ location /setup { include fastcgi_params; } - location ~ /setup/(?!pub/). { + location ~ ^/setup/(?!pub/). { deny all; } } @@ -44,7 +44,7 @@ location /setup { location /update { root $MAGE_ROOT; - location ~ /update/index.php { + location ~ ^/update/index.php { fastcgi_pass fastcgi_backend; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; @@ -52,7 +52,7 @@ location /update { } # deny everything but index.php - location ~ /update/(?!pub/). { + location ~ ^/update/(?!pub/). { deny all; } } diff --git a/setup/pub/magento/setup/create-admin-account.js b/setup/pub/magento/setup/create-admin-account.js index 423ef0a341f8e86db3bc7c91e2427725054c2f10..ecd31b3459fa1535bf70cac879818382444000b5 100644 --- a/setup/pub/magento/setup/create-admin-account.js +++ b/setup/pub/magento/setup/create-admin-account.js @@ -18,16 +18,17 @@ angular.module('create-admin-account', ['ngStorage']) return; } var p = $scope.admin.password; - if (p.length >= 6 && p.match(/[\d]+/) && p.match(/[a-z]+/) && p.match(/[A-Z]+/) && p.match(/[!@#$%^*()_\/\\\-\+=]+/)) { + var MIN_ADMIN_PASSWORD_LENGTH = 7; + if (p.length >= MIN_ADMIN_PASSWORD_LENGTH && p.match(/[\d]+/) && p.match(/[a-z]+/) && p.match(/[A-Z]+/) && p.match(/[!@#$%^*()_\/\\\-\+=]+/)) { $scope.admin.passwordStatus.class = 'strong'; $scope.admin.passwordStatus.label = 'Strong'; - } else if (p.length >= 6 && p.match(/[\d]+/) && p.match(/[a-z]+/) && p.match(/[A-Z]+/)) { + } else if (p.length >= MIN_ADMIN_PASSWORD_LENGTH && p.match(/[\d]+/) && p.match(/[a-z]+/) && p.match(/[A-Z]+/)) { $scope.admin.passwordStatus.class = 'good'; $scope.admin.passwordStatus.label = 'Good'; - } else if (p.length >= 6 && p.match(/[\d]+/) && p.match(/[a-zA-Z]+/)) { + } else if (p.length >= MIN_ADMIN_PASSWORD_LENGTH && p.match(/[\d]+/) && p.match(/[a-zA-Z]+/)) { $scope.admin.passwordStatus.class = 'fair'; $scope.admin.passwordStatus.label = 'Fair'; - } else if (p.length >= 6) { + } else if (p.length >= MIN_ADMIN_PASSWORD_LENGTH) { $scope.admin.passwordStatus.class = 'weak'; $scope.admin.passwordStatus.label = 'Weak'; } else { diff --git a/setup/pub/magento/setup/readiness-check.js b/setup/pub/magento/setup/readiness-check.js index f2b8cf9e48c5f3a1e4cb63d86cdec1249756ab75..d150e2f5cb1376818e275bde259daa02961965f5 100644 --- a/setup/pub/magento/setup/readiness-check.js +++ b/setup/pub/magento/setup/readiness-check.js @@ -112,6 +112,7 @@ angular.module('readiness-check', []) 'php-version': { url:'index.php/environment/php-version', params: $scope.actionFrom, + useGet: true, show: function() { $scope.startProgress(); $scope.version.visible = true; @@ -129,6 +130,7 @@ angular.module('readiness-check', []) 'php-settings': { url:'index.php/environment/php-settings', params: $scope.actionFrom, + useGet: true, show: function() { $scope.startProgress(); $scope.settings.visible = true; @@ -146,6 +148,7 @@ angular.module('readiness-check', []) 'php-extensions': { url:'index.php/environment/php-extensions', params: $scope.actionFrom, + useGet: true, show: function() { $scope.startProgress(); $scope.extensions.visible = true; @@ -285,11 +288,25 @@ angular.module('readiness-check', []) $scope.query = function(item) { if (item.params) { - return $http.post(item.url, item.params) - .success(function(data) { item.process(data) }) - .error(function(data, status) { - item.fail(); - }); + if (item.useGet === true) { + // The http request type has been changed from POST to GET for a reason. The POST request + // results in PHP throwing a warning regards to 'always_populate_raw_post_data' + // being incorrectly set to a value different than -1. This warning is throw during the initial + // boot up sequence when POST request is received before the control gets transferred over to + // the Magento customer error handler, hence not catchable. To avoid that warning, the HTTP + // request type is being changed from POST to GET for select queries. Those queries are: + // (1) PHP Version Check (2) PHP Settings Check and (3) PHP Extensions Check. + + item.url = item.url + '?type=' + item.params; + } else { + return $http.post(item.url, item.params) + .success(function (data) { + item.process(data) + }) + .error(function (data, status) { + item.fail(); + }); + } } // setting 1 minute timeout to prevent system from timing out return $http.get(item.url, {timeout: 60000}) diff --git a/setup/src/Magento/Setup/Controller/Environment.php b/setup/src/Magento/Setup/Controller/Environment.php index 57c8a509abadf2ca6ce2d64f69ebf397d56959b9..ac646bcbceff322156bef1fb5379352eaa22a0ff 100644 --- a/setup/src/Magento/Setup/Controller/Environment.php +++ b/setup/src/Magento/Setup/Controller/Environment.php @@ -111,7 +111,8 @@ class Environment extends AbstractActionController */ public function phpVersionAction() { - $type = $this->getRequest()->getContent(); + $type = $this->getRequest()->getQuery('type'); + $data = []; if ($type == ReadinessCheckInstaller::INSTALLER) { $data = $this->phpReadinessCheck->checkPhpVersion(); @@ -128,7 +129,8 @@ class Environment extends AbstractActionController */ public function phpSettingsAction() { - $type = $this->getRequest()->getContent(); + $type = $this->getRequest()->getQuery('type'); + $data = []; if ($type == ReadinessCheckInstaller::INSTALLER) { $data = $this->phpReadinessCheck->checkPhpSettings(); @@ -145,7 +147,8 @@ class Environment extends AbstractActionController */ public function phpExtensionsAction() { - $type = $this->getRequest()->getContent(); + $type = $this->getRequest()->getQuery('type'); + $data = []; if ($type == ReadinessCheckInstaller::INSTALLER) { $data = $this->phpReadinessCheck->checkPhpExtensions(); diff --git a/setup/src/Magento/Setup/Model/ConfigGenerator.php b/setup/src/Magento/Setup/Model/ConfigGenerator.php index db1e6727b703f2bf7cae32b9c0c45007c21e80c9..812cbd1830a38c71f1bcfbebfcd2120915984e1e 100644 --- a/setup/src/Magento/Setup/Model/ConfigGenerator.php +++ b/setup/src/Magento/Setup/Model/ConfigGenerator.php @@ -98,7 +98,7 @@ class ConfigGenerator if ($currentKey === null) { $configData->set( ConfigOptionsListConstants::CONFIG_PATH_CRYPT_KEY, - md5($this->random->getRandomString(10)) + md5($this->random->getRandomString(ConfigOptionsListConstants::STORE_KEY_RANDOM_STRING_SIZE)) ); } } diff --git a/setup/src/Magento/Setup/Model/PhpReadinessCheck.php b/setup/src/Magento/Setup/Model/PhpReadinessCheck.php index a7b0b923216b21fd50366d168fd32766356052eb..b6bed9a9d1cb26c3d5076c4a153884b4dbfc61b0 100644 --- a/setup/src/Magento/Setup/Model/PhpReadinessCheck.php +++ b/setup/src/Magento/Setup/Model/PhpReadinessCheck.php @@ -95,7 +95,8 @@ class PhpReadinessCheck $responseType = ResponseTypeInterface::RESPONSE_TYPE_SUCCESS; $settings = array_merge( - $this->checkXDebugNestedLevel() + $this->checkXDebugNestedLevel(), + $this->checkPopulateRawPostSetting() ); foreach ($settings as $setting) { @@ -178,4 +179,47 @@ class PhpReadinessCheck return $data; } + + /** + * Checks if PHP version >= 5.6.0 and always_populate_raw_post_data is set to -1 + * + * Beginning PHP 7.0, support for 'always_populate_raw_post_data' is going to removed. + * And beginning PHP 5.6, a deprecated message is displayed if 'always_populate_raw_post_data' + * is set to a value other than -1. + * + * @return array + */ + private function checkPopulateRawPostSetting() + { + // HHVM does not support 'always_populate_raw_post_data' to be set to -1 + if (defined('HHVM_VERSION')) { + return []; + } + + $data = []; + $error = false; + $iniSetting = intVal(ini_get('always_populate_raw_post_data')); + + if (version_compare(PHP_VERSION, '5.6.0') >= 0 && $iniSetting !== -1) { + $error = true; + } + + $message = sprintf( + 'Your PHP Version is %s, but always_populate_raw_post_data = %d. + $HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will stop the installer from running. + Please open your php.ini file and set always_populate_raw_post_data to -1. + If you need more help please call your hosting provider. + ', + PHP_VERSION, + intVal(ini_get('always_populate_raw_post_data')) + ); + + $data['always_populate_raw_post_data'] = [ + 'message' => $message, + 'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data', + 'error' => $error + ]; + + return $data; + } } diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/EnvironmentTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/EnvironmentTest.php index fc3fee7684e9ea15f76998244ed84678e72ff947..e34be41d76be26d8f7976af10d205171b1968dd1 100644 --- a/setup/src/Magento/Setup/Test/Unit/Controller/EnvironmentTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Controller/EnvironmentTest.php @@ -109,8 +109,7 @@ class EnvironmentTest extends \PHPUnit_Framework_TestCase $mvcEvent->expects($this->once())->method('setResponse')->with($response)->willReturn($mvcEvent); $mvcEvent->expects($this->once())->method('setTarget')->with($this->environment)->willReturn($mvcEvent); $mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch); - $content = ReadinessCheckInstaller::INSTALLER; - $request->expects($this->any())->method('getContent')->willReturn($content); + $request->expects($this->once())->method('getQuery')->willReturn(ReadinessCheckInstaller::INSTALLER); $this->phpReadinessCheck->expects($this->once())->method('checkPhpVersion'); $this->environment->setEvent($mvcEvent); $this->environment->dispatch($request, $response); @@ -128,8 +127,7 @@ class EnvironmentTest extends \PHPUnit_Framework_TestCase $mvcEvent->expects($this->once())->method('setResponse')->with($response)->willReturn($mvcEvent); $mvcEvent->expects($this->once())->method('setTarget')->with($this->environment)->willReturn($mvcEvent); $mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch); - $content = ReadinessCheckUpdater::UPDATER; - $request->expects($this->any())->method('getContent')->willReturn($content); + $request->expects($this->once())->method('getQuery')->willReturn(ReadinessCheckUpdater::UPDATER); $this->phpReadinessCheck->expects($this->never())->method('checkPhpVersion'); $read = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\ReadInterface', [], '', false); $this->filesystem->expects($this->once())->method('getDirectoryRead')->willReturn($read); @@ -152,8 +150,7 @@ class EnvironmentTest extends \PHPUnit_Framework_TestCase $mvcEvent->expects($this->once())->method('setResponse')->with($response)->willReturn($mvcEvent); $mvcEvent->expects($this->once())->method('setTarget')->with($this->environment)->willReturn($mvcEvent); $mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch); - $content = ReadinessCheckInstaller::INSTALLER; - $request->expects($this->any())->method('getContent')->willReturn($content); + $request->expects($this->once())->method('getQuery')->willReturn(ReadinessCheckInstaller::INSTALLER); $this->phpReadinessCheck->expects($this->once())->method('checkPhpSettings'); $this->environment->setEvent($mvcEvent); $this->environment->dispatch($request, $response); @@ -171,8 +168,7 @@ class EnvironmentTest extends \PHPUnit_Framework_TestCase $mvcEvent->expects($this->once())->method('setResponse')->with($response)->willReturn($mvcEvent); $mvcEvent->expects($this->once())->method('setTarget')->with($this->environment)->willReturn($mvcEvent); $mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch); - $content = ReadinessCheckUpdater::UPDATER; - $request->expects($this->any())->method('getContent')->willReturn($content); + $request->expects($this->once())->method('getQuery')->willReturn(ReadinessCheckUpdater::UPDATER); $this->phpReadinessCheck->expects($this->never())->method('checkPhpSettings'); $read = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\ReadInterface', [], '', false); $this->filesystem->expects($this->once())->method('getDirectoryRead')->willReturn($read); @@ -195,8 +191,7 @@ class EnvironmentTest extends \PHPUnit_Framework_TestCase $mvcEvent->expects($this->once())->method('setResponse')->with($response)->willReturn($mvcEvent); $mvcEvent->expects($this->once())->method('setTarget')->with($this->environment)->willReturn($mvcEvent); $mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch); - $content = ReadinessCheckInstaller::INSTALLER; - $request->expects($this->any())->method('getContent')->willReturn($content); + $request->expects($this->once())->method('getQuery')->willReturn(ReadinessCheckInstaller::INSTALLER); $this->phpReadinessCheck->expects($this->once())->method('checkPhpExtensions'); $this->environment->setEvent($mvcEvent); $this->environment->dispatch($request, $response); @@ -214,8 +209,7 @@ class EnvironmentTest extends \PHPUnit_Framework_TestCase $mvcEvent->expects($this->once())->method('setResponse')->with($response)->willReturn($mvcEvent); $mvcEvent->expects($this->once())->method('setTarget')->with($this->environment)->willReturn($mvcEvent); $mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch); - $content = ReadinessCheckUpdater::UPDATER; - $request->expects($this->any())->method('getContent')->willReturn($content); + $request->expects($this->once())->method('getQuery')->willReturn(ReadinessCheckUpdater::UPDATER); $this->phpReadinessCheck->expects($this->never())->method('checkPhpExtensions'); $read = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\ReadInterface', [], '', false); $this->filesystem->expects($this->once())->method('getDirectoryRead')->willReturn($read); diff --git a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php index 098e210824389a8848265a9d2b072d53fa24fd2d..0364f22e3b400003d81fd23651634da2bfd3e684 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php @@ -6,8 +6,8 @@ namespace Magento\Setup\Test\Unit\Model; -use Magento\Backend\Setup\ConfigOptionsList as BackendConfigOptionsList; -use Magento\Framework\Config\ConfigOptionsListConstants as SetupConfigOptionsList; +use Magento\Backend\Setup\ConfigOptionsList; +use Magento\Framework\Config\ConfigOptionsListConstants; use \Magento\Setup\Model\Installer; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Filesystem\DriverPool; @@ -137,10 +137,10 @@ class InstallerTest extends \PHPUnit_Framework_TestCase * @var array */ private static $dbConfig = [ - SetupConfigOptionsList::KEY_HOST => '127.0.0.1', - SetupConfigOptionsList::KEY_NAME => 'magento', - SetupConfigOptionsList::KEY_USER => 'magento', - SetupConfigOptionsList::KEY_PASSWORD => '', + ConfigOptionsListConstants::KEY_HOST => '127.0.0.1', + ConfigOptionsListConstants::KEY_NAME => 'magento', + ConfigOptionsListConstants::KEY_USER => 'magento', + ConfigOptionsListConstants::KEY_PASSWORD => '', ]; /** @@ -227,11 +227,11 @@ class InstallerTest extends \PHPUnit_Framework_TestCase public function testInstall() { $request = [ - SetupConfigOptionsList::INPUT_KEY_DB_HOST => '127.0.0.1', - SetupConfigOptionsList::INPUT_KEY_DB_NAME => 'magento', - SetupConfigOptionsList::INPUT_KEY_DB_USER => 'magento', - SetupConfigOptionsList::INPUT_KEY_ENCRYPTION_KEY => 'encryption_key', - BackendConfigOptionsList::INPUT_KEY_BACKEND_FRONTNAME => 'backend', + ConfigOptionsListConstants::INPUT_KEY_DB_HOST => '127.0.0.1', + ConfigOptionsListConstants::INPUT_KEY_DB_NAME => 'magento', + ConfigOptionsListConstants::INPUT_KEY_DB_USER => 'magento', + ConfigOptionsListConstants::INPUT_KEY_ENCRYPTION_KEY => 'encryption_key', + ConfigOptionsList::INPUT_KEY_BACKEND_FRONTNAME => 'backend', ]; $this->config->expects($this->atLeastOnce())->method('isAvailable')->willReturn(true); $allModules = ['Foo_One' => [], 'Bar_Two' => []]; @@ -436,7 +436,7 @@ class InstallerTest extends \PHPUnit_Framework_TestCase $this->config->expects($this->once())->method('isAvailable')->willReturn(true); $this->config->expects($this->once()) ->method('get') - ->with(SetupConfigOptionsList::CONFIG_PATH_DB_CONNECTION_DEFAULT) + ->with(ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT) ->willReturn(self::$dbConfig); $this->connection->expects($this->at(0))->method('quoteIdentifier')->with('magento')->willReturn('`magento`'); $this->connection->expects($this->at(1))->method('query')->with('DROP DATABASE IF EXISTS `magento`'); @@ -489,3 +489,15 @@ class InstallerTest extends \PHPUnit_Framework_TestCase return $newObject; } } + +namespace Magento\Setup\Model; + +/** + * Mocking autoload function + * + * @returns array + */ +function spl_autoload_functions() +{ + return ['mock_function_one', 'mock_function_two']; +} diff --git a/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php b/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php index 26289d9ba52fe368db84c326610dce05891f0974..3080faf35d90ba555a310f1079c3209c90081cda 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php @@ -179,19 +179,32 @@ class PhpReadinessCheckTest extends \PHPUnit_Framework_TestCase { $this->phpInfo->expects($this->once())->method('getCurrent')->willReturn(['xdebug']); $this->phpInfo->expects($this->once())->method('getRequiredMinimumXDebugNestedLevel')->willReturn(50); - $message = sprintf( + $xdebugMessage = sprintf( 'Your current setting of xdebug.max_nesting_level=%d. Magento 2 requires it to be set to %d or more. Edit your config, restart web server, and try again.', 100, 50 ); + $rawPostMessage = sprintf( + 'Your PHP Version is %s, but always_populate_raw_post_data = -1. + $HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will stop the installer from running. + Please open your php.ini file and set always_populate_raw_post_data to -1. + If you need more help please call your hosting provider. + ', + PHP_VERSION + ); $expected = [ 'responseType' => ResponseTypeInterface::RESPONSE_TYPE_SUCCESS, 'data' => [ 'xdebug_max_nesting_level' => [ - 'message' => $message, + 'message' => $xdebugMessage, 'error' => false, + ], + 'always_populate_raw_post_data' => [ + 'message' => $rawPostMessage, + 'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data', + 'error' => false ] ] ]; @@ -202,19 +215,32 @@ class PhpReadinessCheckTest extends \PHPUnit_Framework_TestCase { $this->phpInfo->expects($this->once())->method('getCurrent')->willReturn(['xdebug']); $this->phpInfo->expects($this->once())->method('getRequiredMinimumXDebugNestedLevel')->willReturn(200); - $message = sprintf( + $xdebugMessage = sprintf( 'Your current setting of xdebug.max_nesting_level=%d. Magento 2 requires it to be set to %d or more. Edit your config, restart web server, and try again.', 100, 200 ); + $rawPostMessage = sprintf( + 'Your PHP Version is %s, but always_populate_raw_post_data = -1. + $HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will stop the installer from running. + Please open your php.ini file and set always_populate_raw_post_data to -1. + If you need more help please call your hosting provider. + ', + PHP_VERSION + ); $expected = [ 'responseType' => ResponseTypeInterface::RESPONSE_TYPE_ERROR, 'data' => [ 'xdebug_max_nesting_level' => [ - 'message' => $message, + 'message' => $xdebugMessage, 'error' => true, + ], + 'always_populate_raw_post_data' => [ + 'message' => $rawPostMessage, + 'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data', + 'error' => false ] ] ]; @@ -224,7 +250,24 @@ class PhpReadinessCheckTest extends \PHPUnit_Framework_TestCase public function testCheckPhpSettingsNoXDebug() { $this->phpInfo->expects($this->once())->method('getCurrent')->willReturn([]); - $expected = ['responseType' => ResponseTypeInterface::RESPONSE_TYPE_SUCCESS, 'data' => []]; + $rawPostMessage = sprintf( + 'Your PHP Version is %s, but always_populate_raw_post_data = -1. + $HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will stop the installer from running. + Please open your php.ini file and set always_populate_raw_post_data to -1. + If you need more help please call your hosting provider. + ', + PHP_VERSION + ); + $expected = [ + 'responseType' => ResponseTypeInterface::RESPONSE_TYPE_SUCCESS, + 'data' => [ + 'always_populate_raw_post_data' => [ + 'message' => $rawPostMessage, + 'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data', + 'error' => false + ] + ] + ]; $this->assertEquals($expected, $this->phpReadinessCheck->checkPhpSettings()); } @@ -282,7 +325,11 @@ class PhpReadinessCheckTest extends \PHPUnit_Framework_TestCase namespace Magento\Setup\Model; -function ini_get() +function ini_get($param) { - return 100; + if ($param === 'xdebug.max_nesting_level') { + return 100; + } elseif ($param === 'always_populate_raw_post_data') { + return -1; + } } diff --git a/setup/src/Magento/Setup/Test/Unit/Validator/DbValidatorTest.php b/setup/src/Magento/Setup/Test/Unit/Validator/DbValidatorTest.php index 3f833f10a80e6aa2d6abc5c987659cdf919f437f..ad7f8285196d29543b94473189461b93aa6adb02 100644 --- a/setup/src/Magento/Setup/Test/Unit/Validator/DbValidatorTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Validator/DbValidatorTest.php @@ -46,9 +46,31 @@ class DbValidatorTest extends \PHPUnit_Framework_TestCase $this->connection ->expects($this->atLeastOnce()) ->method('query') - ->with('SHOW GRANTS FOR current_user()') ->willReturn($pdo); - $pdo->expects($this->once())->method('fetchAll')->willReturn([['GRANT ALL PRIVILEGES ON `name.*` TO']]); + $pdo->expects($this->once()) + ->method('fetchAll') + ->willReturn( + [ + ['SELECT'], + ['INSERT'], + ['UPDATE'], + ['DELETE'], + ['CREATE'], + ['DROP'], + ['REFERENCES'], + ['INDEX'], + ['ALTER'], + ['CREATE TEMPORARY TABLES'], + ['LOCK TABLES'], + ['EXECUTE'], + ['CREATE VIEW'], + ['SHOW VIEW'], + ['CREATE ROUTINE'], + ['ALTER ROUTINE'], + ['EVENT'], + ['TRIGGER'], + ] + ); $this->assertEquals(true, $this->dbValidator->checkDatabaseConnection('name', 'host', 'user', 'password')); } @@ -65,11 +87,10 @@ class DbValidatorTest extends \PHPUnit_Framework_TestCase ->willReturn('5.6.0-0ubuntu0.12.04.1'); $pdo = $this->getMockForAbstractClass('Zend_Db_Statement_Interface', [], '', false); $this->connection - ->expects($this->once()) + ->expects($this->atLeastOnce()) ->method('query') - ->with('SHOW GRANTS FOR current_user()') ->willReturn($pdo); - $pdo->expects($this->once())->method('fetchAll')->willReturn([['GRANT SELECT ON *.* TO']]); + $pdo->expects($this->atLeastOnce())->method('fetchAll')->willReturn([['SELECT']]); $this->dbValidator->checkDatabaseConnection('name', 'host', 'user', 'password'); } diff --git a/setup/src/Magento/Setup/Validator/DbValidator.php b/setup/src/Magento/Setup/Validator/DbValidator.php index 1470ecf6c1814942d3656971f854fa7fc40161ef..e7b7aea7f0bf02bd6058d1811ddce51fe2ec24f6 100644 --- a/setup/src/Magento/Setup/Validator/DbValidator.php +++ b/setup/src/Magento/Setup/Validator/DbValidator.php @@ -62,8 +62,9 @@ class DbValidator */ public function checkDatabaseConnection($dbName, $dbHost, $dbUser, $dbPass = '') { + // establish connection to information_schema view to retrieve information about user and table privileges $connection = $this->connectionFactory->create([ - ConfigOptionsListConstants::KEY_NAME => $dbName, + ConfigOptionsListConstants::KEY_NAME => 'information_schema', ConfigOptionsListConstants::KEY_HOST => $dbHost, ConfigOptionsListConstants::KEY_USER => $dbUser, ConfigOptionsListConstants::KEY_PASSWORD => $dbPass, @@ -86,6 +87,7 @@ class DbValidator } } } + return $this->checkDatabasePrivileges($connection, $dbName); } @@ -99,12 +101,60 @@ class DbValidator */ private function checkDatabasePrivileges(\Magento\Framework\DB\Adapter\AdapterInterface $connection, $dbName) { - $grantInfo = $connection->query('SHOW GRANTS FOR current_user()')->fetchAll(\PDO::FETCH_NUM); + $requiredPrivileges = [ + 'SELECT', + 'INSERT', + 'UPDATE', + 'DELETE', + 'CREATE', + 'DROP', + 'REFERENCES', + 'INDEX', + 'ALTER', + 'CREATE TEMPORARY TABLES', + 'LOCK TABLES', + 'EXECUTE', + 'CREATE VIEW', + 'SHOW VIEW', + 'CREATE ROUTINE', + 'ALTER ROUTINE', + 'EVENT', + 'TRIGGER' + ]; + + // check global privileges + $userPrivilegesQuery = "SELECT PRIVILEGE_TYPE FROM USER_PRIVILEGES " + . "WHERE REPLACE(GRANTEE, '\'', '') = current_user()"; + $grantInfo = $connection->query($userPrivilegesQuery)->fetchAll(\PDO::FETCH_NUM); + if (empty(array_diff($requiredPrivileges, $this->parseGrantInfo($grantInfo)))) { + return true; + } + + // check table privileges + $schemaPrivilegesQuery = "SELECT PRIVILEGE_TYPE FROM SCHEMA_PRIVILEGES " . + "WHERE '$dbName' LIKE TABLE_SCHEMA AND REPLACE(GRANTEE, '\'', '') = current_user()"; + $grantInfo = $connection->query($schemaPrivilegesQuery)->fetchAll(\PDO::FETCH_NUM); + if (empty(array_diff($requiredPrivileges, $this->parseGrantInfo($grantInfo)))) { + return true; + } + + $errorMessage = 'Database user does not have enough privileges. Please make sure ' + . implode(', ', $requiredPrivileges) . " privileges are granted to table '$dbName'."; + throw new \Magento\Setup\Exception($errorMessage); + } + + /** + * Parses query result + * + * @param array $grantInfo + * @return array + */ + private function parseGrantInfo(array $grantInfo) + { + $result = []; foreach ($grantInfo as $grantRow) { - if (preg_match('/(ALL|ALL\sPRIVILEGES)\sON\s[^a-zA-Z\d\s]?(\*|' . $dbName . ')/', $grantRow[0]) === 1) { - return true; - } + $result[] = $grantRow[0]; } - throw new \Magento\Setup\Exception('Database user does not have enough privileges.'); + return $result; } } diff --git a/setup/view/magento/setup/create-admin-account.phtml b/setup/view/magento/setup/create-admin-account.phtml index 379974ec0c6698b8d8641ff73f4f0cc377ee9b80..fa58a132d6de365ea907f8abc44a3c39b8bac666 100644 --- a/setup/view/magento/setup/create-admin-account.phtml +++ b/setup/view/magento/setup/create-admin-account.phtml @@ -19,7 +19,7 @@ $passwordWizard = sprintf( </div> <p>%s</p>', 'Password Strength:', - 'Enter a mix of 6 or more numbers and letters. For a stronger password, include at least one small letter, big letter, and symbol (Ex: BuyIt$54).' + 'Enter a mix of 7 or more numbers and letters. For a stronger password, include at least one small letter, big letter, and symbol (Ex: BuyIt$54).' ); ?> @@ -146,7 +146,7 @@ $passwordWizard = sprintf( > <div class="error-container"> <span ng-show="account.adminPassword.$error.checkPassword"> - Please enter a mix of at least 6 alpha-numeric characters. + Please enter a mix of at least 7 alpha-numeric characters. </span> <span ng-show="account.adminPassword.$error.required"> Please enter your new password. diff --git a/setup/view/magento/setup/readiness-check/progress.phtml b/setup/view/magento/setup/readiness-check/progress.phtml index 964f9c403e472b31c115fbd5d30da479b40382e3..53ca61521c556249a18ffa14ec85d6e5b90bfeb4 100755 --- a/setup/view/magento/setup/readiness-check/progress.phtml +++ b/setup/view/magento/setup/readiness-check/progress.phtml @@ -285,7 +285,7 @@ </div> <p ng-show="componentDependency.expanded">For additional assistance, see - <a href="http://devdocs.magento.com/guides/v2.0/install-gde/trouble/trouble/php/tshoot_php-set.html" + <a href="http://devdocs.magento.com/guides/v2.0/install-gde/trouble/php/tshoot_php-set.html" target="_blank">PHP settings check help </a>. </p>