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/Model/PaymentMethod.php b/app/code/Magento/Braintree/Model/PaymentMethod.php
index 8e14ed191e350097a62984c7570d667c149a077b..45171956e87bcf8832723f7b7dffeb90ea5f1f79 100644
--- a/app/code/Magento/Braintree/Model/PaymentMethod.php
+++ b/app/code/Magento/Braintree/Model/PaymentMethod.php
@@ -11,6 +11,7 @@ use \Braintree_Exception;
 use \Braintree_Transaction;
 use \Braintree_Result_Successful;
 use Magento\Framework\Exception\LocalizedException;
+use Magento\Sales\Model\Order\Payment\Transaction;
 use Magento\Sales\Model\ResourceModel\Order\Payment\Transaction\CollectionFactory as TransactionCollectionFactory;
 use Magento\Sales\Model\Order\Payment\Transaction as PaymentTransaction;
 use Magento\Payment\Model\InfoInterface;
@@ -648,6 +649,7 @@ class PaymentMethod extends \Magento\Payment\Model\Method\Cc
                 }
             }
 
+            // transaction should be voided if it not settled
             $canVoid = ($transaction->status === \Braintree_Transaction::AUTHORIZED
                 || $transaction->status === \Braintree_Transaction::SUBMITTED_FOR_SETTLEMENT);
             $result = $canVoid
@@ -655,6 +657,7 @@ class PaymentMethod extends \Magento\Payment\Model\Method\Cc
                 : $this->braintreeTransaction->refund($transactionId, $amount);
             $this->_debug($this->_convertObjToArray($result));
             if ($result->success) {
+                $payment->setTransactionId($transactionId . '-' . Transaction::TYPE_REFUND);
                 $payment->setIsTransactionClosed(true);
             } else {
                 throw new LocalizedException($this->errorHelper->parseBraintreeError($result));
diff --git a/app/code/Magento/Braintree/Test/Unit/Model/PaymentMethodTest.php b/app/code/Magento/Braintree/Test/Unit/Model/PaymentMethodTest.php
index f8f0494c128672811a883a0f832ae464b5f663dc..e20af765062e3b3b0713c5732d5b67f8f3c279f3 100644
--- a/app/code/Magento/Braintree/Test/Unit/Model/PaymentMethodTest.php
+++ b/app/code/Magento/Braintree/Test/Unit/Model/PaymentMethodTest.php
@@ -8,6 +8,7 @@ namespace Magento\Braintree\Test\Unit\Model;
 
 use Magento\Braintree\Model\PaymentMethod;
 use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
+use Magento\Sales\Model\Order\Payment\Transaction;
 use \Magento\Sales\Model\ResourceModel\Order\Payment\Transaction\CollectionFactory as TransactionCollectionFactory;
 use Magento\Framework\Exception\LocalizedException;
 use \Braintree_Result_Successful;
@@ -2378,6 +2379,7 @@ class PaymentMethodTest extends \PHPUnit_Framework_TestCase
 
         $this->model->refund($paymentObject, $amount);
         $this->assertEquals(1, $paymentObject->getIsTransactionClosed());
+        $this->assertEquals($refundTransactionId . '-' .Transaction::TYPE_REFUND, $paymentObject->getTransactionId());
     }
 
     /**
diff --git a/app/code/Magento/Braintree/view/adminhtml/templates/form.phtml b/app/code/Magento/Braintree/view/adminhtml/templates/form.phtml
index c27901cd4e8704fc7fdf044e47b8cc40db1a7e40..5610e082e1715e36dcecc8f7cc241bf1aeee2798 100644
--- a/app/code/Magento/Braintree/view/adminhtml/templates/form.phtml
+++ b/app/code/Magento/Braintree/view/adminhtml/templates/form.phtml
@@ -133,7 +133,7 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
             </div>
         </fieldset>
     <?php endif; ?>
-    <?php if($_useVault): ?>
+    <?php if($useVault): ?>
         <fieldset class="admin__fieldset hide_if_token_selected">
             <div id="<?php /* @noEscape */ echo $code; ?>_store_in_vault_div" style="text-align:left;" class="">
                 <input type="checkbox" title="<?php echo $block->escapeHtml(__('Save this card for future use')); ?>"
diff --git a/app/code/Magento/Braintree/view/frontend/layout/braintree_paypal_review.xml b/app/code/Magento/Braintree/view/frontend/layout/braintree_paypal_review.xml
index 1c7b14abfa13d308f65ec8ff17aa6042c42a1497..126f80a2e25e82ba2d4c82638fb13d035844481d 100644
--- a/app/code/Magento/Braintree/view/frontend/layout/braintree_paypal_review.xml
+++ b/app/code/Magento/Braintree/view/frontend/layout/braintree_paypal_review.xml
@@ -24,7 +24,7 @@
                 <block class="Magento\Framework\View\Element\Text\ListText" name="paypal.additional.actions"/>
                 <block class="Magento\Paypal\Block\Express\Review\Details" name="paypal.express.review.details" as="details" template="express/review/details.phtml">
                     <block class="Magento\Framework\View\Element\RendererList" name="checkout.onepage.review.item.renderers" as="renderer.list"/>
-                    <block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="onepage/review/totals.phtml"/>
+                    <block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="checkout/onepage/review/totals.phtml"/>
                 </block>
                 <block class="Magento\CheckoutAgreements\Block\Agreements" name="paypal.express.review.details.agreements" as="agreements" template="Magento_CheckoutAgreements::additional_agreements.phtml"/>
             </block>
diff --git a/app/code/Magento/Braintree/view/frontend/templates/creditcard/index.phtml b/app/code/Magento/Braintree/view/frontend/templates/creditcard/index.phtml
index fd9ee17028bb6eae399fe70103f3f8e82933681f..467e2523e6162efa00389deb18ecfe9f5fa43f9a 100644
--- a/app/code/Magento/Braintree/view/frontend/templates/creditcard/index.phtml
+++ b/app/code/Magento/Braintree/view/frontend/templates/creditcard/index.phtml
@@ -19,7 +19,7 @@ $storedCards = $block->getCurrentCustomerStoredCards();
     <?php endif; ?>
 </div>
 <?php echo $block->getLayout()->getMessagesBlock()->getGroupedHtml(); ?>
-<?php if (count($_storedCards)): ?>
+<?php if (count($storedCards)): ?>
     <table class="data-table" id="my-quotes-table">
         <col width="1" />
         <col width="1" />
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/Checkout/Block/Onepage.php b/app/code/Magento/Checkout/Block/Onepage.php
index d298599319540e5cbdf5143567e4e04fda46246b..25cbb6081959d727fd6415fec3896657846faf93 100644
--- a/app/code/Magento/Checkout/Block/Onepage.php
+++ b/app/code/Magento/Checkout/Block/Onepage.php
@@ -5,15 +5,11 @@
  */
 namespace Magento\Checkout\Block;
 
