diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml
index a4ce77aa0db0226332905ae1cb8df5d744a03dcc..fcd8b838c1b5d24467d90bcbfd9c2e1dd7435922 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/labels.phtml
@@ -16,26 +16,28 @@
         </strong>
     </div>
     <div class="fieldset-wrapper-content in collapse" id="manage-titles-content">
-        <fieldset class="fieldset">
-            <table class="admin__control-table" id="attribute-labels-table">
-                <thead>
-                <tr>
-                    <?php foreach ($block->getStores() as $_store): ?>
-                        <th class="col-store-view"><?php /* @escapeNotVerified */ echo $_store->getName() ?></th>
-                    <?php endforeach; ?>
-                </tr>
-                </thead>
-                <tbody>
-                <tr>
-                    <?php $_labels = $block->getLabelValues() ?>
-                    <?php foreach ($block->getStores() as $_store): ?>
-                        <td class="col-store-view">
-                            <input class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>" type="text" name="frontend_label[<?php /* @escapeNotVerified */ echo $_store->getId() ?>]" value="<?php echo $block->escapeHtml($_labels[$_store->getId()]) ?>"<?php if ($block->getReadOnly()):?> disabled="disabled"<?php endif;?>/>
-                        </td>
-                    <?php endforeach; ?>
-                </tr>
-                </tbody>
-            </table>
+        <fieldset class="admin__fieldset fieldset">
+            <div class="admin__control-table-wrapper">
+                <table class="admin__control-table" id="attribute-labels-table">
+                    <thead>
+                    <tr>
+                        <?php foreach ($block->getStores() as $_store): ?>
+                            <th class="col-store-view"><?php /* @escapeNotVerified */ echo $_store->getName() ?></th>
+                        <?php endforeach; ?>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <tr>
+                        <?php $_labels = $block->getLabelValues() ?>
+                        <?php foreach ($block->getStores() as $_store): ?>
+                            <td class="col-store-view">
+                                <input class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID): ?> required-option<?php endif; ?>" type="text" name="frontend_label[<?php /* @escapeNotVerified */ echo $_store->getId() ?>]" value="<?php echo $block->escapeHtml($_labels[$_store->getId()]) ?>"<?php if ($block->getReadOnly()):?> disabled="disabled"<?php endif;?>/>
+                            </td>
+                        <?php endforeach; ?>
+                    </tr>
+                    </tbody>
+                </table>
+            </div>
         </fieldset>
     </div>
 </div>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml
index 932d3dc50dc7f879453a1ef0671140c553017742..1f1dc0925f2c0199c49d3e244fd69d07eb8a697f 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml
@@ -10,11 +10,11 @@
 
 $stores = $block->getStoresSortedBySortOrder();
 ?>
-<fieldset class="fieldset">
+<fieldset class="admin__fieldset fieldset">
     <legend class="legend">
         <span><?php echo $block->escapeHtml(__('Manage Options (Values of Your Attribute)')); ?></span>
-    </legend>
-    <div id="manage-options-panel" data-index="attribute_options_select_container">
+    </legend><br />
+    <div class="admin__control-table-wrapper" id="manage-options-panel" data-index="attribute_options_select_container">
         <table class="admin__control-table" data-index="attribute_options_select">
             <thead>
                 <tr id="attribute-options-table">
diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml
index f7475d0bb816828dd3c214600e8eeb48d03e39a8..c2aa0b8c6962258f253241d440703067b9c196e3 100644
--- a/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml
+++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml
@@ -23,6 +23,9 @@
                 <item name="config" xsi:type="array">
                     <item name="component" xsi:type="string">Magento_Ui/js/grid/provider</item>
                     <item name="update_url" xsi:type="url" path="mui/index/render"/>
+                    <item name="storageConfig" xsi:type="array">
+                        <item name="dataScope" xsi:type="string">filters.store_id</item>
+                    </item>
                 </item>
             </argument>
         </argument>
diff --git a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml
index a5f96e8d27cf07714562e242c96ef29008acbd8c..d9c7402a3e1588fc1c6c24f0fcc1b3afc5af9f3b 100644
--- a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml
+++ b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml
@@ -10,9 +10,11 @@
 
 $stores = $block->getStoresSortedBySortOrder();
 ?>
-<fieldset class="fieldset">
-    <legend class="legend"><span><?php echo $block->escapeHtml( __('Manage Swatch (Values of Your Attribute)')); ?></span></legend>
-    <div id="swatch-visual-options-panel">
+<fieldset class="admin__fieldset fieldset">
+    <legend class="legend">
+        <span><?php echo $block->escapeHtml( __('Manage Swatch (Values of Your Attribute)')); ?></span>
+    </legend><br />
+    <div class="admin__control-table-wrapper" id="swatch-visual-options-panel">
         <table class="data-table clearfix" cellspacing="0">
             <thead>
             <tr id="swatch-visual-options-table">
@@ -116,5 +118,4 @@ $stores = $block->getStoresSortedBySortOrder();
             }
         }
     </script>
-
 </fieldset>
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/data-storage.js b/app/code/Magento/Ui/view/base/web/js/grid/data-storage.js
index 950e87b2bfb58762bf63ab6d2200a63a7c8e5049..642c9b607274516ed8494dc09fd77181289e1256 100644
--- a/app/code/Magento/Ui/view/base/web/js/grid/data-storage.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/data-storage.js
@@ -20,6 +20,7 @@ define([
                 method: 'GET',
                 dataType: 'json'
             },
+            dataScope: '',
             data: {}
         },
 