-use Magento\Checkout\Block\Checkout\LayoutProcessorInterface;
-use Magento\Customer\Api\CustomerRepositoryInterface;
-use Magento\Customer\Model\Address\Config as AddressConfig;
-
 /**
  * Onepage checkout block
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  */
-class Onepage extends \Magento\Checkout\Block\Onepage\AbstractOnepage
+class Onepage extends \Magento\Framework\View\Element\Template
 {
     /**
      * @var \Magento\Framework\Data\Form\FormKey
@@ -36,60 +32,25 @@ class Onepage extends \Magento\Checkout\Block\Onepage\AbstractOnepage
     protected $configProvider;
 
     /**
-     * @var array|Checkout\LayoutProcessorInterface[]
+     * @var array|\Magento\Checkout\Block\Checkout\LayoutProcessorInterface[]
      */
     protected $layoutProcessors;
 
     /**
      * @param \Magento\Framework\View\Element\Template\Context $context
-     * @param \Magento\Directory\Helper\Data $directoryHelper
-     * @param \Magento\Framework\App\Cache\Type\Config $configCacheType
-     * @param \Magento\Customer\Model\Session $customerSession
-     * @param \Magento\Checkout\Model\Session $resourceSession
-     * @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory
-     * @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory
-     * @param CustomerRepositoryInterface $customerRepository
-     * @param AddressConfig $addressConfig
-     * @param \Magento\Framework\App\Http\Context $httpContext
-     * @param \Magento\Customer\Model\Address\Mapper $addressMapper
      * @param \Magento\Framework\Data\Form\FormKey $formKey
      * @param \Magento\Checkout\Model\CompositeConfigProvider $configProvider
-     * @param LayoutProcessorInterface[] $layoutProcessors
+     * @param array $layoutProcessors
      * @param array $data
-     * @codeCoverageIgnore
-     * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
     public function __construct(
         \Magento\Framework\View\Element\Template\Context $context,
-        \Magento\Directory\Helper\Data $directoryHelper,
-        \Magento\Framework\App\Cache\Type\Config $configCacheType,
-        \Magento\Customer\Model\Session $customerSession,
-        \Magento\Checkout\Model\Session $resourceSession,
-        \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory,
-        \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory,
-        CustomerRepositoryInterface $customerRepository,
-        AddressConfig $addressConfig,
-        \Magento\Framework\App\Http\Context $httpContext,
-        \Magento\Customer\Model\Address\Mapper $addressMapper,
         \Magento\Framework\Data\Form\FormKey $formKey,
         \Magento\Checkout\Model\CompositeConfigProvider $configProvider,
         array $layoutProcessors = [],
         array $data = []
     ) {
-        parent::__construct(
-            $context,
-            $directoryHelper,
-            $configCacheType,
-            $customerSession,
-            $resourceSession,
-            $countryCollectionFactory,
-            $regionCollectionFactory,
-            $customerRepository,
-            $addressConfig,
-            $httpContext,
-            $addressMapper,
-            $data
-        );
+        parent::__construct($context, $data);
         $this->formKey = $formKey;
         $this->_isScopePrivate = true;
         $this->jsLayout = isset($data['jsLayout']) && is_array($data['jsLayout']) ? $data['jsLayout'] : [];
diff --git a/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php b/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php
deleted file mode 100644
index 6b4e92640ec7090878068aed4f6f6be55afee980..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php
+++ /dev/null
@@ -1,391 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Checkout\Block\Onepage;
-
-use Magento\Customer\Api\CustomerRepositoryInterface;
-use Magento\Customer\Model\Address\Config as AddressConfig;
-use Magento\Directory\Model\ResourceModel\Country\Collection;
-use Magento\Directory\Model\ResourceModel\Region\Collection as RegionCollection;
-use Magento\Framework\Exception\NoSuchEntityException;
-use Magento\Quote\Model\Quote;
-
-/**
- * One page common functionality block
- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
- */
-abstract class AbstractOnepage extends \Magento\Framework\View\Element\Template
-{
-    /**
-     * @var \Magento\Framework\App\Cache\Type\Config
-     */
-    protected $_configCacheType;
-
-    /**
-     * @var \Magento\Customer\Api\Data\CustomerInterface
-     */
-    protected $_customer;
-
-    /**
-     * @var Quote
-     */
-    protected $_quote;
-
-    /**
-     * @var  Collection
-     */
-    protected $_countryCollection;
-
-    /**
-     * @var RegionCollection
-     */
-    protected $_regionCollection;
-
-    /**
-     * @var mixed
-     */
-    protected $_addressesCollection;
-
-    /**
-     * @var \Magento\Checkout\Model\Session
-     */
-    protected $_checkoutSession;
-
-    /**
-     * @var \Magento\Directory\Model\ResourceModel\Region\CollectionFactory
-     */
-    protected $_regionCollectionFactory;
-
-    /**
-     * @var \Magento\Directory\Model\ResourceModel\Country\CollectionFactory
-     */
-    protected $_countryCollectionFactory;
-
-    /**
-     * @var \Magento\Directory\Helper\Data
-     */
-    protected $directoryHelper;
-
-    /**
-     * @var CustomerRepositoryInterface
-     */
-    protected $customerRepository;
-
-    /**
-     * @var \Magento\Customer\Model\Address\Config
-     */
-    private $_addressConfig;
-
-    /**
-     * @var \Magento\Framework\App\Http\Context
-     */
-    protected $httpContext;
-
-    /**
-     * @var \Magento\Customer\Model\Address\Mapper
-     */
-    protected $addressMapper;
-
-    /**
-     * @param \Magento\Framework\View\Element\Template\Context $context
-     * @param \Magento\Directory\Helper\Data $directoryHelper
-     * @param \Magento\Framework\App\Cache\Type\Config $configCacheType
-     * @param \Magento\Customer\Model\Session $customerSession
-     * @param \Magento\Checkout\Model\Session $resourceSession
-     * @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory
-     * @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory
-     * @param CustomerRepositoryInterface $customerRepository
-     * @param AddressConfig $addressConfig
-     * @param \Magento\Framework\App\Http\Context $httpContext
-     * @param \Magento\Customer\Model\Address\Mapper $addressMapper
-     * @param array $data
-     * @SuppressWarnings(PHPMD.ExcessiveParameterList)
-     */
-    public function __construct(
-        \Magento\Framework\View\Element\Template\Context $context,
-        \Magento\Directory\Helper\Data $directoryHelper,
-        \Magento\Framework\App\Cache\Type\Config $configCacheType,
-        \Magento\Customer\Model\Session $customerSession,
-        \Magento\Checkout\Model\Session $resourceSession,
-        \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory,
-        \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory,
-        CustomerRepositoryInterface $customerRepository,
-        AddressConfig $addressConfig,
-        \Magento\Framework\App\Http\Context $httpContext,
-        \Magento\Customer\Model\Address\Mapper $addressMapper,
-        array $data = []
-    ) {
-        $this->directoryHelper = $directoryHelper;
-        $this->_configCacheType = $configCacheType;
-        $this->_customerSession = $customerSession;
-        $this->_checkoutSession = $resourceSession;
-        $this->_countryCollectionFactory = $countryCollectionFactory;
-        $this->_regionCollectionFactory = $regionCollectionFactory;
-        $this->httpContext = $httpContext;
-        parent::__construct($context, $data);
-        $this->_isScopePrivate = true;
-        $this->customerRepository = $customerRepository;
-        $this->_addressConfig = $addressConfig;
-        $this->addressMapper = $addressMapper;
-    }
-
-    /**
-     * Get config
-     *
-     * @param string $path
-     * @return string|null
-     */
-    public function getConfig($path)
-    {
-        return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
-    }
-
-    /**
-     * Get logged in customer
-     *
-     * @return \Magento\Customer\Api\Data\CustomerInterface
-     */
-    protected function _getCustomer()
-    {
-        if (empty($this->_customer)) {
-            $this->_customer = $this->customerRepository->getById($this->_customerSession->getCustomerId());
-        }
-        return $this->_customer;
-    }
-
-    /**
-     * Retrieve checkout session model
-     *
-     * @return \Magento\Checkout\Model\Session
-     */
-    public function getCheckout()
-    {
-        return $this->_checkoutSession;
-    }
-
-    /**
-     * Retrieve sales quote model
-     *
-     * @return Quote
-     */
-    public function getQuote()
-    {
-        if (empty($this->_quote)) {
-            $this->_quote = $this->getCheckout()->getQuote();
-        }
-        return $this->_quote;
-    }
-
-    /**
-     * @return bool
-     */
-    public function isCustomerLoggedIn()
-    {
-        return $this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH);
-    }
-
-    /**
-     * @return Collection
-     * @removeCandidate
-     */
-    public function getCountryCollection()
-    {
-        if (!$this->_countryCollection) {
-            $this->_countryCollection = $this->_countryCollectionFactory->create()->loadByStore();
-        }
-        return $this->_countryCollection;
-    }
-
-    /**
-     * @return RegionCollection
-     * @removeCandidate
-     */
-    public function getRegionCollection()
-    {
-        if (!$this->_regionCollection) {
-            $this->_regionCollection = $this->_regionCollectionFactory->create()->addCountryFilter(
-                $this->getAddress()->getCountryId()
-            )->load();
-        }
-        return $this->_regionCollection;
-    }
-
-    /**
-     * @return int
-     * @removeCandidate
-     */
-    public function customerHasAddresses()
-    {
-        try {
-            return count($this->_getCustomer()->getAddresses());
-        } catch (NoSuchEntityException $e) {
-            return 0;
-        }
-    }
-
-    /**
-     * @param string $type
-     * @return string
-     * @removeCandidate
-     */
-    public function getAddressesHtmlSelect($type)
-    {
-        if ($this->isCustomerLoggedIn()) {
-            $options = [];
-
-            try {
-                $addresses = $this->_getCustomer()->getAddresses();
-            } catch (NoSuchEntityException $e) {
-                $addresses = [];
-            }
-
-            foreach ($addresses as $address) {
-                $builtOutputAddressData = $this->addressMapper->toFlatArray($address);
-                $label = $this->_addressConfig
-                    ->getFormatByCode(AddressConfig::DEFAULT_ADDRESS_FORMAT)
-                    ->getRenderer()
-                    ->renderArray($builtOutputAddressData);
-
-                $options[] = ['value' => $address->getId(), 'label' => $label];
-            }
-
-            $addressId = $this->getAddress()->getCustomerAddressId();
-            if (empty($addressId)) {
-                try {
-                    if ($type == 'billing') {
-                        $addressId = $this->_getCustomer()->getDefaultBilling();
-                    } else {
-                        $addressId = $this->_getCustomer()->getDefaultShipping();
-                    }
-                } catch (NoSuchEntityException $e) {
-                    // Do nothing
-                }
-            }
-
-            $select = $this->getLayout()->createBlock('Magento\Framework\View\Element\Html\Select')
-                ->setName($type . '_address_id')
-                ->setId($type . ':address-select')
-                ->setClass('address-select')
-                ->setValue($addressId)
-                ->setOptions($options);
-
-            $select->addOption('', __('New Address'));
-
-            return $select->getHtml();
-        }
-        return '';
-    }
-
-    /**
-     * @param string $type
-     * @return string
-     * @removeCandidate
-     */
-    public function getCountryHtmlSelect($type)
-    {
-        $countryId = $this->getAddress()->getCountryId();
-        if ($countryId === null) {
-            $countryId = $this->directoryHelper->getDefaultCountry();
-        }
-        $select = $this->getLayout()->createBlock(
-            'Magento\Framework\View\Element\Html\Select'
-        )->setName(
-            $type . '[country_id]'
-        )->setId(
-            $type . ':country_id'
-        )->setTitle(
-            __('Country')
-        )->setClass(
-            'validate-select'
-        )->setValue(
-            $countryId
-        )->setOptions(
-            $this->getCountryOptions()
-        );
-        return $select->getHtml();
-    }
-
-    /**
-     * @param string $type
-     * @return string
-     * @removeCandidate
-     */
-    public function getRegionHtmlSelect($type)
-    {
-        $select = $this->getLayout()->createBlock(
-            'Magento\Framework\View\Element\Html\Select'
-        )->setName(
-            $type . '[region]'
-        )->setId(
-            $type . ':region'
-        )->setTitle(
-            __('State/Province')
-        )->setClass(
-            'required-entry validate-state'
-        )->setValue(
-            $this->getAddress()->getRegionId()
-        )->setOptions(
-            $this->getRegionCollection()->toOptionArray()
-        );
-
-        return $select->getHtml();
-    }
-
-    /**
-     * @return mixed
-     * @removeCandidate
-     */
-    public function getCountryOptions()
-    {
-        $options = false;
-        $cacheId = 'DIRECTORY_COUNTRY_SELECT_STORE_' . $this->_storeManager->getStore()->getCode();
-        if ($optionsCache = $this->_configCacheType->load($cacheId)) {
-            $options = unserialize($optionsCache);
-        }
-
-        if ($options == false) {
-            $options = $this->getCountryCollection()->toOptionArray();
-            $this->_configCacheType->save(serialize($options), $cacheId);
-        }
-        return $options;
-    }
-
-    /**
-     * Get checkout steps codes
-     *
-     * @return string[]
-     * @removeCandidate
-     */
-    protected function _getStepCodes()
-    {
-        return ['login', 'billing', 'shipping', 'shipping_method', 'payment', 'review'];
-    }
-
-    /**
-     * Retrieve is allow and show block
-     *
-     * @return bool
-     * @removeCandidate
-     */
-    public function isShow()
-    {
-        return true;
-    }
-
-    /**
-     * Return the html text for shipping price
-     *
-     * @param \Magento\Quote\Model\Quote\Address\Rate $rate
-     * @return string
-     * @removeCandidate
-     */
-    public function getShippingPriceHtml(\Magento\Quote\Model\Quote\Address\Rate $rate)
-    {
-        /** @var \Magento\Checkout\Block\Shipping\Price $block */
-        $block = $this->getLayout()->getBlock('checkout.shipping.price');
-        $block->setShippingRate($rate);
-        return $block->toHtml();
-    }
-}
diff --git a/app/code/Magento/Checkout/Block/Onepage/Billing.php b/app/code/Magento/Checkout/Block/Onepage/Billing.php
deleted file mode 100644
index 1aee1948f0f3518fd9480e9e2992db5fca543824..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/Block/Onepage/Billing.php
+++ /dev/null
@@ -1,235 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Checkout\Block\Onepage;
-
-use Magento\Customer\Api\CustomerRepositoryInterface;
-use Magento\Customer\Model\Address\Config as AddressConfig;
-
-/**
- * One page checkout status
- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
- * @removeCandidate
- */
-class Billing extends \Magento\Checkout\Block\Onepage\AbstractOnepage
-{
-    /**
-     * Sales Quote Billing Address instance
-     *
-     * @var \Magento\Quote\Model\Quote\Address
-     */
-    protected $_address;
-
-    /**
-     * Customer Taxvat Widget block
-     *
-     * @var \Magento\Customer\Block\Widget\Taxvat
-     */
-    protected $_taxvat;
-
-    /**
-     * @var \Magento\Quote\Model\Quote\AddressFactory
-     */
-    protected $_addressFactory;
-
-    /**
-     * @param \Magento\Framework\View\Element\Template\Context $context
-     * @param \Magento\Directory\Helper\Data $directoryHelper
-     * @param \Magento\Framework\App\Cache\Type\Config $configCacheType
-     * @param \Magento\Customer\Model\Session $customerSession
-     * @param \Magento\Checkout\Model\Session $resourceSession
-     * @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory
-     * @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory
-     * @param CustomerRepositoryInterface $customerRepository
-     * @param AddressConfig $addressConfig
-     * @param \Magento\Framework\App\Http\Context $httpContext
-     * @param \Magento\Customer\Model\Address\Mapper $addressMapper
-     * @param \Magento\Quote\Model\Quote\AddressFactory $addressFactory
-     * @param array $data
-     * @SuppressWarnings(PHPMD.ExcessiveParameterList)
-     */
-    public function __construct(
-        \Magento\Framework\View\Element\Template\Context $context,
-        \Magento\Directory\Helper\Data $directoryHelper,
-        \Magento\Framework\App\Cache\Type\Config $configCacheType,
-        \Magento\Customer\Model\Session $customerSession,
-        \Magento\Checkout\Model\Session $resourceSession,
-        \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory,
-        \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory,
-        CustomerRepositoryInterface $customerRepository,
-        AddressConfig $addressConfig,
-        \Magento\Framework\App\Http\Context $httpContext,
-        \Magento\Customer\Model\Address\Mapper $addressMapper,
-        \Magento\Quote\Model\Quote\AddressFactory $addressFactory,
-        array $data = []
-    ) {
-        $this->_addressFactory = $addressFactory;
-        parent::__construct(
-            $context,
-            $directoryHelper,
-            $configCacheType,
-            $customerSession,
-            $resourceSession,
-            $countryCollectionFactory,
-            $regionCollectionFactory,
-            $customerRepository,
-            $addressConfig,
-            $httpContext,
-            $addressMapper,
-            $data
-        );
-        $this->_isScopePrivate = true;
-    }
-
-    /**
-     * Initialize billing address step
-     *
-     * @return void
-     */
-    protected function _construct()
-    {
-        $this->getCheckout()->setStepData(
-            'billing',
-            ['label' => __('Billing Information'), 'is_show' => $this->isShow()]
-        );
-
-        if ($this->isCustomerLoggedIn()) {
-            $this->getCheckout()->setStepData('billing', 'allow', true);
-        }
-        parent::_construct();
-    }
-
-    /**
-     * @return bool
-     */
-    public function isUseBillingAddressForShipping()
-    {
-        if ($this->getQuote()->getIsVirtual() || !$this->getQuote()->getShippingAddress()->getSameAsBilling()) {
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Return country collection
-     *
-     * @return \Magento\Directory\Model\ResourceModel\Country\Collection
-     */
-    public function getCountries()
-    {
-        return $this->_countryCollectionFactory->create()->loadByStore();
-    }
-
-    /**
-     * Return checkout method
-     *
-     * @return string
-     */
-    public function getMethod()
-    {
-        return $this->getQuote()->getCheckoutMethod();
-    }
-
-    /**
-     * Return Sales Quote Address model
-     *
-     * @return \Magento\Quote\Model\Quote\Address
-     */
-    public function getAddress()
-    {
-        if ($this->_address === null) {
-            if ($this->isCustomerLoggedIn()) {
-                $this->_address = $this->getQuote()->getBillingAddress();
-                if (!$this->_address->getFirstname()) {
-                    $this->_address->setFirstname($this->getQuote()->getCustomer()->getFirstname());
-                }
-                if (!$this->_address->getLastname()) {
-                    $this->_address->setLastname($this->getQuote()->getCustomer()->getLastname());
-                }
-            } else {
-                $this->_address = $this->_addressFactory->create();
-            }
-        }
-
-        return $this->_address;
-    }
-
-    /**
-     * Return Customer Address First Name
-     * If Sales Quote Address First Name is not defined - return Customer First Name
-     *
-     * @return string
-     */
-    public function getFirstname()
-    {
-        return $this->getAddress()->getFirstname();
-    }
-
-    /**
-     * Return Customer Address Last Name
-     * If Sales Quote Address Last Name is not defined - return Customer Last Name
-     *
-     * @return string
-     */
-    public function getLastname()
-    {
-        return $this->getAddress()->getLastname();
-    }
-
-    /**
-     * Check is Quote items can ship to
-     *
-     * @return bool
-     */
-    public function canShip()
-    {
-        return !$this->getQuote()->isVirtual();
-    }
-
-    /**
-     * @return void
-     */
-    public function getSaveUrl()
-    {
-    }
-
-    /**
-     * Get Customer Taxvat Widget block
-     *
-     * @return \Magento\Customer\Block\Widget\Taxvat
-     */
-    protected function _getTaxvat()
-    {
-        if (!$this->_taxvat) {
-            $this->_taxvat = $this->getLayout()->createBlock('Magento\Customer\Block\Widget\Taxvat');
-        }
-
-        return $this->_taxvat;
-    }
-
-    /**
-     * Check whether taxvat is enabled
-     *
-     * @return bool
-     */
-    public function isTaxvatEnabled()
-    {
-        return $this->_getTaxvat()->isEnabled();
-    }
-
-    /**
-     * @return string
-     */
-    public function getTaxvatHtml()
-    {
-        return $this->_getTaxvat()->setTaxvat(
-            $this->getQuote()->getCustomerTaxvat()
-        )->setFieldIdFormat(
-            'billing:%s'
-        )->setFieldNameFormat(
-            'billing[%s]'
-        )->toHtml();
-    }
-}
diff --git a/app/code/Magento/Checkout/Block/Onepage/Payment.php b/app/code/Magento/Checkout/Block/Onepage/Payment.php
deleted file mode 100644
index 4298784226ae932e3c74dea26f35d79cf082b1eb..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/Block/Onepage/Payment.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Checkout\Block\Onepage;
-
-/**
- * One page checkout status
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- * @removeCandidate
- */
-class Payment extends \Magento\Checkout\Block\Onepage\AbstractOnepage
-{
-    /**
-     * @return void
-     */
-    protected function _construct()
-    {
-        $this->getCheckout()->setStepData(
-            'payment',
-            ['label' => __('Payment Information'), 'is_show' => $this->isShow()]
-        );
-        parent::_construct();
-    }
-
-    /**
-     * Getter
-     *
-     * @return float
-     */
-    public function getQuoteBaseGrandTotal()
-    {
-        return (double)$this->getQuote()->getBaseGrandTotal();
-    }
-
-    /**
-     * Get options
-     *
-     * @return array
-     */
-    public function getOptions()
-    {
-        $registerParam = $this->getRequest()->getParam('register');
-        return [
-            'quoteBaseGrandTotal' => $this->getQuoteBaseGrandTotal(),
-            'progressUrl' => $this->getUrl('checkout/onepage/progress'),
-            'reviewUrl' => $this->getUrl('checkout/onepage/review'),
-            'failureUrl' => $this->getUrl('checkout/cart'),
-            'getAddressUrl' => $this->getUrl('checkout/onepage/getAddress') . 'address/',
-            'checkout' => [
-                'suggestRegistration' => $registerParam || $registerParam === '',
-                'saveUrl' => $this->getUrl('checkout/onepage/saveMethod'),
-            ],
-            'billing' => ['saveUrl' => $this->getUrl('checkout/onepage/saveBilling')],
-            'shipping' => ['saveUrl' => $this->getUrl('checkout/onepage/saveShipping')],
-            'shippingMethod' => ['saveUrl' => $this->getUrl('checkout/onepage/saveShippingMethod')],
-            'payment' => [
-                'defaultPaymentMethod' => $this->getChildBlock('methods')->getSelectedMethodCode(),
-                'saveUrl' => $this->getUrl('checkout/onepage/savePayment'),
-            ],
-            'review' => [
-                'saveUrl' => $this->getUrl('checkout/onepage/saveOrder'),
-                'successUrl' => $this->getUrl('checkout/onepage/success'),
-            ]
-        ];
-    }
-}
diff --git a/app/code/Magento/Checkout/Block/Onepage/Payment/Info.php b/app/code/Magento/Checkout/Block/Onepage/Payment/Info.php
deleted file mode 100644
index 67f682a25c19d95c37798e534a75376a8f7c2b49..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/Block/Onepage/Payment/Info.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Checkout\Block\Onepage\Payment;
-
-/**
- * Checkout payment information data
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- * @removeCandidate
- */
-class Info extends \Magento\Payment\Block\Info\AbstractContainer
-{
-    /**
-     * @var \Magento\Checkout\Model\Session
-     */
-    protected $_checkoutSession;
-
-    /**
-     * @param \Magento\Framework\View\Element\Template\Context $context
-     * @param \Magento\Payment\Helper\Data $paymentData
-     * @param \Magento\Checkout\Model\Session $checkoutSession
-     * @param array $data
-     */
-    public function __construct(
-        \Magento\Framework\View\Element\Template\Context $context,
-        \Magento\Payment\Helper\Data $paymentData,
-        \Magento\Checkout\Model\Session $checkoutSession,
-        array $data = []
-    ) {
-        $this->_checkoutSession = $checkoutSession;
-        parent::__construct($context, $paymentData, $data);
-        $this->_isScopePrivate = true;
-    }
-
-    /**
-     * Retrieve payment info model
-     *
-     * @return \Magento\Payment\Model\Info|false
-     */
-    public function getPaymentInfo()
-    {
-        $info = $this->_checkoutSession->getQuote()->getPayment();
-        if ($info->getMethod()) {
-            return $info;
-        }
-        return false;
-    }
-
-    /**
-     * @return string
-     */
-    protected function _toHtml()
-    {
-        $html = '';
-        if ($block = $this->getChildBlock($this->_getInfoBlockName())) {
-            $html = $block->toHtml();
-        }
-        return $html;
-    }
-}
diff --git a/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php b/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php
deleted file mode 100644
index 48285ad73dc277fa9890d46e7fa758246d5865e0..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-/**
- * One page checkout status
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- * @removeCandidate
- */
-namespace Magento\Checkout\Block\Onepage\Payment;
-
-class Methods extends \Magento\Payment\Block\Form\Container
-{
-    /**
-     * @var \Magento\Checkout\Model\Session
-     */
-    protected $_checkoutSession;
-
-    /**
-     * @param \Magento\Framework\View\Element\Template\Context $context
-     * @param \Magento\Payment\Helper\Data $paymentHelper
-     * @param \Magento\Payment\Model\Checks\SpecificationFactory $methodSpecificationFactory
-     * @param \Magento\Checkout\Model\Session $checkoutSession
-     * @param array $data
-     */
-    public function __construct(
-        \Magento\Framework\View\Element\Template\Context $context,
-        \Magento\Payment\Helper\Data $paymentHelper,
-        \Magento\Payment\Model\Checks\SpecificationFactory $methodSpecificationFactory,
-        \Magento\Checkout\Model\Session $checkoutSession,
-        array $data = []
-    ) {
-        $this->_checkoutSession = $checkoutSession;
-        parent::__construct($context, $paymentHelper, $methodSpecificationFactory, $data);
-        $this->_isScopePrivate = true;
-    }
-
-    /**
-     * @return \Magento\Quote\Model\Quote
-     */
-    public function getQuote()
-    {
-        return $this->_checkoutSession->getQuote();
-    }
-
-    /**
-     * Check payment method model
-     *
-     * @param \Magento\Payment\Model\MethodInterface $method
-     * @return bool
-     */
-    protected function _canUseMethod($method)
-    {
-        return $method && $method->canUseCheckout() && parent::_canUseMethod($method);
-    }
-
-    /**
-     * Retrieve code of current payment method
-     *
-     * @return mixed
-     */
-    public function getSelectedMethodCode()
-    {
-        $method = $this->getQuote()->getPayment()->getMethod();
-        if ($method) {
-            return $method;
-        }
-        return false;
-    }
-
-    /**
-     * Payment method form html getter
-     *
-     * @param \Magento\Payment\Model\MethodInterface $method
-     * @return string
-     */
-    public function getPaymentMethodFormHtml(\Magento\Payment\Model\MethodInterface $method)
-    {
-        return $this->getChildHtml('payment.method.' . $method->getCode());
-    }
-
-    /**
-     * Return method title for payment selection page
-     *
-     * @param \Magento\Payment\Model\MethodInterface $method
-     * @return string
-     */
-    public function getMethodTitle(\Magento\Payment\Model\MethodInterface $method)
-    {
-        $form = $this->getChildBlock('payment.method.' . $method->getCode());
-        if ($form && $form->hasMethodTitle()) {
-            return $form->getMethodTitle();
-        }
-        return $method->getTitle();
-    }
-
-    /**
-     * Payment method additional label part getter
-     *
-     * @param \Magento\Payment\Model\MethodInterface $method
-     * @return string
-     */
-    public function getMethodLabelAfterHtml(\Magento\Payment\Model\MethodInterface $method)
-    {
-        $form = $this->getChildBlock('payment.method.' . $method->getCode());
-        if ($form) {
-            return $form->getMethodLabelAfterHtml();
-        }
-    }
-}
diff --git a/app/code/Magento/Checkout/Block/Onepage/Review/Button.php b/app/code/Magento/Checkout/Block/Onepage/Review/Button.php
deleted file mode 100644
index 39cba9ffce7470f1f0508fc8503fed741cf84341..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/Block/Onepage/Review/Button.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Checkout\Block\Onepage\Review;
-
-use Magento\Framework\View\Element\Template;
-
-/**
- * One page checkout order review button
- * @removeCandidate
- */
-class Button extends Template
-{
-    /**
-     * {@inheritdoc}
-     *
-     * @param string $template
-     * @return $this
-     */
-    public function setTemplate($template)
-    {
-        if (!empty($template)) {
-            parent::setTemplate($template);
-        }
-        return $this;
-    }
-}
diff --git a/app/code/Magento/Checkout/Block/Onepage/Review/Info.php b/app/code/Magento/Checkout/Block/Onepage/Review/Info.php
deleted file mode 100644
index 9adbc1c4e5ed140507e0c613ae8bd66c13ea7b6b..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/Block/Onepage/Review/Info.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Checkout\Block\Onepage\Review;
-
-/**
- * One page checkout order review
- * @removeCandidate
- */
-class Info extends \Magento\Sales\Block\Items\AbstractItems
-{
-    /**
-     * @var \Magento\Checkout\Model\Session
-     */
-    protected $_checkoutSession;
-
-    /**
-     * @param \Magento\Framework\View\Element\Template\Context $context
-     * @param \Magento\Checkout\Model\Session $checkoutSession
-     * @param array $data
-     */
-    public function __construct(
-        \Magento\Framework\View\Element\Template\Context $context,
-        \Magento\Checkout\Model\Session $checkoutSession,
-        array $data = []
-    ) {
-        $this->_checkoutSession = $checkoutSession;
-        parent::__construct($context, $data);
-        $this->_isScopePrivate = true;
-    }
-
-    /**
-     * @return array
-     */
-    public function getItems()
-    {
-        return $this->_checkoutSession->getQuote()->getAllVisibleItems();
-    }
-
-    /**
-     * @return array
-     */
-    public function getTotals()
-    {
-        return $this->_checkoutSession->getQuote()->getTotals();
-    }
-}
diff --git a/app/code/Magento/Checkout/Block/Onepage/Shipping.php b/app/code/Magento/Checkout/Block/Onepage/Shipping.php
deleted file mode 100644
index d8dcad11e01c0e50a726c2f85e2f1a10165ac12c..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/Block/Onepage/Shipping.php
+++ /dev/null
@@ -1,131 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Checkout\Block\Onepage;
-
-use Magento\Customer\Api\CustomerRepositoryInterface;
-use Magento\Customer\Model\Address\Config as AddressConfig;
-
-/**
- * One page checkout status
- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
- * @removeCandidate
- */
-class Shipping extends \Magento\Checkout\Block\Onepage\AbstractOnepage
-{
-    /**
-     * Sales Quote Shipping Address instance
-     *
-     * @var \Magento\Quote\Model\Quote\Address
-     */
-    protected $_address = null;
-
-    /**
-     * @var \Magento\Quote\Model\Quote\AddressFactory
-     */
-    protected $_addressFactory;
-
-    /**
-     * @param \Magento\Framework\View\Element\Template\Context $context
-     * @param \Magento\Directory\Helper\Data $directoryHelper
-     * @param \Magento\Framework\App\Cache\Type\Config $configCacheType
-     * @param \Magento\Customer\Model\Session $customerSession
-     * @param \Magento\Checkout\Model\Session $resourceSession
-     * @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory
-     * @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory
-     * @param CustomerRepositoryInterface $customerRepository
-     * @param AddressConfig $addressConfig
-     * @param \Magento\Framework\App\Http\Context $httpContext
-     * @param \Magento\Customer\Model\Address\Mapper $addressMapper
-     * @param \Magento\Quote\Model\Quote\AddressFactory $addressFactory
-     * @param array $data
-     * @SuppressWarnings(PHPMD.ExcessiveParameterList)
-     */
-    public function __construct(
-        \Magento\Framework\View\Element\Template\Context $context,
-        \Magento\Directory\Helper\Data $directoryHelper,
-        \Magento\Framework\App\Cache\Type\Config $configCacheType,
-        \Magento\Customer\Model\Session $customerSession,
-        \Magento\Checkout\Model\Session $resourceSession,
-        \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory,
-        \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory,
-        CustomerRepositoryInterface $customerRepository,
-        AddressConfig $addressConfig,
-        \Magento\Framework\App\Http\Context $httpContext,
-        \Magento\Customer\Model\Address\Mapper $addressMapper,
-        \Magento\Quote\Model\Quote\AddressFactory $addressFactory,
-        array $data = []
-    ) {
-        $this->_addressFactory = $addressFactory;
-        parent::__construct(
-            $context,
-            $directoryHelper,
-            $configCacheType,
-            $customerSession,
-            $resourceSession,
-            $countryCollectionFactory,
-            $regionCollectionFactory,
-            $customerRepository,
-            $addressConfig,
-            $httpContext,
-            $addressMapper,
-            $data
-        );
-        $this->_isScopePrivate = true;
-    }
-
-    /**
-     * Initialize shipping address step
-     *
-     * @return void
-     */
-    protected function _construct()
-    {
-        $this->getCheckout()->setStepData(
-            'shipping',
-            ['label' => __('Shipping Information'), 'is_show' => $this->isShow()]
-        );
-
-        parent::_construct();
-    }
-
-    /**
-     * Return checkout method
-     *
-     * @return string
-     */
-    public function getMethod()
-    {
-        return $this->getQuote()->getCheckoutMethod();
-    }
-
-    /**
-     * Return Sales Quote Address model (shipping address)
-     *
-     * @return \Magento\Quote\Model\Quote\Address
-     */
-    public function getAddress()
-    {
-        if ($this->_address === null) {
-            if ($this->isCustomerLoggedIn()) {
-                $this->_address = $this->getQuote()->getShippingAddress();
-            } else {
-                $this->_address = $this->_addressFactory->create();
-            }
-        }
-
-        return $this->_address;
-    }
-
-    /**
-     * Retrieve is allow and show block
-     *
-     * @return bool
-     */
-    public function isShow()
-    {
-        return !$this->getQuote()->isVirtual();
-    }
-}
diff --git a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method.php b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method.php
deleted file mode 100644
index 5145d6fdca269a7613618b6b12f0dd979220e0e9..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Checkout\Block\Onepage\Shipping;
-
-/**
- * One page checkout status
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- * @removeCandidate
- */
-class Method extends \Magento\Checkout\Block\Onepage\AbstractOnepage
-{
-    /**
-     * @return void
-     */
-    protected function _construct()
-    {
-        $this->getCheckout()->setStepData(
-            'shipping_method',
-            ['label' => __('Shipping Method'), 'is_show' => $this->isShow()]
-        );
-        parent::_construct();
-    }
-
-    /**
-     * Retrieve is allow and show block
-     *
-     * @return bool
-     */
-    public function isShow()
-    {
-        return !$this->getQuote()->isVirtual();
-    }
-}
diff --git a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Additional.php b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Additional.php
deleted file mode 100644
index bf27a8fa212086889f4b88616f84edb14f6307df..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Additional.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Checkout\Block\Onepage\Shipping\Method;
-
-/**
- * Block for additional information in shipping method
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- * @removeCandidate
- */
-class Additional extends \Magento\Checkout\Block\Onepage\AbstractOnepage
-{
-}
diff --git a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php
deleted file mode 100644
index 582beafbbb5f4710f9be6558cc1644cad16e8376..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Checkout\Block\Onepage\Shipping\Method;
-
-use Magento\Customer\Api\CustomerRepositoryInterface;
-use Magento\Customer\Model\Address\Config as AddressConfig;
-use Magento\Quote\Model\Quote\Address;
-
-/**
- * One page checkout status
- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
- * @removeCandidate
- */
-class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage
-{
-    /**
-     * @var array
-     */
-    protected $_rates;
-
-    /**
-     * @var Address
-     */
-    protected $_address;
-
-    /**
-     * @param \Magento\Framework\View\Element\Template\Context $context
-     * @param \Magento\Directory\Helper\Data $directoryHelper
-     * @param \Magento\Framework\App\Cache\Type\Config $configCacheType
-     * @param \Magento\Customer\Model\Session $customerSession
-     * @param \Magento\Checkout\Model\Session $resourceSession
-     * @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory
-     * @param \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory
-     * @param CustomerRepositoryInterface $customerRepository
-     * @param AddressConfig $addressConfig
-     * @param \Magento\Framework\App\Http\Context $httpContext
-     * @param \Magento\Customer\Model\Address\Mapper $addressMapper
-     * @param array $data
-     * @SuppressWarnings(PHPMD.ExcessiveParameterList)
-     */
-    public function __construct(
-        \Magento\Framework\View\Element\Template\Context $context,
-        \Magento\Directory\Helper\Data $directoryHelper,
-        \Magento\Framework\App\Cache\Type\Config $configCacheType,
-        \Magento\Customer\Model\Session $customerSession,
-        \Magento\Checkout\Model\Session $resourceSession,
-        \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory,
-        \Magento\Directory\Model\ResourceModel\Region\CollectionFactory $regionCollectionFactory,
-        CustomerRepositoryInterface $customerRepository,
-        AddressConfig $addressConfig,
-        \Magento\Framework\App\Http\Context $httpContext,
-        \Magento\Customer\Model\Address\Mapper $addressMapper,
-        array $data = []
-    ) {
-        parent::__construct(
-            $context,
-            $directoryHelper,
-            $configCacheType,
-            $customerSession,
-            $resourceSession,
-            $countryCollectionFactory,
-            $regionCollectionFactory,
-            $customerRepository,
-            $addressConfig,
-            $httpContext,
-            $addressMapper,
-            $data
-        );
-        $this->_isScopePrivate = true;
-    }
-
-    /**
-     * @return array
-     */
-    public function getShippingRates()
-    {
-        if (empty($this->_rates)) {
-            $this->getAddress()->collectShippingRates()->save();
-            $this->_rates = $this->getAddress()->getGroupedAllShippingRates();
-        }
-
-        return $this->_rates;
-    }
-
-    /**
-     * @return Address
-     */
-    public function getAddress()
-    {
-        if (empty($this->_address)) {
-            $this->_address = $this->getQuote()->getShippingAddress();
-        }
-        return $this->_address;
-    }
-
-    /**
-     * @param string $carrierCode
-     * @return string
-     */
-    public function getCarrierName($carrierCode)
-    {
-        if ($name = $this->_scopeConfig->getValue(
-            'carriers/' . $carrierCode . '/title',
-            \Magento\Store\Model\ScopeInterface::SCOPE_STORE
-        )
-        ) {
-            return $name;
-        }
-        return $carrierCode;
-    }
-
-    /**
-     * @return string
-     */
-    public function getAddressShippingMethod()
-    {
-        return $this->getAddress()->getShippingMethod();
-    }
-}
diff --git a/app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php b/app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php
index 82e9d18b8854e5e2f0e51b131a2f4a84a496bb69..6c66fd165de554889cdbbd39b4b1f40608bb9983 100644
--- a/app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php
+++ b/app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php
@@ -8,9 +8,6 @@ namespace Magento\Checkout\Controller\Onepage;
 use Magento\Framework\DataObject;
 use Magento\Framework\Exception\PaymentException;
 
-/**
- * @removeCandidate
- */
 class SaveOrder extends \Magento\Checkout\Controller\Onepage
 {
     /**
diff --git a/app/code/Magento/Checkout/Test/Unit/Block/OnepageTest.php b/app/code/Magento/Checkout/Test/Unit/Block/OnepageTest.php
index e3ef9b58e827f6031b03c6678e8aeea99f0dd536..d29475962ef4dfe3b80b3b98f01f8ccb5983cd0e 100644
--- a/app/code/Magento/Checkout/Test/Unit/Block/OnepageTest.php
+++ b/app/code/Magento/Checkout/Test/Unit/Block/OnepageTest.php
@@ -35,13 +35,6 @@ class OnepageTest extends \PHPUnit_Framework_TestCase
     protected function setUp()
     {
         $contextMock = $this->getMock('\Magento\Framework\View\Element\Template\Context', [], [], '', false);
-        $directoryHelperMock = $this->getMock('\Magento\Directory\Helper\Data', [], [], '', false);
-        $configCacheTypeMock = $this->getMock('\Magento\Framework\App\Cache\Type\Config', [], [], '', false);
-        $customerSessionMock = $this->getMock('\Magento\Customer\Model\Session', [], [], '', false);
-        $resourceSessionMock = $this->getMock('\Magento\Checkout\Model\Session', [], [], '', false);
-        $addressConfigMock = $this->getMock('\Magento\Customer\Model\Address\Config', [], [], '', false);
-        $httpContextMock = $this->getMock('\Magento\Framework\App\Http\Context', [], [], '', false);
-        $addressMapperMock = $this->getMock('\Magento\Customer\Model\Address\Mapper', [], [], '', false);
         $this->formKeyMock = $this->getMock('\Magento\Framework\Data\Form\FormKey', [], [], '', false);
         $this->configProviderMock = $this->getMock(
             '\Magento\Checkout\Model\CompositeConfigProvider',
@@ -50,27 +43,6 @@ class OnepageTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
-        $countryCollectionFactoryMock = $this->getMock(
-            'Magento\Directory\Model\ResourceModel\Country\CollectionFactory',
-            ['create'],
-            [],
-            '',
-            false
-        );
-        $regionCollectionFactoryMock = $this->getMock(
-            'Magento\Directory\Model\ResourceModel\Region\CollectionFactory',
-            ['create'],
-            [],
-            '',
-            false
-        );
-        $customerRepositoryMock = $this->getMock(
-            '\Magento\Customer\Api\CustomerRepositoryInterface',
-            [],
-            [],
-            '',
-            false
-        );
 
         $this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface', [], [], '', false);
         $contextMock->expects($this->once())->method('getStoreManager')->willReturn($this->storeManagerMock);
@@ -84,16 +56,6 @@ class OnepageTest extends \PHPUnit_Framework_TestCase
 
         $this->model = new \Magento\Checkout\Block\Onepage(
             $contextMock,
-            $directoryHelperMock,
-            $configCacheTypeMock,
-            $customerSessionMock,
-            $resourceSessionMock,
-            $countryCollectionFactoryMock,
-            $regionCollectionFactoryMock,
-            $customerRepositoryMock,
-            $addressConfigMock,
-            $httpContextMock,
-            $addressMapperMock,
             $this->formKeyMock,
             $this->configProviderMock,
             [$this->layoutProcessorMock]
diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json
index 775fe8406e930313ad64a49daf716d7792b60335..ca4d5b91da09dd595225d73f954bfefe0c0cfcac 100644
--- a/app/code/Magento/Checkout/composer.json
+++ b/app/code/Magento/Checkout/composer.json
@@ -15,7 +15,6 @@
         "magento/module-tax": "1.0.0-beta",
         "magento/module-directory": "1.0.0-beta",
         "magento/module-eav": "1.0.0-beta",
-        "magento/module-gift-message": "1.0.0-beta",
         "magento/module-page-cache": "1.0.0-beta",
         "magento/module-sales-rule": "1.0.0-beta",
         "magento/module-theme": "1.0.0-beta",
diff --git a/app/code/Magento/Checkout/view/frontend/requirejs-config.js b/app/code/Magento/Checkout/view/frontend/requirejs-config.js
index e8a99235212544b2c3c7c219865cda4b7d3eab9c..a7055ed7d1558505ac1bf32b6c377d7b13f879f7 100644
--- a/app/code/Magento/Checkout/view/frontend/requirejs-config.js
+++ b/app/code/Magento/Checkout/view/frontend/requirejs-config.js
@@ -9,10 +9,7 @@ var config = {
             discountCode:           'Magento_Checkout/js/discount-codes',
             shoppingCart:           'Magento_Checkout/js/shopping-cart',
             regionUpdater:          'Magento_Checkout/js/region-updater',
-            opcOrderReview:         'Magento_Checkout/js/opc-order-review',
-            sidebar:                'Magento_Checkout/js/sidebar',
-            payment:                'Magento_Checkout/js/payment',
-            paymentAuthentication:  'Magento_Checkout/js/payment-authentication'
+            sidebar:                'Magento_Checkout/js/sidebar'
         }
     }
 };
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/billing.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/billing.phtml
deleted file mode 100644
index 49369053b5be56cb3ea02dee5726ba776aa1c40d..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/billing.phtml
+++ /dev/null
@@ -1,214 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-// @codingStandardsIgnoreFile
-
-/** @var \Magento\Checkout\Block\Onepage\Billing $block */
-/**
- * @removeCandidate
- */
-?>
-<form class="form billing" id="co-billing-form" data-hasrequired="<?php /* @escapeNotVerified */ echo __('* Required Fields') ?>">
-
-    <?php if ($block->customerHasAddresses()): ?>
-        <div class="field addresses">
-            <label class="label" for="billing:address-select"><span><?php /* @escapeNotVerified */ echo __('Select a billing address from your address book or enter a new address.') ?></span></label>
-            <div class="control">
-                <?php echo $block->getAddressesHtmlSelect('billing') ?>
-            </div>
-        </div>
-    <?php endif; ?>
-    <fieldset class="fieldset address" id="billing-new-address-form"<?php if ($block->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
-        <input type="hidden" name="billing[address_id]" value="<?php /* @escapeNotVerified */ echo $block->getAddress()->getId() ?>" id="billing:address_id" />
-
-        <?php echo $block->getLayout()->createBlock('Magento\Customer\Block\Widget\Name')->setObject($block->getAddress()->getFirstname() ? $block->getAddress() : $block->getQuote()->getCustomer())->setForceUseCustomerRequiredAttributes(!$block->isCustomerLoggedIn())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
-
-        <?php if (!$block->isCustomerLoggedIn()): ?>
-                <div class="field required email">
-                    <label class="label" for="billing:email"><span><?php /* @escapeNotVerified */ echo __('Email') ?></span></label>
-                    <div class="control">
-                        <input type="email" name="billing[email]" id="billing:email" value="<?php echo $block->escapeHtml($block->getAddress()->getEmail()) ?>" title="<?php /* @escapeNotVerified */ echo __('Email') ?>" class="input-text" data-validate="{required:true, 'validate-email':true}"/>
-                    </div>
-                </div>
-        <?php endif; ?>
-
-        <div class="field company">
-            <label class="label" for="billing:company"><span><?php /* @escapeNotVerified */ echo __('Company') ?></span></label>
-            <div class="control">
-                <input type="text" id="billing:company" name="billing[company]" value="<?php echo $block->escapeHtml($block->getAddress()->getCompany()) ?>" title="<?php /* @escapeNotVerified */ echo __('Company') ?>" class="input-text <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('company') ?>" />
-            </div>
-        </div>
-
-        <?php if ($this->helper('Magento\Customer\Helper\Address')->isVatAttributeVisible()) : ?>
-        <div class="field taxvat">
-            <label class="label" for="billing:vat_id"><span><?php /* @escapeNotVerified */ echo __('VAT Number') ?></span></label>
-            <div class="control">
-                <input type="text" id="billing:vat_id" name="billing[vat_id]" value="<?php echo $block->escapeHtml($block->getAddress()->getVatId()) ?>" title="<?php /* @escapeNotVerified */ echo __('VAT Number') ?>" class="input-text <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('vat_id') ?>" />
-            </div>
-        </div>
-        <?php endif; ?>
-
-        <?php $_streetValidationClass = $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('street'); ?>
-        <div class="field street required">
-            <label class="label" for="billing:street1"><span><?php /* @escapeNotVerified */ echo __('Address') ?></span></label>
-            <div class="control">
-                <input type="text" title="<?php /* @escapeNotVerified */ echo __('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $block->escapeHtml($block->getAddress()->getStreetLine(1)) ?>" class="input-text <?php /* @escapeNotVerified */ echo $_streetValidationClass ?>" />
-                <div class="nested">
-                    <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
-                    <?php for ($_i = 2, $_n = $this->helper('Magento\Customer\Helper\Address')->getStreetLines(); $_i <= $_n; $_i++): ?>
-                        <div class="field additional">
-                            <label class="label" for="billing:street<?php /* @escapeNotVerified */ echo $_i ?>">
-                                <span><?php /* @escapeNotVerified */ echo __('Address') ?></span>
-                            </label>
-                            <div class="control">
-                                <input type="text" title="<?php /* @escapeNotVerified */ echo __('Street Address %1', $_i) ?>" name="billing[street][]" id="billing:street<?php /* @escapeNotVerified */ echo $_i ?>" value="<?php echo $block->escapeHtml($block->getAddress()->getStreetLine($_i)) ?>" class="input-text <?php /* @escapeNotVerified */ echo $_streetValidationClass ?>" />
-                            </div>
-                        </div>
-                    <?php endfor; ?>
-                </div>
-            </div>
-        </div>
-
-
-        <div class="field city required">
-            <label class="label" for="billing:city"><span><?php /* @escapeNotVerified */ echo __('City') ?></span></label>
-            <div class="control">
-                <input type="text" title="<?php /* @escapeNotVerified */ echo __('City') ?>" name="billing[city]" value="<?php echo $block->escapeHtml($block->getAddress()->getCity()) ?>" class="input-text <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('city') ?>" id="billing:city" />
-            </div>
-        </div>
-
-        <div class="field region required">
-            <label class="label" for="billing:region_id"><span><?php /* @escapeNotVerified */ echo __('State/Province') ?></span></label>
-            <div class="control">
-                <select id="billing:region_id"
-                        name="billing[region_id]"
-                        title="<?php /* @escapeNotVerified */ echo __('State/Province') ?>"
-                        data-validate="{'validate-select':true}"
-                        <?php if ($block->getConfig('general/region/display_all') === 0):?>disabled="disabled"<?php endif; ?>
-                        style="display:none;">
-                    <option value=""><?php /* @escapeNotVerified */ echo __('Please select a region, state or province.') ?></option>
-                </select>
-                <input  type="text"
-                        id="billing:region"
-                        name="billing[region]"
-                        value="<?php echo $block->escapeHtml($block->getAddress()->getRegion()) ?>"
-                        title="<?php /* @escapeNotVerified */ echo __('State/Province') ?>"
-                        class="input-text <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('region') ?>"
-                        <?php if ($block->getConfig('general/region/display_all') === 0):?>disabled="disabled"<?php endif; ?>
-                        style="display:none;" />
-            </div>
-        </div>
-
-        <div class="field zip required">
-            <label class="label" for="billing:postcode"><span><?php /* @escapeNotVerified */ echo __('Zip/Postal Code') ?></span></label>
-            <div class="control">
-                <input type="text" title="<?php /* @escapeNotVerified */ echo __('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $block->escapeHtml($block->getAddress()->getPostcode()) ?>" class="input-text <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('postcode') ?>" data-validate="{'required':true, 'validate-zip-international':true}"/>
-            </div>
-        </div>
-
-        <div class="field country required">
-            <label class="label" for="billing:country_id"><span><?php /* @escapeNotVerified */ echo __('Country') ?></span></label>
-            <div class="control">
-                <?php echo $block->getCountryHtmlSelect('billing') ?>
-            </div>
-        </div>
-
-        <div class="field telephone required">
-            <label class="label" for="billing:telephone"><span><?php /* @escapeNotVerified */ echo __('Phone Number') ?></span></label>
-            <div class="control">
-                <input type="text" name="billing[telephone]" value="<?php echo $block->escapeHtml($block->getAddress()->getTelephone()) ?>" title="<?php /* @escapeNotVerified */ echo __('Telephone') ?>" class="input-text <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('telephone') ?>" id="billing:telephone" />
-            </div>
-        </div>
-
-        <div class="field fax">
-            <label class="label" for="billing:fax"><span><?php /* @escapeNotVerified */ echo __('Fax') ?></span></label>
-            <div class="control">
-                <input type="text" name="billing[fax]" value="<?php echo $block->escapeHtml($block->getAddress()->getFax()) ?>" title="<?php /* @escapeNotVerified */ echo __('Fax') ?>" class="input-text <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('fax') ?>" id="billing:fax" />
-            </div>
-        </div>
-
-        <?php if (!$block->isCustomerLoggedIn()): ?>
-        <?php $_dob = $block->getLayout()->createBlock('Magento\Customer\Block\Widget\Dob') ?>
-        <?php $_taxvat = $block->getLayout()->createBlock('Magento\Customer\Block\Widget\Taxvat') ?>
-        <?php $_gender = $block->getLayout()->createBlock('Magento\Customer\Block\Widget\Gender') ?>
-
-        <?php if ($_dob->isEnabled()): ?>
-            <?php echo $_dob->setDate($block->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
-        <?php endif; ?>
-        <?php if ($_taxvat->isEnabled()): ?>
-            <?php echo $_taxvat->setTaxvat($block->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
-        <?php endif ?>
-        <?php if ($_gender->isEnabled()): ?>
-            <?php echo $_gender->setGender($block->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
-        <?php endif ?>
-        <?php $customerAttributes = $block->getChildBlock('customer_form_customer_user_defined_attributes');?>
-        <?php if ($customerAttributes): ?>
-            <?php $customerAttributes->setEntityModelClass('Magento\Customer\Model\Customer')->setFieldIdFormat('billing:%1$s');?>
-            <?php $customerAttributes->setFieldNameFormat('billing[%1$s]')->setShowContainer(false);?>
-            <?php echo $customerAttributes->toHtml()?>
-        <?php endif;?>
-        <div class="field password required">
-            <label class="label" for="billing:customer_password"><span><?php /* @escapeNotVerified */ echo __('Password') ?></span></label>
-            <div class="control">
-                <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php /* @escapeNotVerified */ echo __('Password') ?>" class="input-text" data-validate="{required:true, 'validate-password':true}"/>
-            </div>
-        </div>
-        <div class="field confirm required">
-            <label class="label" for="billing:confirm_password"><span><?php /* @escapeNotVerified */ echo __('Confirm Password') ?></span></label>
-            <div class="control">
-                <input type="password" name="billing[confirm_password]" title="<?php /* @escapeNotVerified */ echo __('Confirm Password') ?>" id="billing:confirm_password" class="input-text" data-validate="{required:true, 'validate-cpassword':true, equalTo: '#billing\\:customer_password'}"/>
-            </div>
-        </div>
-        <?php endif; ?>
-        <?php echo $block->getChildHtml('form_additional_info'); ?>
-        <?php if ($block->isCustomerLoggedIn() && $block->customerHasAddresses()):?>
-            <div class="field save choice">
-                <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php /* @escapeNotVerified */ echo __('Save in address book') ?>" id="billing:save_in_address_book" <?php if ($block->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" />
-                <label class="label" for="billing:save_in_address_book"><span><?php /* @escapeNotVerified */ echo __('Save in address book') ?></span></label>
-            </div>
-        <?php else:?>
-            <input type="hidden" name="billing[save_in_address_book]" value="1" />
-        <?php endif; ?>
-        <?php /* Extensions placeholder */ ?>
-        <?php echo $block->getChildHtml('checkout.onepage.billing.extra')?>
-</fieldset>
-<?php if ($block->canShip()): ?>
-    <div class="field choice">
-        <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($block->isUseBillingAddressForShipping()) {
-    ?> checked="checked"<?php 
-}?> class="radio" />
-        <label class="label" for="billing:use_for_shipping_yes"><span><?php /* @escapeNotVerified */ echo  __('Ship to this address') ?></span></label>
-    </div>
-    <div class="field choice">
-        <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$block->isUseBillingAddressForShipping()) {
-    ?> checked="checked"<?php 
-}?> class="radio" />
-        <label class="label" for="billing:use_for_shipping_no"><span><?php /* @escapeNotVerified */ echo __('Ship to different address') ?></span></label>
-    </div>
-<?php endif; ?>
-
-<?php if (!$block->canShip()): ?>
-    <input type="hidden" name="billing[use_for_shipping]" value="1" />
-<?php endif; ?>
-<div class="actions" id="billing-buttons-container">
-    <div class="primary"><button data-role="opc-continue" type="button" class="button action continue primary"><span><?php /* @escapeNotVerified */ echo __('Continue') ?></span></button></div>
-</div>
-</form>
-<script type="text/x-magento-init">
-    {
-        "#billing\\:country_id": {
-            "regionUpdater": {
-                "optionalRegionAllowed": <?php /* @escapeNotVerified */ echo($block->getConfig('general/region/display_all') ? 'true' : 'false'); ?>,
-                "regionListId": "#billing\\:region_id",
-                "regionInputId": "#billing\\:region",
-                "postcodeId": "#billing\\:postcode",
-                "regionJson": <?php /* @escapeNotVerified */ echo $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>,
-                "defaultRegion": "<?php /* @escapeNotVerified */ echo $block->getAddress()->getRegionId() ?>",
-                "countriesWithOptionalZip": <?php /* @escapeNotVerified */ echo $this->helper('Magento\Directory\Helper\Data')->getCountriesWithOptionalZip(true) ?>
-            }
-        }
-    }
-</script>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/payment.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/payment.phtml
deleted file mode 100644
index f9ac39fd39dca380af9b9e422fb7e45656f50c20..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/payment.phtml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-// @codingStandardsIgnoreFile
-
-/**
- * @removeCandidate
- */
-?>
-<form id="co-payment-form" class="form payments">
-    <?php echo $block->getBlockHtml('formkey') ?>
-    <fieldset class="fieldset">
-        <legend class="legend payments-title">
-            <span><?php /* @escapeNotVerified */ echo __('Payment Information') ?></span>
-        </legend><br>
-        <?php echo $block->getChildChildHtml('methods_additional') ?>
-        <div id="checkout-payment-method-load" class="opc-payment"></div>
-    </fieldset>
-    <?php echo $block->getChildChildHtml('additional') ?>
-    <div class="actions-toolbar" id="payment-buttons-container">
-        <div class="primary">
-            <button data-role="opc-continue" type="button" class="button action continue primary"><span><?php /* @escapeNotVerified */ echo __('Continue') ?></span></button>
-        </div>
-        <div class="secondary">
-            <a class="action back" href="#"><span><?php /* @escapeNotVerified */ echo __('Back') ?></span></a>
-        </div>
-    </div>
-</form>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/payment/methods.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/payment/methods.phtml
deleted file mode 100644
index f3c0f86cc46bb59bf8528a71db0e40a63635ec1a..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/payment/methods.phtml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-// @codingStandardsIgnoreFile
-
-/**
- * @removeCandidate
- */
-?>
-<?php
-/**
- * One page checkout payment methods
- *
- * @var $block \Magento\Checkout\Block\Onepage\Payment\Methods
- */
-?>
-<dl class="items methods-payment">
-<?php
-    $methods = $block->getMethods();
-    $oneMethod = count($methods) <= 1;
-?>
-<?php if (empty($methods)): ?>
-    <dt class="item-title">
-        <?php /* @escapeNotVerified */ echo __('No Payment Methods') ?>
-    </dt>
-<?php else:
-    foreach ($methods as $_method):
-        $_code = $_method->getCode();
-?>
-    <dt class="item-title <?php /* @escapeNotVerified */ echo $_code ?>">
-    <?php if (!$oneMethod): ?>
-        <input id="p_method_<?php /* @escapeNotVerified */ echo $_code ?>" value="<?php /* @escapeNotVerified */ echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $block->escapeHtml($_method->getTitle()) ?>" <?php if ($block->getSelectedMethodCode() == $_code): ?> checked="checked"<?php endif; ?> class="radio" />
-    <?php else: ?>
-        <input id="p_method_<?php /* @escapeNotVerified */ echo $_code ?>" value="<?php /* @escapeNotVerified */ echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio no-display" />
-        <?php $oneMethod = $_code; ?>
-    <?php endif; ?>
-        <label for="p_method_<?php /* @escapeNotVerified */ echo $_code ?>"><?php echo $block->escapeHtml($block->getMethodTitle($_method)) ?> <?php echo $block->getMethodLabelAfterHtml($_method) ?></label>
-    </dt>
-    <?php if ($html = $block->getPaymentMethodFormHtml($_method)): ?>
-    <dd class="item-content <?php /* @escapeNotVerified */ echo $_code ?>">
-        <?php /* @escapeNotVerified */ echo $html; ?>
-    </dd>
-    <?php endif; ?>
-<?php endforeach;
-    endif;
-?>
-</dl>
-<div class="no-display" data-checkout-price="<?php echo (float)$block->getQuote()->getBaseGrandTotal(); ?>"></div>
-<?php echo $block->getChildChildHtml('additional'); ?>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/button.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/button.phtml
deleted file mode 100644
index 1b26f9922c5faac3b3dc2e0e72d9a60644d0a925..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/button.phtml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-// @codingStandardsIgnoreFile
-/**
- * @removeCandidate
- */
-?>
-<button data-role="review-save" type="submit" title="<?php /* @escapeNotVerified */ echo __('Place Order') ?>"
-        class="button action primary checkout"><span><?php /* @escapeNotVerified */ echo __('Place Order') ?></span></button>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/info.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/info.phtml
deleted file mode 100644
index 8e390e653fd79cf1743b4b7c6d134310d2f02f21..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/info.phtml
+++ /dev/null
@@ -1,54 +0,0 @@
-\<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-// @codingStandardsIgnoreFile
-
-/** @var $block \Magento\Checkout\Block\Onepage\Review\Info */
-
-/**
- * @removeCandidate
- */
-?>
-<?php echo $block->getChildHtml('items_before'); ?>
-<div id="checkout-review-table-wrapper" class="order-review-wrapper table-wrapper">
-    <?php if ($this->helper('Magento\Tax\Helper\Data')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?>
-    <table class="data table table-order-review items" id="checkout-review-table">
-        <caption class="table-caption"><?php /* @escapeNotVerified */ echo __('Order Review'); ?></caption>
-        <thead>
-            <tr>
-                <th class="col item" scope="col"><?php /* @escapeNotVerified */ echo __('Product Name') ?></th>
-                <th class="col price" scope="col"><?php /* @escapeNotVerified */ echo __('Price') ?></th>
-                <th class="col qty" scope="col"><?php /* @escapeNotVerified */ echo __('Qty') ?></th>
-                <th class="col subtotal" scope="col"><?php /* @escapeNotVerified */ echo __('Subtotal') ?></th>
-            </tr>
-        </thead>
-        <tbody>
-        <?php foreach ($block->getItems() as $_item): ?>
-            <?php echo $block->getItemHtml($_item)?>
-        <?php endforeach ?>
-        </tbody>
-        <tfoot>
-            <?php echo $block->getChildHtml('totals'); ?>
-        </tfoot>
-    </table>
-</div>
-<?php echo $block->getChildHtml('items_after'); ?>
-<div id="checkout-review-submit" data-mage-init='{"paymentAuthentication":{}}' class="checkout-submit-order">
-    <?php echo $block->getChildHtml('agreements') ?>
-    <div class="actions-toolbar" id="review-buttons-container">
-        <div class="primary"><?php echo $block->getChildHtml('button') ?></div>
-        <div class="secondary">
-            <span id="checkout-review-edit-label">
-                <?php /* @escapeNotVerified */ echo __('Forgot an Item?') ?>
-            </span>
-            <a href="<?php /* @escapeNotVerified */ echo $block->getUrl('checkout/cart') ?>"
-               aria-describedby="checkout-review-edit-label"
-               class="action edit">
-                <span><?php /* @escapeNotVerified */ echo __('Edit Your Cart') ?></span>
-            </a>
-        </div>
-    </div>
-</div>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml
index 7d107a0589d53580c0e9b9512b3c936b063b49be..54748a318b6adedd0bf8d354eebaeaf8bdcd9c12 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item.phtml
@@ -8,10 +8,6 @@
 
 /** @var $block Magento\Checkout\Block\Cart\Item\Renderer */
 
-/**
- * @removeCandidate
- */
-
 $_item = $block->getItem();
 ?>
 <tbody class="cart item">
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml
index d10b01b1591fca77c9bd511743064a94588b836d..f0ead67e1bdc2a009f77e2bf646408e3e3d79929 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_excl_tax.phtml
@@ -8,10 +8,6 @@
 
 /** @var $block \Magento\Checkout\Block\Item\Price\Renderer */
 
-/**
- * @removeCandidate
- */
-
 $_item = $block->getItem();
 ?>
 <span class="cart-price">
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml
index 09230fd5c336c67769392d2d083cb95af64e20f0..df0f4f3233cb73a5a3552a3355aa9d391f5f223c 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/row_incl_tax.phtml
@@ -8,10 +8,6 @@
 
 /** @var $block \Magento\Checkout\Block\Item\Price\Renderer */
 
-/**
- * @removeCandidate
- */
-
 $_item = $block->getItem();
 ?>
 <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml
index f81ddc607c938bbc6acc8ba9897b1a296a7e14c6..b4b340e78b553c84f10888facbbbbb9ef55f6101 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_excl_tax.phtml
@@ -8,10 +8,6 @@
 
 /** @var $block \Magento\Checkout\Block\Item\Price\Renderer */
 
-/**
- * @removeCandidate
- */
-
 $_item = $block->getItem();
 ?>
 <span class="cart-price">
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml
index 6ff351b90f76a939edd05cce488504d0df22cf70..53118c3312595f301cb9afc861b3476da7a49194 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/onepage/review/item/price/unit_incl_tax.phtml
@@ -8,10 +8,6 @@
 
 /** @var $block \Magento\Checkout\Block\Item\Price\Renderer */
 
-/**
- * @removeCandidate
- */
-
 $_item = $block->getItem();
 ?>
 <?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping.phtml
deleted file mode 100644
index aaff68ef03aca5f2230b68512bca28792c3cee9f..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping.phtml
+++ /dev/null
@@ -1,133 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-// @codingStandardsIgnoreFile
-
-/**
- * @removeCandidate
- */
-?>
-<form class="form shipping address" id="co-shipping-form" data-hasrequired="<?php /* @escapeNotVerified */ echo __('* Required Fields') ?>">
-
-<?php if ($block->customerHasAddresses()): ?>
-   <div class="field addresses">
-       <label class="label" for="shipping:address-select"><span><?php /* @escapeNotVerified */ echo __('Select a shipping address from your address book or enter a new address.') ?></span></label>
-       <div class="control"><?php echo $block->getAddressesHtmlSelect('shipping') ?></div>
-   </div>
-<?php endif ?>
-    <fieldset class="fieldset address" id="shipping-new-address-form"<?php if ($block->customerHasAddresses()): ?> style="display:none;"<?php endif ?>>
-        <input type="hidden" name="shipping[address_id]" value="<?php /* @escapeNotVerified */ echo $block->getAddress()->getId() ?>" id="shipping:address_id" />
-        <?php echo $block->getLayout()->createBlock('Magento\Customer\Block\Widget\Name')->setObject($block->getAddress())->setFieldIdFormat('shipping:%s')->setFieldNameFormat('shipping[%s]')->toHtml() ?>
-        <div class="field company">
-            <label class="label" for="shipping:company"><span><?php /* @escapeNotVerified */ echo __('Company') ?></span></label>
-            <div class="control">
-                <input type="text" id="shipping:company" name="shipping[company]" value="<?php echo $block->escapeHtml($block->getAddress()->getCompany()) ?>" title="<?php /* @escapeNotVerified */ echo __('Company') ?>" class="input-text <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('company') ?>" />
-            </div>
-        </div>
-        <?php if ($this->helper('Magento\Customer\Helper\Address')->isVatAttributeVisible()) : ?>
-        <div class="field taxvat">
-            <label class="label" for="shipping:vat_id"><span><?php /* @escapeNotVerified */ echo __('VAT Number'); ?></span></label>
-            <div class="control">
-                <input type="text" id="shipping:vat_id" name="shipping[vat_id]" value="<?php echo $block->escapeHtml($block->getAddress()->getVatId()); ?>" title="<?php /* @escapeNotVerified */ echo __('VAT Number'); ?>" class="input-text <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('vat_id') ?>" />
-            </div>
-        </div>
-        <?php endif; ?>
-        <?php $_streetValidationClass = $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('street'); ?>
-        <div class="field street required">
-            <label class="label" for="shipping:street1"><span><?php /* @escapeNotVerified */ echo __('Address') ?></span></label>
-            <div class="control">
-                <input type="text" title="<?php /* @escapeNotVerified */ echo __('Street Address') ?>" name="shipping[street][]" id="shipping:street1" value="<?php echo $block->escapeHtml($block->getAddress()->getStreetLine(1)) ?>" class="input-text <?php /* @escapeNotVerified */ echo $_streetValidationClass ?>" />
-                <div class="nested">
-                <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
-                <?php for ($_i = 2, $_n = $this->helper('Magento\Customer\Helper\Address')->getStreetLines(); $_i <= $_n; $_i++): ?>
-                     <div class="field additional">
-                         <label class="label" for="shipping:street<?php /* @escapeNotVerified */ echo $_i ?>">
-                             <span><?php /* @escapeNotVerified */ echo __('Street Address %1', $_i) ?></span>
-                         </label>
-                        <div class="control">
-                            <input type="text" title="<?php /* @escapeNotVerified */ echo __('Street Address %1', $_i) ?>" name="shipping[street][]" id="shipping:street<?php /* @escapeNotVerified */ echo $_i ?>" value="<?php echo $block->escapeHtml($block->getAddress()->getStreetLine($_i)) ?>" class="input-text <?php /* @escapeNotVerified */ echo $_streetValidationClass ?>" />
-                        </div>
-                    </div>
-                <?php endfor; ?>
-                </div>
-            </div>
-        </div>
-
-        <div class="field city required">
-            <label class="label" for="shipping:city"><span><?php /* @escapeNotVerified */ echo __('City') ?></span></label>
-            <div class="control">
-                <input type="text" title="<?php /* @escapeNotVerified */ echo __('City') ?>" name="shipping[city]" value="<?php echo $block->escapeHtml($block->getAddress()->getCity()) ?>" class="input-text <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('city') ?>" id="shipping:city" />
-            </div>
-        </div>
-        <div class="field region required">
-            <label class="label" for="shipping:region"><span><?php /* @escapeNotVerified */ echo __('State/Province') ?></span></label>
-            <div class="control">
-                <select id="shipping:region_id" name="shipping[region_id]" title="<?php /* @escapeNotVerified */ echo __('State/Province') ?>" class="validate-select" style="display:none;">
-                    <option value=""><?php /* @escapeNotVerified */ echo __('Please select a region, state or province.') ?></option>
-                </select>
-                <input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $block->escapeHtml($block->getAddress()->getRegion()) ?>" title="<?php /* @escapeNotVerified */ echo __('State/Province') ?>" class="input-text <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('region') ?>" style="display:none;" />
-            </div>
-        </div>
-        <div class="field zip required">
-            <label class="label" for="shipping:postcode"><span><?php /* @escapeNotVerified */ echo __('Zip/Postal Code') ?></span></label>
-            <div class="control">
-                <input type="text" title="<?php /* @escapeNotVerified */ echo __('Zip/Postal Code') ?>" name="shipping[postcode]" id="shipping:postcode" value="<?php echo $block->escapeHtml($block->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('postcode') ?>" data-validate="{'required':true, 'validate-zip-international':true}" />
-            </div>
-        </div>
-        <div class="field country required">
-            <label class="label" for="shipping:country_id"><span><?php /* @escapeNotVerified */ echo __('Country') ?></span></label>
-            <div class="control">
-                <?php echo $block->getCountryHtmlSelect('shipping') ?>
-            </div>
-        </div>
-        <div class="field telephone required">
-            <label class="label" for="shipping:telephone"><span><?php /* @escapeNotVerified */ echo __('Phone Number') ?></span></label>
-            <div class="control">
-                <input type="text" name="shipping[telephone]" value="<?php echo $block->escapeHtml($block->getAddress()->getTelephone()) ?>" title="<?php /* @escapeNotVerified */ echo __('Telephone') ?>" class="input-text <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('telephone') ?>" id="shipping:telephone" />
-            </div>
-        </div>
-        <div class="field fax">
-            <label class="label" for="shipping:fax"><span><?php /* @escapeNotVerified */ echo __('Fax') ?></span></label>
-            <div class="control">
-                <input type="text" name="shipping[fax]" value="<?php echo $block->escapeHtml($block->getAddress()->getFax()) ?>" title="<?php /* @escapeNotVerified */ echo __('Fax') ?>" class="input-text <?php /* @escapeNotVerified */ echo $this->helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('fax') ?>" id="shipping:fax" />
-            </div>
-        </div>
-
-        <?php if ($block->isCustomerLoggedIn() && $block->customerHasAddresses()):?>
-            <div class="field choice save">
-                <input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php /* @escapeNotVerified */ echo __('Save in address book') ?>" id="shipping:save_in_address_book" <?php if ($block->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" />
-                <label class="label" for="shipping:save_in_address_book"><span><?php /* @escapeNotVerified */ echo __('Save in address book') ?></span></label>
-            </div>
-        <?php else:?>
-            <input type="hidden" name="shipping[save_in_address_book]" value="1" />
-        <?php endif;?>
-    </fieldset>
-    <div class="choice field">
-            <input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_billing" value="1"<?php if ($block->getAddress()->getSameAsBilling()): ?> checked="checked"<?php endif; ?> class="checkbox" />
-        <label class="label" for="shipping:same_as_billing"><span><?php /* @escapeNotVerified */ echo __('Use Billing Address') ?></span></label>
-    </div>
-    <div class="actions-toolbar" id="shipping-buttons-container">
-        <div class="primary">
-            <button data-role="opc-continue" type="button" class="action continue primary"><span><?php /* @escapeNotVerified */ echo __('Continue') ?></span></button>
-        </div>
-        <div class="secondary"><a href="#" class="action back"><span><?php /* @escapeNotVerified */ echo __('Back') ?></span></a></div>
-    </div>
-</form>
-<script type="text/x-magento-init">
-    {
-        "#shipping\\:country_id": {
-            "regionUpdater": {
-                "optionalRegionAllowed": <?php /* @escapeNotVerified */ echo($block->getConfig('general/region/display_all') ? 'true' : 'false'); ?>,
-                "regionListId": "#shipping\\:region_id",
-                "regionInputId": "#shipping\\:region",
-                "postcodeId": "#shipping\\:postcode",
-                "regionJson": <?php /* @escapeNotVerified */ echo $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>,
-                "defaultRegion": "<?php /* @escapeNotVerified */ echo $block->getAddress()->getRegionId() ?>",
-                "countriesWithOptionalZip": <?php /* @escapeNotVerified */ echo $this->helper('Magento\Directory\Helper\Data')->getCountriesWithOptionalZip(true) ?>
-            }
-        }
-    }
-</script>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping_method.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping_method.phtml
deleted file mode 100644
index 4ab0004006b422c96f48ffd63410853abd473a8c..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping_method.phtml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-// @codingStandardsIgnoreFile
-
-/**
- * @removeCandidate
- */
-?>
-<form class="form methods-shipping" id="co-shipping-method-form">
-    <div id="checkout-shipping-method-load"></div>
-    <div id="onepage-checkout-shipping-method-additional-load">
-        <?php echo $block->getChildHtml('additional') ?>
-    </div>
-    <div class="actions-toolbar" id="shipping-method-buttons-container">
-        <div class="primary">
-            <button data-role="opc-continue" type="button" class="button action continue primary"><span><?php /* @escapeNotVerified */ echo __('Continue') ?></span></button>
-        </div>
-        <div class="secondary"><a class="action back" href="#"><span><?php /* @escapeNotVerified */ echo __('Back') ?></span></a></div>
-    </div>
-</form>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping_method/additional.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping_method/additional.phtml
deleted file mode 100644
index ac87ff9ce6691d7e0062c81b1fa59d59aa817df2..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping_method/additional.phtml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-// @codingStandardsIgnoreFile
-
-/**
- * @removeCandidate
- */
-?>
-<?php if (!$block->getQuote()->isVirtual()): ?>
-    <?php /* @escapeNotVerified */ echo $this->helper('Magento\GiftMessage\Helper\Message')->getInline('onepage_checkout', $block->getQuote(), $block->getDontDisplayContainer()) ?>
-<?php endif; ?>
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping_method/available.phtml b/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping_method/available.phtml
deleted file mode 100644
index f2b37b4be7c835b7ec4fe521af4b907e35678510..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/shipping_method/available.phtml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-// @codingStandardsIgnoreFile
-
-/**
- * @removeCandidate
- */
-?>
-<?php /** @var $block \Magento\Checkout\Block\Onepage\Shipping\Method\Available */ ?>
-<?php $_shippingRateGroups = $block->getShippingRates(); ?>
-<?php if (!$_shippingRateGroups): ?>
-    <p><?php /* @escapeNotVerified */ echo __('Sorry, no quotes are available for this order right now.') ?></p>
-<?php else: ?>
-    <dl class="items methods-shipping">
-    <?php $shippingCodePrice = []; ?>
-    <?php $_sole = count($_shippingRateGroups) == 1; foreach ($_shippingRateGroups as $code => $_rates): ?>
-        <dt class="item-title <?php /* @escapeNotVerified */ echo $code ?>"><?php echo $block->escapeHtml($block->getCarrierName($code)) ?></dt>
-        <dd class="item-content <?php /* @escapeNotVerified */ echo $code ?>">
-            <fieldset class="fieldset">
-                <legend class="legend"><span><?php echo $block->escapeHtml($block->getCarrierName($code)) ?></span></legend><br>
-                <?php $_sole = $_sole && count($_rates) == 1; foreach ($_rates as $_rate): ?>
-                    <?php $shippingCodePrice[] = '"'.$_rate->getCode().'":'.(float)$_rate->getPrice(); ?>
-                    <div class="field choice">
-                       <?php if ($_rate->getErrorMessage()): ?>
-                        <div class="message error"><div><?php echo $block->escapeHtml($_rate->getErrorMessage()) ?></div></div>
-                       <?php else: ?>
-                            <?php if ($_sole) : ?>
-                            <span class="no-display"><input name="shipping_method" type="radio" value="<?php /* @escapeNotVerified */ echo $_rate->getCode() ?>" id="s_method_<?php /* @escapeNotVerified */ echo $_rate->getCode() ?>" checked="checked" /></span>
-                            <?php else: ?>
-                            <div class="control">
-                                <input name="shipping_method" type="radio" value="<?php /* @escapeNotVerified */ echo $_rate->getCode() ?>" id="s_method_<?php /* @escapeNotVerified */ echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$block->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio"/>
-                            </div>
-                            <?php endif; ?>
-                            <label class="label" for="s_method_<?php /* @escapeNotVerified */ echo $_rate->getCode() ?>"><span><?php echo $block->escapeHtml($_rate->getMethodTitle()) ?>
-                            <?php echo $block->getShippingPriceHtml($_rate); ?>
-                            </span>
-                            </label>
-                       <?php endif ?>
-                    </div>
-                <?php endforeach; ?>
-            </fieldset>
-        </dd>
-    <?php endforeach; ?>
-    </dl>
-    <div class="no-display" data-shipping-code-price='{<?php /* @escapeNotVerified */ echo implode(",",$shippingCodePrice); ?>}'></div>
-<?php endif; ?>
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/action/set-billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/action/set-billing-address.js
index 2090bdabfe69b2af20f08e340af079cd76d551bd..0c0060f737d536ec0b78774e1e9dcedf38662861 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/action/set-billing-address.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/action/set-billing-address.js
@@ -59,6 +59,7 @@ define(
 
                     if (!quote.isVirtual()) {
                         getTotalsAction([]);
+                        fullScreenLoader.stopLoader();
                     } else {
                         deferred = $.Deferred();
                         getPaymentInformationAction(deferred);
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js b/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js
index c510194a2087382d07fed7f8367408ce95aafdb9..732f328ff727403e2e52e10d2980d902c0839611 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/model/shipping-rates-validator.js
@@ -15,31 +15,46 @@ define(
     ],
     function ($, ko, shippingRatesValidationRules, addressConverter, selectShippingAddress, postcodeValidator, $t) {
         'use strict';
-        var checkoutConfig = window.checkoutConfig;
-        var validators = [];
-        var observedElements = [];
-        var postcodeElement = null;
+
+        var checkoutConfig = window.checkoutConfig,
+            validators = [],
+            observedElements = [],
+            postcodeElement = null;
 
         return {
             validateAddressTimeout: 0,
             validateDelay: 2000,
 
-            registerValidator: function(carrier, validator) {
+            /**
+             * @param {String} carrier
+             * @param {Object} validator
+             */
+            registerValidator: function (carrier, validator) {
                 if (checkoutConfig.activeCarriers.indexOf(carrier) != -1) {
                     validators.push(validator);
                 }
             },
 
-            validateAddressData: function(address) {
+            /**
+             * @param {Object} address
+             * @return {Boolean}
+             */
+            validateAddressData: function (address) {
                 return validators.some(function(validator) {
                     return validator.validate(address);
                 });
             },
 
-            bindChangeHandlers: function(elements, force, delay) {
-                var self = this;
-                var observableFields = shippingRatesValidationRules.getObservableFields();
-                $.each(elements, function(index, elem) {
+            /**
+             * @param {*} elements
+             * @param {Boolean} force
+             * @param {Number} delay
+             */
+            bindChangeHandlers: function (elements, force, delay) {
+                var self = this,
+                    observableFields = shippingRatesValidationRules.getObservableFields();
+
+                $.each(elements, function (index, elem) {
                     if (elem && (observableFields.indexOf(elem.index) != -1 || force)) {
                         if (elem.index !== 'postcode') {
                             self.bindHandler(elem, delay);
@@ -53,17 +68,23 @@ define(
                 });
             },
 
-            bindHandler: function(element, delay) {
+            /**
+             * @param {Object} element
+             * @param {Number} delay
+             */
+            bindHandler: function (element, delay) {
                 var self = this;
+
                 delay = typeof delay === "undefined" ? self.validateDelay : delay;
+
                 if (element.component.indexOf('/group') != -1) {
-                    $.each(element.elems(), function(index, elem) {
+                    $.each(element.elems(), function (index, elem) {
                         self.bindHandler(elem);
                     });
                 } else {
-                    element.on('value', function() {
+                    element.on('value', function () {
                         clearTimeout(self.validateAddressTimeout);
-                        self.validateAddressTimeout = setTimeout(function() {
+                        self.validateAddressTimeout = setTimeout(function () {
                             if (self.postcodeValidation()) {
                                 self.validateFields();
                             }
@@ -73,36 +94,44 @@ define(
                 }
             },
 
-            postcodeValidation: function() {
+            /**
+             * @return {*}
+             */
+            postcodeValidation: function () {
+                var countryId = $('select[name="country_id"]').val(),
+                    validationResult = postcodeValidator.validate(postcodeElement.value(), countryId),
+                    warnMessage;
+
                 if (postcodeElement == null || postcodeElement.value() == null) {
                     return true;
                 }
 
-                var countryId = $('select[name="shippingAddress[country_id]"]').val();
-                var validationResult = postcodeValidator.validate(postcodeElement.value(), countryId);
-
                 postcodeElement.warn(null);
+
                 if (!validationResult) {
-                    var warnMessage = $t('Provided Zip/Postal Code seems to be invalid.');
+                    warnMessage = $t('Provided Zip/Postal Code seems to be invalid.');
                     if (postcodeValidator.validatedPostCodeExample.length) {
                         warnMessage += $t(' Example: ') + postcodeValidator.validatedPostCodeExample.join('; ') + '. ';
                     }
                     warnMessage += $t('If you believe it is the right one you can ignore this notice.');
                     postcodeElement.warn(warnMessage);
                 }
+
                 return validationResult;
             },
 
             /**
              * Convert form data to quote address and validate fields for shipping rates
              */
-            validateFields: function() {
+            validateFields: function () {
                 var addressFlat = addressConverter.formDataProviderToFlatData(
-                    this.collectObservedData(),
-                    'shippingAddress'
-                );
+                        this.collectObservedData(),
+                        'shippingAddress'
+                    ),
+                    address;
+
                 if (this.validateAddressData(addressFlat)) {
-                    var address = addressConverter.formAddressDataToQuoteAddress(addressFlat);
+                    address = addressConverter.formAddressDataToQuoteAddress(addressFlat);
                     selectShippingAddress(address);
                 }
             },
@@ -112,11 +141,13 @@ define(
              *
              * @returns {*}
              */
-            collectObservedData: function() {
+            collectObservedData: function () {
                 var observedValues = {};
-                $.each(observedElements, function(index, field) {
+
+                $.each(observedElements, function (index, field) {
                     observedValues[field.dataScope] = field.value();
                 });
+
                 return observedValues;
             }
         };
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-billing-info.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-billing-info.js
deleted file mode 100644
index 5ed385463d8bca9873012ce9effe69244762c47a..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/web/js/opc-billing-info.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * @category    one page checkout second step
- * @package     mage
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-/*jshint browser:true jquery:true*/
-/*global alert*/
-/**
- * @removeCandidate
- */
-define([
-    "jquery",
-    "jquery/ui",
-    "Magento_Checkout/js/opc-checkout-method",
-    "mage/validation"
-], function($){
-    'use strict';
-       
-    // Extension for mage.opcheckout - second section(Billing Information) in one page checkout accordion
-    $.widget('mage.opcBillingInfo', $.mage.opcCheckoutMethod, {
-        options: {
-            billing: {
-                form: '#co-billing-form',
-                continueSelector: '#opc-billing [data-role=opc-continue]',
-                addressDropdownSelector: '#billing\\:address-select',
-                newAddressFormSelector: '#billing-new-address-form',
-                emailAddressName: 'billing[email]'
-            }
-        },
-
-        _create: function() {
-            this._super();
-            var events = {};
-            events['change ' + this.options.billing.addressDropdownSelector] = function(e) {
-                this.element.find(this.options.billing.newAddressFormSelector).toggle(!$(e.target).val());
-            };
-            events['click ' + this.options.billing.continueSelector] = function() {
-                if ($(this.options.billing.form).validation && $(this.options.billing.form).validation('isValid')) {
-                    this._billingSave();
-                }
-            };
-            this._on(events);
-
-            this.element.find(this.options.billing.form).validation();
-        } ,
-
-        _billingSave: function() {
-            this._ajaxContinue(this.options.billing.saveUrl, $(this.options.billing.form).serialize(), false, function() {
-                //Trigger indicating billing save. eg. GiftMessage listens to this to inject gift options
-                this.element.trigger('billingSave');
-            });
-        }
-    });
-    
-    return $.mage.opcBillingInfo;
-});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js
deleted file mode 100644
index 0f92f6ea63362f1de7e995e7db9ee721d012b15c..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js
+++ /dev/null
@@ -1,291 +0,0 @@
-/**
- * @category    one page checkout first step
- * @package     mage
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-/*jshint browser:true jquery:true*/
-/*global alert*/
-/**
- * @removeCandidate
- */
-define([
-    "jquery",
-    "accordion",
-    'Magento_Ui/js/modal/alert',
-    "jquery/ui",
-    "mage/validation/validation",
-    "mage/translate"
-], function($, accordion, alert){
-    'use strict';
-
-    // Base widget, handle ajax events and first section(Checkout Method) in one page checkout accordion
-    $.widget('mage.opcCheckoutMethod', {
-        options: {
-            checkout: {
-                loginGuestSelector: '[data-role=checkout-method-guest]',
-                loginRegisterSelector: '[data-role=checkout-method-register]',
-                loginFormSelector: 'form[data-role=login]',
-                continueSelector: '#opc-login [data-role=opc-continue]',
-                registerCustomerPasswordSelector: '#co-billing-form .field.password,#co-billing-form .field.confirm',
-                captchaGuestCheckoutSelector: '#co-billing-form [role="guest_checkout"]',
-                registerDuringCheckoutSelector: '#co-billing-form [role="register_during_checkout"]',
-                suggestRegistration: false
-            },
-            pageMessages: '#maincontent .messages .message',
-            sectionSelectorPrefix: 'opc-',
-            billingSection: 'billing',
-            ajaxLoaderPlaceButton: false,
-            updateSelectorPrefix: '#checkout-',
-            updateSelectorSuffix: '-load',
-            backSelector: '.action.back',
-            minBalance: 0.0001,
-            methodsListContainer: 'dl',
-            methodContainer: 'dt',
-            methodDescription : 'dd ul',
-            methodOn: 'dt input:radio'
-        },
-
-        _create: function() {
-            var self = this;
-            
-            this._initAccordion();
-
-            this.sectionActiveClass = this.element.accordion("option","openedState");
-            this.contentSelector = this.element.accordion("option","content");
-            this.checkoutPrice = this.options.quoteBaseGrandTotal;
-            
-            if (this.options.checkout.suggestRegistration) {
-                $(this.options.checkout.loginGuestSelector).prop('checked', false);
-                $(this.options.checkout.loginRegisterSelector).prop('checked', true);
-            }
-            this._handleSteps();
-            var events = {};
-            events['click ' + this.options.checkout.continueSelector] = function(e) {
-                this._continue($(e.currentTarget));
-            };
-            events['click ' + this.options.backSelector] = function(event) {
-                event.preventDefault();
-                var prev  = self.steps.index($('li.' + self.sectionActiveClass)) -1 ;
-                this._activateSection(prev);
-            };
-            events['click ' + '[data-action=checkout-method-login]'] = function(event) {
-                if($(self.options.checkout.loginFormSelector).validation('isValid')){
-                    self.element.find('.section').filter('.' + self.sectionActiveClass).children(self.contentSelector).trigger("processStart");
-                    event.preventDefault();
-                    setTimeout(function(){
-                        $(self.options.checkout.loginFormSelector).submit();
-                    }, 300);
-                }
-            };
-
-            $(document).on({
-                'ajaxError': this._ajaxError.bind(this)
-            });
-
-            $.extend(events, {
-                showAjaxLoader: '_ajaxSend',
-                hideAjaxLoader: '_ajaxComplete',
-                gotoSection: function(e, section) {
-                    self.element.find('.section').filter('.' + self.sectionActiveClass).children(self.contentSelector).trigger("processStop");
-                    var toActivate = this.steps.index($('#' + self.options.sectionSelectorPrefix + section));
-                    this._activateSection(toActivate);
-                }
-            });
-            this._on(events);
-
-            this._on($(this.options.checkoutProgressContainer), {
-                'click [data-goto-section]' : function(e) {
-                    var gotoSection = $(e.target).data('goto-section');
-                    self.element.find('.section').filter('.' + self.sectionActiveClass).children(self.contentSelector).trigger("processStop");
-                    var toActivate = this.steps.index($('#' + self.options.sectionSelectorPrefix + gotoSection));
-                    this._activateSection(toActivate);
-                    return false;
-                }
-            });
-        },
-
-        _initAccordion: function(){
-            var config = this.element.data('accordion');
-
-            accordion(config, this.element[0]);
-        },
-
-        /**
-         * Get the checkout steps, disable steps but first, adding callback on before opening section to
-         * disable all next steps
-         * @private
-         */
-        _handleSteps: function() {
-            var self = this;
-            this.steps = $(this.element).children('[id^=' + this.options.sectionSelectorPrefix + ']');
-            this.element.accordion("disable");
-            this._activateSection(0);
-            $.each(this.steps,function() {
-                $(this).on("beforeOpen",function() {
-                    $(this).nextAll('[id^=' + self.options.sectionSelectorPrefix + ']').collapsible("disable");
-                    $(this).prevAll('[id^=' + self.options.sectionSelectorPrefix + ']').collapsible("enable");
-                });
-            });
-        },
-
-        /**
-         * Activate section
-         * @param index the index of section you want to open
-         * @private
-         */
-        _activateSection: function(index) {
-            this.element.accordion("enable",index);
-            this.element.accordion("activate",index);
-        },
-
-        /**
-         * Callback function for before ajax send event(global)
-         * @private
-         */
-        _ajaxSend: function() {
-            this.element.find('.section').filter('.' + this.sectionActiveClass).children(this.contentSelector).trigger("processStart");
-        },
-
-        /**
-         * Callback function for ajax complete event(global)
-         * @private
-         */
-        _ajaxComplete: function() {
-            this.element.find('.section').filter('.' + this.sectionActiveClass).children(this.contentSelector).trigger("processStop");
-        },
-
-        /**
-         * ajax error for all onepage checkout ajax calls
-         * @private
-         */
-        _ajaxError: function() {
-            window.location.href = this.options.failureUrl;
-        },
-
-        /**
-         * callback function when continue button is clicked
-         * @private
-         * @param elem - continue button
-         * @return {Boolean}
-         */
-        _continue: function(elem) {
-            var json            = elem.data('checkout'),
-                checkout        = this.options.checkout,
-                guestChecked    = $( checkout.loginGuestSelector ).is( ':checked' ),
-                registerChecked = $( checkout.loginRegisterSelector ).is( ':checked' ),
-                method          = 'register',
-                isRegistration  = true;
-
-            //Remove page messages
-            $(this.options.pageMessages).remove();
-            
-            if (json.isGuestCheckoutAllowed) {
-                
-                if( !guestChecked && !registerChecked ){
-                    alert({
-                        content: $.mage.__('Please create an account or check out as a guest.')
-                    });
-                    
-                    return false;
-                }
-
-                if( guestChecked ){
-                    method = 'guest';
-                    isRegistration = false;
-                }
-
-                this._ajaxContinue(
-                    checkout.saveUrl,
-                    { method: method },
-                    this.options.billingSection
-                );
-
-                this.element.find(checkout.registerCustomerPasswordSelector).toggle(isRegistration);
-                this.element.find(checkout.captchaGuestCheckoutSelector).toggle(!isRegistration);
-                this.element.find(checkout.registerDuringCheckoutSelector).toggle(isRegistration);
-            }
-            else if( json.registrationUrl ){
-                window.location = json.registrationUrl;
-            }
-
-            this.element.trigger('login');
-        },
-
-        /**
-         * Ajax call to save checkout info to backend and enable next section in accordion
-         * @private
-         * @param url - ajax url
-         * @param data - post data for ajax call
-         * @param gotoSection - the section needs to show after ajax call
-         * @param successCallback - custom callback function in ajax success
-         */
-        _ajaxContinue: function(url, data, gotoSection, successCallback) {
-            $.ajax({
-                url: url,
-                type: 'post',
-                context: this,
-                data: data,
-                dataType: 'json',
-                beforeSend: this._ajaxSend,
-                complete: this._ajaxComplete,
-                success: function (response) {
-                    if (successCallback) {
-                        successCallback.call(this, response);
-                    }
-                    if ($.type(response) === 'object' && !$.isEmptyObject(response)) {
-                        if (response.error) {
-                            var msg = response.message || response.error_messages || response.error;
-
-                            if (msg) {
-                                if (Array.isArray(msg)) {
-                                    msg = msg.reduce(function (str, chunk) {
-                                        str += '\n' + chunk;
-                                        return str;
-                                    }, '');
-                                }
-
-                                $(this.options.countrySelector).trigger('change');
-
-                                alert({
-                                    content: msg
-                                });
-                            }
-
-                            return;
-                        }
-                        if (response.redirect) {
-                            $.mage.redirect(response.redirect);
-                            return false;
-                        }
-                        else if (response.success) {
-                            $.mage.redirect(this.options.review.successUrl);
-                            return false;
-                        }
-                        if (response.update_section) {
-                            if (response.update_section.name === 'payment-method' && response.update_section.html.indexOf('data-checkout-price')) {
-                                this.element.find(this.options.payment.form).find('[data-checkout-price]').remove();
-                            }
-                            $(this.options.updateSelectorPrefix + response.update_section.name + this.options.updateSelectorSuffix)
-                                .html($(response.update_section.html)).trigger('contentUpdated');
-                        }
-                        if (response.update_progress) {
-                            $(this.options.checkoutProgressContainer).html($(response.update_progress.html)).trigger('progressUpdated');
-                        }
-                        if (response.duplicateBillingInfo) {
-                            $(this.options.shipping.copyBillingSelector).prop('checked', true).trigger('click');
-                            $(this.options.shipping.addressDropdownSelector).val($(this.options.billing.addressDropdownSelector).val()).change();
-                        }
-                        if (response.goto_section) {
-                            this.element.trigger('gotoSection', response.goto_section);
-                        }
-                    } else {
-                        this.element.trigger('gotoSection', gotoSection);
-                    }
-                }
-            });
-        }
-    });
-    
-    return $.mage.opcCheckoutMethod;
-});
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-order-review.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-order-review.js
deleted file mode 100644
index 83313faeebf5c513acfc11577db030f644b15500..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/web/js/opc-order-review.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * @category    one page checkout last step
- * @package     mage
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-/*jshint browser:true jquery:true*/
-/*global alert*/
-/**
- * @removeCandidate
- */
-define([
-    "jquery",
-    "jquery/ui",
-    "Magento_Checkout/js/opc-payment-info"
-], function($){
-    'use strict';
-
-    // Extension for mage.opcheckout - last section(Order Review) in one page checkout accordion
-    $.widget('mage.opcOrderReview', $.mage.opcPaymentInfo, {
-        options: {
-            review: {
-                continueSelector: '#opc-review [data-role=review-save]',
-                container: '#opc-review',
-                agreementGroupSelector: '#checkout-agreements'
-            }
-        },
-
-        _create: function() {
-            this._super();
-            var events = {};
-            events['click ' + this.options.review.continueSelector] = this._saveOrder;
-            events['saveOrder' + this.options.review.container] = this._saveOrder;
-            this._on(events);
-        },
-
-        _saveOrder: function() {
-            var agreementFormsGroup = $(this.options.review.agreementGroupSelector),
-                paymentForm = $(this.options.payment.form);
-            var isAgreementValid = true;
-            agreementFormsGroup.find('form').each(
-                function(){
-                    isAgreementValid = $(this).validation() && $(this).validation('isValid') && isAgreementValid;
-                }
-            );
-
-            if (isAgreementValid &&
-                paymentForm.validation &&
-                paymentForm.validation('isValid')) {
-                var serializedAgreement = '';
-                agreementFormsGroup.find('form').each(function(){serializedAgreement += '&' + $(this).serialize();});
-                this._ajaxContinue(
-                    this.options.review.saveUrl,
-                    paymentForm.serialize() + serializedAgreement);
-            }
-        }
-    });
-    
-    return $.mage.opcOrderReview;
-});
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-payment-info.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-payment-info.js
deleted file mode 100644
index bfa87548aea2a170d7372bbc547266c482e9d7f6..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/web/js/opc-payment-info.js
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- * @category    one page checkout fifth step
- * @package     mage
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-/*jshint browser:true*/
-/*global alert*/
-/**
- * @removeCandidate
- */
-define([
-    'jquery',
-    'mage/template',
-    'Magento_Ui/js/modal/alert',
-    'jquery/ui',
-    'mage/translate',
-    'Magento_Checkout/js/opc-shipping-method'
-], function ($, mageTemplate, alert) {
-    'use strict';
-
-    // Extension for mage.opcheckout - fifth section(Payment Information) in one page checkout accordion
-    $.widget('mage.opcPaymentInfo', $.mage.opcShippingMethod, {
-        options: {
-            payment: {
-                form: '#co-payment-form',
-                continueSelector: '#payment [data-role=opc-continue]',
-                methodsContainer: '#checkout-payment-method-load',
-                freeInput: {
-                    tmpl: '<input id="hidden-free" type="hidden" name="payment[method]" value="free">',
-                    selector: '#hidden-free'
-                }
-            }
-        },
-
-        _create: function () {
-            this._super();
-
-            var events = {};
-
-            this.freeInputTmpl = mageTemplate(this.options.payment.freeInput.tmpl);
-
-            events['click ' + this.options.payment.continueSelector] = function () {
-                if (this._validatePaymentMethod() &&
-                    $(this.options.payment.form).validation &&
-                    $(this.options.payment.form).validation('isValid')) {
-                    this._ajaxContinue(this.options.payment.saveUrl, $(this.options.payment.form).serialize());
-                }
-            };
-
-            events['contentUpdated ' + this.options.payment.form] = function () {
-                $(this.options.payment.form).find('dd [name^="payment["]').prop('disabled', true);
-                var checkoutPrice = this.element.find(this.options.payment.form).find('[data-checkout-price]').data('checkout-price');
-
-                if ($.isNumeric(checkoutPrice)) {
-                    this.checkoutPrice = checkoutPrice;
-                }
-
-                if (this.checkoutPrice < this.options.minBalance) {
-                    this._disablePaymentMethods();
-                } else {
-                    this._enablePaymentMethods();
-                }
-            };
-
-            events['click ' + this.options.payment.form + ' dt input:radio'] = '_paymentMethodHandler';
-
-            $.extend(events, {
-                updateCheckoutPrice: function (event, data) {
-                    if (data.price) {
-                        this.checkoutPrice += data.price;
-                    }
-
-                    if (data.totalPrice) {
-                        data.totalPrice = this.checkoutPrice;
-                    }
-
-                    if (this.checkoutPrice < this.options.minBalance) {
-                        // Add free input field, hide and disable unchecked checkbox payment method and all radio button payment methods
-                        this._disablePaymentMethods();
-                    } else {
-                        // Remove free input field, show all payment method
-                        this._enablePaymentMethods();
-                    }
-                }
-            });
-
-            this._on(events);
-
-            this.element.find(this.options.payment.form).validation({
-                errorPlacement: function (error, element) {
-                    if (element.attr('data-validate') && element.attr('data-validate').indexOf('validate-cc-ukss') >= 0) {
-                        element.parents('form').find('[data-validation-msg="validate-cc-ukss"]').html(error);
-                    } else {
-                        element.after(error);
-                    }
-                }
-            });
-        },
-
-        /**
-         * Display payment details when payment method radio button is checked
-         * @private
-         * @param {EventObject} e
-         */
-        _paymentMethodHandler: function (e) {
-            var _this = $(e.target),
-                parentsDl = _this.closest(this.options.methodsListContainer);
-            parentsDl.find(this.options.methodOn).prop('checked', false);
-            _this.prop('checked', true);
-            parentsDl.find(this.options.methodDescription).hide().find('[name^="payment["]').prop('disabled', true);
-            _this.parent().nextUntil(this.options.methodContainer).find(this.options.methodDescription).show().find('[name^="payment["]').prop('disabled', false);
-        },
-
-        /**
-         * make sure one payment method is selected
-         * @private
-         * @return {Boolean}
-         */
-        _validatePaymentMethod: function () {
-            var methods = this.element.find('[name^="payment["]');
-
-            if (methods.length === 0) {
-                alert({
-                    content: $.mage.__('We can\'t complete your order because you don\'t have a payment method set up.')
-                });
-
-                return false;
-            }
-
-            if (this.checkoutPrice < this.options.minBalances) {
-                return true;
-            } else if (methods.filter('input:radio:checked').length) {
-                return true;
-            }
-
-            alert({
-                content: $.mage.__('Please choose a payment method.')
-            });
-
-            return false;
-        },
-
-        /**
-         * Disable and enable payment methods
-         * @private
-         */
-        _disablePaymentMethods: function () {
-            var paymentForm = $(this.options.payment.form),
-                tmpl = this.freeInputTmpl({
-                    data: {}
-                });
-
-            paymentForm.find('input[name="payment[method]"]').prop('disabled', true);
-            paymentForm.find(this.options.payment.methodsContainer).find('[name^="payment["]').prop('disabled', true);
-            paymentForm.find('input[id^="use"][name^="payment[use"]:not(:checked)').prop('disabled', true).parent();
-            paymentForm.find(this.options.payment.freeInput.selector).remove();
-
-            $(tmpl).appendTo(paymentForm);
-        },
-
-        /**
-         * Enable and enable payment methods
-         * @private
-         */
-        _enablePaymentMethods: function () {
-            var paymentForm = $(this.options.payment.form);
-            
-            paymentForm.find('input[name="payment[method]"]').prop('disabled', false);
-            paymentForm.find('input[name="payment[method]"]:checked').trigger('click');
-            paymentForm.find(this.options.payment.methodsContainer).show();
-            paymentForm.find('input[id^="use"][name^="payment[use"]:not(:checked)').prop('disabled', false).parent().show();
-            paymentForm.find(this.options.payment.freeInput.selector).remove();
-        }
-    });
-
-    return $.mage.opcPaymentInfo;
-});
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-info.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-info.js
deleted file mode 100644
index bf3ef59bcf42938b341150c75d6df91d497be10f..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-info.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * @category    one page checkout third step
- * @package     mage
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-/*jshint browser:true jquery:true*/
-/*global alert*/
-/**
- * @removeCandidate
- */
-define([
-    "jquery",
-    "jquery/ui",
-    "Magento_Checkout/js/opc-billing-info",
-    "mage/validation"
-], function($){
-    'use strict';
-
-    // Extension for mage.opcheckout - third section(Shipping Information) in one page checkout accordion
-    $.widget('mage.opcShippingInfo', $.mage.opcBillingInfo, {
-        options: {
-            shipping: {
-                form: '#co-shipping-form',
-                continueSelector:'#shipping [data-role=opc-continue]',
-                addressDropdownSelector: '#shipping\\:address-select',
-                newAddressFormSelector: '#shipping-new-address-form',
-                copyBillingSelector: '#shipping\\:same_as_billing',
-                countrySelector: '#shipping\\:country_id'
-            }
-        },
-
-        _create: function() {
-            this._super();
-            var events = {};
-            var onInputPropChange = function() {
-                $(this.options.shipping.copyBillingSelector).prop('checked', false);
-            };
-            events['change ' + this.options.shipping.addressDropdownSelector] = function(e) {
-                $(this.options.shipping.newAddressFormSelector).toggle(!$(e.target).val());
-                onInputPropChange.call(this);
-            };
-            // for guest checkout
-            events['input ' + this.options.shipping.form + ' :input[name]'] = onInputPropChange;
-            events['propertychange ' + this.options.shipping.form + ' :input[name]'] = onInputPropChange;
-            events['click ' + this.options.shipping.copyBillingSelector] = function(e) {
-                if ($(e.target).is(':checked')) {
-                    this._billingToShipping();
-                }
-            };
-            events['click ' + this.options.shipping.continueSelector] = function() {
-                if ($(this.options.shipping.form).validation && $(this.options.shipping.form).validation('isValid')) {
-                    this._ajaxContinue(this.options.shipping.saveUrl, $(this.options.shipping.form).serialize(), false, function() {
-                        //Trigger indicating shipping save. eg. GiftMessage listens to this to inject gift options
-                        this.element.trigger('shippingSave');
-                    });
-                }
-            };
-            this._on(events);
-
-            this.element.find(this.options.shipping.form).validation();
-        },
-
-        /**
-         * Copy billing address info to shipping address
-         * @private
-         */
-        _billingToShipping: function() {
-            $(':input[name]', this.options.billing.form).each($.proxy(function(key, value) {
-                var fieldObj = $(value.id.replace('billing:', '#shipping\\:'));
-                fieldObj.val($(value).val());
-                if (fieldObj.is("select")) {
-                    fieldObj.trigger('change');
-                }
-            }, this));
-            $(this.options.shipping.copyBillingSelector).prop('checked', true);
-        }
-    });
-    
-    return $.mage.opcShippingInfo;
-});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-method.js b/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-method.js
deleted file mode 100644
index 505db47ab57901c4dcc73330ed27ebf66d0a4968..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-method.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * @category    one page checkout fourth step
- * @package     mage
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-/*jshint browser:true jquery:true*/
-/*global alert*/
-/**
- * @removeCandidate
- */
-define([
-    "jquery",
-    'Magento_Ui/js/modal/alert',
-    "jquery/ui",
-    "Magento_Checkout/js/opc-shipping-info",
-    "mage/validation",
-    "mage/translate"
-], function($, alert){
-    'use strict';    
-
-    // Extension for mage.opcheckout - fourth section(Shipping Method) in one page checkout accordion
-    $.widget('mage.opcShippingMethod', $.mage.opcShippingInfo, {
-        options: {
-            shippingMethod: {
-                form: '#co-shipping-method-form',
-                continueSelector: '#opc-shipping_method [data-role=opc-continue]'
-            }
-        },
-
-        _create: function() {
-            this._super();
-            var events = {};
-            events['click ' + this.options.shippingMethod.continueSelector] = function() {
-                if (this._validateShippingMethod()&&
-                    $(this.options.shippingMethod.form).validation &&
-                    $(this.options.shippingMethod.form).validation('isValid')) {
-                    this._ajaxContinue(this.options.shippingMethod.saveUrl, $(this.options.shippingMethod.form).serialize());
-                }
-            };
-            $.extend(events, {
-                'click input[name=shipping_method]': function(e) {
-                    var selectedPrice = this.shippingCodePrice[$(e.target).val()] || 0,
-                        oldPrice = this.shippingCodePrice[this.currentShippingMethod] || 0;
-                    this.checkoutPrice = this.checkoutPrice - oldPrice + selectedPrice;
-                    this.currentShippingMethod = $(e.target).val();
-                },
-                'contentUpdated': function() {
-                    this.currentShippingMethod = this.element.find('input[name="shipping_method"]:checked').val();
-                    this.shippingCodePrice = this.element.find('[data-shipping-code-price]').data('shipping-code-price');
-                }
-            });
-            this._on(events);
-
-            this.element.find(this.options.shippingMethod.form).validation();
-        },
-
-        /**
-         * Make sure at least one shipping method is selected
-         * @return {Boolean}
-         * @private
-         */
-        _validateShippingMethod: function() {
-            var methods = this.element.find('[name="shipping_method"]');
-            if (methods.length === 0) {
-                alert({
-                    content: $.mage.__('We can\'t ship to this address. Please enter another address or edit this one.')
-                });
-
-                return false;
-            }
-
-            if (methods.filter(':checked').length) {
-                return true;
-            }
-            alert({
-                content:$.mage.__('Please specify a shipping method.')
-            });
-
-            return false;
-        }
-    });
-    
-    return $.mage.opcShippingMethod;
-});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/opcheckout.js b/app/code/Magento/Checkout/view/frontend/web/js/opcheckout.js
deleted file mode 100644
index 570dd9edf2d892eb39266dc467fc85f2861c84fc..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/web/js/opcheckout.js
+++ /dev/null
@@ -1,645 +0,0 @@
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-/*jshint browser:true*/
-/*global alert*/
-/**
- * @removeCandidate
- */
-define([
-    'jquery',
-    'mage/template',
-    'Magento_Ui/js/modal/alert',
-    'jquery/ui',
-    'mage/validation',
-    'mage/translate'
-], function ($, mageTemplate, alert) {
-    'use strict';
-
-    // Base widget, handle ajax events and first section(Checkout Method) in one page checkout accordion
-    $.widget('mage.opcheckout', {
-        options: {
-            checkout: {
-                loginGuestSelector: '#login\\:guest',
-                loginRegisterSelector: '#login\\:register',
-                loginFormSelector: '#login-form',
-                continueSelector: '#onepage-guest-register-button',
-                registerCustomerPasswordSelector: '#co-billing-form .field.password,#co-billing-form .field.confirm',
-                suggestRegistration: false
-            },
-            sectionSelectorPrefix: '#opc-',
-            billingSection: 'billing',
-            ajaxLoaderPlaceButton: false,
-            updateSelectorPrefix: '#checkout-',
-            updateSelectorSuffix: '-load',
-            backSelector: '.action.back',
-            minBalance: 0.0001,
-            methodsListContainer: 'dl',
-            methodContainer: 'dt',
-            methodDescription: 'dd ul',
-            methodOn: 'dt input:radio'
-        },
-
-        _create: function () {
-            var events = {};
-
-            this.checkoutPrice = this.options.quoteBaseGrandTotal;
-
-            if (this.options.checkout.suggestRegistration) {
-                $(this.options.checkout.loginGuestSelector).prop('checked', false);
-                $(this.options.checkout.loginRegisterSelector).prop('checked', true);
-            }
-
-            events['click ' + this.options.checkout.continueSelector] = function (e) {
-                this._continue($(e.currentTarget));
-            };
-
-            events['click ' + this.options.backSelector] = function () {
-                this.element.trigger('enableSection', {
-                    selector: '#' + this.element.find('.active').prev().attr('id')
-                });
-            };
-
-            $(document).on({
-                'ajaxError': this._ajaxError.bind(this)
-            });
-
-            $.extend(events, {
-                showAjaxLoader: '_ajaxSend',
-                hideAjaxLoader: '_ajaxComplete',
-                gotoSection: function (e, section) {
-                    this._ajaxUpdateProgress(section);
-                    this.element.trigger('enableSection', {
-                        selector: this.options.sectionSelectorPrefix + section
-                    });
-                },
-                'click [data-action=login-form-submit]': function () {
-                    $(this.options.checkout.loginFormSelector).submit();
-                }
-            });
-
-            this._on(events);
-
-            this._on($(this.options.checkoutProgressContainer), {
-                'click [data-goto-section]': function (e) {
-                    var gotoSection = $(e.target).data('goto-section');
-
-                    this._ajaxUpdateProgress(gotoSection);
-
-                    this.element.trigger('enableSection', {
-                        selector: this.options.sectionSelectorPrefix + gotoSection
-                    });
-
-                    return false;
-                }
-            });
-        },
-
-        /**
-         * Callback function for before ajax send event(global)
-         * @private
-         */
-        _ajaxSend: function () {
-            var loader;
-
-            this.element.addClass('loading');
-
-            loader = this.element.find('.please-wait').show();
-
-            if (this.options.ajaxLoaderPlaceButton) {
-                loader.siblings('.button').hide();
-            }
-        },
-
-        /**
-         * Callback function for ajax complete event(global)
-         * @private
-         */
-        _ajaxComplete: function () {
-            this.element.removeClass('loading');
-            this.element.find('.please-wait').hide();
-
-            if (this.options.ajaxLoaderPlaceButton) {
-                this.element.find('.button').show();
-            }
-        },
-
-        /**
-         * ajax error for all onepage checkout ajax calls
-         * @private
-         */
-        _ajaxError: function () {
-            window.location.href = this.options.failureUrl;
-        },
-
-        /**
-         * callback function when continue button is clicked
-         * @private
-         * @param elem - continue button
-         * @return {Boolean}
-         */
-        _continue: function (elem) {
-            var json = elem.data('checkout');
-
-            if (json.isGuestCheckoutAllowed) {
-                if ($(this.options.checkout.loginGuestSelector).is(':checked')) {
-                    this._ajaxContinue(this.options.checkout.saveUrl, {
-                        method: 'guest'
-                    }, this.options.billingSection);
-
-                    this.element.find(this.options.checkout.registerCustomerPasswordSelector).hide();
-                } else if ($(this.options.checkout.loginRegisterSelector).is(':checked')) {
-                    this._ajaxContinue(this.options.checkout.saveUrl, {
-                        method: 'register'
-                    }, this.options.billingSection);
-
-                    this.element.find(this.options.checkout.registerCustomerPasswordSelector).show();
-                } else {
-                    alert({
-                        content: $.mage.__('Please create an account or check out as a guest.')
-                    });
-
-                    return false;
-                }
-            } else {
-                if (json.registrationUrl) {
-                    window.location.href = json.registrationUrl;
-                }
-            }
-
-            this.element.trigger('login');
-        },
-
-        /**
-         * Ajax call to save checkout info to backend and enable next section in accordion
-         * @private
-         * @param url - ajax url
-         * @param data - post data for ajax call
-         * @param gotoSection - the section needs to show after ajax call
-         * @param successCallback - custom callback function in ajax success
-         */
-        _ajaxContinue: function (url, data, gotoSection, successCallback) {
-            $.ajax({
-                url: url,
-                type: 'post',
-                context: this,
-                data: data,
-                dataType: 'json',
-                beforeSend: this._ajaxSend,
-                complete: this._ajaxComplete,
-                success: function (response) {
-                    if (successCallback) {
-                        successCallback.call(this, response);
-                    }
-
-                    if ($.type(response) === 'object' && !$.isEmptyObject(response)) {
-                        if (response.error) {
-                            var msg = response.message || response.error_messages;
-
-                            if (msg) {
-                                if ($.type(msg) === 'array') {
-                                    msg = msg.join("\n");
-                                }
-
-                                $(this.options.countrySelector).trigger('change');
-
-                                alert({
-                                    content: msg
-                                });
-                            } else {
-                                alert({
-                                    content: response.error
-                                });
-                            }
-
-                            return;
-                        }
-
-                        if (response.redirect) {
-                            $.mage.redirect(response.redirect);
-
-                            return false;
-                        } else if (response.success) {
-                            $.mage.redirect(this.options.review.successUrl);
-
-                            return false;
-                        }
-
-                        if (response.update_section) {
-                            if (response.update_section.name === 'payment-method' && response.update_section.html.indexOf('data-checkout-price')) {
-                                this.element.find(this.options.payment.form).find('[data-checkout-price]').remove();
-                            }
-                            $(this.options.updateSelectorPrefix + response.update_section.name + this.options.updateSelectorSuffix)
-                                .html($(response.update_section.html)).trigger('contentUpdated');
-                        }
-
-                        if (response.duplicateBillingInfo) {
-                            $(this.options.shipping.copyBillingSelector).prop('checked', true).trigger('click');
-                            $(this.options.shipping.addressDropdownSelector).val($(this.options.billing.addressDropdownSelector).val()).change();
-                        }
-
-                        if (response.goto_section) {
-                            this.element.trigger('gotoSection', response.goto_section);
-                        }
-                    } else {
-                        this.element.trigger('gotoSection', gotoSection);
-                    }
-                }
-            });
-        },
-
-        /**
-         * Update progress sidebar content
-         * @private
-         * @param {*} toStep
-         */
-        _ajaxUpdateProgress: function (toStep) {
-            if (toStep) {
-                $.ajax({
-                    url: this.options.progressUrl,
-                    type: 'get',
-                    async: false,
-                    cache: false,
-                    context: this,
-                    data: toStep ? {
-                        toStep: toStep
-                    } : null,
-                    success: function (response) {
-                        $(this.options.checkoutProgressContainer).html(response);
-                    }
-                });
-            }
-        }
-    });
-
-    // Extension for mage.opcheckout - second section(Billing Information) in one page checkout accordion
-    $.widget('mage.opcheckout', $.mage.opcheckout, {
-        options: {
-            billing: {
-                addressDropdownSelector: '#billing\\:address-select',
-                newAddressFormSelector: '#billing-new-address-form',
-                continueSelector: '#billing-buttons-container .button',
-                form: '#co-billing-form'
-            }
-        },
-
-        _create: function () {
-            var events;
-
-            this._super();
-
-            events = {};
-
-            events['change ' + this.options.billing.addressDropdownSelector] = function (e) {
-                this.element.find(this.options.billing.newAddressFormSelector).toggle(!$(e.target).val());
-            };
-
-            events['click ' + this.options.billing.continueSelector] = function () {
-                if ($(this.options.billing.form).validation && $(this.options.billing.form).validation('isValid')) {
-                    this._billingSave();
-                }
-            };
-
-            this._on(events);
-
-            this.element.find(this.options.billing.form).validation();
-        },
-
-        _billingSave: function () {
-            this._ajaxContinue(this.options.billing.saveUrl, $(this.options.billing.form).serialize(), false, function () {
-                //Trigger indicating billing save. eg. GiftMessage listens to this to inject gift options
-                this.element.trigger('billingSave');
-            });
-        }
-    });
-
-    // Extension for mage.opcheckout - third section(Shipping Information) in one page checkout accordion
-    $.widget('mage.opcheckout', $.mage.opcheckout, {
-        options: {
-            shipping: {
-                form: '#co-shipping-form',
-                addressDropdownSelector: '#shipping\\:address-select',
-                newAddressFormSelector: '#shipping-new-address-form',
-                copyBillingSelector: '#shipping\\:same_as_billing',
-                countrySelector: '#shipping\\:country_id',
-                continueSelector: '#shipping-buttons-container .button'
-            }
-        },
-
-        _create: function () {
-            var events,
-                onInputPropChange;
-
-            this._super();
-
-            events = {};
-
-            onInputPropChange = function () {
-                $(this.options.shipping.copyBillingSelector).prop('checked', false);
-            };
-
-            events['change ' + this.options.shipping.addressDropdownSelector] = function (e) {
-                $(this.options.shipping.newAddressFormSelector).toggle(!$(e.target).val());
-                onInputPropChange.call(this);
-            };
-
-            // for guest checkout
-            events['input ' + this.options.shipping.form + ' :input[name]'] = onInputPropChange;
-
-            events['propertychange ' + this.options.shipping.form + ' :input[name]'] = onInputPropChange;
-
-            events['click ' + this.options.shipping.copyBillingSelector] = function (e) {
-                if ($(e.target).is(':checked')) {
-                    this._billingToShipping();
-                }
-            };
-
-            events['click ' + this.options.shipping.continueSelector] = function () {
-                if ($(this.options.shipping.form).validation && $(this.options.shipping.form).validation('isValid')) {
-                    this._ajaxContinue(this.options.shipping.saveUrl, $(this.options.shipping.form).serialize(), false, function () {
-                        //Trigger indicating shipping save. eg. GiftMessage listens to this to inject gift options
-                        this.element.trigger('shippingSave');
-                    });
-                }
-            };
-
-            this._on(events);
-
-            this.element.find(this.options.shipping.form).validation();
-        },
-
-        /**
-         * Copy billing address info to shipping address
-         * @private
-         */
-        _billingToShipping: function () {
-            $(':input[name]', this.options.billing.form).each($.proxy(function (key, value) {
-                var fieldObj = $(value.id.replace('billing:', '#shipping\\:'));
-
-                fieldObj.val($(value).val());
-
-                if (fieldObj.is('select')) {
-                    fieldObj.trigger('change');
-                }
-            }, this));
-
-            $(this.options.shipping.copyBillingSelector).prop('checked', true);
-        }
-    });
-
-    // Extension for mage.opcheckout - fourth section(Shipping Method) in one page checkout accordion
-    $.widget('mage.opcheckout', $.mage.opcheckout, {
-        options: {
-            shippingMethod: {
-                continueSelector: '#shipping-method-buttons-container .button',
-                form: '#co-shipping-method-form'
-            }
-        },
-
-        _create: function () {
-            this._super();
-            var events = {};
-            events['click ' + this.options.shippingMethod.continueSelector] = function () {
-                if (this._validateShippingMethod() &&
-                    $(this.options.shippingMethod.form).validation &&
-                    $(this.options.shippingMethod.form).validation('isValid')) {
-                    this._ajaxContinue(this.options.shippingMethod.saveUrl, $(this.options.shippingMethod.form).serialize());
-                }
-            };
-            $.extend(events, {
-                'click input[name=shipping_method]': function (e) {
-                    var selectedPrice = this.shippingCodePrice[$(e.target).val()] || 0,
-                        oldPrice = this.shippingCodePrice[this.currentShippingMethod] || 0;
-                    this.checkoutPrice = this.checkoutPrice - oldPrice + selectedPrice;
-                    this.currentShippingMethod = $(e.target).val();
-                },
-                'contentUpdated': function () {
-                    this.currentShippingMethod = this.element.find('input[name="shipping_method"]:checked').val();
-                    this.shippingCodePrice = this.element.find('[data-shipping-code-price]').data('shipping-code-price');
-                }
-            });
-            this._on(events);
-
-            this.element.find(this.options.shippingMethod.form).validation();
-        },
-
-        /**
-         * Make sure at least one shipping method is selected
-         * @return {Boolean}
-         * @private
-         */
-        _validateShippingMethod: function () {
-            var methods = this.element.find('[name="shipping_method"]');
-
-            if (methods.length === 0) {
-                alert({
-                    content: $.mage.__('We can\'t ship to this address. Please choose another address or edit the current one.')
-                });
-
-                return false;
-            }
-
-            if (methods.filter(':checked').length) {
-                return true;
-            }
-
-            alert({
-                content: $.mage.__('Please specify a shipping method.')
-            });
-
-            return false;
-        }
-    });
-
-    // Extension for mage.opcheckout - fifth section(Payment Information) in one page checkout accordion
-    $.widget('mage.opcheckout', $.mage.opcheckout, {
-        options: {
-            payment: {
-                continueSelector: '#payment-buttons-container .button',
-                form: '#co-payment-form',
-                methodsContainer: '#checkout-payment-method-load',
-                freeInput: {
-                    tmpl: '<input id="hidden-free" type="hidden" name="payment[method]" value="free">',
-                    selector: '#hidden-free'
-                }
-            }
-        },
-
-        _create: function () {
-            var events;
-
-            this._super();
-
-            this.freeInputTmpl = mageTemplate(this.options.payment.freeInput.tmpl);
-
-            events = {};
-
-            events['click ' + this.options.payment.continueSelector] = function () {
-                if (this._validatePaymentMethod() &&
-                    $(this.options.payment.form).validation &&
-                    $(this.options.payment.form).validation('isValid')) {
-                    this._ajaxContinue(this.options.payment.saveUrl, $(this.options.payment.form).serialize());
-                }
-            };
-
-            events['contentUpdated ' + this.options.payment.form] = function () {
-                var checkoutPrice;
-
-                $(this.options.payment.form).find('dd [name^="payment["]').prop('disabled', true);
-
-                checkoutPrice = this.element.find(this.options.payment.form).find('[data-checkout-price]').data('checkout-price');
-
-                if ($.isNumeric(checkoutPrice)) {
-                    this.checkoutPrice = checkoutPrice;
-                }
-
-                if (this.checkoutPrice < this.options.minBalance) {
-                    this._disablePaymentMethods();
-                } else {
-                    this._enablePaymentMethods();
-                }
-            };
-
-            events['click ' + this.options.payment.form + ' dt input:radio'] = '_paymentMethodHandler';
-
-            $.extend(events, {
-                updateCheckoutPrice: function (event, data) {
-                    if (data.price) {
-                        this.checkoutPrice += data.price;
-                    }
-
-                    if (data.totalPrice) {
-                        data.totalPrice = this.checkoutPrice;
-                    }
-
-                    if (this.checkoutPrice < this.options.minBalance) {
-                        // Add free input field, hide and disable unchecked checkbox payment method and all radio button payment methods
-                        this._disablePaymentMethods();
-                    } else {
-                        // Remove free input field, show all payment method
-                        this._enablePaymentMethods();
-                    }
-                }
-            });
-
-            this._on(events);
-
-            this.element.find(this.options.payment.form).validation({
-                errorPlacement: function (error, element) {
-                    if (element.attr('data-validate') && element.attr('data-validate').indexOf('validate-cc-ukss') >= 0) {
-                        element.parents('form').find('[data-validation-msg="validate-cc-ukss"]').html(error);
-                    } else {
-                        element.after(error);
-                    }
-                }
-            });
-        },
-
-        /**
-         * Display payment details when payment method radio button is checked
-         * @private
-         * @param {EventObject} e
-         */
-        _paymentMethodHandler: function (e) {
-            var _this = $(e.target),
-                parentsDl = _this.closest(this.options.methodsListContainer);
-            parentsDl.find(this.options.methodOn).prop('checked', false);
-            _this.prop('checked', true);
-            parentsDl.find(this.options.methodDescription).hide().find('[name^="payment["]').prop('disabled', true);
-            _this.closest(this.options.methodContainer)
-                .nextUntil(this.options.methodContainer)
-                .find(this.options.methodDescription).show().find('[name^="payment["]').prop('disabled', false);
-        },
-
-        /**
-         * make sure one payment method is selected
-         * @private
-         * @return {Boolean}
-         */
-        _validatePaymentMethod: function () {
-            var methods = this.element.find('[name^="payment["]');
-
-            if (methods.length === 0) {
-                alert({
-                    content: $.mage.__('We can\'t complete your order because you don\'t have a payment method set up.')
-                });
-
-                return false;
-            }
-
-            if (this.checkoutPrice < this.options.minBalance) {
-                return true;
-            } else if (methods.filter('input:radio:checked').length) {
-                return true;
-            }
-
-            alert({
-                content: $.mage.__('Please choose a payment method.')
-            });
-
-            return false;
-        },
-
-        /**
-         * Disable and enable payment methods
-         * @private
-         */
-        _disablePaymentMethods: function () {
-            var paymentForm = $(this.options.payment.form),
-                tmpl = this.freeInputTmpl({
-                    data: {}
-                });
-
-            paymentForm.find('input[name="payment[method]"]').prop('disabled', true);
-            paymentForm.find(this.options.payment.methodsContainer).find('[name^="payment["]').prop('disabled', true);
-            paymentForm.find('input[id^="use"][name^="payment[use"]:not(:checked)').prop('disabled', true).parent();
-            paymentForm.find(this.options.payment.freeInput.selector).remove();
-
-            $(tmpl).appendTo(paymentForm);
-        },
-
-        /**
-         * Enable and enable payment methods
-         * @private
-         */
-        _enablePaymentMethods: function () {
-            var paymentForm = $(this.options.payment.form);
-            paymentForm.find('input[name="payment[method]"]').prop('disabled', false);
-            paymentForm.find('input[name="payment[method]"]:checked').trigger('click');
-            paymentForm.find(this.options.payment.methodsContainer).show();
-            paymentForm.find('input[id^="use"][name^="payment[use"]:not(:checked)').prop('disabled', false).parent().show();
-            paymentForm.find(this.options.payment.freeInput.selector).remove();
-        }
-    });
-
-    // Extension for mage.opcheckout - last section(Order Review) in one page checkout accordion
-    $.widget('mage.opcheckout', $.mage.opcheckout, {
-        options: {
-            review: {
-                continueSelector: '#review-buttons-container .button',
-                container: '#opc-review',
-                agreementFormSelector: '#checkout-agreements input[type="checkbox"]'
-            }
-        },
-
-        _create: function () {
-            this._super();
-            var events = {};
-            events['click ' + this.options.review.continueSelector] = this._saveOrder;
-            events['saveOrder' + this.options.review.container] = this._saveOrder;
-            this._on(events);
-        },
-
-        _saveOrder: function () {
-            if ($(this.options.payment.form).validation &&
-                $(this.options.payment.form).validation('isValid')) {
-                this._ajaxContinue(
-                    this.options.review.saveUrl,
-                    $(this.options.payment.form).serialize() + '&' + $(this.options.review.agreementFormSelector).serialize());
-            }
-        }
-    });
-
-    return $.mage.opcheckout;
-});
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/payment-authentication.js b/app/code/Magento/Checkout/view/frontend/web/js/payment-authentication.js
deleted file mode 100644
index 8b03193bb79c95626391cfb4d75691def2f3a1cd..0000000000000000000000000000000000000000
--- a/app/code/Magento/Checkout/view/frontend/web/js/payment-authentication.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-/*jshint jquery:true*/
-/**
- * @removeCandidate
- */
-define([
-    "jquery",
-    "jquery/ui"
-], function($){
-    "use strict";
-    
-    $.widget('mage.paymentAuthentication', {
-        options : {
-            bodySelector: '[data-container="body"]'
-        },
-
-        _create: function () {
-            // add a trigger on the body for payment authentication state changes
-            this.element.closest(this.options.bodySelector).on("paymentAuthentication", $.proxy(this._paymentmentAthenticationTrigger, this));
-        },
-
-        /**
-         * This method processes the paymentAuthentication actions.
-         */
-        _paymentmentAthenticationTrigger: function (event, data) {
-            if (data.state === 'start') {
-                this.element.hide();
-            } else {
-                this.element.show();
-            }
-        }
-    });
-
-    return $.mage.paymentAuthentication;
-});
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js b/app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js
index 7a6b4e88be10c65b823c7616ac0e46a3ed5720a1..7754719a506ff406fb18b2b6f3a92aff3366073c 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js
@@ -8,15 +8,19 @@ define([
         'Magento_Customer/js/model/authentication-popup',
         'Magento_Customer/js/customer-data'
     ],
-    function($, authenticationPopup, customerData) {
+    function ($, authenticationPopup, customerData) {
+        'use strict';
+
         return function (config, element) {
-            $(element).click(function(event) {
-                event.preventDefault();
+            $(element).click(function (event) {
                 var cart = customerData.get('cart'),
                     customer = customerData.get('customer');
 
+                event.preventDefault();
+
                 if (!customer().firstname && !cart().isGuestCheckoutAllowed) {
                     authenticationPopup.showModal();
+
                     return false;
                 }
                 location.href = config.checkoutUrl;
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js
index 80d9a5982a6ab575ab68f6500ec72d0e2117d788..b69365ebc0f17eedcdc4b039c235e8286ce3bf73 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js
@@ -82,11 +82,14 @@ define(
                     });
 
                 quote.billingAddress.subscribe(function (newAddress) {
-                    this.isAddressSameAsShipping(
-                        newAddress != null &&
-                            newAddress.getCacheKey() == quote.shippingAddress().getCacheKey() &&
-                            !quote.isVirtual()
-                    );
+                    if (quote.isVirtual()) {
+                        this.isAddressSameAsShipping(false);
+                    } else {
+                        this.isAddressSameAsShipping(
+                            newAddress != null &&
+                            newAddress.getCacheKey() == quote.shippingAddress().getCacheKey()
+                        );
+                    }
 
                     if (newAddress != null && newAddress.saveInAddressBook !== undefined) {
                         this.saveInAddressBook(newAddress.saveInAddressBook);
@@ -115,6 +118,9 @@ define(
             useShippingAddress: function () {
                 if (this.isAddressSameAsShipping()) {
                     selectBillingAddress(quote.shippingAddress());
+                    if (window.checkoutConfig.reloadOnBillingAddress) {
+                        setBillingAddressAction(globalMessageList);
+                    }
                     this.isAddressDetailsVisible(true);
                 } else {
                     lastSelectedBillingAddress = quote.billingAddress();
@@ -142,12 +148,13 @@ define(
 
                     if (!this.source.get('params.invalid')) {
                         var addressData = this.source.get(this.dataScopePrefix),
-                            newBillingAddress = createBillingAddress(addressData);
+                            newBillingAddress;
 
-                        if (this.isCustomerLoggedIn && !this.customerHasAddresses) {
+                        if (customer.isLoggedIn() && !this.customerHasAddresses) {
                             this.saveInAddressBook(true);
                         }
                         addressData.save_in_address_book = this.saveInAddressBook();
+                        newBillingAddress = createBillingAddress(addressData);
 
                         // New address must be selected as a billing address
                         selectBillingAddress(newBillingAddress);
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/Model/Deployer.php b/app/code/Magento/Deploy/Model/Deployer.php
index cada5a4549aee90b4f18f6df5a2588dd37d82c25..60480c220e23ccc1762243ab61075bf7fb7aec7b 100644
--- a/app/code/Magento/Deploy/Model/Deployer.php
+++ b/app/code/Magento/Deploy/Model/Deployer.php
@@ -6,6 +6,7 @@
 
 namespace Magento\Deploy\Model;
 
+use Magento\Framework\View\Asset\PreProcessor\AlternativeSourceInterface;
 use Magento\Framework\App\ObjectManagerFactory;
 use Magento\Framework\App\View\Deployment\Version;
 use Magento\Framework\App\View\Asset\Publisher;
@@ -19,6 +20,7 @@ use Symfony\Component\Console\Output\OutputInterface;
  * A service for deploying Magento static view files for production mode
  *
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 class Deployer
 {
@@ -66,10 +68,18 @@ class Deployer
     protected $jsTranslationConfig;
 
     /**
+     * @var AlternativeSourceInterface[]
+     */
+    private $alternativeSources;
+
+    /**
+     * Constructor
+     *
      * @param Files $filesUtil
      * @param OutputInterface $output
      * @param Version\StorageInterface $versionStorage
      * @param JsTranslationConfig $jsTranslationConfig
+     * @param AlternativeSourceInterface[] $alternativeSources
      * @param bool $isDryRun
      */
     public function __construct(
@@ -77,6 +87,7 @@ class Deployer
         OutputInterface $output,
         Version\StorageInterface $versionStorage,
         JsTranslationConfig $jsTranslationConfig,
+        array $alternativeSources,
         $isDryRun = false
     ) {
         $this->filesUtil = $filesUtil;
@@ -85,6 +96,13 @@ class Deployer
         $this->isDryRun = $isDryRun;
         $this->jsTranslationConfig = $jsTranslationConfig;
         $this->parentTheme = [];
+
+        array_map(
+            function (AlternativeSourceInterface $alternative) {
+            },
+            $alternativeSources
+        );
+        $this->alternativeSources = $alternativeSources;
     }
 
     /**
@@ -124,6 +142,7 @@ class Deployer
                             'design' => $design,
                         ]
                     );
+                    /** @var \Magento\RequireJs\Model\FileManager $fileManager */
                     $fileManager = $this->objectManager->create(
                         'Magento\RequireJs\Model\FileManager',
                         [
@@ -148,11 +167,17 @@ class Deployer
                                     $this->findAncestors($area . Theme::THEME_PATH_SEPARATOR . $themePath)
                                 ))
                         ) {
-                            $this->deployFile($filePath, $area, $themePath, $locale, $module);
+                            $compiledFile = $this->deployFile($filePath, $area, $themePath, $locale, $module);
+                            if ($compiledFile !== '') {
+                                $this->deployFile($compiledFile, $area, $themePath, $locale, $module);
+                            }
                         }
                     }
                     foreach ($libFiles as $filePath) {
-                        $this->deployFile($filePath, $area, $themePath, $locale, null);
+                        $compiledFile = $this->deployFile($filePath, $area, $themePath, $locale, null);
+                        if ($compiledFile !== '') {
+                            $this->deployFile($compiledFile, $area, $themePath, $locale, null);
+                        }
                     }
                     if ($this->jsTranslationConfig->dictionaryEnabled()) {
                         $this->deployFile(
@@ -169,7 +194,7 @@ class Deployer
                 }
             }
         }
-        $this->output->writeln("=== Minify templates ===");
+        $this->output->writeln('=== Minify templates ===');
         $this->count = 0;
         foreach ($this->filesUtil->getPhtmlFiles(false, false) as $template) {
             $this->htmlMinifier->minify($template);
@@ -268,15 +293,25 @@ class Deployer
      * @param string $themePath
      * @param string $locale
      * @param string $module
-     * @return void
+     * @return string
+     * @throws \InvalidArgumentException
+     *
      * @SuppressWarnings(PHPMD.NPathComplexity)
      */
     private function deployFile($filePath, $area, $themePath, $locale, $module)
     {
-        $requestedPath = $filePath;
-        if (substr($filePath, -5) == '.less') {
-            $requestedPath = preg_replace('/.less$/', '.css', $filePath);
+        $compiledFile = '';
+        $extension = pathinfo($filePath, PATHINFO_EXTENSION);
+
+        foreach ($this->alternativeSources as $name => $alternative) {
+            if (in_array($extension, $alternative->getAlternativesExtensionsNames(), true)
+                && strpos(basename($filePath), '_') !== 0
+            ) {
+                $compiledFile = substr($filePath, 0, strlen($filePath) - strlen($extension) - 1);
+                $compiledFile = $compiledFile . '.' . $name;
+            }
         }
+
         $logMessage = "Processing file '$filePath' for area '$area', theme '$themePath', locale '$locale'";
         if ($module) {
             $logMessage .= ", module '$module'";
@@ -288,7 +323,7 @@ class Deployer
 
         try {
             $asset = $this->assetRepo->createAsset(
-                $requestedPath,
+                $filePath,
                 ['area' => $area, 'theme' => $themePath, 'locale' => $locale, 'module' => $module]
             );
             if ($this->output->isVeryVerbose()) {
@@ -303,18 +338,13 @@ class Deployer
                 $this->bundleManager->addAsset($asset);
             }
             $this->count++;
-        } catch (\Less_Exception_Compiler $e) {
-            $this->verboseLog(
-                "\tNotice: Could not parse LESS file '$filePath'. "
-                . "This may indicate that the file is incomplete, but this is acceptable. "
-                . "The file '$filePath' will be combined with another LESS file."
-            );
-            $this->verboseLog("\tCompiler error: " . $e->getMessage());
         } catch (\Exception $e) {
-            $this->output->writeln($e->getMessage() . " ($logMessage)");
+            $this->output->write('.');
             $this->verboseLog($e->getTraceAsString());
             $this->errorCount++;
         }
+
+        return $compiledFile;
     }
 
     /**
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/Deploy/etc/di.xml b/app/code/Magento/Deploy/etc/di.xml
index 9d0ed7220c62a84f0dec3c4baab07c7c49e11131..59fb508c691b53a6137a129bbcc2292acf752a3d 100644
--- a/app/code/Magento/Deploy/etc/di.xml
+++ b/app/code/Magento/Deploy/etc/di.xml
@@ -6,6 +6,13 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
+    <type name="Magento\Deploy\Model\Deployer">
+        <arguments>
+            <argument name="alternativeSources" xsi:type="array">
+                <item name="css" xsi:type="object">AlternativeSourceProcessors</item>
+            </argument>
+        </arguments>
+    </type>
     <type name="Magento\Framework\Console\CommandList">
         <arguments>
             <argument name="commands" xsi:type="array">
diff --git a/app/code/Magento/Developer/Console/Command/CssDeployCommand.php b/app/code/Magento/Developer/Console/Command/CssDeployCommand.php
index 4abf04b34f01f82ef58b214bf442202634949664..ac651b633d026790bfe6d6d3a50283303e00eaa1 100644
--- a/app/code/Magento/Developer/Console/Command/CssDeployCommand.php
+++ b/app/code/Magento/Developer/Console/Command/CssDeployCommand.php
@@ -6,6 +6,7 @@
 
 namespace Magento\Developer\Console\Command;
 
+use Magento\Framework\View\Asset\PreProcessor\Pool;
 use Symfony\Component\Console\Command\Command;
 use Symfony\Component\Console\Input\InputArgument;
 use Symfony\Component\Console\Input\InputOption;
@@ -17,7 +18,6 @@ use Magento\Framework\App\State;
 use Magento\Framework\View\Asset\Repository;
 use Magento\Framework\ObjectManagerInterface;
 use Magento\Framework\App\ObjectManager\ConfigLoader;
-use Magento\Framework\View\Asset\SourceFileGeneratorPool;
 use Magento\Framework\View\Asset\PreProcessor\ChainFactoryInterface;
 use Magento\Framework\App\Filesystem\DirectoryList;
 use Magento\Framework\Validator\Locale;
@@ -73,11 +73,6 @@ class CssDeployCommand extends Command
      */
     private $state;
 
-    /**
-     * @var SourceFileGeneratorPool
-     */
-    private $sourceFileGeneratorPool;
-
     /**
      * @var Source
      */
@@ -98,6 +93,11 @@ class CssDeployCommand extends Command
      */
     private $validator;
 
+    /**
+     * @var Pool
+     */
+    private $pool;
+
     /**
      * Inject dependencies
      *
@@ -106,10 +106,10 @@ class CssDeployCommand extends Command
      * @param ConfigLoader $configLoader
      * @param State $state
      * @param Source $assetSource
-     * @param SourceFileGeneratorPool $sourceFileGeneratorPoll
      * @param ChainFactoryInterface $chainFactory
      * @param Filesystem $filesystem
      * @param Locale $validator
+     * @param Pool $pool
      */
     public function __construct(
         ObjectManagerInterface $objectManager,
@@ -117,22 +117,22 @@ class CssDeployCommand extends Command
         ConfigLoader $configLoader,
         State $state,
         Source $assetSource,
-        SourceFileGeneratorPool $sourceFileGeneratorPoll,
         ChainFactoryInterface $chainFactory,
         Filesystem $filesystem,
-        Locale $validator
+        Locale $validator,
+        Pool $pool
     ) {
         $this->state = $state;
         $this->objectManager = $objectManager;
         $this->configLoader = $configLoader;
         $this->assetRepo = $assetRepo;
-        $this->sourceFileGeneratorPool = $sourceFileGeneratorPoll;
         $this->assetSource = $assetSource;
         $this->chainFactory = $chainFactory;
         $this->filesystem = $filesystem;
         $this->validator = $validator;
 
         parent::__construct();
+        $this->pool = $pool;
     }
 
     /**
@@ -203,8 +203,6 @@ class CssDeployCommand extends Command
         $this->state->setAreaCode($area);
         $this->objectManager->configure($this->configLoader->load($area));
 
-        $sourceFileGenerator = $this->sourceFileGeneratorPool->create($type);
-
         foreach ($input->getArgument(self::FILE_ARGUMENT) as $file) {
             $file .= '.' . $type;
 
@@ -233,14 +231,11 @@ class CssDeployCommand extends Command
                 ]
             );
 
-            $processedCoreFile = $sourceFileGenerator->generateFileTree($chain);
-
+            $this->pool->process($chain);
             $targetDir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
-            $source = $rootDir->getRelativePath($processedCoreFile);
-            $destination = $asset->getPath();
-            $rootDir->copyFile($source, $destination, $targetDir);
+            $targetDir->writeFile($chain->getAsset()->getPath(), $chain->getContent());
 
-            $output->writeln("<info>Successfully processed dynamic stylesheet into CSS</info>");
+            $output->writeln('<info>Successfully processed dynamic stylesheet into CSS</info>');
         }
     }
 }
diff --git a/app/code/Magento/Developer/Test/Unit/Console/Command/CssDeployCommandTest.php b/app/code/Magento/Developer/Test/Unit/Console/Command/CssDeployCommandTest.php
index d274aa003133d2bd6a8bebc061113cb6e94cfd5d..0d930989e424eefbcd192c0c3ca33322c13ba06a 100644
--- a/app/code/Magento/Developer/Test/Unit/Console/Command/CssDeployCommandTest.php
+++ b/app/code/Magento/Developer/Test/Unit/Console/Command/CssDeployCommandTest.php
@@ -7,17 +7,20 @@
 namespace Magento\Developer\Test\Unit\Console\Command;
 
 use Magento\Framework\Filesystem;
+use Magento\Framework\View\Asset\PreProcessor\Pool;
 use Magento\Framework\View\Asset\Source;
 use Magento\Framework\App\State;
 use Magento\Framework\View\Asset\Repository;
 use Magento\Framework\ObjectManagerInterface;
 use Magento\Framework\App\ObjectManager\ConfigLoader;
-use Magento\Framework\View\Asset\SourceFileGeneratorPool;
 use Magento\Framework\View\Asset\PreProcessor\ChainFactoryInterface;
 use Magento\Developer\Console\Command\CssDeployCommand;
 use Symfony\Component\Console\Tester\CommandTester;
 use Magento\Framework\Validator\Locale;
 
+/**
+ * Class CssDeployCommandTest
+ */
 class CssDeployCommandTest extends \PHPUnit_Framework_TestCase
 {
     /**
@@ -45,11 +48,6 @@ class CssDeployCommandTest extends \PHPUnit_Framework_TestCase
      */
     private $state;
 
-    /**
-     * @var SourceFileGeneratorPool|\PHPUnit_Framework_MockObject_MockObject
-     */
-    private $sourceFileGeneratorPool;
-
     /**
      * @var Source|\PHPUnit_Framework_MockObject_MockObject
      */
@@ -70,6 +68,11 @@ class CssDeployCommandTest extends \PHPUnit_Framework_TestCase
      */
     private $validator;
 
+    /**
+     * @var Pool|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $poolMock;
+
     public function setUp()
     {
         $this->objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface');
@@ -77,18 +80,14 @@ class CssDeployCommandTest extends \PHPUnit_Framework_TestCase
         $this->configLoader = $this->getMock('Magento\Framework\App\ObjectManager\ConfigLoader', [], [], '', false);
         $this->state = $this->getMock('Magento\Framework\App\State', [], [], '', false);
         $this->assetSource = $this->getMock('Magento\Framework\View\Asset\Source', [], [], '', false);
-        $this->sourceFileGeneratorPool = $this->getMock(
-            'Magento\Framework\View\Asset\SourceFileGeneratorPool',
-            [],
-            [],
-            '',
-            false
-        );
         $this->chainFactory = $this->getMockForAbstractClass(
             'Magento\Framework\View\Asset\PreProcessor\ChainFactoryInterface'
         );
         $this->filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false);
         $this->validator = $this->getMock('Magento\Framework\Validator\Locale', [], [], '', false);
+        $this->poolMock = $this->getMockBuilder('Magento\Framework\View\Asset\PreProcessor\Pool')
+            ->disableOriginalConstructor()
+            ->getMock();
 
         $this->command = new CssDeployCommand(
             $this->objectManager,
@@ -96,10 +95,10 @@ class CssDeployCommandTest extends \PHPUnit_Framework_TestCase
             $this->configLoader,
             $this->state,
             $this->assetSource,
-            $this->sourceFileGeneratorPool,
             $this->chainFactory,
             $this->filesystem,
-            $this->validator
+            $this->validator,
+            $this->poolMock
         );
     }
 
@@ -109,10 +108,6 @@ class CssDeployCommandTest extends \PHPUnit_Framework_TestCase
 
         $this->configLoader->expects($this->once())->method('load')->with('frontend')->willReturn([]);
         $this->objectManager->expects($this->once())->method('configure');
-        $this->sourceFileGeneratorPool->expects($this->once())
-            ->method('create')
-            ->with('less')
-            ->willReturn($this->getMock('Magento\Framework\View\Asset\SourceFileGeneratorInterface'));
         $asset = $this->getMockForAbstractClass('Magento\Framework\View\Asset\LocalInterface');
         $asset->expects($this->once())->method('getContentType')->willReturn('type');
         $this->assetRepo->expects($this->once())
@@ -128,6 +123,10 @@ class CssDeployCommandTest extends \PHPUnit_Framework_TestCase
             ->willReturn($asset);
         $this->assetSource->expects($this->once())->method('findSource')->willReturn('/dev/null');
 
+        $chainMock = $this->getMock('Magento\Framework\View\Asset\PreProcessor\Chain', [], [], '', false);
+        $assetMock = $this->getMockBuilder('Magento\Framework\View\Asset\LocalInterface')
+            ->getMockForAbstractClass();
+
         $this->chainFactory->expects($this->once())
             ->method('create')
             ->with(
@@ -137,8 +136,11 @@ class CssDeployCommandTest extends \PHPUnit_Framework_TestCase
                     'origContentType' => 'type',
                     'origAssetPath' => 'relative/path',
                 ]
-            )
-            ->willReturn($this->getMock('Magento\Framework\View\Asset\PreProcessor\Chain', [], [], '', false));
+            )->willReturn($chainMock);
+
+        $chainMock->expects(self::once())
+            ->method('getAsset')
+            ->willReturn($assetMock);
 
         $rootDir = $this->getMock('\Magento\Framework\Filesystem\Directory\WriteInterface', [], [], '', false);
         $this->filesystem->expects($this->at(0))->method('getDirectoryWrite')->willReturn($rootDir);
diff --git a/app/code/Magento/Developer/etc/di.xml b/app/code/Magento/Developer/etc/di.xml
index c43c9e06ca2cfe9e1eee412b80729f12d1079df7..a208ec7c5de01f26250b2a93d5d571732899c2d6 100644
--- a/app/code/Magento/Developer/etc/di.xml
+++ b/app/code/Magento/Developer/etc/di.xml
@@ -8,7 +8,7 @@
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
     <preference for="Magento\Framework\View\Asset\PreProcessor\ChainFactoryInterface" type="Magento\Developer\Model\View\Asset\PreProcessor\DeveloperChainFactory"/>
     <preference for="Magento\Framework\Css\PreProcessor\ErrorHandlerInterface" type="Magento\Framework\Css\PreProcessor\ErrorHandler" />
-    <preference for="Magento\Framework\Css\PreProcessor\AdapterInterface" type="Magento\Framework\Css\PreProcessor\Adapter\Less\Oyejorge" />
+    <preference for="Magento\Framework\View\Asset\PreProcessor\Helper\SortInterface" type="Magento\Framework\View\Asset\PreProcessor\Helper\Sort"/>
 
     <type name="Magento\Framework\View\Result\Page">
         <arguments>
@@ -45,52 +45,58 @@
         </arguments>
     </virtualType>
 
+    <virtualType name="viewFileFallbackResolver" type="Magento\Framework\View\Design\FileResolution\Fallback\Resolver\Alternative"/>
 
-
-    <virtualType name="viewFileFallbackResolver" type="Magento\Framework\View\Design\FileResolution\Fallback\Resolver\Alternative">
+    <virtualType name="AlternativeSourceProcessors" type="Magento\Framework\View\Asset\PreProcessor\AlternativeSource">
         <arguments>
-            <argument name="alternativeExtensions" xsi:type="array">
-                <item name="css" xsi:type="array">
-                    <item name="less" xsi:type="string">less</item>
+            <argument name="lockName" xsi:type="string">alternative-source-css</argument>
+            <argument name="lockerProcess" xsi:type="object">Magento\Framework\View\Asset\LockerProcess</argument>
+            <argument name="alternatives" xsi:type="array">
+                <item name="less" xsi:type="array">
+                    <item name="class" xsi:type="string">Magento\Framework\Css\PreProcessor\Adapter\Less\Processor</item>
                 </item>
             </argument>
         </arguments>
     </virtualType>
+
     <type name="Magento\Framework\View\Asset\PreProcessor\Pool">
         <arguments>
-            <argument name="preProcessors" xsi:type="array">
+            <argument name="defaultPreprocessor" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\Passthrough</argument>
+            <argument name="preprocessors" xsi:type="array">
                 <item name="less" xsi:type="array">
-                    <item name="css" xsi:type="array">
-                        <item name="less" xsi:type="string">Magento\Framework\Css\PreProcessor\Less</item>
-                        <item name="variable_notation" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\VariableNotation</item>
-                        <item name="module_notation" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\ModuleNotation</item>
-                        <item name="css_min" xsi:type="string">cssMinificationProcessor</item>
+                    <item name="magento_import" xsi:type="array">
+                        <item name="class" xsi:type="string">Magento\Framework\Css\PreProcessor\Instruction\MagentoImport</item>
                     </item>
-                    <item name="less" xsi:type="array">
-                        <item name="magento_import" xsi:type="string">Magento\Framework\Css\PreProcessor\Instruction\MagentoImport</item>
-                        <item name="import" xsi:type="string">Magento\Framework\Css\PreProcessor\Instruction\Import</item>
+                    <item name="import" xsi:type="array">
+                        <item name="after" xsi:type="string">magento_import</item>
+                        <item name="class" xsi:type="string">Magento\Framework\Css\PreProcessor\Instruction\Import</item>
                     </item>
                 </item>
                 <item name="css" xsi:type="array">
-                    <item name="css" xsi:type="array">
-                        <item name="variable_notation" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\VariableNotation</item>
-                        <item name="module_notation" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\ModuleNotation</item>
-                        <item name="css_min" xsi:type="string">cssMinificationProcessor</item>
+                    <item name="alternativeSource" xsi:type="array">
+                        <item name="class" xsi:type="string">AlternativeSourceProcessors</item>
+                    </item>
+                    <item name="variable_notation" xsi:type="array">
+                        <item name="after" xsi:type="string">alternativeSource</item>
+                        <item name="class" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\VariableNotation</item>
+                    </item>
+                    <item name="module_notation" xsi:type="array">
+                        <item name="after" xsi:type="string">variable_notation</item>
+                        <item name="class" xsi:type="string">Magento\Framework\View\Asset\PreProcessor\ModuleNotation</item>
+                    </item>
+                    <item name="css_min" xsi:type="array">
+                        <item name="after" xsi:type="string">module_notation</item>
+                        <item name="class" xsi:type="string">cssMinificationProcessor</item>
                     </item>
                 </item>
                 <item name="js" xsi:type="array">
-                    <item name="js" xsi:type="array">
-                        <item name="js_min" xsi:type="string">jsMinificationProcessor</item>
+                    <item name="js_min" xsi:type="array">
+                        <item name="class" xsi:type="string">jsMinificationProcessor</item>
                     </item>
                 </item>
             </argument>
         </arguments>
     </type>
-    <type name="Magento\Framework\Css\PreProcessor\Less">
-        <arguments>
-            <argument name="adapter" xsi:type="object">Magento\Framework\Css\PreProcessor\Adapter\Less\Oyejorge</argument>
-        </arguments>
-    </type>
 
     <type name="Magento\Framework\Css\PreProcessor\Instruction\MagentoImport">
         <arguments>
@@ -126,22 +132,4 @@
             <argument name="subDir" xsi:type="string">web</argument>
         </arguments>
     </virtualType>
-
-    <type name="Magento\Framework\View\Asset\SourceFileGeneratorPool">
-        <arguments>
-            <argument name="fileGeneratorTypes" xsi:type="array">
-                <item name="less" xsi:type="object">fileAssemblerFileGenerator</item>
-            </argument>
-        </arguments>
-    </type>
-    <virtualType name="fileAssemblerFileGenerator" type="Magento\Framework\Css\PreProcessor\FileGenerator">
-        <arguments>
-            <argument name="relatedGenerator" xsi:type="object">fileAssemblerRelatedFilesGenerator</argument>
-        </arguments>
-    </virtualType>
-    <virtualType name="fileAssemblerRelatedFilesGenerator" type="Magento\Developer\Model\Css\PreProcessor\FileGenerator\PublicationDecorator">
-        <arguments>
-            <argument name="publisher" xsi:type="object">developerPublisher</argument>
-        </arguments>
-    </virtualType>
 </config>
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/Email/Model/Template/Filter.php b/app/code/Magento/Email/Model/Template/Filter.php
index ebe3d0d8e2974409158217668265124e261bc860..a3cb0a5999688c6ad09a2175663835b3333eea50 100644
--- a/app/code/Magento/Email/Model/Template/Filter.php
+++ b/app/code/Magento/Email/Model/Template/Filter.php
@@ -5,6 +5,8 @@
  */
 namespace Magento\Email\Model\Template;
 
+use Magento\Framework\View\Asset\ContentProcessorInterface;
+
 /**
  * Core Email Template Filter Model
  *
@@ -64,7 +66,7 @@ class Filter extends \Magento\Framework\Filter\Template
      *
      * @var int
      */
-    protected $_storeId = null;
+    protected $_storeId;
 
     /**
      * @var array
@@ -89,7 +91,7 @@ class Filter extends \Magento\Framework\Filter\Template
     /**
      * @var \Magento\Framework\Escaper
      */
-    protected $_escaper = null;
+    protected $_escaper;
 
     /**
      * Core store config
@@ -787,7 +789,7 @@ class Filter extends \Magento\Framework\Filter\Template
 
         $css = $this->getCssFilesContent([$params['file']]);
 
-        if (strpos($css, \Magento\Framework\Css\PreProcessor\AdapterInterface::ERROR_MESSAGE_PREFIX) !== false) {
+        if (strpos($css, ContentProcessorInterface::ERROR_MESSAGE_PREFIX) !== false) {
             // Return compilation error wrapped in CSS comment
             return '/*' . PHP_EOL . $css . PHP_EOL . '*/';
         } elseif (!empty($css)) {
@@ -908,7 +910,7 @@ class Filter extends \Magento\Framework\Filter\Template
         if ($html && $cssToInline) {
             try {
                 // Don't try to compile CSS that has compilation errors
-                if (strpos($cssToInline, \Magento\Framework\Css\PreProcessor\AdapterInterface::ERROR_MESSAGE_PREFIX)
+                if (strpos($cssToInline, ContentProcessorInterface::ERROR_MESSAGE_PREFIX)
                     !== false
                 ) {
                     throw new \Magento\Framework\Exception\MailException(
diff --git a/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php b/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php
index a21a6dbd30bf1b2c72d2c81b412d2c3bd9d321ab..cd7b55f4499e7a59564dfb73c94bfe0538b61d5f 100644
--- a/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php
+++ b/app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php
@@ -282,7 +282,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase
             ],
             'CSS with error does not get inlined' => [
                 '<html><p></p></html>',
-                \Magento\Framework\Css\PreProcessor\AdapterInterface::ERROR_MESSAGE_PREFIX,
+                \Magento\Framework\View\Asset\ContentProcessorInterface::ERROR_MESSAGE_PREFIX,
                 ['<html><p></p></html>'],
             ],
             'Ensure disableStyleBlocksParsing option is working' => [
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/GiftMessage/view/frontend/web/js/model/gift-options.js b/app/code/Magento/GiftMessage/view/frontend/web/js/model/gift-options.js
index 187f17e5b3962788ba0eb03a95858e4672d27c7b..53b8d8fde3b48ba4bc2579738dfe7ee55d10f8f7 100644
--- a/app/code/Magento/GiftMessage/view/frontend/web/js/model/gift-options.js
+++ b/app/code/Magento/GiftMessage/view/frontend/web/js/model/gift-options.js
@@ -3,19 +3,33 @@
  * See COPYING.txt for license details.
  */
 /*global define*/
-define(['underscore'],
-    function (_) {
-        "use strict";
+define(['underscore', 'ko'],
+    function (_, ko) {
+
+        'use strict';
+
         return {
-            options: [],
-            addOption: function(option) {
-                if(!this.options.hasOwnProperty(option.itemId)) {
-                    this.options[option.itemId] = option;
+            options: ko.observableArray([]),
+            addOption: function (option) {
+                if (!this.options().hasOwnProperty(option.itemId)) {
+                    this.options.push({
+                            id: option.itemId, value: option
+                        }
+                    );
                 }
             },
-            getOptionByItemId: function(itemId) {
-                return this.options.hasOwnProperty(itemId) ? this.options[itemId] : null;
+            getOptionByItemId: function (itemId) {
+                var option = null;
+                _.each(this.options(), function (data) {
+                    if (data.id === itemId) {
+                        option = data.value;
+
+                        return false;
+                    }
+                });
+
+                return option;
             }
-        }
+        };
     }
 );
diff --git a/app/code/Magento/GiftMessage/view/frontend/web/js/view/gift-message.js b/app/code/Magento/GiftMessage/view/frontend/web/js/view/gift-message.js
index dae05d712dd9b05eba81c48108e2908c0290b9ee..fc4d6931be2e0629fe444de52c4b19e8e83ae209 100644
--- a/app/code/Magento/GiftMessage/view/frontend/web/js/view/gift-message.js
+++ b/app/code/Magento/GiftMessage/view/frontend/web/js/view/gift-message.js
@@ -3,7 +3,12 @@
  * See COPYING.txt for license details.
  */
 /*global define*/
-define(['uiComponent', '../model/gift-message', '../model/gift-options', '../action/gift-options'],
+define([
+        'uiComponent',
+        'Magento_GiftMessage/js/model/gift-message',
+        'Magento_GiftMessage/js/model/gift-options',
+        'Magento_GiftMessage/js/action/gift-options'
+    ],
     function (Component, giftMessage, giftOptions, giftOptionsService) {
         "use strict";
         return Component.extend({
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>&nbsp;' .
         '<input type="text" name="' .
         $name .
-        '[]" class="input-text input-text-range"' .
+        '[]" class="admin__control-text input-text input-text-range"' .
         ' value="' .
         $fromValue .
         '"/>&nbsp;' .
@@ -200,7 +200,7 @@ class Filter extends \Magento\Backend\Block\Widget\Grid\Extended
         ) .
         ':</strong>&nbsp;<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/Multishipping/view/frontend/requirejs-config.js b/app/code/Magento/Multishipping/view/frontend/requirejs-config.js
index 034ecbd8057cc90818703b5c87aca8e3aeec4078..dbbc46fd928660b3293d2fcd4d2f9a2c270ecb59 100644
--- a/app/code/Magento/Multishipping/view/frontend/requirejs-config.js
+++ b/app/code/Magento/Multishipping/view/frontend/requirejs-config.js
@@ -7,7 +7,8 @@ var config = {
     map: {
         '*': {
             multiShipping: 'Magento_Multishipping/js/multi-shipping',
-            orderOverview: 'Magento_Multishipping/js/overview'
+            orderOverview: 'Magento_Multishipping/js/overview',
+            payment: 'Magento_Multishipping/js/payment'
         }
     }
 };
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/payment.js b/app/code/Magento/Multishipping/view/frontend/web/js/payment.js
similarity index 99%
rename from app/code/Magento/Checkout/view/frontend/web/js/payment.js
rename to app/code/Magento/Multishipping/view/frontend/web/js/payment.js
index 1442bb787605236b3b40abfe430e9b98af6afd24..8baea212f57c07b5449d38b38987010f0f72f790 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/payment.js
+++ b/app/code/Magento/Multishipping/view/frontend/web/js/payment.js
@@ -4,9 +4,7 @@
  */
 /*jshint browser:true*/
 /*global alert*/
-/**
- * @removeCandidate
- */
+
 define([
     'jquery',
     'mage/template',
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/Gateway/Command/CommandPool.php b/app/code/Magento/Payment/Gateway/Command/CommandPool.php
index 6b1014d5aa76d9fefb8a1efb80583147067f2853..d1fc52a72378248b3a9cc87da3fd36d133924d93 100644
--- a/app/code/Magento/Payment/Gateway/Command/CommandPool.php
+++ b/app/code/Magento/Payment/Gateway/Command/CommandPool.php
@@ -18,17 +18,17 @@ class CommandPool implements CommandPoolInterface
     private $commands;
 
     /**
-     * @param array $commands
      * @param TMapFactory $tmapFactory
+     * @param array $commands
      */
     public function __construct(
-        array $commands,
-        TMapFactory $tmapFactory
+        TMapFactory $tmapFactory,
+        array $commands = []
     ) {
         $this->commands = $tmapFactory->create(
             [
                 'array' => $commands,
-                'type' => 'Magento\Payment\Gateway\CommandInterface'
+                'type' => CommandInterface::class
             ]
         );
     }
diff --git a/app/code/Magento/Payment/Gateway/Config/ValueHandlerPool.php b/app/code/Magento/Payment/Gateway/Config/ValueHandlerPool.php
index 0364336a2ea5e42df84c190359218276bd2aa168..b23964b064274e9e4d475c46a23d3448ff32024a 100644
--- a/app/code/Magento/Payment/Gateway/Config/ValueHandlerPool.php
+++ b/app/code/Magento/Payment/Gateway/Config/ValueHandlerPool.php
@@ -21,12 +21,12 @@ class ValueHandlerPool implements \Magento\Payment\Gateway\Config\ValueHandlerPo
     private $handlers;
 
     /**
-     * @param array $handlers
      * @param TMapFactory $tmapFactory
+     * @param array $handlers
      */
     public function __construct(
-        array $handlers,
-        TMapFactory $tmapFactory
+        TMapFactory $tmapFactory,
+        array $handlers
     ) {
         if (!isset($handlers[self::DEFAULT_HANDLER])) {
             throw new \LogicException('Default handler should be provided.');
@@ -35,7 +35,7 @@ class ValueHandlerPool implements \Magento\Payment\Gateway\Config\ValueHandlerPo
         $this->handlers = $tmapFactory->create(
             [
                 'array' => $handlers,
-                'type' => 'Magento\Payment\Gateway\Config\ValueHandlerInterface'
+                'type' => ValueHandlerInterface::class
             ]
         );
     }
diff --git a/app/code/Magento/Payment/Gateway/Request/BuilderComposite.php b/app/code/Magento/Payment/Gateway/Request/BuilderComposite.php
index 66584773b638dfdc05a233ff4db10a7b1272794f..43f39b2932b40b81f06b0788f7b22827fda9f2fc 100644
--- a/app/code/Magento/Payment/Gateway/Request/BuilderComposite.php
+++ b/app/code/Magento/Payment/Gateway/Request/BuilderComposite.php
@@ -19,17 +19,17 @@ class BuilderComposite implements BuilderInterface
     private $builders;
 
     /**
-     * @param array $builders
      * @param TMapFactory $tmapFactory
+     * @param array $builders
      */
     public function __construct(
-        array $builders,
-        TMapFactory $tmapFactory
+        TMapFactory $tmapFactory,
+        array $builders = []
     ) {
         $this->builders = $tmapFactory->create(
             [
                 'array' => $builders,
-                'type' => 'Magento\Payment\Gateway\Request\BuilderInterface'
+                'type' => BuilderInterface::class
             ]
         );
     }
diff --git a/app/code/Magento/Payment/Gateway/Response/HandlerChain.php b/app/code/Magento/Payment/Gateway/Response/HandlerChain.php
index 1425514e7e3fb87054fdb09690d49d53c0b52a72..6a45311d5eb897b0ec15794cccc838995b747c04 100644
--- a/app/code/Magento/Payment/Gateway/Response/HandlerChain.php
+++ b/app/code/Magento/Payment/Gateway/Response/HandlerChain.php
@@ -16,17 +16,17 @@ class HandlerChain implements HandlerInterface
     private $handlers;
 
     /**
-     * @param array $handlers
      * @param TMapFactory $tmapFactory
+     * @param array $handlers
      */
     public function __construct(
-        array $handlers,
-        TMapFactory $tmapFactory
+        TMapFactory $tmapFactory,
+        array $handlers = []
     ) {
         $this->handlers = $tmapFactory->create(
             [
                 'array' => $handlers,
-                'type' => 'Magento\Payment\Gateway\Response\HandlerInterface'
+                'type' => HandlerInterface::class
             ]
         );
     }
diff --git a/app/code/Magento/Payment/Gateway/Validator/ValidatorComposite.php b/app/code/Magento/Payment/Gateway/Validator/ValidatorComposite.php
index 6e7c5c8c0ab5cecf0031ebc87519306289ea40e2..b36ceed14bdfa991d9fad107e120bb4b312a5316 100644
--- a/app/code/Magento/Payment/Gateway/Validator/ValidatorComposite.php
+++ b/app/code/Magento/Payment/Gateway/Validator/ValidatorComposite.php
@@ -18,18 +18,18 @@ class ValidatorComposite extends AbstractValidator
 
     /**
      * @param ResultInterfaceFactory $resultFactory
-     * @param array $validators
      * @param TMapFactory $tmapFactory
+     * @param array $validators
      */
     public function __construct(
         ResultInterfaceFactory $resultFactory,
-        array $validators,
-        TMapFactory $tmapFactory
+        TMapFactory $tmapFactory,
+        array $validators = []
     ) {
         $this->validators = $tmapFactory->create(
             [
                 'array' => $validators,
-                'type' => 'Magento\Payment\Gateway\Validator\ValidatorInterface'
+                'type' => ValidatorInterface::class
             ]
         );
         parent::__construct($resultFactory);
diff --git a/app/code/Magento/Payment/Gateway/Validator/ValidatorPool.php b/app/code/Magento/Payment/Gateway/Validator/ValidatorPool.php
index e2b746ea7334f480ef5fa3a83358081cea3289db..6697dd86c3d883ae85293b0307435820fb069e0e 100644
--- a/app/code/Magento/Payment/Gateway/Validator/ValidatorPool.php
+++ b/app/code/Magento/Payment/Gateway/Validator/ValidatorPool.php
@@ -17,17 +17,17 @@ class ValidatorPool implements \Magento\Payment\Gateway\Validator\ValidatorPoolI
     private $validators;
 
     /**
-     * @param array $validators
      * @param TMapFactory $tmapFactory
+     * @param array $validators
      */
     public function __construct(
-        array $validators,
-        TMapFactory $tmapFactory
+        TMapFactory $tmapFactory,
+        array $validators = []
     ) {
         $this->validators = $tmapFactory->create(
             [
                 'array' => $validators,
-                'type' => 'Magento\Payment\Gateway\Validator\ValidatorInterface'
+                'type' => ValidatorInterface::class
             ]
         );
     }
diff --git a/app/code/Magento/Payment/Model/Method/Logger.php b/app/code/Magento/Payment/Model/Method/Logger.php
index 7e7331b77df73d9f87624d733167eed0b9cdff08..47c91a25968ccb5560280e78659eebd892787308 100644
--- a/app/code/Magento/Payment/Model/Method/Logger.php
+++ b/app/code/Magento/Payment/Model/Method/Logger.php
@@ -41,21 +41,21 @@ class Logger
     /**
      * Logs payment related information used for debug
      *
-     * @param array $debugData
-     * @param array|null $debugReplaceKeys
-     * @param bool|null $debugFlag
+     * @param array $data
+     * @param array|null $maskKeys
+     * @param bool|null $forceDebug
      * @return void
      */
-    public function debug(array $debugData, array $debugReplaceKeys = null, $debugFlag = null)
+    public function debug(array $data, array $maskKeys = null, $forceDebug = null)
     {
-        $debugReplaceKeys = $debugReplaceKeys !== null ? $debugReplaceKeys : $this->getDebugReplaceFields();
-        $debugFlag = $debugFlag !== null ? $debugFlag : $this->isDebugOn();
-        if ($debugFlag === true && !empty($debugData) && !empty($debugReplaceKeys)) {
-            $debugData = $this->filterDebugData(
-                $debugData,
-                $debugReplaceKeys
+        $maskKeys = $maskKeys !== null ? $maskKeys : $this->getDebugReplaceFields();
+        $debugOn = $forceDebug !== null ? $forceDebug : $this->isDebugOn();
+        if ($debugOn === true) {
+            $data = $this->filterDebugData(
+                $data,
+                $maskKeys
             );
-            $this->logger->debug(var_export($debugData, true));
+            $this->logger->debug(var_export($data, true));
         }
     }
 
@@ -66,7 +66,7 @@ class Logger
      */
     private function getDebugReplaceFields()
     {
-        if ($this->config->getValue('debugReplaceKeys')) {
+        if ($this->config and $this->config->getValue('debugReplaceKeys')) {
             return explode(',', $this->config->getValue('debugReplaceKeys'));
         }
         return [];
@@ -79,7 +79,7 @@ class Logger
      */
     private function isDebugOn()
     {
-        return (bool)$this->config->getValue('debug');
+        return $this->config and (bool)$this->config->getValue('debug');
     }
 
     /**
diff --git a/app/code/Magento/Payment/Test/Unit/Gateway/Command/CommandPoolTest.php b/app/code/Magento/Payment/Test/Unit/Gateway/Command/CommandPoolTest.php
index 92394d8bb330ed66ed9fb6dc98f49666fb725155..7ab96f4474e497d197f4c91298e2e44430e5ccef 100644
--- a/app/code/Magento/Payment/Test/Unit/Gateway/Command/CommandPoolTest.php
+++ b/app/code/Magento/Payment/Test/Unit/Gateway/Command/CommandPoolTest.php
@@ -6,6 +6,7 @@
 namespace Magento\Payment\Test\Unit\Gateway\Command;
 
 use Magento\Payment\Gateway\Command\CommandPool;
+use Magento\Payment\Gateway\CommandInterface;
 
 class CommandPoolTest extends \PHPUnit_Framework_TestCase
 {
@@ -26,7 +27,7 @@ class CommandPoolTest extends \PHPUnit_Framework_TestCase
             ->with(
                 [
                     'array' => ['Magento\Payment\Gateway\CommandInterface'],
-                    'type' => 'Magento\Payment\Gateway\CommandInterface'
+                    'type' => CommandInterface::class
                 ]
             )
             ->willReturn($tMap);
@@ -39,7 +40,7 @@ class CommandPoolTest extends \PHPUnit_Framework_TestCase
             ->with('command')
             ->willReturn($commandI);
 
-        $pool = new CommandPool(['Magento\Payment\Gateway\CommandInterface'], $tMapFactory);
+        $pool = new CommandPool($tMapFactory, ['Magento\Payment\Gateway\CommandInterface']);
 
         static::assertSame($commandI, $pool->get('command'));
     }
@@ -61,7 +62,7 @@ class CommandPoolTest extends \PHPUnit_Framework_TestCase
             ->with(
                 [
                     'array' => [],
-                    'type' => 'Magento\Payment\Gateway\CommandInterface'
+                    'type' => CommandInterface::class
                 ]
             )
             ->willReturn($tMap);
@@ -70,7 +71,7 @@ class CommandPoolTest extends \PHPUnit_Framework_TestCase
             ->with('command')
             ->willReturn(false);
 
-        $pool = new CommandPool([], $tMapFactory);
+        $pool = new CommandPool($tMapFactory, []);
         $pool->get('command');
     }
 }
diff --git a/app/code/Magento/Payment/Test/Unit/Gateway/Config/ValueHandlerPoolTest.php b/app/code/Magento/Payment/Test/Unit/Gateway/Config/ValueHandlerPoolTest.php
index 266128b42f6f9ee21b26c83e5e3caf0187163998..cac2d6c1c9d21b030c57b9cde07b8452b7b47e4b 100644
--- a/app/code/Magento/Payment/Test/Unit/Gateway/Config/ValueHandlerPoolTest.php
+++ b/app/code/Magento/Payment/Test/Unit/Gateway/Config/ValueHandlerPoolTest.php
@@ -5,6 +5,7 @@
  */
 namespace Magento\Payment\Test\Unit\Gateway\Config;
 
+use Magento\Payment\Gateway\Config\ValueHandlerInterface;
 use Magento\Payment\Gateway\Config\ValueHandlerPool;
 
 class ValueHandlerPoolTest extends \PHPUnit_Framework_TestCase
@@ -19,7 +20,7 @@ class ValueHandlerPoolTest extends \PHPUnit_Framework_TestCase
 
         $tMapFactory->expects(static::never())
             ->method('create');
-        new ValueHandlerPool([], $tMapFactory);
+        new ValueHandlerPool($tMapFactory, []);
     }
 
     public function testGet()
@@ -46,7 +47,7 @@ class ValueHandlerPoolTest extends \PHPUnit_Framework_TestCase
                         ValueHandlerPool::DEFAULT_HANDLER => 'Magento\Payment\Gateway\Config\ValueHandlerInterface',
                         'some_value' => 'Magento\Payment\Gateway\Config\ValueHandlerInterface'
                     ],
-                    'type' => 'Magento\Payment\Gateway\Config\ValueHandlerInterface'
+                    'type' => ValueHandlerInterface::class
                 ]
             )
             ->willReturn($tMap);
@@ -68,11 +69,11 @@ class ValueHandlerPoolTest extends \PHPUnit_Framework_TestCase
             );
 
         $pool = new ValueHandlerPool(
+            $tMapFactory,
             [
                 ValueHandlerPool::DEFAULT_HANDLER => 'Magento\Payment\Gateway\Config\ValueHandlerInterface',
                 'some_value' => 'Magento\Payment\Gateway\Config\ValueHandlerInterface'
-            ],
-            $tMapFactory
+            ]
         );
         static::assertSame($someValueHandler, $pool->get('some_value'));
         static::assertSame($defaultHandler, $pool->get(ValueHandlerPool::DEFAULT_HANDLER));
diff --git a/app/code/Magento/Payment/Test/Unit/Gateway/Request/BuilderCompositeTest.php b/app/code/Magento/Payment/Test/Unit/Gateway/Request/BuilderCompositeTest.php
index e1e5ea547456a76f23629322b483718b5cf98e61..2c31c318db6780e30a087305e770fad38e181436 100644
--- a/app/code/Magento/Payment/Test/Unit/Gateway/Request/BuilderCompositeTest.php
+++ b/app/code/Magento/Payment/Test/Unit/Gateway/Request/BuilderCompositeTest.php
@@ -6,6 +6,7 @@
 namespace Magento\Payment\Test\Unit\Gateway\Request;
 
 use Magento\Payment\Gateway\Request\BuilderComposite;
+use Magento\Payment\Gateway\Request\BuilderInterface;
 
 class BuilderCompositeTest extends \PHPUnit_Framework_TestCase
 {
@@ -24,7 +25,7 @@ class BuilderCompositeTest extends \PHPUnit_Framework_TestCase
             ->with(
                 [
                     'array' => [],
-                    'type' => 'Magento\Payment\Gateway\Request\BuilderInterface'
+                    'type' => BuilderInterface::class
                 ]
             )
             ->willReturn($tMap);
@@ -32,7 +33,7 @@ class BuilderCompositeTest extends \PHPUnit_Framework_TestCase
             ->method('getIterator')
             ->willReturn(new \ArrayIterator([]));
 
-        $builder = new BuilderComposite([], $tMapFactory);
+        $builder = new BuilderComposite($tMapFactory, []);
         static::assertEquals([], $builder->build([]));
     }
 
@@ -47,6 +48,7 @@ class BuilderCompositeTest extends \PHPUnit_Framework_TestCase
             'item' => 'gas cooker',
             'quantity' => 1
         ];
+
         $tMapFactory = $this->getMockBuilder('Magento\Framework\ObjectManager\TMapFactory')
             ->disableOriginalConstructor()
             ->setMethods(['create'])
@@ -96,7 +98,7 @@ class BuilderCompositeTest extends \PHPUnit_Framework_TestCase
                         'product' => 'Magento\Payment\Gateway\Request\BuilderInterface',
                         'magento' => 'Magento\Payment\Gateway\Request\BuilderInterface'
                     ],
-                    'type' => 'Magento\Payment\Gateway\Request\BuilderInterface'
+                    'type' => BuilderInterface::class
                 ]
             )
             ->willReturn($tMap);
@@ -105,12 +107,12 @@ class BuilderCompositeTest extends \PHPUnit_Framework_TestCase
             ->willReturn(new \ArrayIterator([$customerBuilder, $productBuilder, $magentoBuilder]));
 
         $builder = new BuilderComposite(
+            $tMapFactory,
             [
                 'customer' => 'Magento\Payment\Gateway\Request\BuilderInterface',
                 'product' => 'Magento\Payment\Gateway\Request\BuilderInterface',
                 'magento' => 'Magento\Payment\Gateway\Request\BuilderInterface'
-            ],
-            $tMapFactory
+            ]
         );
 
         static::assertEquals($expectedRequest, $builder->build([]));
diff --git a/app/code/Magento/Payment/Test/Unit/Gateway/Response/HandlerChainTest.php b/app/code/Magento/Payment/Test/Unit/Gateway/Response/HandlerChainTest.php
index c65a826a2624d79adff61fac919ce47385fac6ac..78891068b4cc07fd7a10aa9d80d333f65012cc83 100644
--- a/app/code/Magento/Payment/Test/Unit/Gateway/Response/HandlerChainTest.php
+++ b/app/code/Magento/Payment/Test/Unit/Gateway/Response/HandlerChainTest.php
@@ -6,6 +6,7 @@
 namespace Magento\Payment\Test\Unit\Gateway\Response;
 
 use Magento\Payment\Gateway\Response\HandlerChain;
+use Magento\Payment\Gateway\Response\HandlerInterface;
 
 class HandlerChainTest extends \PHPUnit_Framework_TestCase
 {
@@ -31,7 +32,7 @@ class HandlerChainTest extends \PHPUnit_Framework_TestCase
                         'handler1' => 'Magento\Payment\Gateway\Response\HandlerInterface',
                         'handler2' => 'Magento\Payment\Gateway\Response\HandlerInterface'
                     ],
-                    'type' => 'Magento\Payment\Gateway\Response\HandlerInterface'
+                    'type' => HandlerInterface::class
                 ]
             )
             ->willReturn($tMap);
@@ -49,11 +50,11 @@ class HandlerChainTest extends \PHPUnit_Framework_TestCase
             ->with($handlingSubject, $response);
 
         $chain = new HandlerChain(
+            $tMapFactory,
             [
                 'handler1' => 'Magento\Payment\Gateway\Response\HandlerInterface',
                 'handler2' => 'Magento\Payment\Gateway\Response\HandlerInterface'
-            ],
-            $tMapFactory
+            ]
         );
         $chain->handle($handlingSubject, $response);
     }
diff --git a/app/code/Magento/Payment/Test/Unit/Gateway/Validator/ValidatorCompositeTest.php b/app/code/Magento/Payment/Test/Unit/Gateway/Validator/ValidatorCompositeTest.php
index 8528b65ac6cecf91bd5603009334a0b47f216137..27b589b02900d45d480fc32db141e075251dad92 100644
--- a/app/code/Magento/Payment/Test/Unit/Gateway/Validator/ValidatorCompositeTest.php
+++ b/app/code/Magento/Payment/Test/Unit/Gateway/Validator/ValidatorCompositeTest.php
@@ -6,6 +6,7 @@
 namespace Magento\Payment\Test\Unit\Gateway\Validator;
 
 use Magento\Payment\Gateway\Validator\ValidatorComposite;
+use Magento\Payment\Gateway\Validator\ValidatorInterface;
 
 class ValidatorCompositeTest extends \PHPUnit_Framework_TestCase
 {
@@ -32,7 +33,7 @@ class ValidatorCompositeTest extends \PHPUnit_Framework_TestCase
                         'validator1' => 'Magento\Payment\Gateway\Validator\ValidatorInterface',
                         'validator2' => 'Magento\Payment\Gateway\Validator\ValidatorInterface'
                     ],
-                    'type' => 'Magento\Payment\Gateway\Validator\ValidatorInterface'
+                    'type' => ValidatorInterface::class
                 ]
             )
             ->willReturn($tMap);
@@ -82,11 +83,11 @@ class ValidatorCompositeTest extends \PHPUnit_Framework_TestCase
 
         $validatorComposite = new ValidatorComposite(
             $resultFactory,
+            $tMapFactory,
             [
                 'validator1' => 'Magento\Payment\Gateway\Validator\ValidatorInterface',
                 'validator2' => 'Magento\Payment\Gateway\Validator\ValidatorInterface'
-            ],
-            $tMapFactory
+            ]
         );
         static::assertSame($compositeResult, $validatorComposite->validate($validationSubject));
     }
diff --git a/app/code/Magento/Payment/Test/Unit/Gateway/Validator/ValidatorPoolTest.php b/app/code/Magento/Payment/Test/Unit/Gateway/Validator/ValidatorPoolTest.php
index becc387fab2d91b86cc6ba3b13954c8c0c29ae05..dc6ed060ab7bf2d86895d15b27a04e2d7638efcd 100644
--- a/app/code/Magento/Payment/Test/Unit/Gateway/Validator/ValidatorPoolTest.php
+++ b/app/code/Magento/Payment/Test/Unit/Gateway/Validator/ValidatorPoolTest.php
@@ -5,6 +5,7 @@
  */
 namespace Magento\Payment\Test\Unit\Gateway\Validator;
 
+use Magento\Payment\Gateway\Validator\ValidatorInterface;
 use Magento\Payment\Gateway\Validator\ValidatorPool;
 
 class ValidatorPoolTest extends \PHPUnit_Framework_TestCase
@@ -26,7 +27,7 @@ class ValidatorPoolTest extends \PHPUnit_Framework_TestCase
             ->with(
                 [
                     'array' => ['validator' => 'Magento\Payment\Gateway\Validator\ValidatorInterface'],
-                    'type' => 'Magento\Payment\Gateway\Validator\ValidatorInterface'
+                    'type' => ValidatorInterface::class
                 ]
             )
             ->willReturn($tMap);
@@ -40,8 +41,8 @@ class ValidatorPoolTest extends \PHPUnit_Framework_TestCase
             ->willReturn($commandI);
 
         $pool = new ValidatorPool(
-            ['validator' => 'Magento\Payment\Gateway\Validator\ValidatorInterface'],
-            $tMapFactory
+            $tMapFactory,
+            ['validator' => 'Magento\Payment\Gateway\Validator\ValidatorInterface']
         );
 
         static::assertSame($commandI, $pool->get('validator'));
@@ -64,7 +65,7 @@ class ValidatorPoolTest extends \PHPUnit_Framework_TestCase
             ->with(
                 [
                     'array' => [],
-                    'type' => 'Magento\Payment\Gateway\Validator\ValidatorInterface'
+                    'type' => ValidatorInterface::class
                 ]
             )
             ->willReturn($tMap);
@@ -73,7 +74,7 @@ class ValidatorPoolTest extends \PHPUnit_Framework_TestCase
             ->with('validator')
             ->willReturn(false);
 
-        $pool = new ValidatorPool([], $tMapFactory);
+        $pool = new ValidatorPool($tMapFactory, []);
         $pool->get('validator');
     }
 }
diff --git a/app/code/Magento/Payment/Test/Unit/Model/Method/LoggerTest.php b/app/code/Magento/Payment/Test/Unit/Model/Method/LoggerTest.php
index b56caf5903208f67a51713cef223b8602387a608..36cd63d8c6db69461de3d1a11b25f942cb36e505 100644
--- a/app/code/Magento/Payment/Test/Unit/Model/Method/LoggerTest.php
+++ b/app/code/Magento/Payment/Test/Unit/Model/Method/LoggerTest.php
@@ -45,6 +45,20 @@ class LoggerTest extends \PHPUnit_Framework_TestCase
         $this->logger->debug($debugData, $debugReplaceKeys, true);
     }
 
+    public function testDebugOnNoReplaceKeys()
+    {
+        $debugData =
+            [
+                'request' => ['data1' => '123', 'data2' => '123']
+            ];
+
+        $this->loggerMock->expects(static::once())
+            ->method('debug')
+            ->with(var_export($debugData, true));
+
+        $this->logger->debug($debugData, [], true);
+    }
+
     public function testDebugOff()
     {
         $debugData =
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/Paypal/Block/Express/Review/Billing.php b/app/code/Magento/Paypal/Block/Express/Review/Billing.php
index c613b56c40f0eb285d1b4b63d00c98daec0bb9f4..445582f9dbd6b7024d8f7c1ebaecd998c3486b9c 100644
--- a/app/code/Magento/Paypal/Block/Express/Review/Billing.php
+++ b/app/code/Magento/Paypal/Block/Express/Review/Billing.php
@@ -9,8 +9,222 @@
  */
 namespace Magento\Paypal\Block\Express\Review;
 
-class Billing extends \Magento\Checkout\Block\Onepage\Billing
+use Magento\Customer\Api\CustomerRepositoryInterface;
+use Magento\Quote\Model\Quote;
+
+/**
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
+class Billing extends \Magento\Framework\View\Element\Template
 {
+    /**
+     * Sales Quote Billing Address instance
+     *
+     * @var \Magento\Quote\Model\Quote\Address
+     */
+    protected $address;
+
+    /**
+     * Customer Taxvat Widget block
+     *
+     * @var \Magento\Customer\Block\Widget\Taxvat
+     */
+    protected $taxvat;
+
+    /**
+     * @var \Magento\Quote\Model\Quote\AddressFactory
+     */
+    protected $addressFactory;
+
+    /**
+     * @var \Magento\Customer\Api\Data\CustomerInterface
+     */
+    protected $customer;
+
+    /**
+     * @var Quote
+     */
+    protected $quote;
+
+    /**
+     * @var \Magento\Checkout\Model\Session
+     */
+    protected $checkoutSession;
+
+    /**
+     * @var \Magento\Customer\Model\Session
+     */
+    protected $customerSession;
+
+    /**
+     * @var CustomerRepositoryInterface
+     */
+    protected $customerRepository;
+
+    /**
+     * @var \Magento\Framework\App\Http\Context
+     */
+    protected $httpContext;
+
+    /**
+     * @var \Magento\Directory\Model\ResourceModel\Country\CollectionFactory
+     */
+    protected $countryCollectionFactory;
+
+    /**
+     * @param \Magento\Framework\View\Element\Template\Context $context
+     * @param \Magento\Customer\Model\Session $customerSession
+     * @param \Magento\Checkout\Model\Session $resourceSession
+     * @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory
+     * @param CustomerRepositoryInterface $customerRepository
+     * @param \Magento\Framework\App\Http\Context $httpContext
+     * @param Quote\AddressFactory $addressFactory
+     * @param array $data
+     */
+    public function __construct(
+        \Magento\Framework\View\Element\Template\Context $context,
+        \Magento\Customer\Model\Session $customerSession,
+        \Magento\Checkout\Model\Session $resourceSession,
+        \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $countryCollectionFactory,
+        CustomerRepositoryInterface $customerRepository,
+        \Magento\Framework\App\Http\Context $httpContext,
+        \Magento\Quote\Model\Quote\AddressFactory $addressFactory,
+        array $data = []
+    ) {
+        $this->addressFactory = $addressFactory;
+        $this->_isScopePrivate = true;
+        $this->httpContext = $httpContext;
+        $this->customerRepository = $customerRepository;
+        $this->checkoutSession = $resourceSession;
+        $this->customerSession = $customerSession;
+        $this->countryCollectionFactory = $countryCollectionFactory;
+        parent::__construct($context, $data);
+    }
+
+    /**
+     * Initialize billing address step
+     *
+     * @return void
+     */
+    protected function _construct()
+    {
+        $this->getCheckout()->setStepData(
+            'billing',
+            ['label' => __('Billing Information'), 'is_show' => true]
+        );
+
+        if ($this->isCustomerLoggedIn()) {
+            $this->getCheckout()->setStepData('billing', 'allow', true);
+        }
+        parent::_construct();
+    }
+
+    /**
+     * @return bool
+     */
+    public function isUseBillingAddressForShipping()
+    {
+        if ($this->getQuote()->getIsVirtual() || !$this->getQuote()->getShippingAddress()->getSameAsBilling()) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Return country collection
+     *
+     * @return \Magento\Directory\Model\ResourceModel\Country\Collection
+     */
+    public function getCountries()
+    {
+        return $this->countryCollectionFactory->create()->loadByStore();
+    }
+
+    /**
+     * Return checkout method
+     *
+     * @return string
+     */
+    public function getMethod()
+    {
+        return $this->getQuote()->getCheckoutMethod();
+    }
+
+    /**
+     * Return Customer Address First Name
+     * If Sales Quote Address First Name is not defined - return Customer First Name
+     *
+     * @return string
+     */
+    public function getFirstname()
+    {
+        return $this->getAddress()->getFirstname();
+    }
+
+    /**
+     * Return Customer Address Last Name
+     * If Sales Quote Address Last Name is not defined - return Customer Last Name
+     *
+     * @return string
+     */
+    public function getLastname()
+    {
+        return $this->getAddress()->getLastname();
+    }
+
+    /**
+     * Check is Quote items can ship to
+     *
+     * @return bool
+     */
+    public function canShip()
+    {
+        return !$this->getQuote()->isVirtual();
+    }
+
+    /**
+     * @return void
+     */
+    public function getSaveUrl()
+    {
+    }
+
+    /**
+     * Get Customer Taxvat Widget block
+     *
+     * @return \Magento\Customer\Block\Widget\Taxvat
+     */
+    protected function _getTaxvat()
+    {
+        if (!$this->taxvat) {
+            $this->taxvat = $this->getLayout()->createBlock('Magento\Customer\Block\Widget\Taxvat');
+        }
+
+        return $this->taxvat;
+    }
+
+    /**
+     * Check whether taxvat is enabled
+     *
+     * @return bool
+     */
+    public function isTaxvatEnabled()
+    {
+        return $this->_getTaxvat()->isEnabled();
+    }
+
+    /**
+     * @return string
+     */
+    public function getTaxvatHtml()
+    {
+        return $this->_getTaxvat()
+            ->setTaxvat($this->getQuote()->getCustomerTaxvat())
+            ->setFieldIdFormat('billing:%s')
+            ->setFieldNameFormat('billing[%s]')
+            ->toHtml();
+    }
+
     /**
      * Return Sales Quote Address model
      *
@@ -18,20 +232,75 @@ class Billing extends \Magento\Checkout\Block\Onepage\Billing
      */
     public function getAddress()
     {
-        if ($this->_address === null) {
+        if ($this->address === null) {
             if ($this->isCustomerLoggedIn() || $this->getQuote()->getBillingAddress()) {
-                $this->_address = $this->getQuote()->getBillingAddress();
-                if (!$this->_address->getFirstname()) {
-                    $this->_address->setFirstname($this->getQuote()->getCustomer()->getFirstname());
+                $this->address = $this->getQuote()->getBillingAddress();
+                if (!$this->address->getFirstname()) {
+                    $this->address->setFirstname($this->getQuote()->getCustomer()->getFirstname());
                 }
-                if (!$this->_address->getLastname()) {
-                    $this->_address->setLastname($this->getQuote()->getCustomer()->getLastname());
+                if (!$this->address->getLastname()) {
+                    $this->address->setLastname($this->getQuote()->getCustomer()->getLastname());
                 }
             } else {
-                $this->_address = $this->_addressFactory->create();
+                $this->address = $this->addressFactory->create();
             }
         }
 
-        return $this->_address;
+        return $this->address;
+    }
+
+    /**
+     * Get config
+     *
+     * @param string $path
+     * @return string|null
+     */
+    public function getConfig($path)
+    {
+        return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
+    }
+
+    /**
+     * Get logged in customer
+     *
+     * @return \Magento\Customer\Api\Data\CustomerInterface
+     */
+    protected function _getCustomer()
+    {
+        if (empty($this->customer)) {
+            $this->customer = $this->customerRepository->getById($this->customerSession->getCustomerId());
+        }
+        return $this->customer;
+    }
+
+    /**
+     * Retrieve checkout session model
+     *
+     * @return \Magento\Checkout\Model\Session
+     */
+    public function getCheckout()
+    {
+        return $this->checkoutSession;
+    }
+
+    /**
+     * Retrieve sales quote model
+     *
+     * @return Quote
+     */
+    public function getQuote()
+    {
+        if (empty($this->quote)) {
+            $this->quote = $this->getCheckout()->getQuote();
+        }
+        return $this->quote;
+    }
+
+    /**
+     * @return bool
+     */
+    public function isCustomerLoggedIn()
+    {
+        return $this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH);
     }
 }
diff --git a/app/code/Magento/Paypal/Block/Express/Review/Shipping.php b/app/code/Magento/Paypal/Block/Express/Review/Shipping.php
index 97fe0a20e9c3f045da8a8c29c830f5b97691a8f5..e49171238ceedc62304d95b5e2e0e7a00f6f5053 100644
--- a/app/code/Magento/Paypal/Block/Express/Review/Shipping.php
+++ b/app/code/Magento/Paypal/Block/Express/Review/Shipping.php
@@ -9,8 +9,115 @@
  */
 namespace Magento\Paypal\Block\Express\Review;
 
-class Shipping extends \Magento\Checkout\Block\Onepage\Shipping
+use Magento\Customer\Api\CustomerRepositoryInterface;
+use Magento\Quote\Model\Quote;
+
+class Shipping extends \Magento\Framework\View\Element\Template
 {
+    /**
+     * Sales Quote Shipping Address instance
+     *
+     * @var \Magento\Quote\Model\Quote\Address
+     */
+    protected $address = null;
+
+    /**
+     * @var \Magento\Quote\Model\Quote\AddressFactory
+     */
+    protected $addressFactory;
+
+    /**
+     * @var \Magento\Customer\Api\Data\CustomerInterface
+     */
+    protected $customer;
+
+    /**
+     * @var Quote
+     */
+    protected $quote;
+
+    /**
+     * @var \Magento\Checkout\Model\Session
+     */
+    protected $checkoutSession;
+
+    /**
+     * @var CustomerRepositoryInterface
+     */
+    protected $customerRepository;
+
+    /**
+     * @var \Magento\Framework\App\Http\Context
+     */
+    protected $httpContext;
+
+    /**
+     * @var \Magento\Customer\Model\Session
+     */
+    protected $customerSession;
+
+    /**
+     * @param \Magento\Framework\View\Element\Template\Context $context
+     * @param \Magento\Customer\Model\Session $customerSession
+     * @param \Magento\Checkout\Model\Session $resourceSession
+     * @param CustomerRepositoryInterface $customerRepository
+     * @param \Magento\Framework\App\Http\Context $httpContext
+     * @param \Magento\Quote\Model\Quote\AddressFactory $addressFactory
+     * @param array $data
+     */
+    public function __construct(
+        \Magento\Framework\View\Element\Template\Context $context,
+        \Magento\Customer\Model\Session $customerSession,
+        \Magento\Checkout\Model\Session $resourceSession,
+        CustomerRepositoryInterface $customerRepository,
+        \Magento\Framework\App\Http\Context $httpContext,
+        \Magento\Quote\Model\Quote\AddressFactory $addressFactory,
+        array $data = []
+    ) {
+        $this->addressFactory = $addressFactory;
+        $this->_isScopePrivate = true;
+        $this->httpContext = $httpContext;
+        $this->customerRepository = $customerRepository;
+        $this->checkoutSession = $resourceSession;
+        $this->customerSession = $customerSession;
+        parent::__construct($context, $data);
+    }
+
+    /**
+     * Initialize shipping address step
+     *
+     * @return void
+     */
+    protected function _construct()
+    {
+        $this->checkoutSession->setStepData(
+            'shipping',
+            ['label' => __('Shipping Information'), 'is_show' => $this->isShow()]
+        );
+
+        parent::_construct();
+    }
+
+    /**
+     * Return checkout method
+     *
+     * @return string
+     */
+    public function getMethod()
+    {
+        return $this->getQuote()->getCheckoutMethod();
+    }
+
+    /**
+     * Retrieve is allow and show block
+     *
+     * @return bool
+     */
+    public function isShow()
+    {
+        return !$this->getQuote()->isVirtual();
+    }
+
     /**
      * Return Sales Quote Address model (shipping address)
      *
@@ -18,14 +125,59 @@ class Shipping extends \Magento\Checkout\Block\Onepage\Shipping
      */
     public function getAddress()
     {
-        if ($this->_address === null) {
+        if ($this->address === null) {
             if ($this->isCustomerLoggedIn() || $this->getQuote()->getShippingAddress()) {
-                $this->_address = $this->getQuote()->getShippingAddress();
+                $this->address = $this->getQuote()->getShippingAddress();
             } else {
-                $this->_address = $this->_addressFactory->create();
+                $this->address = $this->addressFactory->create();
             }
         }
 
-        return $this->_address;
+        return $this->address;
+    }
+
+    /**
+     * Get config
+     *
+     * @param string $path
+     * @return string|null
+     */
+    public function getConfig($path)
+    {
+        return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
+    }
+
+    /**
+     * Get logged in customer
+     *
+     * @return \Magento\Customer\Api\Data\CustomerInterface
+     */
+    protected function _getCustomer()
+    {
+        if (empty($this->customer)) {
+            $this->customer = $this->customerRepository->getById($this->customerSession->getCustomerId());
+        }
+        return $this->customer;
+    }
+
+    /**
+     * Retrieve sales quote model
+     *
+     * @return Quote
+     */
+    public function getQuote()
+    {
+        if (empty($this->quote)) {
+            $this->quote = $this->checkoutSession->getQuote();
+        }
+        return $this->quote;
+    }
+
+    /**
+     * @return bool
+     */
+    public function isCustomerLoggedIn()
+    {
+        return $this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH);
     }
 }
diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review.xml
index 60e525f463b8f15ad65139be01d9d31017061bd1..695adda9167dd09b65ff1ecc400ed0dcf6e4a951 100644
--- a/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review.xml
+++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review.xml
@@ -24,7 +24,7 @@
                 <block class="Magento\Framework\View\Element\Text\ListText" name="paypal.additional.actions"/>
                 <block class="Magento\Paypal\Block\Express\Review\Details" name="paypal.express.review.details" as="details" template="express/review/details.phtml">
                     <block class="Magento\Framework\View\Element\RendererList" name="checkout.onepage.review.item.renderers" as="renderer.list"/>
-                    <block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="onepage/review/totals.phtml"/>
+                    <block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="checkout/onepage/review/totals.phtml"/>
                 </block>
                 <block class="Magento\CheckoutAgreements\Block\Agreements" name="paypal.express.review.details.agreements" as="agreements" template="Magento_CheckoutAgreements::additional_agreements.phtml"/>
             </block>
diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review_details.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review_details.xml
index 01be224c3d0f1d5c88ddce44ae8a42d1a24e8d9a..6594f0a472a8a64261dcf93a9759d7b5dc5361ca 100644
--- a/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review_details.xml
+++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_express_review_details.xml
@@ -10,7 +10,7 @@
     <container name="root">
         <block class="Magento\Paypal\Block\Express\Review\Details" name="page.block" template="express/review/details.phtml">
             <block class="Magento\Framework\View\Element\RendererList" name="checkout.onepage.review.item.renderers" as="renderer.list"/>
-            <block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="onepage/review/totals.phtml"/>
+            <block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="checkout/onepage/review/totals.phtml"/>
         </block>
     </container>
 </layout>
diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowexpress_review.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowexpress_review.xml
index e41ab21bced7420064dde9f1340cb62e6a2279c6..7fb0e07142bea9020e7d4c361b5e682de0a0c0b4 100644
--- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowexpress_review.xml
+++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowexpress_review.xml
@@ -27,7 +27,7 @@
                 <block class="Magento\Framework\View\Element\Text\ListText" name="paypal.additional.actions"/>
                 <block class="Magento\Paypal\Block\Express\Review\Details" name="paypal.express.review.details" as="details" template="express/review/details.phtml">
                     <block class="Magento\Framework\View\Element\RendererList" name="checkout.onepage.review.item.renderers" as="renderer.list"/>
-                    <block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="onepage/review/totals.phtml"/>
+                    <block class="Magento\Checkout\Block\Cart\Totals" name="paypal.express.review.details.totals" as="totals" template="checkout/onepage/review/totals.phtml"/>
                 </block>
                 <block class="Magento\CheckoutAgreements\Block\Agreements" name="paypal.express.review.details.agreements" as="agreements" template="Magento_CheckoutAgreements::additional_agreements.phtml"/>
             </block>
diff --git a/app/code/Magento/Paypal/view/frontend/requirejs-config.js b/app/code/Magento/Paypal/view/frontend/requirejs-config.js
index 49f8f54129f620c79eeee168324edeca563a4822..8e6be0da47bd15ba3550a7f04c4668a7165bbc1a 100644
--- a/app/code/Magento/Paypal/view/frontend/requirejs-config.js
+++ b/app/code/Magento/Paypal/view/frontend/requirejs-config.js
@@ -6,7 +6,6 @@
 var config = {
     map: {
         '*': {
-            opcheckoutPaypalIframe: 'Magento_Paypal/js/opcheckout',
             orderReview:            'Magento_Paypal/order-review',
             paypalCheckout:         'Magento_Paypal/js/paypal-checkout'
         }
diff --git a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/totals.phtml b/app/code/Magento/Paypal/view/frontend/templates/checkout/onepage/review/totals.phtml
similarity index 97%
rename from app/code/Magento/Checkout/view/frontend/templates/onepage/review/totals.phtml
rename to app/code/Magento/Paypal/view/frontend/templates/checkout/onepage/review/totals.phtml
index ab70dbab565d4019eb9edbca45eef9ad0a9c6f4e..94aca67913e6b768bfb4200c35327d0315da7fb4 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/onepage/review/totals.phtml
+++ b/app/code/Magento/Paypal/view/frontend/templates/checkout/onepage/review/totals.phtml
@@ -9,10 +9,6 @@
 /**
  * @see \Magento\Checkout\Block\Cart\Totals
  */
-
-/**
- * @removeCandidate
- */
 ?>
 <?php if ($block->getTotals()): ?>
     <?php $_colspan = 3; ?>
diff --git a/app/code/Magento/Paypal/view/frontend/templates/onepage.phtml b/app/code/Magento/Paypal/view/frontend/templates/onepage.phtml
deleted file mode 100644
index 140ad1a72e4841b5cf65c1ca7d7e981ef15b7c81..0000000000000000000000000000000000000000
--- a/app/code/Magento/Paypal/view/frontend/templates/onepage.phtml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-?>
-<script type="text/x-magento-init">
-    {
-        "#checkoutSteps": {
-            "opcheckoutPaypalIframe": {}
-        }
-    }
-</script>
\ No newline at end of file
diff --git a/app/code/Magento/Paypal/view/frontend/web/js/opcheckout.js b/app/code/Magento/Paypal/view/frontend/web/js/opcheckout.js
deleted file mode 100644
index 416a455c511cb87b9732543fe64ed9c92bdb8d73..0000000000000000000000000000000000000000
--- a/app/code/Magento/Paypal/view/frontend/web/js/opcheckout.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-/*jshint browser:true jquery:true*/
-define([
-    "jquery",
-    "Magento_Checkout/js/opc-order-review",
-    "jquery/ui"
-], function($, opcOrderReview){
-    "use strict";
-
-    $.widget('mage.opcheckoutPaypalIframe', opcOrderReview, {
-        options: {
-            review: {
-                submitContainer: '#checkout-review-submit'
-            }
-        },
-
-        _create: function() {
-            var events = {};
-            events['contentUpdated' + this.options.review.container] = function() {
-                var paypalIframe = this.element.find(this.options.review.container)
-                    .find('[data-container="paypal-iframe"]');
-                if (paypalIframe.length) {
-                    paypalIframe.show();
-                    $(this.options.review.submitContainer).hide();
-                }
-            };
-            this._on(events);
-        }
-    });
-
-    return $.mage.opcheckoutPaypalIframe;
-});
\ No newline at end of file
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/Translation/etc/di.xml b/app/code/Magento/Translation/etc/di.xml
index 4f8ccfd64333bf850bda4fd9653131f23ddb5100..05c7f766a452e694c648138db45d7835b9721dd2 100644
--- a/app/code/Magento/Translation/etc/di.xml
+++ b/app/code/Magento/Translation/etc/di.xml
@@ -63,22 +63,24 @@
             </argument>
         </arguments>
     </type>
+
     <type name="Magento\Framework\View\Asset\PreProcessor\Pool">
         <arguments>
-            <argument name="preProcessors" xsi:type="array">
+            <argument name="preprocessors" xsi:type="array">
                 <item name="js" xsi:type="array">
-                    <item name="js" xsi:type="array">
-                        <item name="js_translation" xsi:type="string">Magento\Translation\Model\Js\PreProcessor</item>
+                    <item name="js_translation" xsi:type="array">
+                        <item name="class" xsi:type="string">Magento\Translation\Model\Js\PreProcessor</item>
                     </item>
                 </item>
                 <item name="json" xsi:type="array">
-                    <item name="json" xsi:type="array">
-                        <item name="json_generation" xsi:type="string">Magento\Translation\Model\Json\PreProcessor</item>
+                    <item name="json_generation" xsi:type="array">
+                        <item name="class" xsi:type="string">Magento\Translation\Model\Json\PreProcessor</item>
                     </item>
                 </item>
             </argument>
         </arguments>
     </type>
+
     <type name="Magento\Framework\Console\CommandList">
         <arguments>
             <argument name="commands" xsi:type="array">
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/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php
index 8c486761f3906fd7a456e0b46c79337298ca5ea6..2554dacd770551b56fae549f9306d7bcaabd65cc 100644
--- a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/ProductOptionRepositoryTest.php
@@ -147,16 +147,6 @@ class ProductOptionRepositoryTest extends \Magento\TestFramework\TestCase\Webapi
      */
     public function testUpdate()
     {
-        /** TODO: Remove after MAGETWO-40822 */
-        $isPhpVersionSupported = version_compare(
-            '7.0.0',
-            preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION),
-            '>'
-        );
-        if (!$isPhpVersionSupported) {
-            $this->markTestSkipped('MAGETWO-40822');
-        }
-
         $productSku = 'bundle-product';
         $request = [
             'title' => 'someTitle',
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 \&#39;!@#$%^&amp;*()+:;\\|}{][?=-~` %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/Checkout/Block/Onepage/Payment/MethodsTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Block/Onepage/Payment/MethodsTest.php
deleted file mode 100644
index 8e9cd3f440d6c2634e201e33df39a75608548b9a..0000000000000000000000000000000000000000
--- a/dev/tests/integration/testsuite/Magento/Checkout/Block/Onepage/Payment/MethodsTest.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-/**
- * Test class for \Magento\Checkout\Block\Onepage\Payment\Methods
- */
-namespace Magento\Checkout\Block\Onepage\Payment;
-
-class MethodsTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @var \Magento\Checkout\Block\Onepage\Payment\Methods
-     */
-    protected $_block;
-
-    protected function setUp()
-    {
-        parent::setUp();
-        $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
-            'Magento\Framework\View\LayoutInterface'
-        )->createBlock(
-            'Magento\Checkout\Block\Onepage\Payment\Methods'
-        );
-    }
-
-    /**
-     * @magentoAppArea frontend
-     */
-    public function testGetMethodTitleAndMethodLabelAfterHtml()
-    {
-        $expectedTitle = 'Free Method';
-        $expectedLabel = 'Label After Html';
-        $method = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
-            'Magento\Payment\Model\Method\Free'
-        );
-
-        $block = $this->_block->getLayout()->createBlock('Magento\Framework\View\Element\Text')
-            ->setMethodTitle($expectedTitle)
-            ->setMethodLabelAfterHtml($expectedLabel);
-
-        $this->assertEquals('No Payment Information Required', $this->_block->getMethodTitle($method));
-        $this->_block->setChild('payment.method.free', $block);
-        $actualTitle = $this->_block->getMethodTitle($method);
-        $actualLabel = $this->_block->getMethodLabelAfterHtml($method);
-
-        $this->assertEquals($expectedTitle, $actualTitle);
-        $this->assertEquals($expectedLabel, $actualLabel);
-    }
-}
diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php
index fbc90ac30f4c6da05143fd0391520237c2aaf580..ed282c1793d1c2d7836bee5daab7d28d371fe8c3 100644
--- a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php
+++ b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php
@@ -19,7 +19,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase
     /**
      * @var \Magento\Email\Model\Template\Filter
      */
-    protected $model = null;
+    protected $model;
 
     /**
      * @var \Magento\TestFramework\ObjectManager
@@ -270,7 +270,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase
             'File with compilation error results in error message' => [
                 TemplateTypesInterface::TYPE_HTML,
                 'file="css/file-with-error.css"',
-                \Magento\Framework\Css\PreProcessor\AdapterInterface::ERROR_MESSAGE_PREFIX,
+                \Magento\Framework\View\Asset\ContentProcessorInterface::ERROR_MESSAGE_PREFIX,
             ],
         ];
     }
@@ -356,7 +356,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase
             ],
             'Developer mode - File with compilation error results in error message' => [
                 '<html><p></p> {{inlinecss file="css/file-with-error.css"}}</html>',
-                \Magento\Framework\Css\PreProcessor\AdapterInterface::ERROR_MESSAGE_PREFIX,
+                \Magento\Framework\View\Asset\ContentProcessorInterface::ERROR_MESSAGE_PREFIX,
                 false,
             ],
         ];
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/OyejorgeTest.php b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/OyejorgeTest.php
deleted file mode 100644
index 399f0b7a44bfda7cde4a3623a6042edc372d3c71..0000000000000000000000000000000000000000
--- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/OyejorgeTest.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Framework\Css\PreProcessor\Adapter\Less;
-
-use Magento\Framework\App\State;
-
-/**
- * Oyejorge adapter model
- */
-class OyejorgeTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @var Oyejorge
-     */
-    protected $model;
-
-    /**
-     * @var \Magento\Framework\App\State
-     */
-    protected $state;
-
-    public function setUp()
-    {
-        $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
-        $this->model = $objectManager->create('Magento\Framework\Css\PreProcessor\Adapter\Less\Oyejorge');
-        $this->state = $objectManager->get('Magento\Framework\App\State');
-    }
-
-    public function testProcess()
-    {
-        $sourceFilePath = realpath(__DIR__ . '/_files/oyejorge.less');
-        $expectedCss = ($this->state->getMode() === State::MODE_DEVELOPER)
-            ? file_get_contents(__DIR__ . '/_files/oyejorge_dev.css')
-            : file_get_contents(__DIR__ . '/_files/oyejorge.css');
-        $actualCss = ($this->model->process($sourceFilePath));
-
-        $this->assertEquals($this->cutCopyrights($expectedCss), $actualCss);
-    }
-
-    /**
-     * Cuts copyrights from css source
-     *
-     * @param string $cssSource
-     * @return string
-     */
-    private function cutCopyrights($cssSource)
-    {
-        $copyright = <<<'TAG'
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-
-TAG;
-        return (string)str_replace($copyright, '', $cssSource);
-
-    }
-}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/cache/lib/nested/import.less b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/cache/lib/nested/import.less
deleted file mode 100644
index 0b6a8af1a5130a6d19a8d976dff524408c5b15bf..0000000000000000000000000000000000000000
--- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/cache/lib/nested/import.less
+++ /dev/null
@@ -1,6 +0,0 @@
-// /**
-//  * Copyright © 2015 Magento. All rights reserved.
-//  * See COPYING.txt for license details.
-//  */
-
-h1 { background-color: red; }
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/cache/lib/oyejorge.less b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/cache/lib/oyejorge.less
deleted file mode 100644
index c71bb050df796ac1f963b2bd62a024c020f8c0c8..0000000000000000000000000000000000000000
--- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/cache/lib/oyejorge.less
+++ /dev/null
@@ -1,6 +0,0 @@
-// /**
-//  * Copyright © 2015 Magento. All rights reserved.
-//  * See COPYING.txt for license details.
-//  */
-
-@import "nested/import.less";
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/nested/import.less b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/nested/import.less
deleted file mode 100644
index 2e284b2e8eb87a22b92b769e67086265962d3822..0000000000000000000000000000000000000000
--- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/nested/import.less
+++ /dev/null
@@ -1,6 +0,0 @@
-// /**
-//  * Copyright © 2015 Magento. All rights reserved.
-//  * See COPYING.txt for license details.
-//  */
-
-@body-bg-img: url(Magento_Theme::validation_advice_bg.gif);
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/oyejorge.css b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/oyejorge.css
deleted file mode 100644
index bcf1aa406b5edaa5723cf3584be8e8896fb7cbf8..0000000000000000000000000000000000000000
--- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/oyejorge.css
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-#header{color: #4d926f}h2{color: #4d926f}#header{-webkit-border-radius: 5px;-moz-border-radius: 5px;-ms-border-radius: 5px;-o-border-radius: 5px;border-radius: 5px}#footer{-webkit-border-radius: 10px;-moz-border-radius: 10px;-ms-border-radius: 10px;-o-border-radius: 10px;border-radius: 10px}#header h1{font-size: 26px;font-weight: bold}#header p{font-size: 12px}#header p a{text-decoration: none}#header p a:hover{border-width: 1px}#header{color: #333;border-left: 1px;border-right: 2px}#footer{color: #141;border-color: #7d2717}body{background-image: url(Magento_Theme::validation_advice_bg.gif)}
\ No newline at end of file
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/oyejorge.less b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/oyejorge.less
deleted file mode 100644
index 58914770c2f5de25e75cfd0fc38524fd61d31959..0000000000000000000000000000000000000000
--- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/oyejorge.less
+++ /dev/null
@@ -1,74 +0,0 @@
-// /**
-//  * Copyright © 2015 Magento. All rights reserved.
-//  * See COPYING.txt for license details.
-//  */
-
-// Variables
-
-@color: #4D926F;
-
-#header {
-  color: @color;
-}
-
-h2 {
-  color: @color;
-}
-
-// Mixins
-
-.rounded-corners (@radius: 5px) {
-  -webkit-border-radius: @radius;
-  -moz-border-radius: @radius;
-  -ms-border-radius: @radius;
-  -o-border-radius: @radius;
-  border-radius: @radius;
-}
-
-#header {
-  .rounded-corners;
-}
-
-#footer {
-  .rounded-corners(10px);
-}
-
-// Nested Rules
-
-#header {
-  h1 {
-    font-size: 26px;
-    font-weight: bold;
-  }
-  p { font-size: 12px;
-    a {
-      text-decoration: none;
-      &:hover {
-        border-width: 1px;
-      }
-    }
-  }
-}
-
-// Functions & Operations
-
-@the-border: 1px;
-@base-color: #111;
-@red:        #842210;
-
-#header {
-  color: (@base-color * 3);
-  border-left: @the-border;
-  border-right: (@the-border * 2);
-}
-
-#footer {
-  color: (@base-color + #003300);
-  border-color: desaturate(@red, 10%);
-}
-
-@import "nested/import.less";
-
-body {
-  background-image: @body-bg-img;
-}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/oyejorge_dev.css b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/oyejorge_dev.css
deleted file mode 100644
index 0e70c6da760dbc6c5b39775e940f619daa8910db..0000000000000000000000000000000000000000
--- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/Adapter/Less/_files/oyejorge_dev.css
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-#header {
-  color: #4d926f;
-}
-h2 {
-  color: #4d926f;
-}
-#header {
-  -webkit-border-radius: 5px;
-  -moz-border-radius: 5px;
-  -ms-border-radius: 5px;
-  -o-border-radius: 5px;
-  border-radius: 5px;
-}
-#footer {
-  -webkit-border-radius: 10px;
-  -moz-border-radius: 10px;
-  -ms-border-radius: 10px;
-  -o-border-radius: 10px;
-  border-radius: 10px;
-}
-#header h1 {
-  font-size: 26px;
-  font-weight: bold;
-}
-#header p {
-  font-size: 12px;
-}
-#header p a {
-  text-decoration: none;
-}
-#header p a:hover {
-  border-width: 1px;
-}
-#header {
-  color: #333333;
-  border-left: 1px;
-  border-right: 2px;
-}
-#footer {
-  color: #114411;
-  border-color: #7d2717;
-}
-body {
-  background-image: url(Magento_Theme::validation_advice_bg.gif);
-}
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Block/Onepage/BillingTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Block/Express/Review/BillingTest.php
similarity index 84%
rename from dev/tests/integration/testsuite/Magento/Checkout/Block/Onepage/BillingTest.php
rename to dev/tests/integration/testsuite/Magento/Paypal/Block/Express/Review/BillingTest.php
index 86ac63afe57145019c36e4f111e5e398d0c12260..c256479cc7c833efa628eb58bc084554b87d2ce3 100644
--- a/dev/tests/integration/testsuite/Magento/Checkout/Block/Onepage/BillingTest.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/Block/Express/Review/BillingTest.php
@@ -3,7 +3,7 @@
  * Copyright © 2015 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */
-namespace Magento\Checkout\Block\Onepage;
+namespace Magento\Paypal\Block\Express\Review;
 
 use Magento\Customer\Model\Context;
 use Magento\TestFramework\Helper\Bootstrap;
@@ -13,7 +13,7 @@ use Magento\TestFramework\Helper\Bootstrap;
  */
 class BillingTest extends \PHPUnit_Framework_TestCase
 {
-    /** @var \Magento\Checkout\Block\Onepage\Billing */
+    /** @var \Magento\Paypal\Block\Express\Review\Billing */
     protected $_block;
 
     /** @var \Magento\Customer\Api\AddressRepositoryInterface */
@@ -67,9 +67,9 @@ class BillingTest extends \PHPUnit_Framework_TestCase
             ->setValue(Context::CONTEXT_AUTH, true, false);
         $this->_block = $objectManager->get('Magento\Framework\View\LayoutInterface')
             ->createBlock(
-                'Magento\Checkout\Block\Onepage\Billing',
+                'Magento\Paypal\Block\Express\Review\Billing',
                 '',
-                ['customerSession' => $customerSession, 'checkoutSession' => $checkoutSession]
+                ['customerSession' => $customerSession, 'resourceSession' => $checkoutSession]
             );
     }
 
@@ -136,19 +136,4 @@ class BillingTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals(self::SAMPLE_FIRST_NAME, $this->_block->getFirstname());
         $this->assertEquals(self::SAMPLE_LAST_NAME, $this->_block->getLastname());
     }
-
-    /**
-     * @magentoDataFixture Magento/Customer/_files/customer.php
-     * @magentoDataFixture Magento/Customer/_files/customer_address.php
-     */
-    public function testGetAddressesHtmlSelect()
-    {
-        Bootstrap::getObjectManager()->get('Magento\Customer\Model\Session')->setCustomerId(1);
-        // @codingStandardsIgnoreStart
-        $expected = <<<OUTPUT
-<select name="billing_address_id" id="billing:address-select" class="address-select" title="" ><option value="1" selected="selected" >John Smith, Green str, 67, CityM, Alabama 75477, United States</option><option value="" >New Address</option></select>
-OUTPUT;
-        // @codingStandardsIgnoreEnd
-        $this->assertEquals($expected, $this->_block->getAddressesHtmlSelect('billing'));
-    }
 }
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/integration/testsuite/Magento/Sitemap/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php
index 3eacb4c386420311d3587fe3e407eae85f5319ef..2579f660db11dc69b964c33e58cc132c8010b645 100644
--- a/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php
@@ -14,15 +14,6 @@ class DataTest extends \PHPUnit_Framework_TestCase
 
     protected function setUp()
     {
-        // TODO: Remove provided check after PHPMD will support PHP version 7
-        $isSupported = version_compare(
-            '7.0.0',
-            preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION),
-            '>'
-        );
-        if (!$isSupported) {
-            $this->markTestSkipped('MAGETWO-40822: PHP7 incompatible');
-        }
         $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
             'Magento\Sitemap\Helper\Data'
         );
diff --git a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php
index 6349d18bdced4120969be3672cd54cb77c49ddcd..ed5c2b33fdb300f95da2efff0e1ceb3835ad1575 100644
--- a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php
+++ b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeMessDetector.php
@@ -46,9 +46,7 @@ class CodeMessDetector implements ToolInterface
      */
     public function canRun()
     {
-        /** TODO: Remove provided check after PHPMD will support PHP version 7 */
-        $isPhpVersionSupported = PHP_VERSION_ID < 70000;
-        return class_exists('PHPMD\TextUI\Command') && $isPhpVersionSupported;
+        return class_exists('PHPMD\TextUI\Command');
     }
 
     /**
diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php
index 196e065ee3e70fec05aa5ff56dfe847a2677d6e6..b3b7e590f57764f349feb000fd9c778aaa4863c4 100644
--- a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php
+++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeMessDetectorTest.php
@@ -14,15 +14,8 @@ class CodeMessDetectorTest extends \PHPUnit_Framework_TestCase
             'some/report/file.xml'
         );
 
-        /** TODO: Remove provided check after PHPMD will support PHP version 7 */
-        $isPhpVersionSupported = version_compare(
-            '7.0.0',
-            preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION),
-            '>'
-        );
-
         $this->assertEquals(
-            class_exists('PHPMD\TextUI\Command') && $isPhpVersionSupported,
+            class_exists('PHPMD\TextUI\Command'),
             $messDetector->canRun()
         );
     }
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/blacklist/magento.txt b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt
index 70168b63a4efb5f06f978a00c9896b0c1a6d5f12..7497804d68237b137475036e394951135630508e 100644
--- a/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt
@@ -105,15 +105,6 @@ app/code/Magento/Checkout/view/frontend/web/js/model/sidebar.js
 app/code/Magento/Checkout/view/frontend/web/js/model/step-navigator.js
 app/code/Magento/Checkout/view/frontend/web/js/model/totals.js
 app/code/Magento/Checkout/view/frontend/web/js/model/url-builder.js
-app/code/Magento/Checkout/view/frontend/web/js/opc-billing-info.js
-app/code/Magento/Checkout/view/frontend/web/js/opc-checkout-method.js
-app/code/Magento/Checkout/view/frontend/web/js/opc-order-review.js
-app/code/Magento/Checkout/view/frontend/web/js/opc-payment-info.js
-app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-info.js
-app/code/Magento/Checkout/view/frontend/web/js/opc-shipping-method.js
-app/code/Magento/Checkout/view/frontend/web/js/opcheckout.js
-app/code/Magento/Checkout/view/frontend/web/js/payment-authentication.js
-app/code/Magento/Checkout/view/frontend/web/js/payment.js
 app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js
 app/code/Magento/Checkout/view/frontend/web/js/region-updater.js
 app/code/Magento/Checkout/view/frontend/web/js/shopping-cart.js
@@ -219,6 +210,7 @@ app/code/Magento/Msrp/view/frontend/requirejs-config.js
 app/code/Magento/Multishipping/view/frontend/requirejs-config.js
 app/code/Magento/Multishipping/view/frontend/web/js/multi-shipping.js
 app/code/Magento/Multishipping/view/frontend/web/js/overview.js
+app/code/Magento/Multishipping/view/frontend/web/js/payment.js
 app/code/Magento/OfflinePayments/view/frontend/web/js/view/payment/method-renderer/banktransfer-method.js
 app/code/Magento/OfflinePayments/view/frontend/web/js/view/payment/method-renderer/cashondelivery-method.js
 app/code/Magento/OfflinePayments/view/frontend/web/js/view/payment/method-renderer/checkmo-method.js
@@ -688,15 +680,6 @@ vendor/magento/module-checkout/view/frontend/web/js/model/step-loader.js
 vendor/magento/module-checkout/view/frontend/web/js/model/step-navigator.js
 vendor/magento/module-checkout/view/frontend/web/js/model/totals.js
 vendor/magento/module-checkout/view/frontend/web/js/model/url-builder.js
-vendor/magento/module-checkout/view/frontend/web/js/opc-billing-info.js
-vendor/magento/module-checkout/view/frontend/web/js/opc-checkout-method.js
-vendor/magento/module-checkout/view/frontend/web/js/opc-order-review.js
-vendor/magento/module-checkout/view/frontend/web/js/opc-payment-info.js
-vendor/magento/module-checkout/view/frontend/web/js/opc-shipping-info.js
-vendor/magento/module-checkout/view/frontend/web/js/opc-shipping-method.js
-vendor/magento/module-checkout/view/frontend/web/js/opcheckout.js
-vendor/magento/module-checkout/view/frontend/web/js/payment-authentication.js
-vendor/magento/module-checkout/view/frontend/web/js/payment.js
 vendor/magento/module-checkout/view/frontend/web/js/proceed-to-checkout.js
 vendor/magento/module-checkout/view/frontend/web/js/region-updater.js
 vendor/magento/module-checkout/view/frontend/web/js/shopping-cart.js
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/dev/tests/static/testsuite/Magento/Test/Js/_files/jshint/blacklist/core.txt b/dev/tests/static/testsuite/Magento/Test/Js/_files/jshint/blacklist/core.txt
index 9699f47c4bcccc9dd1009437092117fae86c0f25..2cb2aca38f906e767c139a830976538f18f337cc 100644
--- a/dev/tests/static/testsuite/Magento/Test/Js/_files/jshint/blacklist/core.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Js/_files/jshint/blacklist/core.txt
@@ -4,7 +4,6 @@ module Magento_Catalog view/adminhtml/web/catalog/category/edit.js
 module Magento_Catalog view/adminhtml/web/catalog/product.js
 module Magento_Catalog view/adminhtml/web/catalog/product/composite/configure.js
 module Magento_Checkout view/frontend/web/js/opcheckout.js
-module Magento_Checkout view/frontend/web/js/payment.js
 module Magento_Rule view/adminhtml/web/rules.js
 module Magento_Sales view/adminhtml/web/order/create/giftmessage.js
 module Magento_Sales view/adminhtml/web/order/create/scripts.js
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/Css/PreProcessor/Adapter/Less/Oyejorge.php b/lib/internal/Magento/Framework/Css/PreProcessor/Adapter/Less/Oyejorge.php
deleted file mode 100644
index eed8d0555341be43c29d3fe7f05452b08ebd7783..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Css/PreProcessor/Adapter/Less/Oyejorge.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Framework\Css\PreProcessor\Adapter\Less;
-
-use Magento\Framework\App\State;
-
-/**
- * Oyejorge adapter model
- */
-class Oyejorge implements \Magento\Framework\Css\PreProcessor\AdapterInterface
-{
-    /**
-     * @var \Psr\Log\LoggerInterface
-     */
-    protected $logger;
-
-    /**
-     * @var \Magento\Framework\App\State
-     */
-    protected $appState;
-
-    /**
-     * @param \Psr\Log\LoggerInterface $logger
-     * @param State $appState
-     */
-    public function __construct(
-        \Psr\Log\LoggerInterface $logger,
-        State $appState
-    ) {
-        $this->logger = $logger;
-        $this->appState = $appState;
-    }
-
-    /**
-     * @param string $sourceFilePath
-     * @return string
-     */
-    public function process($sourceFilePath)
-    {
-        $options = ['relativeUrls' => false, 'compress' => $this->appState->getMode() !== State::MODE_DEVELOPER];
-        try {
-            $parser = new \Less_Parser($options);
-            $parser->parseFile($sourceFilePath, '');
-            return $parser->getCss();
-        } catch (\Exception $e) {
-            $errorMessage = self::ERROR_MESSAGE_PREFIX . $e->getMessage();
-            $this->logger->critical($errorMessage);
-            return $errorMessage;
-        }
-    }
-}
diff --git a/lib/internal/Magento/Framework/Css/PreProcessor/Adapter/Less/Processor.php b/lib/internal/Magento/Framework/Css/PreProcessor/Adapter/Less/Processor.php
new file mode 100644
index 0000000000000000000000000000000000000000..26cb1ce21d66a979dc2c97ba5db99db8d8d4890d
--- /dev/null
+++ b/lib/internal/Magento/Framework/Css/PreProcessor/Adapter/Less/Processor.php
@@ -0,0 +1,92 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\Css\PreProcessor\Adapter\Less;
+
+use Psr\Log\LoggerInterface;
+use Magento\Framework\App\State;
+use Magento\Framework\View\Asset\File;
+use Magento\Framework\View\Asset\Source;
+use Magento\Framework\Css\PreProcessor\File\Temporary;
+use Magento\Framework\View\Asset\ContentProcessorInterface;
+
+/**
+ * Class Processor
+ */
+class Processor implements ContentProcessorInterface
+{
+    /**
+     * @var LoggerInterface
+     */
+    private $logger;
+
+    /**
+     * @var State
+     */
+    private $appState;
+
+    /**
+     * @var Source
+     */
+    private $assetSource;
+
+    /**
+     * @var Temporary
+     */
+    private $temporaryFile;
+
+    /**
+     * Constructor
+     *
+     * @param LoggerInterface $logger
+     * @param State $appState
+     * @param Source $assetSource
+     * @param Temporary $temporaryFile
+     */
+    public function __construct(
+        LoggerInterface $logger,
+        State $appState,
+        Source $assetSource,
+        Temporary $temporaryFile
+    ) {
+        $this->logger = $logger;
+        $this->appState = $appState;
+        $this->assetSource = $assetSource;
+        $this->temporaryFile = $temporaryFile;
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function processContent(File $asset)
+    {
+        try {
+            $parser = new \Less_Parser(
+                [
+                    'relativeUrls' => false,
+                    'compress' => $this->appState->getMode() !== State::MODE_DEVELOPER
+                ]
+            );
+
+            $content = $this->assetSource->getContent($asset);
+
+            if (trim($content) === '') {
+                return '';
+            }
+
+            $tmpFilePath = $this->temporaryFile->createFile($asset->getPath(), $content);
+            $parser->parseFile($tmpFilePath, '');
+
+            $content = $parser->getCss();
+
+            return $content;
+        } catch (\Exception $e) {
+            $errorMessage = self::ERROR_MESSAGE_PREFIX . $e->getMessage();
+            $this->logger->critical($errorMessage);
+
+            return $errorMessage;
+        }
+    }
+}
diff --git a/lib/internal/Magento/Framework/Css/PreProcessor/AdapterInterface.php b/lib/internal/Magento/Framework/Css/PreProcessor/AdapterInterface.php
deleted file mode 100644
index b2b230bc30233add74cc614f0f820a70cd352dc4..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Css/PreProcessor/AdapterInterface.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Framework\Css\PreProcessor;
-
-/**
- * Css pre-processor adapter interface
- */
-interface AdapterInterface
-{
-    const ERROR_MESSAGE_PREFIX = 'CSS compilation from source ';
-
-    /**
-     * @param string $sourceFilePath
-     * @return string
-     */
-    public function process($sourceFilePath);
-}
diff --git a/lib/internal/Magento/Framework/Css/PreProcessor/FileGenerator.php b/lib/internal/Magento/Framework/Css/PreProcessor/FileGenerator.php
deleted file mode 100644
index ff69af61e354c142422430e601222fbacdfc8173..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Css/PreProcessor/FileGenerator.php
+++ /dev/null
@@ -1,149 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-namespace Magento\Framework\Css\PreProcessor;
-
-use Magento\Framework\App\Filesystem\DirectoryList;
-use Magento\Framework\View\Asset\PreProcessor\Chain;
-use Magento\Framework\View\Asset\SourceFileGeneratorInterface;
-
-/**
- * Class FileGenerator
- * @package Magento\Framework\Css
- * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
- */
-class FileGenerator implements SourceFileGeneratorInterface
-{
-    /**
-     * Max execution (locking) time for generation process (in seconds)
-     */
-    const MAX_LOCK_TIME = 300;
-
-    /**
-     * Lock file, if exists shows that process is locked
-     */
-    const LOCK_FILE = 'css.lock';
-
-    /**
-     * @var \Magento\Framework\Filesystem\Directory\WriteInterface
-     */
-    protected $tmpDirectory;
-
-    /**
-     * @var \Magento\Framework\View\Asset\Repository
-     */
-    private $assetRepo;
-
-    /**
-     * @var \Magento\Framework\View\Asset\Source
-     */
-    private $assetSource;
-
-    /**
-     * @var \Magento\Framework\Css\PreProcessor\Instruction\MagentoImport
-     */
-    private $magentoImportProcessor;
-
-    /**
-     * @var \Magento\Framework\Css\PreProcessor\Instruction\Import
-     */
-    private $importProcessor;
-
-    /**
-     * @var FileGenerator\RelatedGenerator
-     */
-    private $relatedGenerator;
-
-    /**
-     * @var Config
-     */
-    private $config;
-
-    /**
-     * @var File\Temporary
-     */
-    private $temporaryFile;
-
-    /**
-     * @param \Magento\Framework\Filesystem $filesystem
-     * @param \Magento\Framework\View\Asset\Repository $assetRepo
-     * @param \Magento\Framework\Css\PreProcessor\Instruction\MagentoImport $magentoImportProcessor
-     * @param \Magento\Framework\Css\PreProcessor\Instruction\Import $importProcessor
-     * @param \Magento\Framework\View\Asset\Source $assetSource
-     * @param FileGenerator\RelatedGenerator $relatedGenerator
-     * @param Config $config
-     * @param File\Temporary $temporaryFile
-     */
-    public function __construct(
-        \Magento\Framework\Filesystem $filesystem,
-        \Magento\Framework\View\Asset\Repository $assetRepo,
-        \Magento\Framework\Css\PreProcessor\Instruction\MagentoImport $magentoImportProcessor,
-        \Magento\Framework\Css\PreProcessor\Instruction\Import $importProcessor,
-        \Magento\Framework\View\Asset\Source $assetSource,
-        \Magento\Framework\Css\PreProcessor\FileGenerator\RelatedGenerator $relatedGenerator,
-        Config $config,
-        File\Temporary $temporaryFile
-    ) {
-        $this->tmpDirectory = $filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
-        $this->assetRepo = $assetRepo;
-        $this->assetSource = $assetSource;
-
-        $this->magentoImportProcessor = $magentoImportProcessor;
-        $this->importProcessor = $importProcessor;
-        $this->relatedGenerator = $relatedGenerator;
-        $this->config = $config;
-        $this->temporaryFile = $temporaryFile;
-    }
-
-    /**
-     * Create a tree of self-sustainable files and return the topmost source file,
-     * ready for passing to 3rd party library
-     *
-     * @param Chain $chain
-     * @return string Absolute path of generated topmost source file
-     */
-    public function generateFileTree(Chain $chain)
-    {
-        /**
-         * wait if generation process has already started
-         */
-        while ($this->isProcessLocked()) {
-            sleep(1);
-        }
-        $lockFilePath = $this->config->getMaterializationRelativePath() . '/' . self::LOCK_FILE;
-        $this->tmpDirectory->writeFile($lockFilePath, time());
-
-        $this->magentoImportProcessor->process($chain);
-        $this->importProcessor->process($chain);
-        $this->relatedGenerator->generate($this->importProcessor);
-
-        $contentType = $chain->getContentType();
-        $relativePath = preg_replace('#\.css$#', '.' . $contentType, $chain->getAsset()->getPath());
-        $tmpFilePath = $this->temporaryFile->createFile($relativePath, $chain->getContent());
-
-        $this->tmpDirectory->delete($lockFilePath);
-        return $tmpFilePath;
-    }
-
-    /**
-     * Check whether generation process has already locked
-     *
-     * @return bool
-     */
-    protected function isProcessLocked()
-    {
-        $lockFilePath = $this->config->getMaterializationRelativePath() . '/' . self::LOCK_FILE;
-        if ($this->tmpDirectory->isExist($lockFilePath)) {
-            $lockTime = time() - (int)$this->tmpDirectory->readFile($lockFilePath);
-            if ($lockTime >= self::MAX_LOCK_TIME) {
-                $this->tmpDirectory->delete($lockFilePath);
-                return false;
-            }
-            return true;
-        }
-        return false;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Css/PreProcessor/Instruction/Import.php b/lib/internal/Magento/Framework/Css/PreProcessor/Instruction/Import.php
index 158d022f78a0ef33c07eff29d164294ab2db9c3f..2559c32270373ee30d03ab3a518a632ed27ace52 100644
--- a/lib/internal/Magento/Framework/Css/PreProcessor/Instruction/Import.php
+++ b/lib/internal/Magento/Framework/Css/PreProcessor/Instruction/Import.php
@@ -11,6 +11,7 @@ namespace Magento\Framework\Css\PreProcessor\Instruction;
 use Magento\Framework\View\Asset\LocalInterface;
 use Magento\Framework\View\Asset\NotationResolver;
 use Magento\Framework\View\Asset\PreProcessorInterface;
+use Magento\Framework\Css\PreProcessor\FileGenerator\RelatedGenerator;
 
 /**
  * @import instruction preprocessor
@@ -34,11 +35,22 @@ class Import implements PreProcessorInterface
     protected $relatedFiles = [];
 
     /**
+     * @var RelatedGenerator
+     */
+    private $relatedFileGenerator;
+
+    /**
+     * Constructor
+     *
      * @param NotationResolver\Module $notationResolver
+     * @param RelatedGenerator $relatedFileGenerator
      */
-    public function __construct(NotationResolver\Module $notationResolver)
-    {
+    public function __construct(
+        NotationResolver\Module $notationResolver,
+        RelatedGenerator $relatedFileGenerator
+    ) {
         $this->notationResolver = $notationResolver;
+        $this->relatedFileGenerator = $relatedFileGenerator;
     }
 
     /**
@@ -54,6 +66,7 @@ class Import implements PreProcessorInterface
         $content = $this->removeComments($chain->getContent());
 
         $processedContent = preg_replace_callback(self::REPLACE_PATTERN, $replaceCallback, $content);
+        $this->relatedFileGenerator->generate($this);
 
         if ($processedContent !== $content) {
             $chain->setContent($processedContent);
diff --git a/lib/internal/Magento/Framework/Css/PreProcessor/Less.php b/lib/internal/Magento/Framework/Css/PreProcessor/Less.php
deleted file mode 100644
index 4bdbbcf31a58e7093b87becf7c5dc9ab0d7cd1c6..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Css/PreProcessor/Less.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-namespace Magento\Framework\Css\PreProcessor;
-
-use Magento\Framework\View\Asset\PreProcessorInterface;
-
-class Less implements PreProcessorInterface
-{
-    /**
-     * @var \Magento\Framework\Css\PreProcessor\FileGenerator
-     */
-    protected $fileGenerator;
-
-    /**
-     * @var AdapterInterface
-     */
-    protected $adapter;
-
-    /**
-     * @param \Magento\Framework\Css\PreProcessor\FileGenerator $fileGenerator
-     * @param AdapterInterface $adapter
-     */
-    public function __construct(
-        \Magento\Framework\Css\PreProcessor\FileGenerator $fileGenerator,
-        AdapterInterface $adapter
-    ) {
-        $this->fileGenerator = $fileGenerator;
-        $this->adapter = $adapter;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function process(\Magento\Framework\View\Asset\PreProcessor\Chain $chain)
-    {
-        $chain->setContentType('less');
-        $tmpFile = $this->fileGenerator->generateFileTree($chain);
-        $cssContent = $this->adapter->process($tmpFile);
-        $cssTrimmedContent = trim($cssContent);
-        if (!empty($cssTrimmedContent)) {
-            $chain->setContent($cssContent);
-        }
-        $chain->setContentType('css');
-    }
-}
diff --git a/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/FileGeneratorTest.php b/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/FileGeneratorTest.php
deleted file mode 100644
index 4f034c16360776c8e5d7344943725bfba4b4a190..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/FileGeneratorTest.php
+++ /dev/null
@@ -1,177 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-namespace Magento\Framework\Css\Test\Unit\PreProcessor;
-
-class FileGeneratorTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @var \Magento\Framework\Css\PreProcessor\Instruction\Import|\PHPUnit_Framework_MockObject_MockObject
-     */
-    private $import;
-
-    /**
-     * @var \Magento\Framework\Css\PreProcessor\Instruction\MagentoImport|\PHPUnit_Framework_MockObject_MockObject
-     */
-    private $magentoImport;
-
-    /**
-     * @var \Magento\Framework\Filesystem\Directory\WriteInterface|\PHPUnit_Framework_MockObject_MockObject
-     */
-    private $tmpDirectory;
-
-    /**
-     * @var \Magento\Framework\Filesystem\Directory\ReadInterface|\PHPUnit_Framework_MockObject_MockObject
-     */
-    private $rootDirectory;
-
-    /**
-     * @var \Magento\Framework\View\Asset\Repository|\PHPUnit_Framework_MockObject_MockObject
-     */
-    private $assetRepo;
-
-    /**
-     * @var \Magento\Framework\Css\PreProcessor\FileGenerator
-     */
-    private $object;
-
-    /**
-     * @var \Magento\Framework\Css\PreProcessor\FileGenerator\RelatedGenerator|\PHPUnit_Framework_MockObject_MockObject
-     */
-    private $relatedGenerator;
-
-    /**
-     * @var \Magento\Framework\Css\PreProcessor\Config|\PHPUnit_Framework_MockObject_MockObject
-     */
-    private $config;
-
-    /**
-     * @var \Magento\Framework\Css\PreProcessor\File\Temporary|\PHPUnit_Framework_MockObject_MockObject
-     */
-    private $temporaryFile;
-
-    protected function setUp()
-    {
-        $this->tmpDirectory = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\WriteInterface');
-        $this->rootDirectory = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\ReadInterface');
-        $this->rootDirectory->expects($this->any())
-            ->method('getRelativePath')
-            ->will($this->returnArgument(0));
-        $this->rootDirectory->expects($this->any())
-            ->method('readFile')
-            ->will(
-                $this->returnCallback(
-                    function ($file) {
-                        return "content of '$file'";
-                    }
-                )
-            );
-        $filesystem = $this->getMock('\Magento\Framework\Filesystem', [], [], '', false);
-        $filesystem->expects($this->once())
-            ->method('getDirectoryWrite')
-            ->will($this->returnValue($this->tmpDirectory));
-        $this->assetRepo = $this->getMock('\Magento\Framework\View\Asset\Repository', [], [], '', false);
-        $this->magentoImport = $this->getMock(
-            'Magento\Framework\Css\PreProcessor\Instruction\MagentoImport',
-            [],
-            [],
-            '',
-            false
-        );
-        $this->import = $this->getMock(
-            'Magento\Framework\Css\PreProcessor\Instruction\Import',
-            [],
-            [],
-            '',
-            false
-        );
-
-        $assetSource = $this->getMock(
-            'Magento\Framework\View\Asset\Source',
-            [],
-            [],
-            '',
-            false
-        );
-
-        $this->relatedGenerator = $this->getMockBuilder(
-            'Magento\Framework\Css\PreProcessor\FileGenerator\RelatedGenerator'
-        )
-            ->disableOriginalConstructor()
-            ->setMethods([])
-            ->getMock();
-        $this->config = $this->getMockBuilder('Magento\Framework\Css\PreProcessor\Config')
-            ->disableOriginalConstructor()
-            ->setMethods([])
-            ->getMock();
-        $this->temporaryFile = $this->getMockBuilder('Magento\Framework\Css\PreProcessor\File\Temporary')
-            ->disableOriginalConstructor()
-            ->setMethods([])
-            ->getMock();
-        $this->object = new \Magento\Framework\Css\PreProcessor\FileGenerator(
-            $filesystem,
-            $this->assetRepo,
-            $this->magentoImport,
-            $this->import,
-            $assetSource,
-            $this->relatedGenerator,
-            $this->config,
-            $this->temporaryFile
-        );
-    }
-
-    public function testGenerateFileTree()
-    {
-        $lessDirectory = 'path/to/less';
-        $expectedContent = 'updated content';
-        $expectedRelativePath = 'some/file.less';
-        $expectedPath = $lessDirectory . '/some/file.less';
-
-
-        $asset = $this->getMock('Magento\Framework\View\Asset\File', [], [], '', false);
-        $chain = $this->getMock('Magento\Framework\View\Asset\PreProcessor\Chain', [], [], '', false);
-
-        $this->config->expects($this->any())
-            ->method('getLessDirectory')
-            ->willReturn($lessDirectory);
-        $this->tmpDirectory->expects($this->once())
-            ->method('isExist')
-            ->willReturn(true);
-
-        $this->magentoImport->expects($this->once())
-            ->method('process')
-            ->with($chain);
-        $this->import->expects($this->once())
-            ->method('process')
-            ->with($chain);
-        $this->relatedGenerator->expects($this->once())
-            ->method('generate')
-            ->with($this->import);
-
-        $asset->expects($this->once())
-            ->method('getPath')
-            ->will($this->returnValue('some/file.css'));
-        $chain->expects($this->once())
-            ->method('getContent')
-            ->willReturn($expectedContent);
-        $chain->expects($this->once())
-            ->method('getAsset')
-            ->willReturn($asset);
-        $chain->expects($this->once())
-            ->method('getContentType')
-            ->willReturn('less');
-
-        $this->temporaryFile->expects($this->once())
-            ->method('createFile')
-            ->with(
-                $expectedRelativePath,
-                $expectedContent
-            )
-            ->willReturn($expectedPath);
-
-        $this->assertSame($expectedPath, $this->object->generateFileTree($chain));
-    }
-}
diff --git a/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php b/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php
index 6be802eaf35dc19ab8238a39fa0856ae4f1eb6c6..b5959faaf5d9e016847f7f2c3c6f729941cd6fc8 100644
--- a/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php
+++ b/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/Instruction/ImportTest.php
@@ -8,6 +8,12 @@
 
 namespace Magento\Framework\Css\Test\Unit\PreProcessor\Instruction;
 
+use Magento\Framework\Css\PreProcessor\FileGenerator\RelatedGenerator;
+use Magento\Framework\Css\PreProcessor\Instruction\Import;
+
+/**
+ * Class ImportTest
+ */
 class ImportTest extends \PHPUnit_Framework_TestCase
 {
     /**
@@ -21,18 +27,29 @@ class ImportTest extends \PHPUnit_Framework_TestCase
     private $asset;
 
     /**
-     * @var \Magento\Framework\Css\PreProcessor\Instruction\Import
+     * @var Import
      */
     private $object;
 
+    /**
+     * @var RelatedGenerator
+     */
+    private $relatedFileGeneratorMock;
+
     protected function setUp()
     {
+
         $this->notationResolver = $this->getMock(
             '\Magento\Framework\View\Asset\NotationResolver\Module', [], [], '', false
         );
         $this->asset = $this->getMock('\Magento\Framework\View\Asset\File', [], [], '', false);
         $this->asset->expects($this->any())->method('getContentType')->will($this->returnValue('css'));
-        $this->object = new \Magento\Framework\Css\PreProcessor\Instruction\Import($this->notationResolver);
+
+        $this->relatedFileGeneratorMock = $this->getMockBuilder(RelatedGenerator::class)
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->object = new Import($this->notationResolver, $this->relatedFileGeneratorMock);
     }
 
     /**
diff --git a/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/LessTest.php b/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/LessTest.php
deleted file mode 100644
index 4b13f6d09411d4dd948f39e14d5449d374e19b58..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Css/Test/Unit/PreProcessor/LessTest.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-/**
- * Copyright © 2015 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-namespace Magento\Framework\Css\Test\Unit\PreProcessor;
-
-use Magento\Framework\View\Asset\PreProcessor\Chain;
-
-class LessTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @var \Magento\Framework\Css\PreProcessor\FileGenerator|\PHPUnit_Framework_MockObject_MockObject
-     */
-    private $fileGenerator;
-
-    /**
-     * @var \Magento\Framework\Css\PreProcessor\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject
-     */
-    private $adapter;
-
-    /**
-     * @var Chain
-     */
-    private $chain;
-
-    /**
-     * @var \Magento\Framework\Css\PreProcessor\Less
-     */
-    private $object;
-
-    protected function setUp()
-    {
-        $this->fileGenerator = $this->getMock('\Magento\Framework\Css\PreProcessor\FileGenerator', [], [], '', false);
-        $this->adapter = $this->getMockForAbstractClass('\Magento\Framework\Css\PreProcessor\AdapterInterface');
-        $asset = $this->getMockForAbstractClass('\Magento\Framework\View\Asset\LocalInterface');
-        $asset->expects($this->once())->method('getContentType')->will($this->returnValue('origType'));
-        $this->chain = new Chain($asset, 'original content', 'origType', 'origPath');
-        $this->object = new \Magento\Framework\Css\PreProcessor\Less($this->fileGenerator, $this->adapter);
-    }
-
-    public function testProcess()
-    {
-        $expectedContent = 'updated content';
-        $tmpFile = 'tmp/file.ext';
-        $this->fileGenerator->expects($this->once())
-            ->method('generateFileTree')
-            ->with($this->chain)
-            ->will($this->returnValue($tmpFile));
-        $this->adapter->expects($this->once())
-            ->method('process')
-            ->with($tmpFile)
-            ->will($this->returnValue($expectedContent));
-        $this->object->process($this->chain);
-        $this->assertEquals($expectedContent, $this->chain->getContent());
-        $this->assertEquals('css', $this->chain->getContentType());
-    }
-}
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/View/Asset/ContentProcessorInterface.php b/lib/internal/Magento/Framework/View/Asset/ContentProcessorInterface.php
new file mode 100644
index 0000000000000000000000000000000000000000..a7df2aad78c42c00b8b2c96530f53e796b610ff2
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Asset/ContentProcessorInterface.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Asset;
+
+use Magento\Framework\View\Asset\File;
+
+/**
+ * Interface ContentProcessorInterface
+ */
+interface ContentProcessorInterface
+{
+    /**
+     * Error prefix
+     */
+    const ERROR_MESSAGE_PREFIX = 'Compilation from source: ';
+
+    /**
+     * Process file content
+     *
+     * @param File $asset
+     * @return string
+     */
+    public function processContent(File $asset);
+}
diff --git a/lib/internal/Magento/Framework/View/Asset/LockerProcess.php b/lib/internal/Magento/Framework/View/Asset/LockerProcess.php
new file mode 100644
index 0000000000000000000000000000000000000000..3f07c9b0ab23a1b5292f9f9b6e5ac3d46f5fde22
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Asset/LockerProcess.php
@@ -0,0 +1,111 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Asset;
+
+use Magento\Framework\Filesystem;
+use Magento\Framework\App\Filesystem\DirectoryList;
+use Magento\Framework\Exception\FileSystemException;
+use Magento\Framework\Filesystem\Directory\WriteInterface;
+
+/**
+ * Class LockerProcess
+ */
+class LockerProcess implements LockerProcessInterface
+{
+    /**
+     * File extension lock
+     */
+    const LOCK_EXTENSION = '.lock';
+
+    /**
+     * Max execution (locking) time for process (in seconds)
+     */
+    const MAX_LOCK_TIME = 30;
+
+    /**
+     * @var Filesystem
+     */
+    private $filesystem;
+
+    /**
+     * @var string
+     */
+    private $lockFilePath;
+
+    /**
+     * @var WriteInterface
+     */
+    private $tmpDirectory;
+
+    /**
+     * Constructor
+     *
+     * @param Filesystem $filesystem
+     */
+    public function __construct(Filesystem $filesystem)
+    {
+        $this->filesystem = $filesystem;
+    }
+
+    /**
+     * @inheritdoc
+     * @throws FileSystemException
+     */
+    public function lockProcess($lockName)
+    {
+        $this->tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
+        $this->lockFilePath = $this->getFilePath($lockName);
+
+        while ($this->isProcessLocked()) {
+            sleep(1);
+        }
+
+        $this->tmpDirectory->writeFile($this->lockFilePath, time());
+
+    }
+
+    /**
+     * @inheritdoc
+     * @throws FileSystemException
+     */
+    public function unlockProcess()
+    {
+        $this->tmpDirectory->delete($this->lockFilePath);
+    }
+
+    /**
+     * Check whether generation process has already locked
+     *
+     * @return bool
+     * @throws FileSystemException
+     */
+    private function isProcessLocked()
+    {
+        if ($this->tmpDirectory->isExist($this->lockFilePath)) {
+            $lockTime = (int) $this->tmpDirectory->readFile($this->lockFilePath);
+            if ((time() - $lockTime) >= self::MAX_LOCK_TIME) {
+                $this->tmpDirectory->delete($this->lockFilePath);
+
+                return false;
+            }
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Get name of lock file
+     *
+     * @param string $name
+     * @return string
+     */
+    private function getFilePath($name)
+    {
+        return DirectoryList::TMP . DIRECTORY_SEPARATOR . $name . self::LOCK_EXTENSION;
+    }
+}
diff --git a/lib/internal/Magento/Framework/View/Asset/LockerProcessInterface.php b/lib/internal/Magento/Framework/View/Asset/LockerProcessInterface.php
new file mode 100644
index 0000000000000000000000000000000000000000..d719653a5f18d74e6592072e1acf7fa71adb8310
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Asset/LockerProcessInterface.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Asset;
+
+/**
+ * Interface LockerProcessInterface
+ */
+interface LockerProcessInterface
+{
+    /**
+     * @param string $lockName
+     * @return void
+     */
+    public function lockProcess($lockName);
+
+    /**
+     * @return void
+     */
+    public function unlockProcess();
+}
diff --git a/lib/internal/Magento/Framework/View/Asset/PreProcessor/AlternativeSource.php b/lib/internal/Magento/Framework/View/Asset/PreProcessor/AlternativeSource.php
new file mode 100644
index 0000000000000000000000000000000000000000..d727bd9fa40598dba7c3cf65330c8da88155d361
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Asset/PreProcessor/AlternativeSource.php
@@ -0,0 +1,161 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Asset\PreProcessor;
+
+use Magento\Framework\Filesystem;
+use Magento\Framework\ObjectManagerInterface;
+use Magento\Framework\View\Asset\File\FallbackContext;
+use Magento\Framework\View\Asset\LockerProcessInterface;
+use Magento\Framework\View\Asset\ContentProcessorInterface;
+use Magento\Framework\View\Asset\PreProcessor\AlternativeSource\AssetBuilder;
+
+/**
+ * Class AlternativeSource
+ */
+class AlternativeSource implements AlternativeSourceInterface
+{
+    /**
+     * The key name of the processor class
+     */
+    const PROCESSOR_CLASS = 'class';
+
+    /**
+     * @var Helper\SortInterface
+     */
+    private $sorter;
+
+    /**
+     * @var array
+     */
+    private $alternatives;
+
+    /**
+     * @var ObjectManagerInterface
+     */
+    private $objectManager;
+
+    /**
+     * @var array
+     */
+    private $alternativesSorted;
+
+    /**
+     * @var LockerProcessInterface
+     */
+    private $lockerProcess;
+
+    /**
+     * @var string
+     */
+    private $lockName;
+
+    /**
+     * @var AssetBuilder
+     */
+    private $assetBuilder;
+
+    /**
+     * Constructor
+     *
+     * @param ObjectManagerInterface $objectManager
+     * @param LockerProcessInterface $lockerProcess
+     * @param Helper\SortInterface $sorter
+     * @param AssetBuilder $assetBuilder
+     * @param string $lockName
+     * @param array $alternatives
+     */
+    public function __construct(
+        ObjectManagerInterface $objectManager,
+        LockerProcessInterface $lockerProcess,
+        Helper\SortInterface $sorter,
+        AssetBuilder $assetBuilder,
+        $lockName,
+        array $alternatives = []
+    ) {
+        $this->objectManager = $objectManager;
+        $this->lockerProcess = $lockerProcess;
+        $this->sorter = $sorter;
+        $this->alternatives = $alternatives;
+        $this->lockName = $lockName;
+        $this->assetBuilder = $assetBuilder;
+    }
+
+    /**
+     * @inheritdoc
+     * @throws \UnexpectedValueException
+     */
+    public function process(Chain $chain)
+    {
+        $path = $chain->getAsset()->getFilePath();
+        $content = $chain->getContent();
+        if (trim($content) !== '') {
+            return;
+        }
+
+        try {
+            $this->lockerProcess->lockProcess($this->lockName . sprintf('%x', crc32($path . $content)));
+
+            $module = $chain->getAsset()->getModule();
+
+            /** @var  FallbackContext $context */
+            $context = $chain->getAsset()->getContext();
+            $chain->setContent($this->processContent($path, $content, $module, $context));
+        } finally {
+            $this->lockerProcess->unlockProcess();
+        }
+    }
+
+    /**
+     * Preparation of content for the destination file
+     *
+     * @param string $path
+     * @param string $content
+     * @param string $module
+     * @param FallbackContext $context
+     * @return string
+     * @throws \UnexpectedValueException
+     */
+    private function processContent($path, $content, $module, FallbackContext $context)
+    {
+        if ($this->alternativesSorted === null) {
+            $this->alternativesSorted = $this->sorter->sort($this->alternatives);
+        }
+
+        foreach ($this->alternativesSorted as $name => $alternative) {
+            $asset = $this->assetBuilder->setArea($context->getAreaCode())
+                ->setTheme($context->getThemePath())
+                ->setLocale($context->getLocale())
+                ->setModule($module)
+                ->setPath(preg_replace(
+                    '#\.' . preg_quote(pathinfo($path, PATHINFO_EXTENSION)) . '$#',
+                    '.' . $name,
+                    $path
+                ))->build();
+
+            $processor = $this->objectManager->get($alternative[self::PROCESSOR_CLASS]);
+            if (!$processor  instanceof ContentProcessorInterface) {
+                throw new \UnexpectedValueException(
+                    '"' . $alternative[self::PROCESSOR_CLASS] . '" has to implement the ContentProcessorInterface.'
+                );
+            }
+            $content = $processor->processContent($asset);
+
+            if (trim($content) !== '') {
+                return $content;
+            }
+        }
+
+        return $content;
+    }
+
+    /**
+     * @inheritdoc
+     */
+    public function getAlternativesExtensionsNames()
+    {
+        return array_keys($this->alternatives);
+    }
+}
diff --git a/lib/internal/Magento/Framework/View/Asset/PreProcessor/AlternativeSource/AssetBuilder.php b/lib/internal/Magento/Framework/View/Asset/PreProcessor/AlternativeSource/AssetBuilder.php
new file mode 100644
index 0000000000000000000000000000000000000000..79f13bb5632a44cb8f959d8577f22f600f9c8755
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Asset/PreProcessor/AlternativeSource/AssetBuilder.php
@@ -0,0 +1,134 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Asset\PreProcessor\AlternativeSource;
+
+use Magento\Framework\View\Asset\File;
+use Magento\Framework\View\Asset\Repository;
+
+/**
+ * Class AssetBuilder
+ */
+class AssetBuilder
+{
+    /**
+     * @var string
+     */
+    private $area;
+
+    /**
+     * @var string
+     */
+    private $theme;
+
+    /**
+     * @var string
+     */
+    private $locale;
+
+    /**
+     * @var string
+     */
+    private $module;
+
+    /**
+     * @var string
+     */
+    private $path;
+
+    /**
+     * @var Repository
+     */
+    private $repository;
+
+    /**
+     * Constructor
+     *
+     * @param Repository $repository
+     */
+    public function __construct(Repository $repository)
+    {
+        $this->repository = $repository;
+    }
+
+    /**
+     * Set area
+     *
+     * @param string $area
+     * @return $this
+     */
+    public function setArea($area)
+    {
+        $this->area = $area;
+        return $this;
+    }
+
+    /**
+     * Set theme
+     *
+     * @param string $theme
+     * @return $this
+     */
+    public function setTheme($theme)
+    {
+        $this->theme = $theme;
+        return $this;
+    }
+
+    /**
+     * Set locale
+     *
+     * @param string $locale
+     * @return $this
+     */
+    public function setLocale($locale)
+    {
+        $this->locale = $locale;
+        return $this;
+    }
+
+    /**
+     * Set module
+     *
+     * @param string $module
+     * @return $this
+     */
+    public function setModule($module)
+    {
+        $this->module = $module;
+        return $this;
+    }
+
+    /**
+     * Set path
+     *
+     * @param string $path
+     * @return $this
+     */
+    public function setPath($path)
+    {
+        $this->path = $path;
+        return $this;
+    }
+
+    /**
+     * @return File
+     */
+    public function build()
+    {
+        $params = [
+            'area' => $this->area,
+            'theme' => $this->theme,
+            'locale' => $this->locale,
+            'module' => $this->module,
+        ];
+
+        $asset = $this->repository->createAsset($this->path, $params);
+
+        unset($this->path, $this->module, $this->locale, $this->theme, $this->area);
+
+        return $asset;
+    }
+}
diff --git a/lib/internal/Magento/Framework/View/Asset/PreProcessor/AlternativeSourceInterface.php b/lib/internal/Magento/Framework/View/Asset/PreProcessor/AlternativeSourceInterface.php
new file mode 100644
index 0000000000000000000000000000000000000000..43a20b74809449bd401fff2e119292a99910b60b
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Asset/PreProcessor/AlternativeSourceInterface.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Asset\PreProcessor;
+
+use Magento\Framework\View\Asset\PreProcessorInterface;
+
+/**
+ * Interface AlternativeSourceInterface
+ */
+interface AlternativeSourceInterface extends PreProcessorInterface
+{
+    /**
+     * Get extensions names of alternatives
+     *
+     * @return string[]
+     */
+    public function getAlternativesExtensionsNames();
+}
diff --git a/lib/internal/Magento/Framework/View/Asset/PreProcessor/Helper/Sort.php b/lib/internal/Magento/Framework/View/Asset/PreProcessor/Helper/Sort.php
new file mode 100644
index 0000000000000000000000000000000000000000..a2a4c1d8f2b5eca6f53cbdb87634a1a0e11aec4a
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Asset/PreProcessor/Helper/Sort.php
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Asset\PreProcessor\Helper;
+
+use Magento\Framework\Phrase;
+
+/**
+ * Class Sort
+ */
+class Sort implements SortInterface
+{
+    /**
+     * Name of directive
+     */
+    const DIRECTIVE = 'after';
+
+    /**
+     * Key of name items
+     */
+    const NEXT_KEY = 'next';
+
+    /**
+     * @var array
+     */
+    private $result;
+
+    /**
+     * @var array
+     */
+    private $array;
+
+    /**
+     * @inheritdoc
+     */
+    public function sort(array $array)
+    {
+        $this->result = [];
+        $this->array = $array;
+
+        $nodes = [];
+        $structure = [];
+        foreach ($this->array as $name => $item) {
+            $nodes[$name] = isset($nodes[$name]) ? $nodes[$name] : [self::NEXT_KEY => null];
+            if (isset($item[self::DIRECTIVE])) {
+                $nodes[$item[self::DIRECTIVE]][self::NEXT_KEY][$name] = &$nodes[$name];
+                continue;
+            }
+            $structure[$name] = &$nodes[$name];
+        }
+
+        $this->fillResult($structure);
+
+        return $this->result;
+    }
+
+    /**
+     * @param array $structure
+     * @return void
+     */
+    private function fillResult(array $structure)
+    {
+        foreach ($structure as $name => $item) {
+            $this->result[$name] = $this->array[$name];
+            if (!empty($item[self::NEXT_KEY])) {
+                $this->fillResult($item[self::NEXT_KEY]);
+            }
+        }
+    }
+}
diff --git a/lib/internal/Magento/Framework/View/Asset/PreProcessor/Helper/SortInterface.php b/lib/internal/Magento/Framework/View/Asset/PreProcessor/Helper/SortInterface.php
new file mode 100644
index 0000000000000000000000000000000000000000..130add1da0108caadbd72af45badbc56e00eb1b6
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Asset/PreProcessor/Helper/SortInterface.php
@@ -0,0 +1,23 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Asset\PreProcessor\Helper;
+
+/**
+ * Interface SortInterface
+ */
+interface SortInterface
+{
+    /**
+     * Sorting an array by directive
+     * [
+     *     'name-1' => ['after' => 'xxx', 'data' => [...]]
+     *     'name-2' => ['after' => 'xxx', 'data' => [...]]
+     * ]
+     * @param array $array
+     * @return array
+     */
+    public function sort(array $array);
+}
diff --git a/lib/internal/Magento/Framework/View/Asset/PreProcessor/Pool.php b/lib/internal/Magento/Framework/View/Asset/PreProcessor/Pool.php
index 7a8fee000db446c8348d4442dd86bac57d57192f..ee891d96720762ffa50a6ee4edb57acf0736232a 100644
--- a/lib/internal/Magento/Framework/View/Asset/PreProcessor/Pool.php
+++ b/lib/internal/Magento/Framework/View/Asset/PreProcessor/Pool.php
@@ -14,24 +14,51 @@ use Magento\Framework\View\Asset\PreProcessorInterface;
  */
 class Pool
 {
+    const PREPROCESSOR_CLASS = 'class';
+
     /**
-     * @var ObjectManagerInterface
+     * @var array
      */
-    private $objectManager;
+    private $preprocessors;
 
     /**
      * @var array
      */
-    private $preProcessorClasses = [];
+    private $instances;
+
+    /**
+     * @var Helper\SortInterface
+     */
+    private $sorter;
+
+    /**
+     * @var string
+     */
+    private $defaultPreprocessor;
 
     /**
+     * @var ObjectManagerInterface
+     */
+    private $objectManager;
+
+    /**
+     * Constructor
+     *
      * @param ObjectManagerInterface $objectManager
-     * @param array $preProcessors
+     * @param Helper\SortInterface $sorter
+     * @param string $defaultPreprocessor
+     * @param array $preprocessors
      */
-    public function __construct(ObjectManagerInterface $objectManager, array $preProcessors = [])
-    {
+    public function __construct(
+        ObjectManagerInterface $objectManager,
+        Helper\SortInterface $sorter,
+        $defaultPreprocessor,
+        array $preprocessors = []
+    ) {
+        $this->preprocessors = $preprocessors;
+        $this->sorter = $sorter;
+        $this->defaultPreprocessor = $defaultPreprocessor;
         $this->objectManager = $objectManager;
-        $this->preProcessorClasses = $preProcessors;
     }
 
     /**
@@ -42,9 +69,8 @@ class Pool
      */
     public function process(Chain $chain)
     {
-        $fromType = $chain->getOrigContentType();
-        $toType = $chain->getTargetContentType();
-        foreach ($this->getPreProcessors($fromType, $toType) as $preProcessor) {
+        $type = $chain->getTargetContentType();
+        foreach ($this->getPreProcessors($type) as $preProcessor) {
             $preProcessor->process($chain);
         }
     }
@@ -52,28 +78,35 @@ class Pool
     /**
      * Retrieve preProcessors by types
      *
-     * @param string $fromType
-     * @param string $toType
+     * @param string $type
      * @return PreProcessorInterface[]
+     * @throws \UnexpectedValueException
      */
-    private function getPreProcessors($fromType, $toType)
+    private function getPreProcessors($type)
     {
-        $preProcessors = [];
-        if (isset($this->preProcessorClasses[$fromType]) && isset($this->preProcessorClasses[$fromType][$toType])) {
-            $preProcessors = $this->preProcessorClasses[$fromType][$toType];
+        if (isset($this->instances[$type])) {
+            return $this->instances[$type];
+        }
+
+        if (isset($this->preprocessors[$type])) {
+            $preprocessors = $this->sorter->sort($this->preprocessors[$type]);
         } else {
-            $preProcessors[] = 'Magento\Framework\View\Asset\PreProcessor\Passthrough';
+            $preprocessors = [
+                'default' => [self::PREPROCESSOR_CLASS => $this->defaultPreprocessor]
+            ];
         }
 
-        $processorInstances = [];
-        foreach ($preProcessors as $preProcessor) {
-            $processorInstance = $this->objectManager->get($preProcessor);
-            if (!$processorInstance instanceof PreProcessorInterface) {
-                throw new \UnexpectedValueException("{$preProcessor} has to implement the PreProcessorInterface.");
+        $this->instances[$type] = [];
+        foreach ($preprocessors as $preprocessor) {
+            $instance = $this->objectManager->get($preprocessor[self::PREPROCESSOR_CLASS]);
+            if (!$instance instanceof PreProcessorInterface) {
+                throw new \UnexpectedValueException(
+                    '"' . $preprocessor[self::PREPROCESSOR_CLASS] . '" has to implement the PreProcessorInterface.'
+                );
             }
-            $processorInstances[] = $processorInstance;
+            $this->instances[$type][] = $instance;
         }
 
-        return $processorInstances;
+        return $this->instances[$type];
     }
 }
diff --git a/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/Resolver/Alternative.php b/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/Resolver/Alternative.php
index f943656b1cd92a2a0da9803d84a129a3593b3c6e..c8872027ad2af919f455ca7afd7fe3801e6dc9b6 100644
--- a/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/Resolver/Alternative.php
+++ b/lib/internal/Magento/Framework/View/Design/FileResolution/Fallback/Resolver/Alternative.php
@@ -30,7 +30,7 @@ class Alternative extends Simple
     public function __construct(
         Filesystem $filesystem,
         \Magento\Framework\View\Design\Fallback\RulePool $rulePool,
-        array $alternativeExtensions
+        array $alternativeExtensions = []
     ) {
         foreach ($alternativeExtensions as $extension => $newExtensions) {
             if (!is_string($extension) || !is_array($newExtensions)) {
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/LockerProcessTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/LockerProcessTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..8cd6a99610b09619e3d3feb14c779065757e7ffd
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/LockerProcessTest.php
@@ -0,0 +1,155 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Test\Unit\Asset;
+
+use Magento\Framework\Filesystem;
+use Magento\Framework\View\Asset\LockerProcess;
+use Magento\Framework\App\Filesystem\DirectoryList;
+use Magento\Framework\Filesystem\Directory\WriteInterface;
+
+/**
+ * Class LockerProcessTest
+ *
+ * @see \Magento\Framework\View\Asset\LockerProcess
+ */
+class LockerProcessTest extends \PHPUnit_Framework_TestCase
+{
+    const LOCK_NAME = 'test-lock';
+
+    /**
+     * @var string
+     */
+    private $fileName;
+
+    /**
+     * @var LockerProcess
+     */
+    private $lockerProcess;
+
+    /**
+     * @var Filesystem|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $filesystemMock;
+
+    /**
+     * Set up
+     */
+    protected function setUp()
+    {
+        $this->fileName = DirectoryList::TMP . DIRECTORY_SEPARATOR . self::LOCK_NAME . LockerProcess::LOCK_EXTENSION;
+
+        $this->filesystemMock = $this->getMockBuilder('Magento\Framework\Filesystem')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->lockerProcess = new LockerProcess($this->filesystemMock);
+    }
+
+    /**
+     * Test for lockProcess method
+     *
+     * @param string $method
+     *
+     * @dataProvider dataProviderTestLockProcess
+     */
+    public function testLockProcess($method)
+    {
+        $this->filesystemMock->expects(self::once())
+            ->method('getDirectoryWrite')
+            ->with(DirectoryList::VAR_DIR)
+            ->willReturn($this->$method());
+
+        $this->lockerProcess->lockProcess(self::LOCK_NAME);
+    }
+
+    /**
+     * Test for unlockProcess method
+     */
+    public function testUnlockProcess()
+    {
+        $this->filesystemMock->expects(self::once())
+            ->method('getDirectoryWrite')
+            ->with(DirectoryList::VAR_DIR)
+            ->willReturn($this->getTmpDirectoryMockFalse(1));
+
+        $this->lockerProcess->lockProcess(self::LOCK_NAME);
+        $this->lockerProcess->unlockProcess();
+    }
+
+    /**
+     * @return array
+     */
+    public function dataProviderTestLockProcess()
+    {
+        return [
+            ['method' => 'getTmpDirectoryMockTrue'],
+            ['method' => 'getTmpDirectoryMockFalse']
+        ];
+    }
+
+    /**
+     * @return WriteInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected function getTmpDirectoryMockTrue()
+    {
+        $tmpDirectoryMock = $this->getTmpDirectoryMock();
+
+        $tmpDirectoryMock->expects(self::atLeastOnce())
+            ->method('isExist')
+            ->with($this->fileName)
+            ->willReturn(true);
+
+        $tmpDirectoryMock->expects(self::atLeastOnce())
+            ->method('readFile')
+            ->with($this->fileName)
+            ->willReturn(time() - 25);
+
+
+        $tmpDirectoryMock->expects(self::once())
+            ->method('writeFile')
+            ->with($this->fileName, self::matchesRegularExpression('#\d+#'));
+
+        return $tmpDirectoryMock;
+    }
+
+    /**
+     * @param int $exactly
+     * @return WriteInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected function getTmpDirectoryMockFalse($exactly = 0)
+    {
+        $tmpDirectoryMock = $this->getTmpDirectoryMock();
+
+        $tmpDirectoryMock->expects(self::atLeastOnce())
+            ->method('isExist')
+            ->with($this->fileName)
+            ->willReturn(false);
+
+        $tmpDirectoryMock->expects(self::never())
+            ->method('readFile');
+
+        $tmpDirectoryMock->expects(self::exactly($exactly))
+            ->method('delete')
+            ->with($this->fileName);
+
+        $tmpDirectoryMock->expects(self::once())
+            ->method('writeFile')
+            ->with($this->fileName, self::matchesRegularExpression('#\d+#'));
+
+        return $tmpDirectoryMock;
+    }
+
+    /**
+     * @return WriteInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getTmpDirectoryMock()
+    {
+        $tmpDirectoryMock = $this->getMockBuilder('Magento\Framework\Filesystem\Directory\WriteInterface')
+            ->getMockForAbstractClass();
+
+        return $tmpDirectoryMock;
+    }
+}
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/Adapter/Less/ProcessorTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/Adapter/Less/ProcessorTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..5989389bdd2d50b3d2137e62a84801845ee6a33d
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/Adapter/Less/ProcessorTest.php
@@ -0,0 +1,185 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Test\Unit\Asset\PreProcessor\Adapter\Less;
+
+use Psr\Log\LoggerInterface;
+use Magento\Framework\App\State;
+use Magento\Framework\View\Asset\File;
+use Magento\Framework\View\Asset\Source;
+use Magento\Framework\Css\PreProcessor\File\Temporary;
+use Magento\Framework\Css\PreProcessor\Adapter\Less\Processor;
+
+/**
+ * Class ProcessorTest
+ */
+class ProcessorTest extends \PHPUnit_Framework_TestCase
+{
+    const TEST_CONTENT = 'test-content';
+
+    const ASSET_PATH = 'test-path';
+
+    const TMP_PATH_LESS = '_file/test.less';
+
+    const TMP_PATH_CSS = '_file/test.css';
+
+    const ERROR_MESSAGE = 'Test exception';
+
+    /**
+     * @var Processor
+     */
+    private $processor;
+
+    /**
+     * @var LoggerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $loggerMock;
+
+    /**
+     * @var State|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $appStateMock;
+
+    /**
+     * @var Source|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $assetSourceMock;
+
+    /**
+     * @var Temporary|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $temporaryFileMock;
+
+    /**
+     * Set up
+     */
+    protected function setUp()
+    {
+        $this->loggerMock = $this->getMockBuilder('Psr\Log\LoggerInterface')
+            ->getMockForAbstractClass();
+        $this->appStateMock = $this->getMockBuilder('Magento\Framework\App\State')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->assetSourceMock = $this->getMockBuilder('Magento\Framework\View\Asset\Source')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->temporaryFileMock = $this->getMockBuilder('Magento\Framework\Css\PreProcessor\File\Temporary')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->processor = new Processor(
+            $this->loggerMock,
+            $this->appStateMock,
+            $this->assetSourceMock,
+            $this->temporaryFileMock
+        );
+    }
+
+    /**
+     * Test for processContent method (exception)
+     */
+    public function testProcessContentException()
+    {
+        $assetMock = $this->getAssetMock();
+
+        $this->appStateMock->expects(self::once())
+            ->method('getMode')
+            ->willReturn(State::MODE_DEVELOPER);
+
+        $this->assetSourceMock->expects(self::once())
+            ->method('getContent')
+            ->with($assetMock)
+            ->willThrowException(new \Exception(self::ERROR_MESSAGE));
+
+        $this->loggerMock->expects(self::once())
+            ->method('critical')
+            ->with(Processor::ERROR_MESSAGE_PREFIX . self::ERROR_MESSAGE);
+
+        $this->temporaryFileMock->expects(self::never())
+            ->method('createFile');
+
+        $assetMock->expects(self::never())
+            ->method('getPath');
+
+        $content = $this->processor->processContent($assetMock);
+
+        self::assertEquals(Processor::ERROR_MESSAGE_PREFIX . self::ERROR_MESSAGE, $content);
+    }
+
+    /**
+     * Test for processContent method (empty content)
+     */
+    public function testProcessContentEmpty()
+    {
+        $assetMock = $this->getAssetMock();
+
+        $this->appStateMock->expects(self::once())
+            ->method('getMode')
+            ->willReturn(State::MODE_DEVELOPER);
+
+        $this->assetSourceMock->expects(self::once())
+            ->method('getContent')
+            ->with($assetMock)
+            ->willReturn('');
+
+        $this->temporaryFileMock->expects(self::never())
+            ->method('createFile');
+
+        $assetMock->expects(self::never())
+            ->method('getPath');
+
+        $this->loggerMock->expects(self::never())
+            ->method('critical');
+
+        $this->processor->processContent($assetMock);
+    }
+
+    /**
+     * Test for processContent method (not empty content)
+     */
+    public function testProcessContentNotEmpty()
+    {
+        $assetMock = $this->getAssetMock();
+
+        $this->appStateMock->expects(self::once())
+            ->method('getMode')
+            ->willReturn(State::MODE_DEVELOPER);
+
+        $this->assetSourceMock->expects(self::once())
+            ->method('getContent')
+            ->with($assetMock)
+            ->willReturn(self::TEST_CONTENT);
+
+        $this->temporaryFileMock->expects(self::once())
+            ->method('createFile')
+            ->with(self::ASSET_PATH, self::TEST_CONTENT)
+            ->willReturn(__DIR__ . '/' . self::TMP_PATH_LESS);
+
+        $assetMock->expects(self::once())
+            ->method('getPath')
+            ->willReturn(self::ASSET_PATH);
+
+        $this->loggerMock->expects(self::never())
+            ->method('critical');
+
+        $clearSymbol = ["\n", "\r", "\t", ' '];
+        self::assertEquals(
+            trim(str_replace($clearSymbol, '', file_get_contents(__DIR__ . '/' . self::TMP_PATH_CSS))),
+            trim(str_replace($clearSymbol, '', $this->processor->processContent($assetMock)))
+        );
+    }
+
+    /**
+     * @return File|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getAssetMock()
+    {
+        $assetMock = $this->getMockBuilder('Magento\Framework\View\Asset\File')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        return $assetMock;
+    }
+}
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/Adapter/Less/_file/test.css b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/Adapter/Less/_file/test.css
new file mode 100644
index 0000000000000000000000000000000000000000..7c30a79a3a75110b9504ce41bbcbc33155284668
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/Adapter/Less/_file/test.css
@@ -0,0 +1,19 @@
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+body {
+   background: #333333;
+   color: #454545;
+}
+a {
+   color: #ff9900;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+   color: #333333;
+}
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/Adapter/Less/_file/test.less b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/Adapter/Less/_file/test.less
new file mode 100644
index 0000000000000000000000000000000000000000..6ecc83aa9dae673f78e64c3c43423b852505e0be
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/Adapter/Less/_file/test.less
@@ -0,0 +1,19 @@
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+@color-orange: #ff9900;
+@color-gray_light: #cccccc;
+@color-black_dark: #333333;
+@color-black_medium: #454545;
+
+body {
+  background: @color-black_dark;
+  color: @color-black_medium;
+}
+a {
+  color:@color-orange;
+}
+h1, h2, h3, h4, h5, h6 {
+  color: @color-black_dark;
+}
\ No newline at end of file
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/AlternativeSourceTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/AlternativeSourceTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..2c3591ffbb6f294f5d52757121de9bbb00b2158f
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/AlternativeSourceTest.php
@@ -0,0 +1,363 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Test\Unit\Asset\PreProcessor;
+
+use Magento\Framework\Filesystem;
+use Magento\Framework\View\Asset\File;
+use Magento\Framework\ObjectManagerInterface;
+use Magento\Framework\View\Asset\LocalInterface;
+use Magento\Framework\View\Asset\PreProcessor\Chain;
+use Magento\Framework\View\Asset\File\FallbackContext;
+use Magento\Framework\View\Asset\LockerProcessInterface;
+use Magento\Framework\View\Asset\ContentProcessorInterface;
+use Magento\Framework\View\Asset\PreProcessor\AlternativeSource;
+use Magento\Framework\View\Asset\PreProcessor\Helper\SortInterface;
+use Magento\Framework\View\Asset\PreProcessor\AlternativeSource\AssetBuilder;
+
+/**
+ * Class AlternativeSourceTest
+ *
+ * @see \Magento\Framework\View\Asset\PreProcessor\AlternativeSource
+ */
+class AlternativeSourceTest extends \PHPUnit_Framework_TestCase
+{
+    const AREA = 'test-area';
+
+    const THEME = 'test-theme';
+
+    const LOCALE = 'test-locale';
+
+    const FILE_PATH = 'test-file';
+
+    const MODULE = 'test-module';
+
+    const NEW_CONTENT = 'test-new-content';
+
+    /**
+     * @var SortInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $sorterMock;
+
+    /**
+     * @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $objectManagerMock;
+
+    /**
+     * @var LockerProcessInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $lockerProcessMock;
+
+    /**
+     * @var AssetBuilder|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $assetBuilderMock;
+
+    /**
+     * @var ContentProcessorInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $alternativeMock;
+
+    /**
+     * Set up
+     */
+    protected function setUp()
+    {
+        $this->sorterMock = $this->getMockBuilder('Magento\Framework\View\Asset\PreProcessor\Helper\SortInterface')
+            ->getMockForAbstractClass();
+        $this->objectManagerMock = $this->getMockBuilder('Magento\Framework\ObjectManagerInterface')
+            ->getMockForAbstractClass();
+        $this->lockerProcessMock = $this->getMockBuilder('Magento\Framework\View\Asset\LockerProcessInterface')
+            ->getMockForAbstractClass();
+        $this->assetBuilderMock = $this->getMockBuilder(
+            'Magento\Framework\View\Asset\PreProcessor\AlternativeSource\AssetBuilder'
+        )->disableOriginalConstructor()
+            ->getMock();
+        $this->alternativeMock = $this->getMockBuilder('Magento\Framework\View\Asset\ContentProcessorInterface')
+            ->getMockForAbstractClass();
+    }
+
+    /**
+     * Run test for process method (exception)
+     */
+    public function testProcessException()
+    {
+        $alternatives = [
+            'processor' => [
+                AlternativeSource::PROCESSOR_CLASS => 'stdClass'
+            ]
+        ];
+
+        $this->lockerProcessMock->expects(self::once())
+            ->method('lockProcess')
+            ->with(self::isType('string'));
+        $this->lockerProcessMock->expects(self::once())
+            ->method('unlockProcess');
+
+        $this->sorterMock->expects(self::once())
+            ->method('sort')
+            ->with($alternatives)
+            ->willReturn($alternatives);
+
+        $this->assetBuilderMock->expects(self::once())
+            ->method('setArea')
+            ->with(self::AREA)
+            ->willReturnSelf();
+        $this->assetBuilderMock->expects(self::once())
+            ->method('setTheme')
+            ->with(self::THEME)
+            ->willReturnSelf();
+        $this->assetBuilderMock->expects(self::once())
+            ->method('setLocale')
+            ->with(self::LOCALE)
+            ->willReturnSelf();
+        $this->assetBuilderMock->expects(self::once())
+            ->method('setModule')
+            ->with(self::MODULE)
+            ->willReturnSelf();
+        $this->assetBuilderMock->expects(self::once())
+            ->method('setPath')
+            ->with(self::FILE_PATH)
+            ->willReturnSelf();
+        $this->assetBuilderMock->expects(self::once())
+            ->method('build')
+            ->willReturn($this->getAssetNew());
+
+        $this->objectManagerMock->expects(self::once())
+            ->method('get')
+            ->with('stdClass')
+            ->willReturn(new \stdClass());
+
+        $alternativeSource = new AlternativeSource(
+            $this->objectManagerMock,
+            $this->lockerProcessMock,
+            $this->sorterMock,
+            $this->assetBuilderMock,
+            'lock',
+            $alternatives
+        );
+        try {
+            $alternativeSource->process($this->getChainMockExpects('', 0));
+        } catch (\UnexpectedValueException $e) {
+            self::assertInstanceOf('\UnexpectedValueException', $e);
+        }
+    }
+
+    /**
+     * Run test for process method
+     */
+    public function testProcess()
+    {
+        $alternatives = [
+            'processor' => [
+                AlternativeSource::PROCESSOR_CLASS => 'Magento\Framework\View\Asset\ContentProcessorInterface'
+            ]
+        ];
+
+        $this->lockerProcessMock->expects(self::once())
+            ->method('lockProcess')
+            ->with(self::isType('string'));
+        $this->lockerProcessMock->expects(self::once())
+            ->method('unlockProcess');
+
+        $this->sorterMock->expects(self::once())
+            ->method('sort')
+            ->with($alternatives)
+            ->willReturn($alternatives);
+
+        $assetMock = $this->getAssetNew();
+
+        $this->assetBuilderMock->expects(self::once())
+            ->method('setArea')
+            ->with(self::AREA)
+            ->willReturnSelf();
+        $this->assetBuilderMock->expects(self::once())
+            ->method('setTheme')
+            ->with(self::THEME)
+            ->willReturnSelf();
+        $this->assetBuilderMock->expects(self::once())
+            ->method('setLocale')
+            ->with(self::LOCALE)
+            ->willReturnSelf();
+        $this->assetBuilderMock->expects(self::once())
+            ->method('setModule')
+            ->with(self::MODULE)
+            ->willReturnSelf();
+        $this->assetBuilderMock->expects(self::once())
+            ->method('setPath')
+            ->with(self::FILE_PATH)
+            ->willReturnSelf();
+        $this->assetBuilderMock->expects(self::once())
+            ->method('build')
+            ->willReturn($assetMock);
+
+        $this->objectManagerMock->expects(self::once())
+            ->method('get')
+            ->with('Magento\Framework\View\Asset\ContentProcessorInterface')
+            ->willReturn($this->getProcessorMock($assetMock));
+
+        $alternativeSource = new AlternativeSource(
+            $this->objectManagerMock,
+            $this->lockerProcessMock,
+            $this->sorterMock,
+            $this->assetBuilderMock,
+            'lock',
+            $alternatives
+        );
+
+        $alternativeSource->process($this->getChainMockExpects());
+    }
+
+    /**
+     * Run test for process method (content not empty)
+     */
+    public function testProcessContentNotEmpty()
+    {
+        $chainMock = $this->getChainMock();
+        $assetMock = $this->getAssetMock();
+
+        $chainMock->expects(self::once())
+            ->method('getContent')
+            ->willReturn('test-content');
+
+        $chainMock->expects(self::once())
+            ->method('getAsset')
+            ->willReturn($assetMock);
+
+        $this->lockerProcessMock->expects(self::never())
+            ->method('lockProcess');
+        $this->lockerProcessMock->expects(self::never())
+            ->method('unlockProcess');
+
+        $alternativeSource = new AlternativeSource(
+            $this->objectManagerMock,
+            $this->lockerProcessMock,
+            $this->sorterMock,
+            $this->assetBuilderMock,
+            'lock',
+            []
+        );
+
+        $alternativeSource->process($chainMock);
+    }
+
+    /**
+     * @param \PHPUnit_Framework_MockObject_MockObject $asset
+     * @return ContentProcessorInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getProcessorMock($asset)
+    {
+        $processorMock = $this->getMockBuilder('Magento\Framework\View\Asset\ContentProcessorInterface')
+            ->getMockForAbstractClass();
+
+        $processorMock->expects(self::once())
+            ->method('processContent')
+            ->with($asset)
+            ->willReturn(self::NEW_CONTENT);
+
+        return $processorMock;
+    }
+
+    /**
+     * @return Chain|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getChainMock()
+    {
+        $chainMock = $this->getMockBuilder('Magento\Framework\View\Asset\PreProcessor\Chain')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        return $chainMock;
+    }
+
+    /**
+     * @param string $content
+     * @param int $contentExactly
+     * @return Chain|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getChainMockExpects($content = '', $contentExactly = 1)
+    {
+        $chainMock = $this->getChainMock();
+
+        $chainMock->expects(self::once())
+            ->method('getContent')
+            ->willReturn($content);
+        $chainMock->expects(self::exactly(3))
+            ->method('getAsset')
+            ->willReturn($this->getAssetMockExpects());
+        $chainMock->expects(self::exactly($contentExactly))
+            ->method('setContent')
+            ->willReturn(self::NEW_CONTENT);
+
+        return $chainMock;
+    }
+
+    /**
+     * @return File|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getAssetNew()
+    {
+        $assetMock = $this->getMockBuilder('Magento\Framework\View\Asset\File')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        return $assetMock;
+    }
+
+    /**
+     * @return LocalInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getAssetMock()
+    {
+        $assetMock = $this->getMockBuilder('Magento\Framework\View\Asset\LocalInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        return $assetMock;
+    }
+
+    /**
+     * @return LocalInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getAssetMockExpects()
+    {
+        $assetMock = $this->getAssetMock();
+
+        $assetMock->expects(self::once())
+            ->method('getContext')
+            ->willReturn($this->getContextMock());
+        $assetMock->expects(self::once())
+            ->method('getFilePath')
+            ->willReturn(self::FILE_PATH);
+        $assetMock->expects(self::once())
+            ->method('getModule')
+            ->willReturn(self::MODULE);
+
+        return $assetMock;
+    }
+
+    /**
+     * @return FallbackContext|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getContextMock()
+    {
+        $contextMock = $this->getMockBuilder('Magento\Framework\View\Asset\File\FallbackContext')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $contextMock->expects(self::once())
+            ->method('getAreaCode')
+            ->willReturn(self::AREA);
+        $contextMock->expects(self::once())
+            ->method('getThemePath')
+            ->willReturn(self::THEME);
+        $contextMock->expects(self::once())
+            ->method('getLocale')
+            ->willReturn(self::LOCALE);
+
+        return $contextMock;
+    }
+}
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/Helper/SortTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/Helper/SortTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..35e043143266047e8ec3e579409ab0a1ce1f9713
--- /dev/null
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/Helper/SortTest.php
@@ -0,0 +1,195 @@
+<?php
+/**
+ * Copyright © 2015 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Framework\View\Test\Unit\Asset\PreProcessor\Helper;
+
+use Magento\Framework\View\Asset\PreProcessor\Helper\Sort;
+
+/**
+ * Class SortTest
+ *
+ * @see \Magento\Framework\View\Asset\PreProcessor\Helper\Sorter2
+ */
+class SortTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @param array $arrayData
+     * @param array $expected
+     *
+     * @dataProvider dataProviderTestSorting
+     */
+    public function testSorting(array $arrayData, array $expected, $message)
+    {
+        $sorter = new Sort();
+
+        $result = $sorter->sort($arrayData);
+
+        static::assertEquals($expected, array_keys($result), $message);
+    }
+
+    /**
+     * @return array
+     *
+     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+     */
+    public function dataProviderTestSorting()
+    {
+        return [
+            [
+                'arrayData' => [
+                    'name-1' => [ // 2
+                        'after' => 'name-3',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-2' => [ // 0
+                        'processor' => new \stdClass()
+                    ],
+                    'name-3' => [ // 1
+                        'after' => 'name-2',
+                        'processor' => new \stdClass()
+                    ],
+                ],
+                'expected' => [
+                    'name-2', 'name-3', 'name-1'
+                ],
+                'message' => 'variation-1',
+            ],
+            [
+                'arrayData' => [
+                    'name-1' => [ // 3
+                        'after' => 'name-6',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-2' => [ // 1
+                        'processor' => new \stdClass()
+                    ],
+                    'name-3' => [ // 6
+                        'after' => 'name-5',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-4' => [ // 4
+                        'after' => 'name-1',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-5' => [ // 5
+                        'after' => 'name-4',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-6' => [ // 2
+                        'after' => 'name-2',
+                        'processor' => new \stdClass()
+                    ],
+                ],
+                'expected' => [
+                    'name-2', 'name-6', 'name-1', 'name-4', 'name-5', 'name-3'
+                ],
+                'message' => 'variation-2',
+            ],
+            [
+                'arrayData' => [
+                    'name-1' => [ // 3
+                        'after' => 'name-6',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-3' => [ // 6
+                        'after' => 'name-5',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-4' => [ // 4
+                        'after' => 'name-1',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-5' => [ // 5
+                        'after' => 'name-4',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-6' => [ // 2
+                        'after' => 'name-2',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-2' => [ // 1
+                        'processor' => new \stdClass()
+                    ],
+                ],
+                'expected' => [
+                    'name-2', 'name-6', 'name-1', 'name-4', 'name-5', 'name-3'
+                ],
+                'message' => 'variation-3',
+            ],
+            [
+                'arrayData' => [
+                    'name-1' => [ // 3
+                        'after' => 'name-6',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-2' => [ // 1
+                        'processor' => new \stdClass()
+                    ],
+                    'name-3' => [ // 6
+                        'after' => 'name-5',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-4' => [ // 4
+                        'after' => 'name-1',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-5' => [ // 5
+                        'after' => 'name-4',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-6' => [ // 2
+                        'after' => 'name-2',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-7' => [ // end
+                        'processor' => new \stdClass()
+                    ],
+                    'name-8' => [ // end
+                        'processor' => new \stdClass()
+                    ],
+                ],
+                'expected' => [
+                    'name-2', 'name-6', 'name-1', 'name-4', 'name-5', 'name-3', 'name-7', 'name-8'
+                ],
+                'message' => 'variation-4',
+            ],
+            [
+                'arrayData' => [
+                    'name-1' => [ // xxx
+                        'after' => 'name-6',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-2' => [ // 1
+                        'processor' => new \stdClass()
+                    ],
+                    'name-3' => [ // xxx
+                        'after' => 'name-XXX',
+                        'processor' => new \stdClass()
+                    ]
+                ],
+                'expected' => ['name-2'],
+                'message' => 'variation-5',
+            ],
+            [
+                'arrayData' => [
+                    'name-1' => [ // xxx
+                        'after' => 'name-3',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-2' => [ // xxx
+                        'after' => 'name-1',
+                        'processor' => new \stdClass()
+                    ],
+                    'name-3' => [ // xxx
+                        'after' => 'name-2',
+                        'processor' => new \stdClass()
+                    ]
+                ],
+                'expected' => [],
+                'message' => 'variation-6',
+            ],
+        ];
+    }
+}
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/PoolTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/PoolTest.php
index eb41418aaefed37555ce5aa5b0114b19dc8a8a23..d7fd211ef79493d7728f4f208a1c4b405dcf4bde 100644
--- a/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/PoolTest.php
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/PreProcessor/PoolTest.php
@@ -6,127 +6,181 @@
 
 namespace Magento\Framework\View\Test\Unit\Asset\PreProcessor;
 
-use \Magento\Framework\View\Asset\PreProcessor\Pool;
+use Magento\Framework\ObjectManagerInterface;
+use Magento\Framework\View\Asset\PreProcessor\Pool;
+use Magento\Framework\View\Asset\PreProcessor\Chain;
+use Magento\Framework\View\Asset\PreProcessorInterface;
+use Magento\Framework\View\Asset\PreProcessor\Helper\SortInterface;
 
+/**
+ * Class PoolTest
+ *
+ * @see \Magento\Framework\View\Asset\PreProcessor\Pool
+ */
 class PoolTest extends \PHPUnit_Framework_TestCase
 {
+    const DEFAULT_PREPROCESSOR = 'defaul/preprocessor';
+
+    const CONTENT_TYPE = 'test-type';
+
+    const PREPROCESSOR_CLASS = 'Magento\Framework\View\Asset\PreProcessorInterface';
+
     /**
-     * @var \Magento\Framework\View\Asset\PreProcessor\Pool
+     * @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $processorPool;
+    private $objectManagerMock;
 
     /**
-     * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     * @var SortInterface|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $objectManager;
+    private $sorterMock;
 
     /**
-     * @var \Magento\Framework\View\Asset\PreProcessor\Chain|\PHPUnit_Framework_MockObject_MockObject
+     * Set up
+     *
+     * @return void
      */
-    protected $processorChain;
-
-    protected function setUp()
+    public function setUp()
     {
-        $this->objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface');
+        $this->objectManagerMock = $this->getMockBuilder('Magento\Framework\ObjectManagerInterface')
+            ->getMockForAbstractClass();
+        $this->sorterMock = $this->getMockBuilder('Magento\Framework\View\Asset\PreProcessor\Helper\SortInterface')
+            ->getMockForAbstractClass();
+    }
 
-        $this->processorChain = $this->getMockBuilder('Magento\Framework\View\Asset\PreProcessor\Chain')
+    /**
+     * @return Chain|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getChainMock($type)
+    {
+        /** @var Chain|\PHPUnit_Framework_MockObject_MockObject $chainMock */
+        $chainMock = $this->getMockBuilder('Magento\Framework\View\Asset\PreProcessor\Chain')
             ->disableOriginalConstructor()
-            ->setMethods([])
             ->getMock();
 
-        $this->processorPool = new Pool(
-            $this->objectManager,
-            [
-                'less' => [
-                    'css' =>
-                        [
-                            'Magento\Framework\Css\PreProcessor\Less',
-                            'Magento\Framework\View\Asset\PreProcessor\VariableNotation',
-                            'Magento\Framework\View\Asset\PreProcessor\ModuleNotation',
-                        ],
-                    'less' =>
-                        [
-                            'Magento\Framework\Css\PreProcessor\Instruction\MagentoImport',
-                            'Magento\Framework\Css\PreProcessor\Instruction\Import',
-                        ],
-                ],
-                'css' => [
-                    'css' => [
-                        'Magento\Framework\View\Asset\PreProcessor\VariableNotation',
-                        'Magento\Framework\View\Asset\PreProcessor\ModuleNotation',
-                    ]
-                ],
+        $chainMock->expects(self::once())
+            ->method('getTargetContentType')
+            ->willReturn($type);
+
+        return $chainMock;
+    }
+
+    /**
+     * @param Chain|\PHPUnit_Framework_MockObject_MockObject $chainMock
+     * @return PreProcessorInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getPreprocessorMock($chainMock)
+    {
+        /** @var PreProcessorInterface|\PHPUnit_Framework_MockObject_MockObject $preprocessorMock */
+        $preprocessorMock = $this->getMockBuilder(self::PREPROCESSOR_CLASS)
+            ->getMockForAbstractClass();
+
+        $preprocessorMock->expects(self::once())
+            ->method('process')
+            ->with($chainMock);
+
+        return $preprocessorMock;
+    }
+
+    /**
+     * Run test for process method
+     */
+    public function testProcess()
+    {
+        $preprocessors = [
+            self::CONTENT_TYPE => [
+                'test' => [
+                    Pool::PREPROCESSOR_CLASS => self::PREPROCESSOR_CLASS
+                ]
             ]
+        ];
+
+        $pool = new Pool(
+            $this->objectManagerMock,
+            $this->sorterMock,
+            self::DEFAULT_PREPROCESSOR,
+            $preprocessors
         );
+
+        $this->sorterMock->expects(self::once())
+            ->method('sort')
+            ->with($preprocessors[self::CONTENT_TYPE])
+            ->willReturn($preprocessors[self::CONTENT_TYPE]);
+
+        $chainMock = $this->getChainMock(self::CONTENT_TYPE);
+
+        $this->objectManagerMock->expects(self::once())
+            ->method('get')
+            ->with(self::PREPROCESSOR_CLASS)
+            ->willReturn($this->getPreprocessorMock($chainMock));
+
+        $pool->process($chainMock);
     }
 
     /**
-     * @param string $sourceContentType
-     * @param string $targetContentType
-     * @param array $expectedResult
-     *
-     * @dataProvider getPreProcessorsDataProvider
+     * Run test for process method (default preprocessor)
      */
-    public function testProcess($sourceContentType, $targetContentType, array $expectedResult)
+    public function testProcessDefault()
     {
+        $preprocessors = [
+            'bad-type' => [],
+        ];
 
-        $this->processorChain->expects($this->any())
-            ->method('getOrigContentType')
-            ->willReturn($sourceContentType);
-        $this->processorChain->expects($this->any())
-            ->method('getTargetContentType')
-            ->willReturn($targetContentType);
-        $processorMaps = [];
-        foreach ($expectedResult as $processor) {
-            $processorMock = $this->getMock($processor, ['process'], [], '', false);
-            $processorMock->expects($this->any())
-                ->method('process')
-                ->with($this->processorChain);
-            $processorMaps[] = [$processor, $processorMock];
-        }
-        $this->objectManager
-            ->expects(static::atLeastOnce())
+        $pool = new Pool(
+            $this->objectManagerMock,
+            $this->sorterMock,
+            self::DEFAULT_PREPROCESSOR,
+            $preprocessors
+        );
+
+        $this->sorterMock->expects(self::never())
+            ->method('sort');
+
+        $chainMock = $this->getChainMock(self::CONTENT_TYPE);
+
+        $this->objectManagerMock->expects(self::once())
             ->method('get')
-            ->willReturnMap($processorMaps);
+            ->with(self::DEFAULT_PREPROCESSOR)
+            ->willReturn($this->getPreprocessorMock($chainMock));
 
-        $this->processorPool->process($this->processorChain);
+        $pool->process($chainMock);
     }
 
-    public function getPreProcessorsDataProvider()
+    /**
+     * Run test for process method (exception)
+     *
+     * @expectedException \UnexpectedValueException
+     * @expectedExceptionMessage "stdClass" has to implement the PreProcessorInterface.
+     */
+    public function testProcessBadInterface()
     {
-        return [
-            'css => css' => [
-                'css', 'css',
-                [
-                    'Magento\Framework\View\Asset\PreProcessor\VariableNotation',
-                    'Magento\Framework\View\Asset\PreProcessor\ModuleNotation',
-                ],
-            ],
-            //all undefined types will be processed by Passthrough preprocessor
-            'css => less' => [
-                'css', 'less',
-                ['Magento\Framework\View\Asset\PreProcessor\Passthrough'],
-            ],
-            'less => css' => [
-                'less', 'css',
-                [
-                    'Magento\Framework\Css\PreProcessor\Less',
-                    'Magento\Framework\View\Asset\PreProcessor\VariableNotation',
-                    'Magento\Framework\View\Asset\PreProcessor\ModuleNotation',
-                ],
-            ],
-            'less => less' => [
-                'less', 'less',
-                [
-                    'Magento\Framework\Css\PreProcessor\Instruction\MagentoImport',
-                    'Magento\Framework\Css\PreProcessor\Instruction\Import',
-                ],
-            ],
-            //all undefined types will be processed by Passthrough preprocessor
-            'txt => log (undefined)' => [
-                'txt', 'log',
-                ['Magento\Framework\View\Asset\PreProcessor\Passthrough'],
-            ],
+        $preprocessors = [
+            self::CONTENT_TYPE => [
+                'test' => [
+                    Pool::PREPROCESSOR_CLASS => 'stdClass'
+                ]
+            ]
         ];
+
+        $pool = new Pool(
+            $this->objectManagerMock,
+            $this->sorterMock,
+            self::DEFAULT_PREPROCESSOR,
+            $preprocessors
+        );
+
+        $this->sorterMock->expects(self::once())
+            ->method('sort')
+            ->with($preprocessors[self::CONTENT_TYPE])
+            ->willReturn($preprocessors[self::CONTENT_TYPE]);
+
+        $chainMock = $this->getChainMock(self::CONTENT_TYPE);
+
+        $this->objectManagerMock->expects(self::once())
+            ->method('get')
+            ->with('stdClass')
+            ->willReturn(new \stdClass());
+
+        $pool->process($chainMock);
     }
 }
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=["&#173;",'<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/Connect.php b/setup/src/Magento/Setup/Controller/Connect.php
index b5a400262717c5c4ae6a1c6da7fa2f0b70e4c067..7ff039e3f4bcc85d05427b13f0c056fa08e7f08b 100644
--- a/setup/src/Magento/Setup/Controller/Connect.php
+++ b/setup/src/Magento/Setup/Controller/Connect.php
@@ -42,7 +42,10 @@ class Connect extends AbstractActionController
      */
     public function saveAuthJsonAction()
     {
-        $params = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY);
+        $params = [];
+        if ($this->getRequest()->getContent()) {
+            $params = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY);
+        }
         try {
             $userName = isset($params['username']) ? $params['username'] : '';
             $password = isset($params['password']) ? $params['password'] : '';
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>