@@ -29,8 +30,16 @@ define([
          * @returns {DataStorage} Chainable.
          */
         initConfig: function () {
+            var scope;
+
             this._super();
 
+            scope = this.dataScope;
+
+            if (typeof scope === 'string') {
+                this.dataScope = scope ? [scope] : [];
+            }
+
             this._requests = [];
 
             return this;
@@ -77,10 +86,12 @@ define([
          * @returns {jQueryPromise}
          */
         getData: function (params, options) {
-            var cachedRequest = this.getRequest(params);
+            var cachedRequest;
 
-            if (params && params.filters && params.filters['store_id']) {
-                cachedRequest = false;
+            if (this.hasScopeChanged(params)) {
+                this.clearRequests();
+            } else {
+                cachedRequest = this.getRequest(params);
             }
 
             options = options || {};
@@ -90,6 +101,30 @@ define([
                 this.requestData(params);
         },
 
+        /**
+         * Tells whether one of the parameters defined in the "dataScope" has
+         * changed since the last request.
+         *
+         * @param {Object} params - Request parameters.
+         * @returns {Boolean}
+         */
+        hasScopeChanged: function (params) {
+            var lastRequest = _.last(this._requests),
+                keys,
+                diff;
+
+            if (!lastRequest) {
+                return false;
+            }
+
+            diff = utils.compare(lastRequest.params, params);
+
+            keys = _.pluck(diff.changes, 'path');
+            keys = keys.concat(Object.keys(diff.containers));
+
+            return _.intersection(this.dataScope, keys).length > 0;
+        },
+
         /**
          * Extends records of current data object
          * with the provided records collection.
diff --git a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less
index 43f04e52a8e6040f3d554d8c73946cdaa069a5d8..3ae7e9bf31178f155a118ece3e28c5927e209bb9 100644
--- a/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less
+++ b/app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less
@@ -131,6 +131,7 @@
         &._required {
             span {
                 &:after {
+                    .lib-css(margin, @form-field-label-asterisk__margin);
                     color: @validation__color;
                     content: '*';
                 }
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 3a8cc65a597b27b9558f6d507308cc9b716a8137..d8c894788dd8252724f344f342fc69a867b9f313 100644
--- a/app/design/adminhtml/Magento/backend/web/css/styles-old.less
+++ b/app/design/adminhtml/Magento/backend/web/css/styles-old.less
@@ -744,6 +744,7 @@
     //  --------------------------------------
 
     fieldset {
+        min-width: 0;
         padding: 20px;
     }
 
@@ -5049,6 +5050,10 @@
             }
         }
     }
+
+    .admin__control-table-wrapper {
+        clear: both;
+    }
 }
 
 .catalog-product-set-index {
diff --git a/dev/tests/functional/composer.json b/dev/tests/functional/composer.json
index 3567ec530f437996c0ed28d792ebd929d2188e0c..cfa06fbf60402c808778035c4b321f1404c384d3 100644
--- a/dev/tests/functional/composer.json
+++ b/dev/tests/functional/composer.json
@@ -1,6 +1,6 @@
 {
     "require": {
-        "magento/mtf": "1.0.0-rc51",
+        "magento/mtf": "1.0.0-rc52",
         "php": "~5.6.5|7.0.2|~7.0.6",
         "phpunit/phpunit": "~4.8.0|~5.5.0",
         "phpunit/phpunit-selenium": ">=1.2"
diff --git a/dev/tests/functional/etc/repository_replacer_payments.xml b/dev/tests/functional/etc/repository_replacer_payments.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6b9b9fe54515f5684f8d71ae6bb60b72b357fb5b
--- /dev/null
+++ b/dev/tests/functional/etc/repository_replacer_payments.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/**
+ * Copyright © 2013-2017 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/Magento/Mtf/Repository/etc/repository.xsd">
+    <repository class="Magento\Braintree\Test\Repository\BraintreeSandboxCustomer">
+        <dataset name="braintree_sandbox_default">
+            <field name="environment" xsi:type="string">BRAINTREEE_ENVIRONMENT</field>
+            <field name="merchantId" xsi:type="string">BRAINTREEE_MERCHANT_ID</field>
+            <field name="publicKey" xsi:type="string">BRAINTREE_PUBLIC_KEY</field>
+            <field name="privateKey" xsi:type="string">BRAINTREE_PRIVATE_KEY</field>
+        </dataset>
+    </repository>
+</config>
diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Cache.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Cache.php
index 7b26568132bbe4da15ec4796a4676d4efd8f4435..272e3158d3c27021d4a8bddd1130edfa8ba9a832 100644
--- a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Cache.php
+++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Cache.php
@@ -29,13 +29,16 @@ class Cache extends Cli
     const PARAM_CACHE_ENABLE = 'cache:enable';
 
     /**
-     * Flush cache.
+     * Flush Cache.
+     * If no parameters are set, all cache types are flushed.
      *
+     * @param array $cacheTypes
      * @return void
      */
-    public function flush()
+    public function flush(array $cacheTypes = [])
     {
-        parent::execute(Cache::PARAM_CACHE_FLUSH);
+        $options = empty($cacheTypes) ? '' : ' ' . implode(' ', $cacheTypes);
+        parent::execute(Cache::PARAM_CACHE_FLUSH . $options);
     }
 
     /**
diff --git a/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/StaticContent.php b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/StaticContent.php
new file mode 100644
index 0000000000000000000000000000000000000000..225b99b0283f6d8d03bace79d7124847169a9539
--- /dev/null
+++ b/dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/StaticContent.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Mtf\Util\Command\Cli;
+
+use Magento\Mtf\Util\Command\Cli;
+
+/**
+ * Merchant Developer deploys static view files during test executions so that Storefront UI updates are applied.
+ */
+class StaticContent extends Cli
+{
+    /**
+     * Parameter for deploy static view files.
+     */
+    const PARAM_SETUP_STATIC_CONTENT_DEPLOY = 'setup:static-content:deploy';
+
+    /**
+     * Deploy static view files.
+     *
+     * @return void
+     */
+    public function deploy()
+    {
+        parent::execute(StaticContent::PARAM_SETUP_STATIC_CONTENT_DEPLOY);
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertHttpUsedOnFrontend.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertHttpUsedOnFrontend.php
new file mode 100644
index 0000000000000000000000000000000000000000..e7937da1e4ec8ffa4e37999e54829837ad569474
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertHttpUsedOnFrontend.php
@@ -0,0 +1,91 @@
+<?php
+/**
+ * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Backend\Test\Constraint;
+
+use Magento\Mtf\Constraint\AbstractConstraint;
+use Magento\Mtf\Client\BrowserInterface;
+use Magento\Customer\Test\Fixture\Customer;
+use Magento\Customer\Test\TestStep\LoginCustomerOnFrontendStep as LogInCustomerOnStorefront;
+use Magento\Customer\Test\TestStep\LogoutCustomerOnFrontendStep as LogOutCustomerOnStorefront;
+
+/**
+ * Assert that http is used all over the Storefront.
+ */
+class AssertHttpUsedOnFrontend extends AbstractConstraint
+{
+    /**
+     * Unsecured protocol format.
+     *
+     * @var string
+     */
+    private $unsecuredProtocol = \Magento\Framework\HTTP\PhpEnvironment\Request::SCHEME_HTTP;
+
+    /**
+     * Browser interface.
+     *
+     * @var BrowserInterface
+     */
+    protected $browser;
+
+    /**
+     * Customer account.
+     *
+     * @var Customer
+     */
+    protected $customer;
+
+    /**
+     * Validations execution.
+     *
+     * @param BrowserInterface $browser
+     * @param Customer $customer
+     * @return void
+     */
+    public function processAssert(BrowserInterface $browser, Customer $customer)
+    {
+        $this->browser = $browser;
+        $this->customer = $customer;
+        $this->customer->persist();
+
+        // Log in to Customer Account on Storefront to assert that http is used indeed.
+        $this->objectManager->create(LogInCustomerOnStorefront::class, ['customer' => $this->customer])->run();
+        $this->assertUsedProtocol($this->unsecuredProtocol);
+
+        // Log out from Customer Account on Storefront to assert that JS is deployed validly as a part of statics.
+        $this->objectManager->create(LogOutCustomerOnStorefront::class)->run();
+        $this->assertUsedProtocol($this->unsecuredProtocol);
+    }
+
+    /**
+     * Assert that specified protocol is used on current page.
+     *
+     * @param string $expectedProtocol
+     * @return void
+     */
+    protected function assertUsedProtocol($expectedProtocol)
+    {
+        if (substr($expectedProtocol, -3) !== "://") {
+            $expectedProtocol .= '://';
+        }
+
+        \PHPUnit_Framework_Assert::assertStringStartsWith(
+            $expectedProtocol,
+            $this->browser->getUrl(),
+            "$expectedProtocol is not used."
+        );
+    }
+
+    /**
+     * Returns a string representation of the object.
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'Unsecured URLs are used for Storefront pages.';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertHttpsUsedOnBackend.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertHttpsUsedOnBackend.php
new file mode 100644
index 0000000000000000000000000000000000000000..34019f5849be6ee997a362fc154e1af6abd96ca6
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Constraint/AssertHttpsUsedOnBackend.php
@@ -0,0 +1,101 @@
+<?php
+/**
+ * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Backend\Test\Constraint;
+
+use Magento\Mtf\Constraint\AbstractConstraint;
+use Magento\Mtf\Client\BrowserInterface;
+use Magento\Backend\Test\Page\Adminhtml\Dashboard;
+
+/**
+ * Assert that https protocol is used all over the Admin panel.
+ */
+class AssertHttpsUsedOnBackend extends AbstractConstraint
+{
+    /**
+     * Secured protocol format.
+     *
+     * @var string
+     */
+    private $securedProtocol = \Magento\Framework\HTTP\PhpEnvironment\Request::SCHEME_HTTPS;
+
+    /**
+     * Unsecured protocol format.
+     *
+     * @var string
+     */
+    private $unsecuredProtocol = \Magento\Framework\HTTP\PhpEnvironment\Request::SCHEME_HTTP;
+
+    /**
+     * Browser interface.
+     *
+     * @var BrowserInterface
+     */
+    protected $browser;
+
+    /**
+     * Validations execution.
+     *
+     * @param BrowserInterface $browser
+     * @param Dashboard $adminDashboardPage
+     * @param string $navMenuPath
+     * @return void
+     */
+    public function processAssert(BrowserInterface $browser, Dashboard $adminDashboardPage, $navMenuPath)
+    {
+        $this->browser = $browser;
+
+        // Open specified Admin page using Navigation Menu to assert that JS is deployed validly as a part of statics.
+        $adminDashboardPage->open()->getMenuBlock()->navigate($navMenuPath);
+        $this->assertUsedProtocol($this->securedProtocol);
+        $this->assertDirectHttpUnavailable();
+    }
+
+    /**
+     * Assert that specified protocol is used on current page.
+     *
+     * @param string $expectedProtocol
+     * @return void
+     */
+    protected function assertUsedProtocol($expectedProtocol)
+    {
+        if (substr($expectedProtocol, -3) !== "://") {
+            $expectedProtocol .= '://';
+        }
+
+        \PHPUnit_Framework_Assert::assertStringStartsWith(
+            $expectedProtocol,
+            $this->browser->getUrl(),
+            "$expectedProtocol is not used."
+        );
+    }
+
+    /**
+     * Assert that Merchant is redirected to https if trying to access the page directly via http.
+     *
+     * @return void
+     */
+    protected function assertDirectHttpUnavailable()
+    {
+        $fakeUrl = str_replace($this->securedProtocol, $this->unsecuredProtocol, $this->browser->getUrl());
+        $this->browser->open($fakeUrl);
+        \PHPUnit_Framework_Assert::assertStringStartsWith(
+            $this->securedProtocol,
+            $this->browser->getUrl(),
+            'Merchant is not redirected to https if tries to access the Admin panel page directly via http.'
+        );
+    }
+
+    /**
+     * Returns a string representation of the object.
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return 'Secured URLs are used for Admin panel pages.';
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml
index eb65b5daa9e9d756bcae958d9ef17553d32acbe7..25e6442e5105bf6e5be2bac04323ca81ab4665f6 100644
--- a/dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml
+++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Repository/ConfigData.xml
@@ -5,7 +5,8 @@
  * See COPYING.txt for license details.
  */
 -->
-<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd">
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/Magento/Mtf/Repository/etc/repository.xsd">
     <repository class="Magento\Config\Test\Repository\ConfigData">
         <dataset name="store_information_US">
             <field name="general/store_information/name" xsi:type="array">
@@ -165,12 +166,14 @@
                 <item name="scope_id" xsi:type="number">0</item>
                 <item name="label" xsi:type="string">Yes</item>
                 <item name="value" xsi:type="number">1</item>
+                <item name="inherit" xsi:type="number">1</item>
             </field>
             <field name="web/secure/use_in_adminhtml" xsi:type="array">
                 <item name="scope" xsi:type="string">default</item>
                 <item name="scope_id" xsi:type="number">0</item>
                 <item name="label" xsi:type="string">Yes</item>
                 <item name="value" xsi:type="number">1</item>
+                <item name="inherit" xsi:type="number">1</item>
             </field>
         </dataset>
 
@@ -220,6 +223,21 @@
             </field>
         </dataset>
 
+        <dataset name="disable_https_frontend_admin">
+            <field name="web/secure/use_in_frontend" xsi:type="array">
+                <item name="scope" xsi:type="string">default</item>
+                <item name="scope_id" xsi:type="number">0</item>
+                <item name="label" xsi:type="string">No</item>
+                <item name="value" xsi:type="number">0</item>
+            </field>
+            <field name="web/secure/use_in_adminhtml" xsi:type="array">
+                <item name="scope" xsi:type="string">default</item>
+                <item name="scope_id" xsi:type="number">0</item>
+                <item name="label" xsi:type="string">No</item>
+                <item name="value" xsi:type="number">0</item>
+            </field>
+        </dataset>
+
         <dataset name="custom_allowed_country">
             <field name="general/country/allow" xsi:type="array">
                 <item name="scope" xsi:type="string">default</item>
diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/ConfigureSecureUrlsTest.php b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/ConfigureSecureUrlsTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..d6508cac810757323f50ce6683aeb5a24df0025d
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/ConfigureSecureUrlsTest.php
@@ -0,0 +1,157 @@
+<?php
+/**
+ * Copyright © 2013-2017 Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Backend\Test\TestCase;
+
+use Magento\Mtf\TestCase\Injectable;
+use Magento\Mtf\Fixture\FixtureFactory;
+use Magento\Backend\Test\Page\Adminhtml\SystemConfigEdit;
+use Magento\Mtf\Util\Command\Cli\Cache;
+use Magento\Mtf\Util\Command\Cli\StaticContent;
+
+/**
+ * Verify that Merchant can configure secure URLs for Storefront and/or Admin panel in order to improve Store security.
+ *
+ * Preconditions:
+ *  1. SSL on server is configured.
+ *  2. Secure URLs are disabled for Storefront & Admin (out-of-the-box Magento state).
+ *
+ * Steps:
+ *  1. Log in to Admin panel.
+ *  2. Go to "Stores > Configuration" page.
+ *  3. Select needed scope.
+ *  4. Go to "General > Web > Base URLs (Secure)" section.
+ *  5. Specify Base URL with Secure protocol in the same format as a Secure Base URL.
+ *    (i) Make sure that Secure Base URL ends with a "/".
+ *  6. Enable Secure URLs for Storefront if there is a need.
+ *  7. Enable Secure URLs for Admin if there is a need.
+ *  8. Save the Config & refresh invalidated caches (Configuration, Page Cache).
+ *  9. Deploy static view files.
+ *
+ *  10. If Secure URLs for Storefront were enabled:
+ *      1. Assert that https is used all over the Storefront.
+ *      2. Assert that static content is deployed validly (ex: JS functionality works on Storefront).
+ *      3. Assert that Customer is redirected to https if trying to access the page directly via http.
+ *  11. If secure URLs for Storefront were disabled:
+ *      1. Assert that http is used all over the Storefront.
+ *      2. Assert that static content is deployed validly (ex: JS functionality works on Storefront).
+ *
+ *  12. If secure URLs for Admin were enabled:
+ *      1. Assert that https is used all over the Admin panel.
+ *      2. Assert that static content is deployed validly (ex: JS functionality works in Admin panel).
+ *      3. Assert that Merchant is redirected to https if trying to access the page directly via http.
+ *  13. If secure URLs for Admin were disabled:
+ *      1. Assert that http is used all over the Admin panel.
+ *      2. Assert that static content is deployed validly (ex: JS functionality works in Admin panel).
+ *      3. Assert that Merchant is redirected to http if trying to access the page directly via https.
+ *
+ * Postconditions:
+ *  1. Turn the Secure URLs usage off (with further cache refreshing & static content deploying).
+ *
+ * @ZephyrId MAGETWO-35408
+ */
+class ConfigureSecureUrlsTest extends Injectable
+{
+    /* tags */
+    const MVP = 'no';
+    const SEVERITY = 'S1';
+    /* end tags */
+
+    /**
+     * Fixture factory.
+     *
+     * @var FixtureFactory
+     */
+    protected $fixtureFactory;
+
+    /**
+     * "Configuration" page in Admin panel.
+     *
+     * @var SystemConfigEdit
+     */
+    protected $configurationAdminPage;
+
+    /**
+     * Cache CLI.
+     *
+     * @var Cache
+     */
+    protected $cache;
+
+    /**
+     * Static content CLI.
+     *
+     * @var StaticContent
+     */
+    protected $staticContent;
+
+    /**
+     * Prepare data for further test execution.
+     *
+     * @param FixtureFactory $fixtureFactory
+     * @param SystemConfigEdit $configurationAdminPage
+     * @param Cache $cache
+     * @param StaticContent $staticContent
+     * @return void
+     */
+    public function __inject(
+        FixtureFactory $fixtureFactory,
+        SystemConfigEdit $configurationAdminPage,
+        Cache $cache,
+        StaticContent $staticContent
+    ) {
+        $this->fixtureFactory = $fixtureFactory;
+        $this->configurationAdminPage = $configurationAdminPage;
+        $this->cache = $cache;
+        $this->staticContent = $staticContent;
+    }
+
+    /**
+     * Test execution.
+     *
+     * @param string $configData
+     * @return void
+     */
+    public function test($configData)
+    {
+        $data = [
+            'web/secure/base_url' => [
+                'scope' => 'default',
+                'scope_id' => 0,
+                'value' => str_replace(['http', 'index.php/'], ['https', ''], $_ENV['app_frontend_url'])
+            ]
+        ];
+        $config = $this->fixtureFactory->createByCode('configData', ['dataset' => $configData, 'data' => $data]);
+        $config->persist();
+
+        // Workaround until MTA-3879 is delivered.
+        $this->configurationAdminPage->open();
+        $this->configurationAdminPage->getForm()
+            ->getGroup('web', 'secure')
+            ->setValue('web', 'secure', 'use_in_adminhtml', 'Yes');
+        $this->configurationAdminPage->getPageActions()->save();
+        $_ENV['app_backend_url'] = str_replace('http', 'https', $_ENV['app_backend_url']);
+
+        $this->cache->flush(['config', 'full_page']);
+        $this->staticContent->deploy();
+    }
+
+    /**
+     * Revert all applied high-level changes.
+     *
+     * @return void
+     */
+    public function tearDown()
+    {
+        $this->configurationAdminPage->open();
+        $this->configurationAdminPage->getForm()
+            ->getGroup('web', 'secure')
+            ->setValue('web', 'secure', 'use_in_adminhtml', 'No');
+        $this->configurationAdminPage->getPageActions()->save();
+        $this->cache->flush(['config', 'full_page']);
+        $this->staticContent->deploy();
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/ConfigureSecureUrlsTest.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/ConfigureSecureUrlsTest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d63e0639ea030ad9b5ada22a89d9dc100c2372d4
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/ConfigureSecureUrlsTest.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright © 2013-2017 Magento, Inc. 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\Backend\Test\TestCase\ConfigureSecureUrlsTest" summary="Configure secure URLs" ticketId="MAGETWO-35408">
+        <variation name="ConfigureSecureUrlsHttpForStorefrontHttpsForAdmin" summary="http for Storefront, https for Admin" ticketId="MAGETWO-35408">
+            <data name="configData" xsi:type="string">disable_https_frontend_admin</data>
+            <data name="navMenuPath" xsi:type="string">Marketing>Catalog Price Rule</data>
+            <constraint name="Magento\Backend\Test\Constraint\AssertHttpUsedOnFrontend" />
+            <constraint name="Magento\Backend\Test\Constraint\AssertHttpsUsedOnBackend" />
+        </variation>
+    </testCase>
+</config>
diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/etc/di.xml b/dev/tests/functional/tests/app/Magento/Backend/Test/etc/di.xml
index ecba481f0e9480c63fa604cb64ff8bceb517b924..722279d5ec65914ece2ea22887a817ae41abfea2 100644
--- a/dev/tests/functional/tests/app/Magento/Backend/Test/etc/di.xml
+++ b/dev/tests/functional/tests/app/Magento/Backend/Test/etc/di.xml
@@ -11,6 +11,16 @@
             <argument name="severity" xsi:type="string">high</argument>
         </arguments>
     </type>
+    <type name="Magento\Backend\Test\Constraint\AssertHttpsUsedOnBackend">
+        <arguments>
+            <argument name="severity" xsi:type="string">high</argument>
+        </arguments>
+    </type>
+    <type name="Magento\Backend\Test\Constraint\AssertHttpsUsedOnFrontend">
+        <arguments>
+            <argument name="severity" xsi:type="string">middle</argument>
+        </arguments>
+    </type>
     <type name="Magento\Backend\Test\Constraint\AssertStoreCanBeLocalized">
         <arguments>
             <argument name="severity" xsi:type="string">high</argument>
diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Constraint/AssertTransactionIsPresentInSettlementReport.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/Constraint/AssertTransactionIsPresentInSettlementReport.php
index ca9d4ebea309f913b64a256e23dba24aeb053b3a..2ae10ed4305baa4b2491af3c776e0d904b85f4e0 100644
--- a/dev/tests/functional/tests/app/Magento/Braintree/Test/Constraint/AssertTransactionIsPresentInSettlementReport.php
+++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Constraint/AssertTransactionIsPresentInSettlementReport.php
@@ -11,7 +11,7 @@ use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
 
 /**
- * Class AssertTransactionIsPresentInSettlementReport
+ * Assert that comment with transaction id exists in Comments History section on order page in Admin.
  */
 class AssertTransactionIsPresentInSettlementReport extends AbstractConstraint
 {
@@ -26,6 +26,8 @@ class AssertTransactionIsPresentInSettlementReport extends AbstractConstraint
     private $settlementReportIndex;
 
     /**
+     * Assert that comment with transaction id exists in Comments History section on order page in Admin.
+     *
      * @param $orderId
      * @param OrderIndex $orderIndex
      * @param SalesOrderView $salesOrderView
@@ -58,7 +60,9 @@ class AssertTransactionIsPresentInSettlementReport extends AbstractConstraint
     }
 
     /**
-     * @inheritdoc
+     * Returns a string representation of the object.
+     *
+     * @return string
      */
     public function toString()
     {
@@ -66,15 +70,18 @@ class AssertTransactionIsPresentInSettlementReport extends AbstractConstraint
     }
 
     /**
-     * Get transaction id from order comments
-     * @return mixed
+     * Get transaction id from order comments.
+     *
+     * @return null|string
      */
     private function getTransactionId()
     {
-        $comments = $this->salesOrderView->getOrderHistoryBlock()->getCommentsHistory();
+        /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */
+        $infoTab = $this->salesOrderView->getOrderForm()->openTab('info')->getTab('info');
+        $latestComment = $infoTab->getCommentsHistoryBlock()->getLatestComment();
         $transactionId = null;
 
-        preg_match('/(\w+-*\w+)"/', $comments, $matches);
+        preg_match('/(\w+-*\w+)"/', $latestComment['comment'], $matches);
         if (!empty($matches[1])) {
             $transactionId = $matches[1];
         }
diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Fixture/BraintreeSandboxCustomer.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/Fixture/BraintreeSandboxCustomer.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ed7d001af06d2b708f41bdf8c08517d161c1eb1c
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Fixture/BraintreeSandboxCustomer.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright © 2013-2017 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/fixture.xsd">
+    <fixture name="braintree_sandbox_customer"
+             module="Magento_Braintree"
+             type="virtual"
+             repository_class="Magento\Braintree\Test\Repository\BraintreeSandboxCustomer"
+             class="Magento\Braintree\Test\Fixture\BraintreeSandboxCustomer">
+        <field name="environment" />
+        <field name="merchantId" />
+        <field name="publicKey" />
+        <field name="privateKey" />
+    </fixture>
+</config>
diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/Repository/BraintreeSandboxCustomer.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/Repository/BraintreeSandboxCustomer.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e11d49b867d1a5792f19333e23acb7db4ecc9db1
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/Repository/BraintreeSandboxCustomer.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<!--
+/**
+ * Copyright © 2013-2017 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/Magento/Mtf/Repository/etc/repository.xsd">
+    <repository class="Magento\Braintree\Test\Repository\BraintreeSandboxCustomer">
+        <dataset name="braintree_sandbox_default">
+            <field name="environment" xsi:type="string">BRAINTREEE_ENVIRONMENT</field>
+            <field name="merchantId" xsi:type="string">BRAINTREEE_MERCHANT_ID</field>
+            <field name="publicKey" xsi:type="string">BRAINTREE_PUBLIC_KEY</field>
+            <field name="privateKey" xsi:type="string">BRAINTREE_PRIVATE_KEY</field>
+        </dataset>
+    </repository>
+</config>
diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.xml
index 0fc9162effca7c2b8cd8fca5940db3127874ae7a..996ce28f10b00f53fe22aef5204c5ef60adf6934 100644
--- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreePaypalTest.xml
@@ -11,10 +11,17 @@
             <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
             <data name="products/1" xsi:type="string">bundleProduct::bundle_fixed_100_dollar_product</data>
             <data name="customer/dataset" xsi:type="string">default</data>
-            <data name="checkoutMethod" xsi:type="string">login</data>
+            <data name="checkoutMethod" xsi:type="string">guest</data>
             <data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
-            <data name="refundedPrices" xsi:type="array">
-                <item name="0" xsi:type="string">139.90</item>
+            <data name="order/data/refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="invoiceId" xsi:type="string">0</item>
+                </item>
+            </data>
+            <data name="order/data/price/refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="grand_creditmemo_total" xsi:type="string">139.90</item>
+                </item>
             </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>
@@ -22,7 +29,6 @@
             <data name="payment/method" xsi:type="string">braintree_paypal</data>
             <data name="configData" xsi:type="string">braintree, braintree_paypal, braintree_paypal_sale, braintree_paypal_skip_order_review</data>
             <data name="paymentAction" xsi:type="string">sale</data>
-            <data name="data/items_data/0/qty" xsi:type="string">-</data>
             <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data>
             <constraint name="Magento\Sales\Test\Constraint\AssertRefundSuccessCreateMessage" />
             <constraint name="Magento\Sales\Test\Constraint\AssertRefundInCreditMemoTab" />
@@ -31,10 +37,28 @@
         <variation name="CreateOnlineCreditMemoBraintreePaypalTestVariation2" summary="Partial refund of order placed within Braintree PayPal" ticketId="MAGETWO-48698">
             <data name="products/0" xsi:type="string">catalogProductSimple::simple_for_sales</data>
             <data name="customer/dataset" xsi:type="string">default</data>
-            <data name="checkoutMethod" xsi:type="string">login</data>
+            <data name="checkoutMethod" xsi:type="string">guest</data>
             <data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
-            <data name="refundedPrices" xsi:type="array">
-                <item name="0" xsi:type="string">621.20</item>
+            <data name="order/data/refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="invoiceId" xsi:type="string">0</item>
+                    <item name="items_data" xsi:type="array">
+                        <item name="0" xsi:type="array">
+                            <item name="qty" xsi:type="string">1</item>
+                        </item>
+                    </item>
+                </item>
+                <item name="1" xsi:type="array">
+                    <item name="invoiceId" xsi:type="string">0</item>
+                </item>
+            </data>
+            <data name="order/data/price/refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="grand_creditmemo_total" xsi:type="string">621.20</item>
+                </item>
+                <item name="1" xsi:type="array">
+                    <item name="grand_creditmemo_total" xsi:type="string">606.20</item>
+                </item>
             </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>
@@ -42,9 +66,6 @@
             <data name="payment/method" xsi:type="string">braintree_paypal</data>
             <data name="configData" xsi:type="string">braintree, braintree_paypal, braintree_paypal_skip_order_review</data>
             <data name="data/items_data/0/qty" xsi:type="string">2</data>
-            <data name="refundData/items_data/0/qty" xsi:type="string">1</data>
-            <data name="order/dataset" xsi:type="string">default</data>
-            <data name="isCreditMemoPartial" xsi:type="string">Yes</data>
             <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data>
             <constraint name="Magento\Sales\Test\Constraint\AssertRefundSuccessCreateMessage" />
             <constraint name="Magento\Sales\Test\Constraint\AssertRefundInCreditMemoTab" />
diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreeTest.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreeTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..16aa003bd04b75e5b16ed39f4f89737243d1c74f
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreeTest.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Copyright © 2013-2017 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Braintree\Test\TestCase;
+
+use Magento\Mtf\TestCase\Scenario;
+
+/**
+ * Preconditions:
+ * 1. Full capture of order placed within Braintree.
+ *
+ * Steps:
+ * 1. Log in to Admin.
+ * 2. Open created order.
+ * 3. Create credit memo.
+ * 4. Perform assertions.
+ *
+ * @group Braintree
+ * @ZephyrId MAGETWO-38324
+ */
+class CreateOnlineCreditMemoBraintreeTest extends Scenario
+{
+    /* tags */
+    const MVP = 'yes';
+    const TEST_TYPE = '3rd_party_test';
+    const SEVERITY = 'S1';
+    /* end tags */
+
+    /**
+     * Runs test for online credit memo creation for order placed via Braintree Credit Card.
+     *
+     * @return void
+     */
+    public function test()
+    {
+        $this->executeScenario();
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreeTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreeTest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..638c76cadb55da59049dabc4cdcdffbfbd7adbf4
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/CreateOnlineCreditMemoBraintreeTest.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright © 2013-2017 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\Braintree\Test\TestCase\CreateOnlineCreditMemoBraintreeTest" summary="Create online credit memo for Braintree credit card" ticketId="MAGETWO-38324">
+        <variation name="CreateOnlineCreditMemoBraintreeTestVariation1" summary="Refund an order placed through Braintree with full capture" ticketId="MAGETWO-38324">
+            <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data>
+            <data name="products" xsi:type="array">
+                <item name="0" xsi:type="string">catalogProductSimple::product_10_dollar</item>
+                <item name="1" xsi:type="string">configurableProduct::with_one_option</item>
+                <item name="2" xsi:type="string">bundleProduct::bundle_fixed_100_dollar_product</item>
+            </data>
+            <data name="customer/dataset" xsi:type="string">default</data>
+            <data name="braintreeSandboxCustomer/dataset" xsi:type="string">braintree_sandbox_default</data>
+            <data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
+            <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data>
+            <data name="checkoutMethod" xsi:type="string">guest</data>
+            <data name="shipping" xsi:type="array">
+                <item name="shipping_service" xsi:type="string">Flat Rate</item>
+                <item name="shipping_method" xsi:type="string">Fixed</item>
+            </data>
+            <data name="payment/method" xsi:type="string">braintree</data>
+            <data name="creditCard/dataset" xsi:type="string">visa_default</data>
+            <data name="creditCard/data/payment_code" xsi:type="string">braintree</data>
+            <data name="configData" xsi:type="string">braintree</data>
+            <data name="status" xsi:type="string">Closed</data>
+            <data name="order/data/refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="invoiceId" xsi:type="string">0</item>
+                </item>
+            </data>
+            <data name="order/data/price/refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="grand_creditmemo_total" xsi:type="string">145.98</item>
+                </item>
+            </data>
+            <data name="transactions/refund" xsi:type="array">
+                <item name="transactionType" xsi:type="string">Refund</item>
+                <item name="statusIsClosed" xsi:type="string">Yes</item>
+            </data>
+            <constraint name="Magento\Sales\Test\Constraint\AssertRefundSuccessCreateMessage" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertRefundInCommentsHistory" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertTransactionStatus" />
+        </variation>
+        <variation name="CreateOnlineCreditMemoBraintreeTestVariation2" summary="Partial Refund an order placed through Braintree with Partial capture" ticketId="MAGETWO-38325">
+            <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data>
+            <data name="products" xsi:type="array">
+                <item name="0" xsi:type="string">catalogProductSimple::product_10_dollar</item>
+                <item name="1" xsi:type="string">configurableProduct::with_one_option</item>
+                <item name="2" xsi:type="string">bundleProduct::bundle_fixed_100_dollar_product</item>
+            </data>
+            <data name="customer/dataset" xsi:type="string">default</data>
+            <data name="braintreeSandboxCustomer/dataset" xsi:type="string">braintree_sandbox_default</data>
+            <data name="taxRule" xsi:type="string">us_ca_ny_rule</data>
+            <data name="shippingAddress/dataset" xsi:type="string">US_address_1_without_email</data>
+            <data name="checkoutMethod" xsi:type="string">guest</data>
+            <data name="shipping" xsi:type="array">
+                <item name="shipping_service" xsi:type="string">Flat Rate</item>
+                <item name="shipping_method" xsi:type="string">Fixed</item>
+            </data>
+            <data name="payment/method" xsi:type="string">braintree</data>
+            <data name="creditCard/dataset" xsi:type="string">visa_default</data>
+            <data name="creditCard/data/payment_code" xsi:type="string">braintree</data>
+            <data name="configData" xsi:type="string">braintree</data>
+            <data name="status" xsi:type="string">Processing</data>
+            <data name="order/data/refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="invoiceId" xsi:type="string">0</item>
+                    <item name="items_data" xsi:type="array">
+                        <item name="1" xsi:type="array">
+                            <item name="qty" xsi:type="string">0</item>
+                        </item>
+                    </item>
+                </item>
+                <item name="1" xsi:type="array">
+                    <item name="invoiceId" xsi:type="string">0</item>
+                </item>
+            </data>
+            <data name="order/data/price/refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="grand_creditmemo_total" xsi:type="string">134.07</item>
+                </item>
+                <item name="1" xsi:type="array">
+                    <item name="grand_creditmemo_total" xsi:type="string">1.08</item>
+                </item>
+            </data>
+            <data name="data/items_data" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="qty" xsi:type="string">0</item>
+                </item>
+            </data>
+            <constraint name="Magento\Sales\Test\Constraint\AssertRefundSuccessCreateMessage" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertRefundInCommentsHistory" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
+        </variation>
+    </testCase>
+</config>
diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php
index d90dfeeb17f3148acf898e496b1b8dc477cf0681..38d32214186201b8015bc5507a9db684d7dc27c8 100644
--- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php
+++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php
@@ -11,47 +11,69 @@ use Magento\Checkout\Test\Page\CheckoutOnepage;
 use Magento\Checkout\Test\Page\CheckoutOnepageSuccess;
 use Magento\Mtf\Fixture\FixtureFactory;
 use Magento\Mtf\TestStep\TestStepInterface;
+use Magento\Sales\Test\Fixture\OrderInjectable;
 
 /**
- * Class PlaceOrderWithPaypalStep
+ * Place order with Paypal in one page checkout.
  */
 class PlaceOrderWithPaypalStep implements TestStepInterface
 {
     /**
+     * Onepage checkout page.
+     *
      * @var CheckoutOnepage
      */
     private $checkoutOnepage;
 
     /**
+     * Assert that Order Grand Total is correct on checkout page review block.
+     *
      * @var AssertGrandTotalOrderReview
      */
     private $assertGrandTotalOrderReview;
 
     /**
+     * Assert billing address is not present in selected payment method.
+     *
      * @var AssertBillingAddressAbsentInPayment
      */
     private $assertBillingAddressAbsentInPayment;
 
     /**
+     * One page checkout success page.
+     *
      * @var CheckoutOnepageSuccess
      */
     private $checkoutOnepageSuccess;
 
     /**
+     * Price array.
+     *
      * @var array
      */
     private $prices;
 
     /**
+     * Factory for fixtures.
+     *
      * @var FixtureFactory
      */
     private $fixtureFactory;
 
     /**
+     * Array of product entities.
+     *
      * @var array
      */
     private $products;
 
+    /**
+     * Fixture OrderInjectable.
+     *
+     * @var OrderInjectable
+     */
+    private $order;
+
     /**
      * @param CheckoutOnepage $checkoutOnepage
      * @param AssertGrandTotalOrderReview $assertGrandTotalOrderReview
@@ -60,6 +82,7 @@ class PlaceOrderWithPaypalStep implements TestStepInterface
      * @param FixtureFactory $fixtureFactory
      * @param array $products
      * @param array $prices
+     * @param OrderInjectable|null $order
      */
     public function __construct(
         CheckoutOnepage $checkoutOnepage,
@@ -68,7 +91,8 @@ class PlaceOrderWithPaypalStep implements TestStepInterface
         CheckoutOnepageSuccess $checkoutOnepageSuccess,
         FixtureFactory $fixtureFactory,
         array $products,
-        array $prices = []
+        array $prices = [],
+        OrderInjectable $order = null
     ) {
         $this->checkoutOnepage = $checkoutOnepage;
         $this->assertGrandTotalOrderReview = $assertGrandTotalOrderReview;
@@ -77,10 +101,13 @@ class PlaceOrderWithPaypalStep implements TestStepInterface
         $this->fixtureFactory = $fixtureFactory;
         $this->products = $products;
         $this->prices = $prices;
+        $this->order = $order;
     }
 
     /**
-     * @inheritdoc
+     * Place order after checking order totals on review step.
+     *
+     * @return array
      */
     public function run()
     {
@@ -94,15 +121,15 @@ class PlaceOrderWithPaypalStep implements TestStepInterface
             ->getSelectedPaymentMethodBlock()
             ->clickPayWithPaypal();
         $this->checkoutOnepage->getBraintreePaypalBlock()->process($parentWindow);
-        
+        $data = [
+            'entity_id' => ['products' => $this->products]
+        ];
+        $orderData = $this->order !== null ? $this->order->getData() : [];
         $order = $this->fixtureFactory->createByCode(
             'orderInjectable',
-            [
-                'data' => [
-                    'entity_id' => ['products' => $this->products]
-                ]
-            ]
+            ['data' => array_merge($data, $orderData)]
         );
+
         return [
             'orderId' => $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId(),
             'order' => $order
diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/SettleTransactionStep.php b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/SettleTransactionStep.php
new file mode 100644
index 0000000000000000000000000000000000000000..977b95fb8b9aafdca7b1aaf2057fcd8649564b61
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/SettleTransactionStep.php
@@ -0,0 +1,93 @@
+<?php
+/**
+ * Copyright © 2013-2017 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Braintree\Test\TestStep;
+
+use Magento\Braintree\Test\Fixture\BraintreeSandboxCustomer;
+use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
+use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
+use Magento\Mtf\ObjectManagerFactory;
+use Braintree\Gateway;
+use Magento\Mtf\TestStep\TestStepInterface;
+
+/**
+ * Settle transaction for Braintree Credit Card.
+ */
+class SettleTransactionStep implements TestStepInterface
+{
+    /**
+     * Braintree Sandbox customer fixture.
+     *
+     * @var BraintreeSandboxCustomer
+     */
+    private $braintreeSandboxCustomer;
+
+    /**
+     * Sales order page.
+     *
+     * @var OrderIndex
+     */
+    private $salesOrder;
+
+    /**
+     * Sales order view page.
+     *
+     * @var SalesOrderView
+     */
+    private $salesOrderView;
+
+    /**
+     * Order id.
+     *
+     * @var string
+     */
+    private $orderId;
+
+    /**
+     * @param BraintreeSandboxCustomer $braintreeSandboxCustomer
+     * @param OrderIndex $salesOrder
+     * @param SalesOrderView $salesOrderView
+     * @param string $orderId
+     */
+    public function __construct(
+        BraintreeSandboxCustomer $braintreeSandboxCustomer,
+        OrderIndex $salesOrder,
+        SalesOrderView $salesOrderView,
+        $orderId
+    ) {
+        $this->braintreeSandboxCustomer = $braintreeSandboxCustomer;
+        $this->salesOrder = $salesOrder;
+        $this->salesOrderView = $salesOrderView;
+        $this->orderId = $orderId;
+    }
+
+    /**
+     * Settle transaction for Braintree Credit Card.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        $credentials = $this->braintreeSandboxCustomer->getData();
+        $gateway = ObjectManagerFactory::getObjectManager()->create(Gateway::class, ['config' => $credentials]);
+        $transactionId = $this->getTransactionId();
+        $gateway->testing()->settle($transactionId);
+    }
+
+    /**
+     * Get transaction id.
+     *
+     * @return string
+     */
+    private function getTransactionId()
+    {
+        $this->salesOrder->open();
+        $this->salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $this->orderId]);
+        $this->salesOrderView->getOrderForm()->openTab('transactions');
+        $actualTransactions = $this->salesOrderView->getOrderForm()->getTab('transactions')->getGridBlock()->getIds();
+
+        return current(array_keys($actualTransactions));
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/etc/testcase.xml
index d55bde9089b9fb6f2ddfe532b8cc8430453e1773..ffe67f1979ee02bb9d226fdb7bd6e958a640a4b6 100644
--- a/dev/tests/functional/tests/app/Magento/Braintree/Test/etc/testcase.xml
+++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/etc/testcase.xml
@@ -188,4 +188,22 @@
         <step name="useVaultPaymentToken" module="Magento_Vault" next="submitOrder" />
         <step name="submitOrder" module="Magento_Sales" />
     </scenario>
+    <scenario name="CreateOnlineCreditMemoBraintreeTest" firstStep="setupConfiguration">
+        <step name="setupConfiguration" module="Magento_Config" next="createProducts" />
+        <step name="createProducts" module="Magento_Catalog" next="createTaxRule" />
+        <step name="createTaxRule" module="Magento_Tax" next="addProductsToTheCart" />
+        <step name="addProductsToTheCart" module="Magento_Checkout" next="estimateShippingAndTax" />
+        <step name="estimateShippingAndTax" module="Magento_Checkout" next="clickProceedToCheckout" />
+        <step name="clickProceedToCheckout" module="Magento_Checkout" next="createCustomer" />
+        <step name="createCustomer" module="Magento_Customer" next="selectCheckoutMethod" />
+        <step name="selectCheckoutMethod" module="Magento_Checkout" next="fillShippingAddress" />
+        <step name="fillShippingAddress" module="Magento_Checkout" next="fillShippingMethod" />
+        <step name="fillShippingMethod" module="Magento_Checkout" next="selectPaymentMethod" />
+        <step name="selectPaymentMethod" module="Magento_Checkout" next="fillBillingInformation" />
+        <step name="fillBillingInformation" module="Magento_Checkout" next="placeOrder" />
+        <step name="placeOrder" module="Magento_Checkout" next="createInvoice" />
+        <step name="createInvoice" module="Magento_Sales" next="settleTransaction" />
+        <step name="settleTransaction" module="Magento_Braintree" next="createOnlineCreditMemo" />
+        <step name="createOnlineCreditMemo" module="Magento_Sales" />
+    </scenario>
 </config>
diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Fixture/Cart/Items.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Fixture/Cart/Items.php
index 5aa80efe329c4d4a97bb37bc6c8f42a957ce1230..a5c9499e2b792d54036db2d6192a43b240155fc0 100644
--- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Fixture/Cart/Items.php
+++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Fixture/Cart/Items.php
@@ -34,13 +34,6 @@ class Items extends DataSource
     {
         $this->params = $params;
         $this->products = isset($data['products']) ? $data['products'] : [];
-
-        foreach ($this->products as $product) {
-            $classItem = 'Magento\\' . $this->getModuleName($product) . '\Test\Fixture\Cart\Item';
-            $item = ObjectManager::getInstance()->create($classItem, ['product' => $product]);
-
-            $this->data[] = $item;
-        }
     }
 
     /**
@@ -55,6 +48,24 @@ class Items extends DataSource
         return isset($match[1]) ? $match[1] : '';
     }
 
+    /**
+     * Return prepared dataset.
+     *
+     * @param null|string $key
+     * @return array
+     */
+    public function getData($key = null)
+    {
+        foreach ($this->products as $product) {
+            $classItem = 'Magento\\' . $this->getModuleName($product) . '\Test\Fixture\Cart\Item';
+            $item = ObjectManager::getInstance()->create($classItem, ['product' => $product]);
+            $item->getData();
+            $this->data[] = $item;
+        }
+
+        return parent::getData($key);
+    }
+
     /**
      * Get source products.
      *
diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php
index 985780a30eae0fae11ec7ce1c640dfa00176182d..88466249ba2e89e656bd39ec34ce9f1b5872cb0a 100644
--- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php
+++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/PlaceOrderStep.php
@@ -11,6 +11,7 @@ use Magento\Checkout\Test\Page\CheckoutOnepage;
 use Magento\Checkout\Test\Page\CheckoutOnepageSuccess;
 use Magento\Mtf\Fixture\FixtureFactory;
 use Magento\Mtf\TestStep\TestStepInterface;
+use Magento\Sales\Test\Fixture\OrderInjectable;
 
 /**
  * Place order in one page checkout.
@@ -59,6 +60,13 @@ class PlaceOrderStep implements TestStepInterface
      */
     private $products;
 
+    /**
+     * Fixture OrderInjectable.
+     *
+     * @var OrderInjectable
+     */
+    private $order;
+
     /**
      * @param CheckoutOnepage $checkoutOnepage
      * @param AssertGrandTotalOrderReview $assertGrandTotalOrderReview
@@ -66,6 +74,7 @@ class PlaceOrderStep implements TestStepInterface
      * @param FixtureFactory $fixtureFactory
      * @param array $products
      * @param array $prices
+     * @param OrderInjectable|null $order
      */
     public function __construct(
         CheckoutOnepage $checkoutOnepage,
@@ -73,7 +82,8 @@ class PlaceOrderStep implements TestStepInterface
         CheckoutOnepageSuccess $checkoutOnepageSuccess,
         FixtureFactory $fixtureFactory,
         array $products = [],
-        array $prices = []
+        array $prices = [],
+        OrderInjectable $order = null
     ) {
         $this->checkoutOnepage = $checkoutOnepage;
         $this->assertGrandTotalOrderReview = $assertGrandTotalOrderReview;
@@ -81,6 +91,7 @@ class PlaceOrderStep implements TestStepInterface
         $this->fixtureFactory = $fixtureFactory;
         $this->products = $products;
         $this->prices = $prices;
+        $this->order = $order;
     }
 
     /**
@@ -95,14 +106,14 @@ class PlaceOrderStep implements TestStepInterface
         }
         $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder();
         $orderId = $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId();
+        $data = [
+            'id' => $orderId,
+            'entity_id' => ['products' => $this->products]
+        ];
+        $orderData = $this->order !== null ? $this->order->getData() : [];
         $order = $this->fixtureFactory->createByCode(
             'orderInjectable',
-            [
-                'data' => [
-                    'id' => $orderId,
-                    'entity_id' => ['products' => $this->products],
-                ]
-            ]
+            ['data' => array_merge($data, $orderData)]
         );
 
         return [
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/Cart/Item.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/Cart/Item.php
index 0b87fc0d1b23837b188c1a5093216e99256dc302..905a382f01897d00494857b0a0771a50833371d7 100644
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/Cart/Item.php
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/Cart/Item.php
@@ -48,7 +48,11 @@ class Item extends \Magento\Catalog\Test\Fixture\Cart\Item
             ];
         }
         $attributeKey = implode(' ', $attributeKey);
-        $cartItem['sku'] = $productData['configurable_attributes_data']['matrix'][$attributeKey]['sku'];
+        if (isset($productData['configurable_attributes_data']['matrix'][$attributeKey])) {
+            $cartItem['sku'] = $productData['configurable_attributes_data']['matrix'][$attributeKey]['sku'];
+        } else {
+            $cartItem['sku'] = $productData['sku'];
+        }
         $cartItem['name'] = $productData['name'];
 
         $cartItem['options'] = isset($cartItem['options'])
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 642bbdbdcc664d40805d32bb74a769f8384ca284..6f9d04e626a9b783282f287e0d4612c38d65d64c 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
@@ -309,5 +309,17 @@
             <field name="region_id" xsi:type="string">California</field>
             <field name="postcode" xsi:type="string">90230</field>
         </dataset>
+
+        <dataset name="AVS_zip_match_address">
+            <field name="firstname" xsi:type="string">John</field>
+            <field name="lastname" xsi:type="string">Doe</field>
+            <field name="company" xsi:type="string">Magento %isolation%</field>
+            <field name="city" xsi:type="string">Culver City</field>
+            <field name="street" xsi:type="string">49 Main</field>
+            <field name="telephone" xsi:type="string">555-55-555-55</field>
+            <field name="country_id" xsi:type="string">United States</field>
+            <field name="region_id" xsi:type="string">California</field>
+            <field name="postcode" xsi:type="string">00382</field>
+        </dataset>
     </repository>
 </config>
diff --git a/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml b/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml
index 1b59246febbdf16fb6aba6e72dc01a2c2e9796bb..5392509a932cd6d2a4d8b83a87d6992119200ddc 100644
--- a/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml
+++ b/dev/tests/functional/tests/app/Magento/Payment/Test/Repository/CreditCard.xml
@@ -50,5 +50,12 @@
             <field name="cc_exp_year" xsi:type="string" />
             <field name="cc_cid" xsi:type="string" />
         </dataset>
+
+        <dataset name="visa_cvv_mismatch">
+            <field name="cc_number" xsi:type="string">4111111111111111</field>
+            <field name="cc_exp_month" xsi:type="string">01 - January</field>
+            <field name="cc_exp_year" xsi:type="string">2020</field>
+            <field name="cc_cid" xsi:type="string">306</field>
+        </dataset>
     </repository>
 </config>
diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/Repository/ConfigData.xml
index 0f26e3bec8afab8491d8cf8a2949aee99f7e6616..51f18cd929a97e17a9091f4013a6f458b6344d78 100644
--- a/dev/tests/functional/tests/app/Magento/Paypal/Test/Repository/ConfigData.xml
+++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/Repository/ConfigData.xml
@@ -236,6 +236,15 @@
             </field>
         </dataset>
 
+        <dataset name="payflowpro_avs_security_code_does_not_match">
+            <field name="payment/payflowpro/avs_security_code" xsi:type="array">
+                <item name="scope" xsi:type="string">payment</item>
+                <item name="scope_id" xsi:type="number">1</item>
+                <item name="label" xsi:type="string">Yes</item>
+                <item name="value" xsi:type="number">1</item>
+            </field>
+        </dataset>
+
         <dataset name="hosted_pro">
             <field name="payment/paypal_group_all_in_one/payments_pro_hosted_solution_with_express_checkout/pphs_required_settings/pphs_required_settings_pphs/business_account" xsi:type="array">
                 <item name="scope" xsi:type="string">payment</item>
@@ -494,6 +503,7 @@
                 <item name="value" xsi:type="number">0</item>
             </field>
         </dataset>
+
         <dataset name="payflowpro_use_vault">
             <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/paypal_payflow_required/payflowpro_cc_vault_active" xsi:type="array">
                 <item name="scope" xsi:type="string">payment</item>
@@ -510,5 +520,34 @@
                 <item name="value" xsi:type="number">0</item>
             </field>
         </dataset>
+
+        <dataset name="payflowpro_use_avs_zip">
+            <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/settings_paypal_payflow/settings_paypal_payflow_advanced/paypal_payflow_avs_check/avs_zip" xsi:type="array">
+                <item name="scope" xsi:type="string">payment</item>
+                <item name="scope_id" xsi:type="number">1</item>
+                <item name="label" xsi:type="string">Yes</item>
+                <item name="value" xsi:type="number">1</item>
+            </field>
+            <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/settings_paypal_payflow/settings_paypal_payflow_advanced/paypal_payflow_avs_check/avs_security_code" xsi:type="array">
+                <item name="scope" xsi:type="string">payment</item>
+                <item name="scope_id" xsi:type="number">1</item>
+                <item name="label" xsi:type="string">No</item>
+                <item name="value" xsi:type="number">0</item>
+            </field>
+        </dataset>
+        <dataset name="payflowpro_use_avs_zip_rollback">
+            <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/settings_paypal_payflow/settings_paypal_payflow_advanced/paypal_payflow_avs_check/avs_zip" xsi:type="array">
+                <item name="scope" xsi:type="string">payment</item>
+                <item name="scope_id" xsi:type="number">1</item>
+                <item name="label" xsi:type="string">No</item>
+                <item name="value" xsi:type="number">0</item>
+            </field>
+            <field name="payment/paypal_payment_gateways/paypal_payflowpro_with_express_checkout/settings_paypal_payflow/settings_paypal_payflow_advanced/paypal_payflow_avs_check/avs_security_code" xsi:type="array">
+                <item name="scope" xsi:type="string">payment</item>
+                <item name="scope_id" xsi:type="number">1</item>
+                <item name="label" xsi:type="string">Yes</item>
+                <item name="value" xsi:type="number">1</item>
+            </field>
+        </dataset>
     </repository>
 </config>
diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CreateOnlineCreditMemoTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CreateOnlineCreditMemoTest.xml
index b155dacf8f25c5832ed55a686801dda9cde83ecc..419ccb61a7f79ab25fbaa1507f04704d91f583f9 100644
--- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CreateOnlineCreditMemoTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/CreateOnlineCreditMemoTest.xml
@@ -7,12 +7,20 @@
  -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
     <testCase name="Magento\Sales\Test\TestCase\CreateOnlineCreditMemoTest" summary="Create online credit memo for order placed with online payment method">
-        <variation name="CreateCreditMemoPaymentsProTestVariation1" summary="Create Refund for Order Paid with PayPal Payments Pro" ticketId="MAGETWO-13059">
+        <variation name="CreateOnlineCreditMemoPaymentsProTestVariation1" summary="Create Refund for Order Paid with PayPal Payments Pro" ticketId="MAGETWO-13059">
+            <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S0</data>
             <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
             <data name="customer/dataset" xsi:type="string">default</data>
             <data name="checkoutMethod" xsi:type="string">guest</data>
-            <data name="refundedPrices" xsi:type="array">
-                <item name="0" xsi:type="string">15.00</item>
+            <data name="order/data/refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="invoiceId" xsi:type="string">0</item>
+                </item>
+            </data>
+            <data name="order/data/price/refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="grand_creditmemo_total" xsi:type="string">15.00</item>
+                </item>
             </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>
@@ -23,15 +31,54 @@
             <data name="data/items_data/0/qty" xsi:type="string">-</data>
             <data name="data/form_data/do_shipment" xsi:type="string">Yes</data>
             <data name="status" xsi:type="string">Closed</data>
-            <data name="transactions/Refund" xsi:type="array">
+            <data name="transactions/refund" xsi:type="array">
                 <item name="transactionType" xsi:type="string">Refund</item>
                 <item name="statusIsClosed" xsi:type="string">Yes</item>
             </data>
-            <data name="transactions/Capture" xsi:type="array">
+            <data name="transactions/capture" xsi:type="array">
                 <item name="transactionType" xsi:type="string">Capture</item>
                 <item name="statusIsClosed" xsi:type="string">Yes</item>
             </data>
+            <constraint name="Magento\Sales\Test\Constraint\AssertRefundSuccessCreateMessage" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertRefundInCommentsHistory" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertRefundInCreditMemoTab" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertTransactionStatus" />
+        </variation>
+        <variation name="CreateOnlineCreditMemoPayflowProVariation1" summary="Create Refund for Order Paid with PayPal Payflow Pro" ticketId="MAGETWO-13063">
             <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S0</data>
+            <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
+            <data name="customer/dataset" xsi:type="string">default</data>
+            <data name="checkoutMethod" xsi:type="string">guest</data>
+            <data name="order/data/refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="invoiceId" xsi:type="string">0</item>
+                </item>
+            </data>
+            <data name="order/data/price/refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="grand_creditmemo_total" xsi:type="string">15.00</item>
+                </item>
+            </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="payment/method" xsi:type="string">payflowpro</data>
+            <data name="configData" xsi:type="string">payflowpro</data>
+            <data name="creditCard/dataset" xsi:type="string">visa_default</data>
+            <data name="status" xsi:type="string">Closed</data>
+            <data name="transactions/authorization" xsi:type="array">
+                <item name="transactionType" xsi:type="string">Authorization</item>
+                <item name="statusIsClosed" xsi:type="string">Yes</item>
+            </data>
+            <data name="transactions/refund" xsi:type="array">
+                <item name="transactionType" xsi:type="string">Refund</item>
+                <item name="statusIsClosed" xsi:type="string">Yes</item>
+            </data>
+            <data name="transactions/capture" xsi:type="array">
+                <item name="transactionType" xsi:type="string">Capture</item>
+                <item name="statusIsClosed" xsi:type="string">Yes</item>
+            </data>
             <constraint name="Magento\Sales\Test\Constraint\AssertRefundSuccessCreateMessage" />
             <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
             <constraint name="Magento\Sales\Test\Constraint\AssertRefundInCommentsHistory" />
diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutDeclinedTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutDeclinedTest.xml
index 1ca34ae1bab13e75c0777e0583697a2236e33d1b..e4c0f0196beeb48135c61b12bef4d9b1b396b84e 100644
--- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutDeclinedTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutDeclinedTest.xml
@@ -21,5 +21,33 @@
             <data name="expectedErrorMessage" xsi:type="string">An error occurred on the server. Please try to place the order again.</data>
             <constraint name="Magento\Checkout\Test\Constraint\AssertCheckoutErrorMessage" />
         </variation>
+        <variation name="OnePageCheckoutDeclinedTestWithAVSZIP" summary="Place order via Payflow Pro with AVS ZIP verification fail" ticketId="MAGETWO-37483">
+            <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</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">guest</data>
+            <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data>
+            <data name="shipping/shipping_method" xsi:type="string">Fixed</data>
+            <data name="payment/method" xsi:type="string">payflowpro</data>
+            <data name="creditCard/dataset" xsi:type="string">visa_default</data>
+            <data name="expectedErrorMessage" xsi:type="string">An error occurred on the server. Please try to place the order again.</data>
+            <data name="configData" xsi:type="string">payflowpro, payflowpro_use_avs_zip</data>
+            <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data>
+            <constraint name="Magento\Checkout\Test\Constraint\AssertCheckoutErrorMessage" />
+        </variation>
+        <variation name="OnePageCheckoutPayflowProWithCVVDoesNotMatch" summary="Place order via Payflow Pro with CVV verification fail" ticketId="MAGETWO-37485">
+            <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data>
+            <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</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">guest</data>
+            <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data>
+            <data name="shipping/shipping_method" xsi:type="string">Fixed</data>
+            <data name="payment/method" xsi:type="string">payflowpro</data>
+            <data name="creditCard/dataset" xsi:type="string">visa_cvv_mismatch</data>
+            <data name="configData" xsi:type="string">payflowpro, payflowpro_avs_security_code_does_not_match</data>
+            <data name="expectedErrorMessage" xsi:type="string">An error occurred on the server. Please try to place the order again.</data>
+            <constraint name="Magento\Checkout\Test\Constraint\AssertCheckoutErrorMessage" />
+        </variation>
     </testCase>
 </config>
diff --git a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutTest.xml b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutTest.xml
index 76f5da0b4884f337588484b67e62b8d199cce662..0229ba550aa01ce0894e08a69cb7e95eddb5fc96 100644
--- a/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutTest.xml
+++ b/dev/tests/functional/tests/app/Magento/Paypal/Test/TestCase/OnePageCheckoutTest.xml
@@ -55,7 +55,7 @@
             <constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" />
             <constraint name="Magento\Sales\Test\Constraint\AssertOrderPaymentInformation" />
         </variation>
-        <variation name="OnePageCheckoutPayflowProWithAVSStreetMatch" summary="Place Order via Payflow Pro with success AVS Street verification" ticketId="MAGETWO-37479">
+        <variation name="OnePageCheckoutPayflowProWithAVSStreetMatches" summary="Place Order via Payflow Pro with success AVS Street verification" ticketId="MAGETWO-37479">
             <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data>
             <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
             <data name="customer/dataset" xsi:type="string">default</data>
@@ -99,5 +99,46 @@
             <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
             <constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" />
         </variation>
+        <variation name="OnePageCheckoutPayflowProWithAVSZIP" summary="Place order via Payflow Pro with success AVS ZIP verification" ticketId="MAGETWO-37482">
+            <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</data>
+            <data name="customer/dataset" xsi:type="string">default</data>
+            <data name="shippingAddress/dataset" xsi:type="string">AVS_zip_match_address</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>
+            <data name="payment/method" xsi:type="string">payflowpro</data>
+            <data name="creditCard/dataset" xsi:type="string">visa_default</data>
+            <data name="paymentInfo" xsi:type="array">
+                <item name="AVS zip" xsi:type="string">#Y: Yes. Matched Address and five-didgit ZIP</item>
+            </data>
+            <data name="configData" xsi:type="string">payflowpro, payflowpro_use_avs_zip</data>
+            <data name="status" xsi:type="string">Processing</data>
+            <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data>
+            <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertOrderPaymentInformation" />
+        </variation>
+        <variation name="OnePageCheckoutPayflowProWithCVVMatches" summary="Place order via Payflow Pro with success CVV verification" ticketId="MAGETWO-37484">
+            <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data>
+            <data name="products/0" xsi:type="string">catalogProductSimple::product_10_dollar</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">guest</data>
+            <data name="shipping/shipping_service" xsi:type="string">Flat Rate</data>
+            <data name="shipping/shipping_method" xsi:type="string">Fixed</data>
+            <data name="payment/method" xsi:type="string">payflowpro</data>
+            <data name="prices" xsi:type="array">
+                <item name="grandTotal" xsi:type="string">15.00</item>
+            </data>
+            <data name="creditCard/dataset" xsi:type="string">visa_default</data>
+            <data name="configData" xsi:type="string">payflowpro, payflowpro_avs_security_code_does_not_match</data>
+            <data name="paymentInfo" xsi:type="array">
+                <item name="AVS Street Match" xsi:type="string">#Y: Matched (CVV2CSC)</item>
+            </data>
+            <constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertOrderPaymentInformation" />
+            <constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" />
+        </variation>
     </testCase>
 </config>
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractForm.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractForm.php
index c5c792b24c4fafb48ed646d396cefc3171b1be51..3a25d2ed8fc07b23ed3f24f04232a08b846290f7 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractForm.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractForm.php
@@ -68,8 +68,9 @@ abstract class AbstractForm extends Form
     {
         $data = $this->prepareData($data);
         if (isset($data['items_data']) && $products !== null) {
-            foreach ($products as $key => $product) {
-                $this->getItemsBlock()->getItemProductBlock($product)->fillProduct($data['items_data'][$key]);
+            foreach ($data['items_data'] as $key => $item) {
+                $productSku = $products[$key]->getData()['sku'];
+                $this->getItemsBlock()->getItemProductBlock($productSku)->fillProduct($item);
             }
         }
     }
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItems.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItems.php
index 28814e1f23ad0b2105ac043c90bbe616300d0709..7b2862dcd6412a7fcbfd6818dbe23b83580120bf 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItems.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItems.php
@@ -111,7 +111,7 @@ class AbstractItems extends Block
      * @param ElementInterface $item
      * @return null|int
      */
-    private function getQty(ElementInterface $item)
+    protected function getQty(ElementInterface $item)
     {
         $qty = null;
         $elements = $item->getElements($this->qty);
@@ -127,7 +127,7 @@ class AbstractItems extends Block
      * @param ElementInterface $item
      * @return string
      */
-    private function getSku(ElementInterface $item)
+    protected function getSku(ElementInterface $item)
     {
         $itemContent = $item->find($this->sku)->getText();
         $itemContent = preg_replace('/\n|\r/', '', $itemContent);
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItemsNewBlock.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItemsNewBlock.php
index 15fd358256143a01890a874a2f415e20f50dd76d..71c560894cdf7f722332474e895e5d55b63acd7c 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItemsNewBlock.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/AbstractItemsNewBlock.php
@@ -8,38 +8,36 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order;
 
 use Magento\Sales\Test\Block\Adminhtml\Order\AbstractForm\Product;
 use Magento\Mtf\Block\Block;
-use Magento\Mtf\Fixture\FixtureInterface;
 
 /**
- * Class AbstractItemsNewBlock
- * Items block on Credit Memo, Invoice, Shipment new pages
+ * Items block on Credit Memo, Invoice, Shipment new pages.
  */
 abstract class AbstractItemsNewBlock extends Block
 {
     /**
-     * Item product row selector
+     * Item product row selector.
      *
      * @var string
      */
     protected $productItem = '//tr[contains(.,"%s")]';
 
     /**
-     * 'Update Qty's' button css selector
+     * 'Update Qty's' button css selector.
      *
      * @var string
      */
     protected $updateQty = '.update-button';
 
     /**
-     * Get item product block
+     * Get item product block.
      *
-     * @param FixtureInterface $product
+     * @param  string $productSku
      * @return Product
      */
-    abstract public function getItemProductBlock(FixtureInterface $product);
+    abstract public function getItemProductBlock($productSku);
 
     /**
-     * Click update qty button
+     * Click update qty button.
      *
      * @return void
      */
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php
index b244448e2b6b15f0060c92f2f9e7166bbb5ae1a2..a1c4000e36f26595c895b584b7838c6f5a911134 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Creditmemo/Form/Items.php
@@ -9,7 +9,6 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo\Form;
 use Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo\Form\Items\Product;
 use Magento\Mtf\Block\Block;
 use Magento\Mtf\Client\Locator;
-use Magento\Mtf\Fixture\FixtureInterface;
 
 /**
  * Credit Memo Items block on Credit Memo new page.
@@ -33,12 +32,12 @@ class Items extends Block
     /**
      * Get item product block.
      *
-     * @param FixtureInterface $product
+     * @param string $productSku
      * @return Product
      */
-    public function getItemProductBlock(FixtureInterface $product)
+    public function getItemProductBlock($productSku)
     {
-        $selector = sprintf($this->productItems, $product->getSku());
+        $selector = sprintf($this->productItems, $productSku);
         return $this->blockFactory->create(
             \Magento\Sales\Test\Block\Adminhtml\Order\Creditmemo\Form\Items\Product::class,
             ['element' => $this->_rootElement->find($selector, Locator::SELECTOR_XPATH)]
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/History.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/History.php
deleted file mode 100644
index c0b2e8ef697f9ae79b4267df5bef988431fb2168..0000000000000000000000000000000000000000
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/History.php
+++ /dev/null
@@ -1,175 +0,0 @@
-<?php
-/**
- * Copyright © 2013-2017 Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-namespace Magento\Sales\Test\Block\Adminhtml\Order;
-
-use Magento\Mtf\Block\Block;
-use Magento\Mtf\Client\Locator;
-
-/**
- * Order comments block.
- */
-class History extends Block
-{
-    /**
-     * Comment history Id.
-     *
-     * @var string
-     */
-    protected $commentHistory = '.note-list-comment';
-
-    /**
-     * Comment history status.
-     *
-     * @var string
-     */
-    protected $commentHistoryStatus = '.note-list-status';
-
-    /**
-     * Comment history notified status.
-     *
-     * @var string
-     */
-    protected $commentHistoryNotifiedStatus = '.note-list-customer';
-
-    /**
-     * Authorized Amount.
-     *
-     * @var string
-     */
-    protected $authorizedAmount = '//div[@class="note-list-comment"][contains(text(), "Authorized amount of")]';
-
-    /**
-     * Captured Amount from IPN.
-     *
-     * @var string
-     */
-    protected $capturedAmount = '//div[@class="note-list-comment"][contains(text(), "Captured amount of")]';
-
-    /**
-     * Refunded Amount.
-     *
-     * @var string
-     */
-    protected $refundedAmount = '//div[@class="note-list-comment"][contains(text(), "We refunded")]';
-
-    /**
-     * Voided Amount.
-     *
-     * @var string
-     */
-    protected $voidedAmount = '//div[@class="note-list-comment"][contains(text(), "Voided authorization")]';
-
-    /**
-     * Note list locator.
-     *
-     * @var string
-     */
-    protected $noteList = '.note-list';
-
-    /**
-     * Get comments history.
-     *
-     * @return string
-     */
-    public function getCommentsHistory()
-    {
-        $this->waitCommentsHistory();
-        return $this->_rootElement->find($this->commentHistory, Locator::SELECTOR_CSS)->getText();
-    }
-
-    /**
-     * Get the authorized amount from the comments history.
-     *
-     * @return string
-     */
-    public function getAuthorizedAmount()
-    {
-        $this->waitCommentsHistory();
-        return $this->_rootElement->find($this->authorizedAmount, Locator::SELECTOR_XPATH)->getText();
-    }
-
-    /**
-     * Get the captured amount from the comments history.
-     *
-     * @return array
-     */
-    public function getCapturedAmount()
-    {
-        $result = [];
-        $this->waitCommentsHistory();
-        $captureComments = $this->_rootElement->getElements($this->capturedAmount, Locator::SELECTOR_XPATH);
-        foreach ($captureComments as $captureComment) {
-            $result[] = $captureComment->getText();
-        }
-        return $result;
-    }
-
-    /**
-     * Get the refunded amount from the comments history.
-     *
-     * @return array
-     */
-    public function getRefundedAmount()
-    {
-        $result = [];
-        $this->waitCommentsHistory();
-        $refundedComments = $this->_rootElement->getElements($this->refundedAmount, Locator::SELECTOR_XPATH);
-        foreach ($refundedComments as $refundedComment) {
-            $result[] = $refundedComment->getText();
-        }
-        return $result;
-    }
-
-    /**
-     * Get the voided amount from the comments history.
-     *
-     * @return string
-     */
-    public function getVoidedAmount()
-    {
-        $this->waitCommentsHistory();
-        return $this->_rootElement->find($this->voidedAmount, Locator::SELECTOR_XPATH)->getText();
-    }
-
-    /**
-     * Gets the status which presented in comment
-     *
-     * @return string
-     */
-    public function getStatus()
-    {
-        $this->waitCommentsHistory();
-        return $this->_rootElement->find($this->commentHistoryStatus, Locator::SELECTOR_CSS)->getText();
-    }
-
-    /**
-     * Gets the is customer notified status which presented in comment
-     *
-     * @return string
-     */
-    public function getNotifiedStatus()
-    {
-        $this->waitCommentsHistory();
-        return $this->_rootElement->find($this->commentHistoryNotifiedStatus, Locator::SELECTOR_CSS)->getText();
-    }
-
-    /**
-     * Wait for comments history is visible.
-     *
-     * @return void
-     */
-    protected function waitCommentsHistory()
-    {
-        $element = $this->_rootElement;
-        $selector = $this->noteList;
-        $element->waitUntil(
-            function () use ($element, $selector) {
-                return $element->find($selector)->isVisible() ? true : null;
-            }
-        );
-    }
-}
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Form/Items.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Form/Items.php
index 0ff748e52f9a9d92e05a2f59c9ad8a5dbde53b0d..c97807ccc152206da6000baab4342dd7fd87f117 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Form/Items.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Invoice/Form/Items.php
@@ -9,23 +9,21 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order\Invoice\Form;
 use Magento\Sales\Test\Block\Adminhtml\Order\AbstractItemsNewBlock;
 use Magento\Sales\Test\Block\Adminhtml\Order\Invoice\Form\Items\Product;
 use Magento\Mtf\Client\Locator;
-use Magento\Mtf\Fixture\FixtureInterface;
 
 /**
- * Class Items
- * Block for items to invoice on new invoice page
+ * Block for items to invoice on new invoice page.
  */
 class Items extends AbstractItemsNewBlock
 {
     /**
-     * Get item product block
+     * Get item product block.
      *
-     * @param FixtureInterface $product
+     * @param string $productSku
      * @return Product
      */
-    public function getItemProductBlock(FixtureInterface $product)
+    public function getItemProductBlock($productSku)
     {
-        $selector = sprintf($this->productItem, $product->getSku());
+        $selector = sprintf($this->productItem, $productSku);
         return $this->blockFactory->create(
             \Magento\Sales\Test\Block\Adminhtml\Order\Invoice\Form\Items\Product::class,
             ['element' => $this->_rootElement->find($selector, Locator::SELECTOR_XPATH)]
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Shipment/View/Items.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Shipment/View/Items.php
index 5fa78417a20fb9099d7e7f14dd0a1004b3bcd282..44e6310642ae6bc3f833019d30c6952444e2ec85 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Shipment/View/Items.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Shipment/View/Items.php
@@ -9,13 +9,12 @@ namespace Magento\Sales\Test\Block\Adminhtml\Order\Shipment\View;
 use Magento\Sales\Test\Block\Adminhtml\Order\AbstractItems;
 
 /**
- * Class Items
- * Shipment Items block on Shipment view page
+ * Shipment Items block on Shipment view page.
  */
 class Items extends AbstractItems
 {
     /**
-     * Get items data
+     * Get items data.
      *
      * @return array
      */
@@ -27,8 +26,9 @@ class Items extends AbstractItems
         foreach ($items as $item) {
             $itemData = [];
 
-            $itemData += $this->parseProductName($item->find($this->product)->getText());
-            $itemData['qty'] = $item->find($this->qty)->getText();
+            $itemData['product'] = preg_replace('/\n|\r/', '', $item->find($this->title)->getText());
+            $itemData['sku'] = $this->getSku($item);
+            $itemData['qty'] = $this->getQty($item);
 
             $data[] = $itemData;
         }
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/CreditMemos/Grid.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/CreditMemos/Grid.php
index b73887bfd2ddd02b1ae2cfdd3ecd2817f859a4c8..2cc0571b330ffbdca008132bf02f337425afe491 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/CreditMemos/Grid.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/CreditMemos/Grid.php
@@ -70,6 +70,7 @@ class Grid extends DataGrid
      */
     public function getCreditMemoId()
     {
+        $this->resetFilter();
         $this->waitForElementNotVisible($this->loader, Locator::SELECTOR_XPATH);
         return $this->_rootElement->find($this->creditMemoId)->getText();
     }
@@ -82,6 +83,7 @@ class Grid extends DataGrid
     public function getIds()
     {
         $result = [];
+        $this->resetFilter();
         $this->waitForElementNotVisible($this->loader, Locator::SELECTOR_XPATH);
         $creditMemoIds = $this->_rootElement->getElements($this->creditMemoId);
         foreach ($creditMemoIds as $creditMemoId) {
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info.php
index f4bc65a75e017f5b593bb7eb3f36128030aaba8b..85aa0665414b0c75a4130437869f140a6354949f 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info.php
@@ -7,6 +7,7 @@
 namespace Magento\Sales\Test\Block\Adminhtml\Order\View\Tab;
 
 use Magento\Backend\Test\Block\Widget\Tab;
+use Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info\CommentsHistoryBlock;
 use Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info\PaymentInfoBlock;
 
 /**
@@ -28,6 +29,13 @@ class Info extends Tab
      */
     private $paymentInfoBlockSelector = '.order-payment-method';
 
+    /**
+     * Selector for Comments history block.
+     *
+     * @var string
+     */
+    private $commentsHistoryBlockSelector = '#order_history_block';
+
     /**
      * Get order status from info block.
      *
@@ -50,4 +58,17 @@ class Info extends Tab
             ['element' => $this->_rootElement->find($this->paymentInfoBlockSelector)]
         );
     }
+
+    /**
+     * Returns Comments history block.
+     *
+     * @return CommentsHistoryBlock
+     */
+    public function getCommentsHistoryBlock()
+    {
+        return $this->blockFactory->create(
+            CommentsHistoryBlock::class,
+            ['element' => $this->_rootElement->find($this->commentsHistoryBlockSelector)]
+        );
+    }
 }
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info/CommentsHistoryBlock.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info/CommentsHistoryBlock.php
new file mode 100644
index 0000000000000000000000000000000000000000..9daed9e87482c7b5251801947df8fbdd1f1034ee
--- /dev/null
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Info/CommentsHistoryBlock.php
@@ -0,0 +1,93 @@
+<?php
+/**
+ * Copyright © 2013-2017 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+namespace Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info;
+
+use Magento\Mtf\Block\Block;
+
+/**
+ * Order comments history block.
+ */
+class CommentsHistoryBlock extends Block
+{
+    /**
+     * Comment history list locator.
+     *
+     * @var string
+     */
+    protected $commentHistory = '.note-list-item';
+
+    /**
+     * Comment date.
+     *
+     * @var string
+     */
+    protected $commentHistoryDate = '.note-list-date';
+
+    /**
+     * Comment time.
+     *
+     * @var string
+     */
+    protected $commentHistoryTime = '.note-list-time';
+
+    /**
+     * Comment status.
+     *
+     * @var string
+     */
+    protected $commentHistoryStatus = '.note-list-status';
+
+    /**
+     * Comment notified status.
+     *
+     * @var string
+     */
+    protected $commentHistoryNotifiedStatus = '.note-list-customer';
+
+    /**
+     * Comment locator.
+     *
+     * @var string
+     */
+    protected $comment = '.note-list-comment';
+
+    /**
+     * Get comment history block data.
+     *
+     * @return array
+     */
+    public function getComments()
+    {
+        $result = [];
+        $elements = $this->_rootElement->getElements($this->commentHistory);
+        foreach ($elements as $key => $item) {
+            $result[$key] = [
+                'date' => $item->find($this->commentHistoryDate)->getText(),
+                'time' => $item->find($this->commentHistoryTime)->getText(),
+                'status' => $item->find($this->commentHistoryStatus)->getText(),
+                'is_customer_notified' => $item->find($this->commentHistoryNotifiedStatus)->getText(),
+                'comment' => '',
+            ];
+            if ($item->find($this->comment)->isVisible()) {
+                $result[$key]['comment'] = $item->find($this->comment)->getText();
+            }
+        }
+
+        return $result;
+    }
+
+    /**
+     * Get last comment.
+     *
+     * @return array
+     */
+    public function getLatestComment()
+    {
+        $comments = $this->getComments();
+        return current($comments);
+    }
+}
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAcceptPaymentMessageInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAcceptPaymentMessageInCommentsHistory.php
index 638558bdb906644de0bb34bb6a0471b58d688dae..c25485ee006a8612f311dba4dec67191f6db07e7 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAcceptPaymentMessageInCommentsHistory.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAcceptPaymentMessageInCommentsHistory.php
@@ -10,34 +10,42 @@ use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
 
 /**
- * Class AssertAcceptPaymentMessageInCommentsHistory
+ * Assert that accept payment message exists in Comments History section on order page in Admin.
  *
- * Constraint checks accept payment message in order comments history
  */
 class AssertAcceptPaymentMessageInCommentsHistory extends AbstractConstraint
 {
-
     /**
+     * Accept payment message.
+     *
      * @var string
      */
     private static $message = 'Approved the payment online.';
 
     /**
-     * @param SalesOrderView $orderView
+     * Assert that accept payment message exists in Comments History section on order page in Admin.
+     *
+     * @param SalesOrderView $salesOrderView
      * @param OrderIndex $orderIndex
      * @param $orderId
+     * @return void
      */
-    public function processAssert(SalesOrderView $orderView, OrderIndex $orderIndex, $orderId)
+    public function processAssert(SalesOrderView $salesOrderView, OrderIndex $orderIndex, $orderId)
     {
         $orderIndex->open();
         $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
-        $history = $orderView->getOrderHistoryBlock()->getCommentsHistory();
 
-        \PHPUnit_Framework_Assert::assertContains(self::$message, $history);
+        /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */
+        $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info');
+        $latestComment = $infoTab->getCommentsHistoryBlock()->getLatestComment();
+
+        \PHPUnit_Framework_Assert::assertContains(self::$message, $latestComment['comment']);
     }
 
     /**
-     * @inheritdoc
+     * Returns a string representation of the object.
+     *
+     * @return string
      */
     public function toString()
     {
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAuthorizationInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAuthorizationInCommentsHistory.php
index cfebf8c390502c8fcaf46b941f1be3ec6db4b4b2..78e5a3b31c4cdc0355ffc7ae2f208e405da6e209 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAuthorizationInCommentsHistory.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertAuthorizationInCommentsHistory.php
@@ -21,7 +21,7 @@ class AssertAuthorizationInCommentsHistory extends AbstractConstraint
     const AUTHORIZED_AMOUNT_PATTERN = '/(IPN "Pending" )*Authorized amount of \w*\W{1,2}%s. Transaction ID: "[\w\-]*"/';
 
     /**
-     * Assert that comment about authorized amount exist in Comments History section on order page in Admin.
+     * Assert that comment about authorized amount exists in Comments History section on order page in Admin.
      *
      * @param SalesOrderView $salesOrderView
      * @param OrderIndex $salesOrder
@@ -37,11 +37,14 @@ class AssertAuthorizationInCommentsHistory extends AbstractConstraint
     ) {
         $salesOrder->open();
         $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
-        $actualAuthorizedAmount = $salesOrderView->getOrderHistoryBlock()->getAuthorizedAmount();
+
+        /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */
+        $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info');
+        $latestComment = $infoTab->getCommentsHistoryBlock()->getLatestComment();
 
         \PHPUnit_Framework_Assert::assertRegExp(
             sprintf(self::AUTHORIZED_AMOUNT_PATTERN, $prices['grandTotal']),
-            $actualAuthorizedAmount,
+            $latestComment['comment'],
             'Incorrect authorized amount value for the order #' . $orderId
         );
     }
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php
index b4a0c0c875d3caa7cc2d06e08c7460164182cb29..11087c98bf0f81ab9d07054d9201982364d58b75 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertCaptureInCommentsHistory.php
@@ -6,7 +6,6 @@
 
 namespace Magento\Sales\Test\Constraint;
 
-use Magento\Sales\Test\Fixture\OrderInjectable;
 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
 use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
 use Magento\Mtf\Constraint\AbstractConstraint;
@@ -22,7 +21,7 @@ class AssertCaptureInCommentsHistory extends AbstractConstraint
     const CAPTURED_AMOUNT_PATTERN = '/^Captured amount of \w*\W{1,2}%s online. Transaction ID: "[\w\-]*"/';
 
     /**
-     * Assert that comment about captured amount exist in Comments History section on order page in Admin.
+     * Assert that comment about captured amount exists in Comments History section on order page in Admin.
      *
      * @param SalesOrderView $salesOrderView
      * @param OrderIndex $salesOrder
@@ -39,11 +38,21 @@ class AssertCaptureInCommentsHistory extends AbstractConstraint
         $salesOrder->open();
         $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
 
-        $actualCapturedAmount = $salesOrderView->getOrderHistoryBlock()->getCapturedAmount();
+        /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */
+        $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info');
+        $comments = $infoTab->getCommentsHistoryBlock()->getComments();
+
+        foreach ($comments as $key => $comment) {
+            if (strstr($comment['comment'], 'Captured') === false) {
+                unset($comments[$key]);
+            }
+        }
+        $comments = array_values($comments);
+
         foreach ($capturedPrices as $key => $capturedPrice) {
             \PHPUnit_Framework_Assert::assertRegExp(
                 sprintf(self::CAPTURED_AMOUNT_PATTERN, $capturedPrice),
-                $actualCapturedAmount[$key],
+                $comments[$key]['comment'],
                 'Incorrect captured amount value for the order #' . $orderId
             );
         }
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertDenyPaymentMessageInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertDenyPaymentMessageInCommentsHistory.php
index ca745ffd801d6b7bd3e92e9b27e766b7ecc8a979..ae37d44c877c195782c0020b7f77ac79a77d4f26 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertDenyPaymentMessageInCommentsHistory.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertDenyPaymentMessageInCommentsHistory.php
@@ -10,33 +10,43 @@ use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
 
 /**
- * Class AssertDenyPaymentMessageInCommentsHistory
+ * Assert that deny payment message exists in Comments History section on order page in Admin.
  *
  * Constraint checks deny payment message in order comments history
  */
 class AssertDenyPaymentMessageInCommentsHistory extends AbstractConstraint
 {
     /**
+     * Deny payment message.
+     *
      * @var string
      */
     private static $message = 'Denied the payment online';
 
     /**
-     * @param SalesOrderView $orderView
+     * Assert that deny payment message exists in Comments History section on order page in Admin.
+     *
+     * @param SalesOrderView $salesOrderView
      * @param OrderIndex $orderIndex
      * @param $orderId
+     * @return void
      */
-    public function processAssert(SalesOrderView $orderView, OrderIndex $orderIndex, $orderId)
+    public function processAssert(SalesOrderView $salesOrderView, OrderIndex $orderIndex, $orderId)
     {
         $orderIndex->open();
         $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
-        $history = $orderView->getOrderHistoryBlock()->getCommentsHistory();
 
-        \PHPUnit_Framework_Assert::assertContains(self::$message, $history);
+        /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */
+        $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info');
+        $latestComment = $infoTab->getCommentsHistoryBlock()->getLatestComment();
+
+        \PHPUnit_Framework_Assert::assertContains(self::$message, $latestComment['comment']);
     }
 
     /**
-     * @inheritdoc
+     * Returns a string representation of the object.
+     *
+     * @return string
      */
     public function toString()
     {
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistoryNotifyStatus.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistoryNotifyStatus.php
index ae5b331d2aea5f49bf9015f7fd2e08e3991e1ae2..b99264198c17cd14eb7d23851673890d322ac104 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistoryNotifyStatus.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertOrderCommentsHistoryNotifyStatus.php
@@ -11,12 +11,12 @@ use Magento\Mtf\Constraint\AbstractConstraint;
 use Magento\Sales\Test\Fixture\OrderInjectable;
 
 /**
- * Class AssertOrderCommentsHistoryNotifyStatus
+ * Assert that comment has appropriate notification status in Comments History section on order page in Admin.
  */
 class AssertOrderCommentsHistoryNotifyStatus extends AbstractConstraint
 {
     /**
-     * Assert that comment about refunded amount exist in Comments History section on order page in Admin.
+     * Assert that comment has appropriate notification status in Comments History section on order page in Admin.
      *
      * @param SalesOrderView $salesOrderView
      * @param OrderIndex $salesOrder
@@ -35,8 +35,13 @@ class AssertOrderCommentsHistoryNotifyStatus extends AbstractConstraint
             $data['form_data']['send_email'],
             FILTER_VALIDATE_BOOLEAN
         ) : false;
+
+        /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */
+        $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info');
+        $latestComment = $infoTab->getCommentsHistoryBlock()->getLatestComment();
+
         \PHPUnit_Framework_Assert::assertContains(
-            $salesOrderView->getOrderHistoryBlock()->getNotifiedStatus(),
+            $latestComment['is_customer_notified'],
             (bool)$sendMail ? 'Customer Notified' : 'Customer Not Notified'
         );
     }
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInCommentsHistory.php
index 93fd1e25a5f219fde768914febcb48eeba2f00d2..5be581859df8f9e2bf3b94a1a5cb2be06d866102 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInCommentsHistory.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInCommentsHistory.php
@@ -6,6 +6,7 @@
 
 namespace Magento\Sales\Test\Constraint;
 
+use Magento\Sales\Test\Fixture\OrderInjectable;
 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
 use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
 use Magento\Mtf\Constraint\AbstractConstraint;
@@ -21,28 +22,39 @@ class AssertRefundInCommentsHistory extends AbstractConstraint
     const REFUNDED_AMOUNT_PATTERN = '/^We refunded \w*\W{1,2}%s online. Transaction ID: "[\w\-]*"/';
 
     /**
-     * Assert that comment about refunded amount exist in Comments History section on order page in Admin.
+     * Assert that comment about refunded amount exists in Comments History section on order page in Admin.
      *
+     * @param OrderInjectable $order
      * @param SalesOrderView $salesOrderView
      * @param OrderIndex $salesOrder
      * @param string $orderId
-     * @param array $refundedPrices
      * @return void
      */
     public function processAssert(
+        OrderInjectable $order,
         SalesOrderView $salesOrderView,
         OrderIndex $salesOrder,
-        $orderId,
-        array $refundedPrices
+        $orderId
     ) {
         $salesOrder->open();
         $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
 
-        $actualRefundedAmount = $salesOrderView->getOrderHistoryBlock()->getRefundedAmount();
+        /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */
+        $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info');
+        $comments = $infoTab->getCommentsHistoryBlock()->getComments();
+
+        foreach ($comments as $key => $comment) {
+            if (stristr($comment['comment'], 'refunded') === false) {
+                unset($comments[$key]);
+            }
+        }
+        $comments = array_reverse(array_values($comments));
+
+        $refundedPrices = $order->getPrice()['refund'];
         foreach ($refundedPrices as $key => $refundedPrice) {
             \PHPUnit_Framework_Assert::assertRegExp(
-                sprintf(self::REFUNDED_AMOUNT_PATTERN, $refundedPrice),
-                $actualRefundedAmount[$key],
+                sprintf(self::REFUNDED_AMOUNT_PATTERN, $refundedPrice['grand_creditmemo_total']),
+                $comments[$key]['comment'],
                 'Incorrect refunded amount value for the order #' . $orderId
             );
         }
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInCreditMemoTab.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInCreditMemoTab.php
index f5925564af137aac30cfa548c7cde351d144f487..74862b6db45f84b6ceb5fdba6b56bbcda5c555ed 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInCreditMemoTab.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInCreditMemoTab.php
@@ -37,7 +37,7 @@ class AssertRefundInCreditMemoTab extends AbstractConstraint
         $salesOrderView->getOrderForm()->openTab('creditmemos');
         /** @var Grid $grid */
         $grid = $salesOrderView->getOrderForm()->getTab('creditmemos')->getGridBlock();
-        $amount = $order->getPrice();
+        $amount = $order->getPrice()['refund'];
         foreach ($ids['creditMemoIds'] as $key => $creditMemoId) {
             $filter = [
                 'id' => $creditMemoId,
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInRefundsGrid.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInRefundsGrid.php
index c317d7ce7f1c8661fbef1f91527749c67f6a617a..e0e13e4bf67ef99066f60fa91a43915dc0e17f19 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInRefundsGrid.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundInRefundsGrid.php
@@ -11,13 +11,12 @@ use Magento\Sales\Test\Page\Adminhtml\CreditMemoIndex;
 use Magento\Mtf\Constraint\AbstractConstraint;
 
 /**
- * Class AssertRefundInRefundsGrid
- * Assert that refund is present in the 'Refunds' grid with correct ID, order ID, refunded amount
+ * Assert that refund is present in the 'Refunds' grid with correct ID, order ID, refunded amount.
  */
 class AssertRefundInRefundsGrid extends AbstractConstraint
 {
     /**
-     * Assert that refund is present in the 'Refunds' grid with correct ID, order ID, refunded amount
+     * Assert that refund is present in the 'Refunds' grid with correct ID, order ID, refunded amount.
      *
      * @param CreditMemoIndex $creditMemoIndex
      * @param OrderInjectable $order
@@ -27,7 +26,7 @@ class AssertRefundInRefundsGrid extends AbstractConstraint
     public function processAssert(CreditMemoIndex $creditMemoIndex, OrderInjectable $order, array $ids)
     {
         $creditMemoIndex->open();
-        $amount = $order->getPrice();
+        $amount = $order->getPrice()['refund'];
         $orderId = $order->getId();
         foreach ($ids['creditMemoIds'] as $key => $creditMemoId) {
             $filter = [
@@ -47,7 +46,7 @@ class AssertRefundInRefundsGrid extends AbstractConstraint
     }
 
     /**
-     * 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/Sales/Test/Constraint/AssertRefundNotInRefundsGrid.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundNotInRefundsGrid.php
index 54456cdb8b04dacb856a8e167b948b20c47b6951..2389239bef0456ec9ab347e5d2a508ff89d61ba5 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundNotInRefundsGrid.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundNotInRefundsGrid.php
@@ -26,7 +26,7 @@ class AssertRefundNotInRefundsGrid extends AbstractConstraint
     public function processAssert(CreditMemoIndex $creditMemoIndex, OrderInjectable $order, array $ids)
     {
         $creditMemoIndex->open();
-        $amount = $order->getPrice();
+        $amount = $order->getPrice()['refund'];
         $orderId = $order->getId();
         foreach ($ids['creditMemoIds'] as $key => $creditMemoId) {
             $filter = [
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundOrderStatusInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundOrderStatusInCommentsHistory.php
index 89a968d6692cfa8e08d89ba56b317326cc9db569..207c634cabdbedfefd6cc097f84005940b39c821 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundOrderStatusInCommentsHistory.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundOrderStatusInCommentsHistory.php
@@ -11,12 +11,12 @@ use Magento\Mtf\Constraint\AbstractConstraint;
 use Magento\Sales\Test\Fixture\OrderInjectable;
 
 /**
- * Assert that comment about refunded amount exist in Comments History section on order page in Admin.
+ * Assert that comment with correct order status exists in Comments History section on order page in Admin.
  */
 class AssertRefundOrderStatusInCommentsHistory extends AbstractConstraint
 {
     /**
-     * Assert that comment about refunded amount exist in Comments History section on order page in Admin.
+     * Assert that comment with correct order status exists in Comments History section on order page in Admin.
      *
      * @param SalesOrderView $salesOrderView
      * @param OrderIndex $salesOrder
@@ -33,9 +33,11 @@ class AssertRefundOrderStatusInCommentsHistory extends AbstractConstraint
 
         /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */
         $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info');
+        $latestComment = $infoTab->getCommentsHistoryBlock()->getLatestComment();
+
         \PHPUnit_Framework_Assert::assertContains(
             $infoTab->getOrderStatus(),
-            $salesOrderView->getOrderHistoryBlock()->getStatus()
+            $latestComment['status']
         );
     }
 
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundedGrandTotalOnFrontend.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundedGrandTotalOnFrontend.php
index 6e6478cb835d2b6d5c71872e274e0d97186c41e4..fce8f03197419a7aff226dc1c311205d868dba0b 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundedGrandTotalOnFrontend.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertRefundedGrandTotalOnFrontend.php
@@ -12,12 +12,12 @@ use Magento\Sales\Test\Page\OrderHistory;
 use Magento\Sales\Test\Page\CustomerOrderView;
 
 /**
- * Assert that refunded grand total is equal to data from fixture on My Account page
+ * Assert that refunded grand total is equal to data from fixture on My Account page.
  */
 class AssertRefundedGrandTotalOnFrontend extends AbstractAssertOrderOnFrontend
 {
     /**
-     * Assert that refunded grand total is equal to data from fixture on My Account page
+     * Assert that refunded grand total is equal to data from fixture on My Account page.
      *
      * @param OrderHistory $orderHistory
      * @param OrderInjectable $order
@@ -38,14 +38,14 @@ class AssertRefundedGrandTotalOnFrontend extends AbstractAssertOrderOnFrontend
         $customerOrderView->getOrderViewBlock()->openLinkByName('Refunds');
         foreach ($ids['creditMemoIds'] as $key => $creditMemoId) {
             \PHPUnit_Framework_Assert::assertEquals(
-                number_format($order->getPrice()[$key]['grand_creditmemo_total'], 2),
+                number_format($order->getPrice()['refund'][$key]['grand_creditmemo_total'], 2),
                 $creditMemoView->getCreditMemoBlock()->getItemBlock($creditMemoId)->getGrandTotal()
             );
         }
     }
 
     /**
-     * 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/Sales/Test/Constraint/AssertVoidInCommentsHistory.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertVoidInCommentsHistory.php
index 6175ef03e2c4e8f98f60026e9949d2ff24ae87c0..0c2a723506953a8a2d2266efd896c21f246ddda0 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertVoidInCommentsHistory.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Constraint/AssertVoidInCommentsHistory.php
@@ -21,7 +21,7 @@ class AssertVoidInCommentsHistory extends AbstractConstraint
     const VOIDED_AMOUNT = 'Voided authorization. Amount: $';
 
     /**
-     * Assert that comment about voided amount exist in Comments History section on order page in Admin.
+     * Assert that comment about voided amount exists in Comments History section on order page in Admin.
      *
      * @param SalesOrderView $salesOrderView
      * @param OrderIndex $salesOrder
@@ -38,9 +38,13 @@ class AssertVoidInCommentsHistory extends AbstractConstraint
         $salesOrder->open();
         $salesOrder->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
 
+        /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info $infoTab */
+        $infoTab = $salesOrderView->getOrderForm()->openTab('info')->getTab('info');
+        $latestComment = $infoTab->getCommentsHistoryBlock()->getLatestComment();
+
         \PHPUnit_Framework_Assert::assertContains(
             self::VOIDED_AMOUNT . $prices['grandTotal'],
-            $salesOrderView->getOrderHistoryBlock()->getVoidedAmount(),
+            $latestComment['comment'],
             'Incorrect voided amount value for the order #' . $orderId
         );
     }
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable.xml
index 8bd7261eb2d9e424f7b26e02c2251995c941fd56..2abd9f70bcfd95b17578c6ecb1de62025cc008f7 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable.xml
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderInjectable.xml
@@ -206,5 +206,6 @@
         <field name="gw_card_tax_refunded" is_required="" />
         <field name="id" />
         <field name="price" is_required="1" group="null" repository="Magento\Sales\Test\Repository\OrderInjectable\Price" />
+        <field name="refund" is_required="" />
     </fixture>
 </config>
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/SalesOrderView.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/SalesOrderView.xml
index 057acf52bb51c50f8ea273a41d03dd7129c2d1b4..6d1aceb70bf4ff0872caa5db2829377478c2b289 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/SalesOrderView.xml
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Page/Adminhtml/SalesOrderView.xml
@@ -13,7 +13,6 @@
         <block name="titleBlock" class="Magento\Theme\Test\Block\Html\Title" locator=".page-title-wrapper" strategy="css selector" />
         <block name="itemsOrderedBlock" class="Magento\Sales\Test\Block\Adminhtml\Order\View\Items" locator="#sales_order_view_tabs_order_info_content .edit-order-table" strategy="css selector" />
         <block name="orderTotalsBlock" class="Magento\Sales\Test\Block\Adminhtml\Order\Totals" locator=".order-totals" strategy="css selector" />
-        <block name="orderHistoryBlock" class="Magento\Sales\Test\Block\Adminhtml\Order\History" locator=".order-comments-history" strategy="css selector" />
         <block name="informationBlock" class="Magento\Sales\Test\Block\Adminhtml\Order\View\Info" locator=".order-account-information" strategy="css selector" />
         <block name="orderInfoBlock" class="Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Info" locator="[data-ui-id='sales-order-tabs-tab-content-order-info']" strategy="css selector" />
         <block name="orderInvoiceGrid" class="Magento\Sales\Test\Block\Adminhtml\Invoice\Grid" locator="//div[contains(@data-bind, 'sales_order_view_invoice_grid.sales_order_view_invoice_grid')]" strategy="xpath" />
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable/Price.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable/Price.xml
index ce1774bcd35ea2a9411e83e0e7d39da22b2de530..4d8f8ad44c1f31bbd659c5cbc1b7e20610ef933e 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable/Price.xml
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Repository/OrderInjectable/Price.xml
@@ -34,20 +34,27 @@
         </dataset>
 
         <dataset name="full_refund">
-            <field name="0" xsi:type="array">
-                <item name="grand_creditmemo_total" xsi:type="string">565</item>
+            <field name="refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="grand_creditmemo_total" xsi:type="string">565</item>
+                </item>
             </field>
         </dataset>
 
         <dataset name="full_refund_with_zero_shipping_refund">
-            <field name="0" xsi:type="array">
-                <item name="grand_creditmemo_total" xsi:type="string">555</item>
+            <field name="refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="grand_creditmemo_total" xsi:type="string">555</item>
+                </item>
             </field>
         </dataset>
 
+
         <dataset name="partial_refund">
-            <field name="0" xsi:type="array">
-                <item name="grand_creditmemo_total" xsi:type="string">110</item>
+            <field name="refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="grand_creditmemo_total" xsi:type="string">110</item>
+                </item>
             </field>
         </dataset>
 
@@ -59,8 +66,12 @@
         </dataset>
 
         <dataset name="full_flow">
+            <field name="refund" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="grand_creditmemo_total" xsi:type="string">565</item>
+                </item>
+            </field>
             <field name="0" xsi:type="array">
-                <item name="grand_creditmemo_total" xsi:type="string">565</item>
                 <item name="grand_invoice_total" xsi:type="string">565</item>
                 <item name="grand_order_total" xsi:type="string">565</item>
             </field>
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOnlineCreditMemoStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOnlineCreditMemoStep.php
index c0edef812197cce613f812e13e6d7652fa76dd55..691d9e5c87d45ba952a8111915c1718e1d0587c3 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOnlineCreditMemoStep.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateOnlineCreditMemoStep.php
@@ -6,6 +6,7 @@
 
 namespace Magento\Sales\Test\TestStep;
 
+use Magento\Checkout\Test\Fixture\Cart;
 use Magento\Mtf\TestStep\TestStepInterface;
 use Magento\Sales\Test\Fixture\OrderInjectable;
 use Magento\Sales\Test\Page\Adminhtml\OrderCreditMemoNew;
@@ -61,7 +62,14 @@ class CreateOnlineCreditMemoStep implements TestStepInterface
     private $orderInvoiceView;
 
     /**
-     * @construct
+     * Checkout Cart fixture.
+     *
+     * @var Cart
+     */
+    private $cart;
+
+    /**
+     * @param Cart $cart
      * @param OrderIndex $orderIndex
      * @param SalesOrderView $salesOrderView
      * @param OrderInjectable $order
@@ -70,6 +78,7 @@ class CreateOnlineCreditMemoStep implements TestStepInterface
      * @param array|null refundData [optional]
      */
     public function __construct(
+        Cart $cart,
         OrderIndex $orderIndex,
         SalesOrderView $salesOrderView,
         OrderInjectable $order,
@@ -77,12 +86,13 @@ class CreateOnlineCreditMemoStep implements TestStepInterface
         OrderCreditMemoNew $orderCreditMemoNew,
         $refundData = null
     ) {
+        $this->cart = $cart;
         $this->orderIndex = $orderIndex;
         $this->salesOrderView = $salesOrderView;
         $this->order = $order;
+        $this->orderInvoiceView = $orderInvoiceView;
         $this->orderCreditMemoNew = $orderCreditMemoNew;
         $this->refundData = $refundData;
-        $this->orderInvoiceView = $orderInvoiceView;
     }
 
     /**
@@ -94,19 +104,20 @@ class CreateOnlineCreditMemoStep implements TestStepInterface
     {
         $this->orderIndex->open();
         $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]);
-        /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Invoices\Grid $invoicesGrid */
-        $invoicesGrid = $this->salesOrderView->getOrderForm()->getTab('invoices')->getGridBlock();
-        $this->salesOrderView->getOrderForm()->openTab('invoices');
-        $invoicesGrid->viewInvoice();
-        $this->salesOrderView->getPageActions()->orderInvoiceCreditMemo();
-        if (!empty($this->refundData)) {
+        $refundsData = $this->order->getRefund();
+        foreach ($refundsData as $refundData) {
+            /** @var \Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Invoices\Grid $invoicesGrid */
+            $invoicesGrid = $this->salesOrderView->getOrderForm()->getTab('invoices')->getGridBlock();
+            $this->salesOrderView->getOrderForm()->openTab('invoices');
+            $invoicesGrid->viewInvoice();
+            $this->salesOrderView->getPageActions()->orderInvoiceCreditMemo();
             $this->orderCreditMemoNew->getFormBlock()->fillProductData(
-                $this->refundData,
-                $this->order->getEntityId()['products']
+                $refundData,
+                $this->cart->getItems()
             );
             $this->orderCreditMemoNew->getFormBlock()->updateQty();
+            $this->orderCreditMemoNew->getFormBlock()->submit();
         }
-        $this->orderCreditMemoNew->getFormBlock()->submit();
 
         return ['ids' => ['creditMemoIds' => $this->getCreditMemoIds()]];
     }
diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SubmitOrderStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SubmitOrderStep.php
index f28cf6bf6aa7630c9f8c85d443d190c0588a80d5..4688fb97787386e4b55978cbd3aa0234356e5097 100644
--- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SubmitOrderStep.php
+++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/SubmitOrderStep.php
@@ -61,7 +61,6 @@ class SubmitOrderStep implements TestStepInterface
     private $products;
 
     /**
-     * @constructor
      * @param OrderCreateIndex $orderCreateIndex
      * @param SalesOrderView $salesOrderView
      * @param FixtureFactory $fixtureFactory
diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form.php
index ee26e2f1e28ecb9ab5a14d88b6b3b0f906b837d6..dd5937fc4770561b40459c638c5b8e7cca05fc86 100644
--- a/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form.php
+++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form.php
@@ -74,7 +74,7 @@ class Form extends AbstractForm
         }
         if (isset($data['items_data']) && $products !== null) {
             foreach ($products as $key => $product) {
-                $this->getItemsBlock()->getItemProductBlock($product)->fillProduct($data['items_data'][$key]);
+                $this->getItemsBlock()->getItemProductBlock($product->getSku())->fillProduct($data['items_data'][$key]);
             }
         }
     }
diff --git a/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items.php b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items.php
index bc2fef9239ce99e3aaf02f911deb5671956fbc10..0cdb42e03b9109389290c8c9d88f31f4b639981c 100644
--- a/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items.php
+++ b/dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Form/Items.php
@@ -9,7 +9,6 @@ namespace Magento\Shipping\Test\Block\Adminhtml\Form;
 use Magento\Sales\Test\Block\Adminhtml\Order\AbstractItemsNewBlock;
 use Magento\Shipping\Test\Block\Adminhtml\Form\Items\Product;
 use Magento\Mtf\Client\Locator;
-use Magento\Mtf\Fixture\FixtureInterface;
 
 /**
  * Adminhtml items to ship block.
@@ -19,12 +18,12 @@ class Items extends AbstractItemsNewBlock
     /**
      * Get item product block.
      *
-     * @param FixtureInterface $product
+     * @param string $productSku
      * @return Product
      */
-    public function getItemProductBlock(FixtureInterface $product)
+    public function getItemProductBlock($productSku)
     {
-        $selector = sprintf($this->productItem, $product->getSku());
+        $selector = sprintf($this->productItem, $productSku);
         return $this->blockFactory->create(
             \Magento\Shipping\Test\Block\Adminhtml\Form\Items\Product::class,
             ['element' => $this->_rootElement->find($selector, Locator::SELECTOR_XPATH)]
diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php b/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php
index d7669fbb1feefb866c0bdc6b1ef31f5e7c1bfebf..3a123d4fbe84813e2376fb48b340396ceee80658 100755
--- a/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php
+++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/Block/Product/ProductList/ProductItem.php
@@ -36,7 +36,9 @@ class ProductItem extends CatalogProductItem
         $attributes = $confAttrSource->getAttributes();
 
         foreach ($options as $option) {
-            if (!isset($attributes[$option['title']])) {
+            if (!isset($attributes[$option['title']])
+                || stripos($attributes[$option['title']]->getFrontendInput(), "swatch") === false
+            ) {
                 continue;
             }
             $availableOptions = $attributes[$option['title']]->getOptions();
diff --git a/dev/tests/functional/tests/app/Magento/Swatches/Test/Repository/ConfigurableProduct/CheckoutData.xml b/dev/tests/functional/tests/app/Magento/Swatches/Test/Repository/ConfigurableProduct/CheckoutData.xml
index 7e571be1129f89a95941112cf3e89da4ebad4852..183890a130f1429fb5aa37da48fd5ad2625bfd1f 100644
--- a/dev/tests/functional/tests/app/Magento/Swatches/Test/Repository/ConfigurableProduct/CheckoutData.xml
+++ b/dev/tests/functional/tests/app/Magento/Swatches/Test/Repository/ConfigurableProduct/CheckoutData.xml
@@ -34,6 +34,10 @@
                         <item name="title" xsi:type="string">attribute_key_0</item>
                         <item name="value" xsi:type="string">option_key_1</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>
diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/data-storage.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/data-storage.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..febbde30f8e9c72b6af3be18a5b4d217ad9e8d83
--- /dev/null
+++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/data-storage.test.js
@@ -0,0 +1,76 @@
+/**
+ * Copyright © 2017 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+/*eslint max-nested-callbacks: 0*/
+/*jscs:disable requireCamelCaseOrUpperCaseIdentifiers*/
+define([
+    'mageUtils',
+    'Magento_Ui/js/grid/data-storage'
+], function (utils, DataStorage) {
+    'use strict';
+
+    describe('Magento_Ui/js/grid/data-storage', function () {
+        describe('costructor', function () {
+            it('converts dataScope property to array', function () {
+                var model = new DataStorage({
+                    dataScope: 'magento'
+                });
+
+                expect(model.dataScope).toEqual(['magento']);
+            });
+        });
+
+        describe('hasScopeChanged', function () {
+            it('is function', function () {
+                var model = new DataStorage({
+                    dataScope: ''
+                });
+
+                expect(model.hasScopeChanged).toBeDefined();
+                expect(typeof model.hasScopeChanged).toEqual('function');
+            });
+
+            it('returns false if no requests have been made', function () {
+                var model = new DataStorage({
+                    dataScope: ''
+                });
+
+                expect(model.hasScopeChanged()).toBeFalsy();
+            });
+
+            it('tells whether parameters defined in the dataScope property have changed', function () {
+                var params, newParams, model;
+
+                params = {
+                    namespace: 'magento',
+                    search: '',
+                    filters: {
+                        store_id: 0
+                    },
+                    sorting: {},
+                    paging: {}
+                };
+
+                newParams = utils.extend({}, params, {
+                    search: 'magento',
+                    filters: {
+                        store_id: 1
+                    }
+                });
+
+                model = new DataStorage({
+                    dataScope: 'filters.store_id'
+                });
+
+                model.cacheRequest({
+                    totalRecords: 0
+                }, params);
+
+                expect(model.hasScopeChanged(params)).toBeFalsy();
+                expect(model.hasScopeChanged(newParams)).toBeTruthy();
+            });
+        });
+    });
+});
diff --git a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php
index 004ebd4d4f4e7b4ba6ea0fdae1e604677f6c491c..279f4476b5f9ddc18dd16cca59e41e394b7f4b43 100644
--- a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php
+++ b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php
@@ -106,7 +106,7 @@ class Write extends Read implements WriteInterface
             $targetDirectory->create($this->driver->getParentDirectory($newPath));
         }
         $absolutePath = $this->driver->getAbsolutePath($this->path, $path);
-        $absoluteNewPath = $targetDirectory->driver->getAbsolutePath($this->path, $newPath);
+        $absoluteNewPath = $targetDirectory->getAbsolutePath($newPath);
         return $this->driver->rename($absolutePath, $absoluteNewPath, $targetDirectory->driver);
     }
 
diff --git a/lib/internal/Magento/Framework/Filesystem/Test/Unit/Directory/WriteTest.php b/lib/internal/Magento/Framework/Filesystem/Test/Unit/Directory/WriteTest.php
index 46cbfdb2077ad314f274d1ba21b8288cdb8d84f5..7ab182f40906d8d14c905153bf083ad7b031ed62 100644
--- a/lib/internal/Magento/Framework/Filesystem/Test/Unit/Directory/WriteTest.php
+++ b/lib/internal/Magento/Framework/Filesystem/Test/Unit/Directory/WriteTest.php
@@ -7,6 +7,9 @@
  */
 namespace Magento\Framework\Filesystem\Test\Unit\Directory;
 
+use Magento\Framework\Filesystem\Directory\WriteInterface;
+use Magento\Framework\Filesystem\DriverInterface;
+
 class WriteTest extends \PHPUnit_Framework_TestCase
 {
     /**
@@ -68,7 +71,7 @@ class WriteTest extends \PHPUnit_Framework_TestCase
     public function testGetDriver()
     {
         $this->assertInstanceOf(
-            \Magento\Framework\Filesystem\DriverInterface::class,
+            DriverInterface::class,
             $this->write->getDriver(),
             'getDriver method expected to return instance of Magento\Framework\Filesystem\DriverInterface'
         );
@@ -90,8 +93,7 @@ class WriteTest extends \PHPUnit_Framework_TestCase
 
     public function testCreateSymlinkTargetDirectoryExists()
     {
-        $targetDir = $this->getMockBuilder(\Magento\Framework\Filesystem\Directory\WriteInterface::class)
-            ->getMock();
+        $targetDir = $this->getMockBuilder(WriteInterface::class)->getMock();
         $targetDir->driver = $this->driver;
         $sourcePath = 'source/path/file';
         $destinationDirectory = 'destination/path';
@@ -159,4 +161,66 @@ class WriteTest extends \PHPUnit_Framework_TestCase
     {
         return $this->path . $path;
     }
+
+    /**
+     * @param string $sourcePath
+     * @param string $targetPath
+     * @param WriteInterface $targetDir
+     * @dataProvider getFilePathsDataProvider
+     */
+    public function testRenameFile($sourcePath, $targetPath, $targetDir)
+    {
+        if ($targetDir !== null) {
+            $targetDir->driver = $this->getMockBuilder(DriverInterface::class)->getMockForAbstractClass();
+            $targetDirPath = 'TARGET_PATH/';
+            $targetDir->expects($this->once())
+                ->method('getAbsolutePath')
+                ->with($targetPath)
+                ->willReturn($targetDirPath . $targetPath);
+            $targetDir->expects($this->once())
+                ->method('isExists')
+                ->with(dirname($targetPath))
+                ->willReturn(false);
+            $targetDir->expects($this->once())
+                ->method('create')
+                ->with(dirname($targetPath));
+        }
+
+        $this->driver->expects($this->any())
+            ->method('getAbsolutePath')
+            ->willReturnMap([
+                [$this->path, $sourcePath, null, $this->getAbsolutePath($sourcePath)],
+                [$this->path, $targetPath, null, $this->getAbsolutePath($targetPath)],
+            ]);
+        $this->driver->expects($this->any())
+            ->method('isFile')
+            ->willReturnMap([
+                [$this->getAbsolutePath($sourcePath), true],
+                [$this->getAbsolutePath($targetPath), true],
+            ]);
+        $this->driver->expects($this->any())
+            ->method('getParentDirectory')
+            ->with($targetPath)
+            ->willReturn(dirname($targetPath));
+        $this->write->renameFile($sourcePath, $targetPath, $targetDir);
+    }
+
+    /**
+     * @return array
+     */
+    public function getFilePathsDataProvider()
+    {
+        return [
+            [
+                'path/to/source.file',
+                'path/to/target.file',
+                null,
+            ],
+            [
+                'path/to/source.file',
+                'path/to/target.file',
+                $this->getMockBuilder(WriteInterface::class)->getMockForAbstractClass(),
+            ],
+        ];
+    }
 }
diff --git a/lib/internal/Magento/Framework/View/Asset/File/FallbackContext.php b/lib/internal/Magento/Framework/View/Asset/File/FallbackContext.php
index 424794c4f30648c04a8a9adf4ca24c0dd01f43bb..c493d4eacb5fa464470d852c6873965564042bd7 100644
--- a/lib/internal/Magento/Framework/View/Asset/File/FallbackContext.php
+++ b/lib/internal/Magento/Framework/View/Asset/File/FallbackContext.php
@@ -13,11 +13,6 @@ use Magento\Framework\App\Filesystem\DirectoryList;
  */
 class FallbackContext extends Context
 {
-    /**
-     * Secure path
-     */
-    const SECURE_PATH = 'secure';
-
     /**
      * @var string
      */
@@ -33,24 +28,17 @@ class FallbackContext extends Context
      */
     private $locale;
 
-    /**
-     * @var bool
-     */
-    private $isSecure;
-
     /**
      * @param string $baseUrl
      * @param string $areaType
      * @param string $themePath
      * @param string $localeCode
-     * @param bool $isSecure
      */
-    public function __construct($baseUrl, $areaType, $themePath, $localeCode, $isSecure = false)
+    public function __construct($baseUrl, $areaType, $themePath, $localeCode)
     {
         $this->area = $areaType;
         $this->theme = $themePath;
         $this->locale = $localeCode;
-        $this->isSecure = $isSecure;
         parent::__construct($baseUrl, DirectoryList::STATIC_VIEW, $this->generatePath());
     }
 
@@ -103,6 +91,6 @@ class FallbackContext extends Context
      */
     public function getConfigPath()
     {
-        return $this->getPath() . ($this->isSecure ? '/' . self::SECURE_PATH : '');
+        return $this->getPath();
     }
 }
diff --git a/lib/internal/Magento/Framework/View/Asset/MergeStrategy/Direct.php b/lib/internal/Magento/Framework/View/Asset/MergeStrategy/Direct.php
index 1e20e27ee538aeab2aa35bab346c0facd32a99ff..de9248b8fe10accfb78f9267c22b71389e800f38 100644
--- a/lib/internal/Magento/Framework/View/Asset/MergeStrategy/Direct.php
+++ b/lib/internal/Magento/Framework/View/Asset/MergeStrategy/Direct.php
@@ -50,8 +50,11 @@ class Direct implements \Magento\Framework\View\Asset\MergeStrategyInterface
     public function merge(array $assetsToMerge, Asset\LocalInterface $resultAsset)
     {
         $mergedContent = $this->composeMergedContent($assetsToMerge, $resultAsset);
-        $dir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
-        $dir->writeFile($resultAsset->getPath(), $mergedContent);
+        $filePath = $resultAsset->getPath();
+        $staticDir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
+        $tmpDir = $this->filesystem->getDirectoryWrite(DirectoryList::TMP);
+        $tmpDir->writeFile($filePath, $mergedContent);
+        $tmpDir->renameFile($filePath, $filePath, $staticDir);
     }
 
     /**
diff --git a/lib/internal/Magento/Framework/View/Asset/Repository.php b/lib/internal/Magento/Framework/View/Asset/Repository.php
index f0ab3d0ae36c1084af9746e270c03651a1bd53e7..28309b7d5836bb811d29407f258d0a91a89f7808 100644
--- a/lib/internal/Magento/Framework/View/Asset/Repository.php
+++ b/lib/internal/Magento/Framework/View/Asset/Repository.php
@@ -268,8 +268,7 @@ class Repository
                     'baseUrl' => $url,
                     'areaType' => $area,
                     'themePath' => $themePath,
-                    'localeCode' => $locale,
-                    'isSecure' => $isSecure
+                    'localeCode' => $locale
                 ]
             );
         }
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/File/FallbackContextTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/File/FallbackContextTest.php
index a338df7ce296b960a5a92ec0c8c7cc2a5c532947..a6d5d2c4c29a5d4bae8b2e97cd04999295bd1fc0 100644
--- a/lib/internal/Magento/Framework/View/Test/Unit/Asset/File/FallbackContextTest.php
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/File/FallbackContextTest.php
@@ -31,7 +31,6 @@ class FallbackContextTest extends \PHPUnit_Framework_TestCase
      * @param string $areaType
      * @param string $themePath
      * @param string $localeCode
-     * @param bool $isSecure
      * @param string $expectedResult
      * @dataProvider getConfigPathDataProvider
      */
@@ -40,7 +39,6 @@ class FallbackContextTest extends \PHPUnit_Framework_TestCase
         $areaType,
         $themePath,
         $localeCode,
-        $isSecure,
         $expectedResult
     ) {
         $this->fallbackContext = $this->objectManager->getObject(
@@ -49,8 +47,7 @@ class FallbackContextTest extends \PHPUnit_Framework_TestCase
                 'baseUrl' => $baseUrl,
                 'areaType' => $areaType,
                 'themePath' => $themePath,
-                'localeCode' => $localeCode,
-                'isSecure' => $isSecure
+                'localeCode' => $localeCode
             ]
         );
         $this->assertEquals($expectedResult, $this->fallbackContext->getConfigPath());
@@ -64,7 +61,6 @@ class FallbackContextTest extends \PHPUnit_Framework_TestCase
                 'areaType' => 'frontend',
                 'themePath' => 'Magento/blank',
                 'localeCode' => 'en_US',
-                'isSecure' => false,
                 'expectedResult' => 'frontend/Magento/blank/en_US'
             ],
             'https' => [
@@ -72,8 +68,7 @@ class FallbackContextTest extends \PHPUnit_Framework_TestCase
                 'areaType' => 'frontend',
                 'themePath' => 'Magento/blank',
                 'localeCode' => 'en_US',
-                'isSecure' => true,
-                'expectedResult' => 'frontend/Magento/blank/en_US/secure'
+                'expectedResult' => 'frontend/Magento/blank/en_US'
             ]
         ];
     }
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/MergeStrategy/DirectTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/MergeStrategy/DirectTest.php
index 17ba6714246d9afa44151cc2b1a72cf3a7e18542..33ad9608109e93dcd34ea9df21aa4f84d23586b5 100644
--- a/lib/internal/Magento/Framework/View/Test/Unit/Asset/MergeStrategy/DirectTest.php
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/MergeStrategy/DirectTest.php
@@ -5,6 +5,7 @@
  */
 namespace Magento\Framework\View\Test\Unit\Asset\MergeStrategy;
 
+use Magento\Framework\Filesystem\Directory\WriteInterface;
 use \Magento\Framework\View\Asset\MergeStrategy\Direct;
 
 use Magento\Framework\App\Filesystem\DirectoryList;
@@ -22,9 +23,14 @@ class DirectTest extends \PHPUnit_Framework_TestCase
     protected $cssUrlResolver;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Filesystem\Directory\WriteInterface
+     * @var \PHPUnit_Framework_MockObject_MockObject|WriteInterface
      */
-    protected $writeDir;
+    protected $staticDir;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject|WriteInterface
+     */
+    protected $tmpDir;
 
     /**
      * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\View\Asset\LocalInterface
@@ -35,11 +41,14 @@ class DirectTest extends \PHPUnit_Framework_TestCase
     {
         $this->cssUrlResolver = $this->getMock(\Magento\Framework\View\Url\CssResolver::class);
         $filesystem = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false);
-        $this->writeDir = $this->getMockForAbstractClass(\Magento\Framework\Filesystem\Directory\WriteInterface::class);
+        $this->staticDir = $this->getMockBuilder(WriteInterface::class)->getMockForAbstractClass();
+        $this->tmpDir = $this->getMockBuilder(WriteInterface::class)->getMockForAbstractClass();
         $filesystem->expects($this->any())
             ->method('getDirectoryWrite')
-            ->with(DirectoryList::STATIC_VIEW)
-            ->will($this->returnValue($this->writeDir));
+            ->willReturnMap([
+                [DirectoryList::STATIC_VIEW, \Magento\Framework\Filesystem\DriverPool::FILE, $this->staticDir],
+                [DirectoryList::TMP, \Magento\Framework\Filesystem\DriverPool::FILE, $this->tmpDir],
+            ]);
         $this->resultAsset = $this->getMock(\Magento\Framework\View\Asset\File::class, [], [], '', false);
         $this->object = new Direct($filesystem, $this->cssUrlResolver);
     }
@@ -47,7 +56,9 @@ class DirectTest extends \PHPUnit_Framework_TestCase
     public function testMergeNoAssets()
     {
         $this->resultAsset->expects($this->once())->method('getPath')->will($this->returnValue('foo/result'));
-        $this->writeDir->expects($this->once())->method('writeFile')->with('foo/result', '');
+        $this->staticDir->expects($this->never())->method('writeFile');
+        $this->tmpDir->expects($this->once())->method('writeFile')->with('foo/result', '');
+        $this->tmpDir->expects($this->once())->method('renameFile')->with('foo/result', 'foo/result', $this->staticDir);
         $this->object->merge([], $this->resultAsset);
     }
 
@@ -55,7 +66,9 @@ class DirectTest extends \PHPUnit_Framework_TestCase
     {
         $this->resultAsset->expects($this->once())->method('getPath')->will($this->returnValue('foo/result'));
         $assets = $this->prepareAssetsToMerge([' one', 'two']); // note leading space intentionally
-        $this->writeDir->expects($this->once())->method('writeFile')->with('foo/result', 'onetwo');
+        $this->staticDir->expects($this->never())->method('writeFile');
+        $this->tmpDir->expects($this->once())->method('writeFile')->with('foo/result', 'onetwo');
+        $this->tmpDir->expects($this->once())->method('renameFile')->with('foo/result', 'foo/result', $this->staticDir);
         $this->object->merge($assets, $this->resultAsset);
     }
 
@@ -73,7 +86,9 @@ class DirectTest extends \PHPUnit_Framework_TestCase
             ->method('aggregateImportDirectives')
             ->with('12')
             ->will($this->returnValue('1020'));
-        $this->writeDir->expects($this->once())->method('writeFile')->with('foo/result', '1020');
+        $this->staticDir->expects($this->never())->method('writeFile');
+        $this->tmpDir->expects($this->once())->method('writeFile')->with('foo/result', '1020');
+        $this->tmpDir->expects($this->once())->method('renameFile')->with('foo/result', 'foo/result', $this->staticDir);
         $this->object->merge($assets, $this->resultAsset);
     }
 
diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Asset/RepositoryTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Asset/RepositoryTest.php
index 7e212fc7980a6ceefd72fb1ff0be97934f3de81d..3f818aaa4e7cab96d1772e06678b658edb8f5f68 100644
--- a/lib/internal/Magento/Framework/View/Test/Unit/Asset/RepositoryTest.php
+++ b/lib/internal/Magento/Framework/View/Test/Unit/Asset/RepositoryTest.php
@@ -185,8 +185,7 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
                     'baseUrl' => '',
                     'areaType' => '',
                     'themePath' => 'Default',
-                    'localeCode' => '',
-                    'isSecure' => '',
+                    'localeCode' => ''
                 ]
             )
             ->willReturn($fallbackContextMock);
@@ -251,8 +250,7 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
                     'baseUrl' => '',
                     'areaType' => 'area',
                     'themePath' => '',
-                    'localeCode' => 'locale',
-                    'isSecure' => '',
+                    'localeCode' => 'locale'
                 ]
             )
             ->willReturn($fallbackContextMock);